Javascript Magento无法在ajax quickview上为可配置产品选择选项
我在为magento上显示在快速查看窗口中的可配置产品选择选项时遇到问题: 错误: 1-当我使用“选择”更改选项时,会出现这种情况: 未捕获的引用错误:选项价格未定义可配置。js:286Javascript Magento无法在ajax quickview上为可配置产品选择选项,javascript,php,ajax,magento,Javascript,Php,Ajax,Magento,我在为magento上显示在快速查看窗口中的可配置产品选择选项时遇到问题: 错误: 1-当我使用“选择”更改选项时,会出现这种情况: 未捕获的引用错误:选项价格未定义可配置。js:286 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 2-当我单击色样选项时,会出现这种情况: ReferenceError{stack:(…),消息:“未定义spConfig”}colorswatch.js:2
optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice});
2-当我单击色样选项时,会出现这种情况:
ReferenceError{stack:(…),消息:“未定义spConfig”}colorswatch.js:221
try{
spConfig.configureElement(document.getElementById(selectId));
spConfig.reloadPrice();
}catch(e){
console.debug(e);
}
我一直尝试定义spConfig和Option Price,但它似乎超出了范围,我不知道,因为我可以对这两个变量进行console.log,但即使成功地将它们记录下来,我也会遇到这些错误
我成功地在类别视图上加载了configurable.js和product.js
还有一些代码:
可配置的.phtml
<script type="text/javascript">
if(typeof optionsPrice === 'undefined' ){
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
}
console.log(optionsPrice); // logs the variable just fine
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
console.log(<?php echo $this->getJsonConfig() ?>); // logs fine
console.log(spConfig); // here too
$j(document).ready(function(){
IWD.ColorSwatch.configAttributes = '<?php echo $_switchHelper->getJsonConfig($_product)?>';
IWD.ColorSwatch.config = '<?php echo $_switchHelper->getJsonModuleConfig()?>';
IWD.ColorSwatch.init();
});
</script>
如果(选项类型价格==‘未定义’){
var optionsPrice=新产品。optionsPrice();
}
console.log(选项价格);//很好地记录变量
var spConfig=new Product.Config();
console.log();//原木很好
console.log(spConfig);//这里也是
$j(文档).ready(函数(){
IWD.ColorSwatch.configAttributes='';
IWD.ColorSwatch.config='';
IWD.ColorSwatch.init();
});
这是该站点的链接:
如果您需要更多的代码,请要求我将其添加到这里
谢谢
编辑
我正在使用自定义快速查看模块您在说什么快速查看窗口?听起来您使用了一个自定义模块来实现此功能。是的,我使用的这个快速查看模块也有相同的问题,您解决了吗?