BasketHandler - Service cart Print

  • 0

In-class Shop. In the first step, shopping basket support (home) and second (complete address details).

Parameters in HTML

Step 1

These parameters are needed to change the dynamic of the country of payment and delivery, along with counting the cost.

  • Shop.values.CurrencyMap (string) - the value 1234.56 formatted with {currency}
  • Shop.values.ShippingValue (object) - map of deliveries to their costs „s” + ID delivery: cost
  • Shop.values.SumNoShipping (float) - the value of the cart without shipping costs
  • Shop.values.Shipping2Payment (object) - map of deliveries to payments which are not supported by „s” + ID delivery : [ an array with the payment ID ]
  • Shop.values.Country2Shipping (object) - map of countries for supplies, which are available on their site are two-letter country code: [array of ID supplies]

Step 2

  • Shop.values.Country2Shipping (an array of) - an array of two-letter country codes that are assigned to the previously selected forms of delivery

The parameters in the JS

Because the class is assigned to together with the Shop, all parameters must be set before the domready event or the latest features conditional Shop.basketHandler.condition()

Parameters Shop.basketHandler.options :

  • For the first step
    • step : (int) 1 - information about step
    • containers (object)
      • step1 : element DOM, a container that contains all countries, delivery and payment
    • ordersumfield : element DOM with the final at the expense of the order (shopping cart + delivery)
    • selectors (object)
      • deliveryrow: rows that contain the delivery
      • paymentrow: rows that contain payment
      • deliverychangelink: the link list to choose supply revealing
      • paymentchangelink: jw. for the payment of
      • paymentheadlabel: a field with the name of the selected payment
      • paymentrlabel: the selector for each paymentrow, the name of the payment
      • paymentradios: input for each payment
      • deliveryheadlabel: a field with the name of the selected forms of delivery
      • deliveryheadvalue: a field with the cost of the selected forms of delivery
      • deliverytrlabel: the selector for each deliveryrow, the name of the forms of delivery
      • deliverytrvalue: the selector for each deliveryrow, the cost of delivery forms
      • deliveryradios: input for each delivery
      • trradio: the selector for deliveryrow and paymentrow, input radio
      • countrytr: line with a choice of country of delivery
      • trcountryselect: the selector for countrytr, select field with countries
  • For step two
    • step : (int) 2 - information about the step
    • containers (object)
      • step2 : element DOM, a container that contains a form with address fields
    • selectors (object)
      • trdifferentaddress - rows that contain input fields from the delivery address (second)
      • differentaddress - input checkbox choice of delivery address
      • personaladdress - input radio, private address
      • companyaddress - input radio, company address
      • formcompanyname - input text, the name of the company in the second address
      • formtaxid - input text, NIP in the first address
      • formcompanyname2 - input text, the name of the company in the second address
      • formtaxid2 - input text, NIP in the first address
      • countryselect - select from the choice of the country in the first address
      • addresstyperadios - the radio (personaladdress and companyaddress)
      • addressselectsubmit - input submit (or button) from the download address from address book (bound to the field <select>, hidden when JavaScript is enabled)
      • addressselect - field <select> the user address for fast loading
      • addressinput - universal selector with a character string ”{name}”, which is used to retrieve an item DOM with a specific name
    • getaddressurl (string) - adres URL where can I get the address details, required client inside a string of characters {id}, that will be swapped to the ID of the desired address

The Phrase:

  • Shop.lang.basket.address_request_error - message when a failed download address
  • Shop.lang.basket.shipping_different_country - error message when you try to box decorations „another delivery address”

Action

All listed selector are caused inside the container of the step.

Step 1

  • deliverychangelink - link „change »” to check delivery, removal of the class. none
  • If, despite the removal of the class. none, link is not visible (the appropriate settings CSS), list of delivery and payment shall be permanently visible
  • otherwise, „change »” for the supply of deliverychangelink and „change»” for the payment of paymentchangelink receive events onClick to expand rows
  • paymentradios receive events onChange
    • give the class selected his <tr>, the other paymentrow Remove
    • suitable paymentheadlabel the content of paymentrlabel with your line
    • hide the payment lines
  • deliveryradios receive events onChange
    • give the class selected his <tr>, the other deliveryrow Remove
    • suitable deliveryheadlabel the content of deliverytrlabel with your line
    • suitable deliveryheadvalue the content of deliverytrvalue with your line
    • Verify that payments are available for the delivery and highlight (class none) the only ones available, the rest is hidden
    • move class first to first line from the payment
  • If you specify an array Shop.values.Country2Shipping and there is more than one, countrytr –> trcountryselect receives event onChange
    • changing the value of exposes only supply deliveryrow available in that, the rest is hidden (class none)
    • class first is shifted to the first visible supply

Step 2

  • Depending on the selection radio companyaddress, the rows containing the formcompanynameformtaxid are hidden or shown
  • Depending on the selection checkbox differentaddress (another delivery address), rows trdifferentaddress are hidden or shown (class none)
  • countryselect receives event onChange, which checks if the selected country is located in the Shop. values. Country2Shipping; If you do not select the differentaddress and blocks his award
  • the button addressselectsubmit is hidden (class none), It is redundant when JavaScript runs, pick an address is onChange
  • addressselect receives event onChange, that gets the user selected value (ID) and fills in the <input> According to the received content

Was this answer helpful?

« Back