升级到Magento1.9.3 产品页出现脚本错误 Product.OptionsPrice is not a constructor 解决办法

阅读导航

最近发布的magento 1.9.3,相信很多人都升级了,升级后发现产品页面出现下面的脚本错误:

脚本错误提示

Uncaught TypeError: Product.OptionsPrice is not a constructor
Uncaught TypeError: Cannot read property 'addCustomPrices' of undefined

问题原因

新版本更新了很多Js文件,特别是产品页引用了:/js/varien/product_options.js 这个新的js文件,而早期的magento模板并没有引用,所以出现了上面的脚本错误。

解决办法

解决只需在对应模板的产品页布局文件catalog.xml中添加product_options.js脚本引用:如下

 <catalog_product_view translate="label">
 <reference name="head">
 <action method="addJs"><script>varien/product.js</script></action>
 <action method="addJs"><script>varien/product_options.js</script></action>
 <action method="addJs"><script>varien/configurable.js</script></action>