I'm using Magento 1.9.3.1 and facing below error on configurable product detail page
TypeError: Product.ConfigurableSwatches is not a constructor
Why am I getting this error and how can I fix it?
That seems to be a bug in Magento since I was able to reproduce it on a fresh installation when the following two conditions are meet:
You can solve it by checking if Product.ConfigurableSwatches
exists before calling it:
1) Open this file: app/design/frontend/rwd/default/template/configurableswatches/catalog/product/view/type/configurable/swatch-js.phtml
2) Change this:
<script type="text/javascript">
document.observe('dom:loaded', function() {
var swatchesConfig = new Product.ConfigurableSwatches(spConfig);
});
</script>
To this:
<script type="text/javascript">
document.observe('dom:loaded', function() {
if (Product.ConfigurableSwatches) {
var swatchesConfig = new Product.ConfigurableSwatches(spConfig);
}
});
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With