StockHandler - Support the selection of variants Print

  • 0

In-class Shop. Field support <select> to choose options for products. Restricts the user to select only existing variants and calls the stockDownloader.

The parameters in the HTML

  • Shop.values.OptionImgWidth (int) - the size of the product pictures
  • Shop.values.OptionImgHeight (int) - jw.
  • Shop.values.optionCurrentStock (int) - By default, the ID of the selected Variant
  • Shop.values.OptionsConfiguration (string) - encoded (Base64) map describing the available variants of the products available in the template /scripts/product/index.tpl under a variable $options_configuration
  • Shop.values.OptionsDefault (string) - hashed (Base64) data on the default product variant, available in the template/scripts/product/index.tpl under a variable $options_default

The Phrase:

  • Shop.lang.common.product_stock_select

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.stockHandler.condition()

Parameters Shop.stockHandler.options :

  • selectstockselector (string) - selector fields <select> on the product tab, the default „div.stocks select”
  • inputselector (string) - selector do <input name=„stock_id”> (usually type=„hidden”), who shall together with the Click „Add to cart”, Variant ID

Action

Automatic, once you find the <select> fields and give all the necessary maps. Based on events onChange. In the absence of field or maps, containers (parents) fields select (selectstockselector.getParent()) shall be hidden (display: none);


Was this answer helpful?

« Back