2

Is there already a JavaScript event for when a customer changes the configuration of a product, say changed/selected a different color? Maybe a click/change event of the switches?

## Update 1

We're looking for an event that we can bind to or observe, so we don't need to modify any existing script.

1

Yes, there is. The main function that fires is spConfig.reloadPrice() for configurable products which is declared in [magento-root]/app/design/frontend/base/default/template/catalog/product/view/type/options/configurable.phtml on line 46

For simple products, it is opConfig instead, which is declared in [magento-root]/app/design/frontend/base/default/template/catalog/product/view/options.phtml on line 185

Both are referencing the configs sent by the blocks' getJsonConfig function, which can be found in [magento-root]/app/code/core/Mage/Catalog/Block/Product/View/Options.php for simple products and [magento-root]/app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php for configurable products.

2
  • This isn't exactly what we're looking for. I have updated my question to include more details of what we want.
    – user61389
    Dec 8 '17 at 6:13
  • @user61389, did you find the solution? Could you please have a look at the similar issue I face and see if you can share some insights at magento.stackexchange.com/questions/312998/… May 18 '20 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.