2013-02-12 78 views
0

我已使用this tutorial来实现此目的。但是当我改变选项我有这个错误:在magento的可配置产品上显示相关产品的图像

Uncaught TypeError: Cannot set property 'src' of null configurable.js:159 
Product.Config.configureElement configurable.js:159 
Product.Config.configure configurable.js:127 
(anonymous function) prototype.js:391 
_createResponder.responder prototype.js:5598 

有没有人可以帮助我呢? Magento ver。 1.7.0.2

或者您能否告诉我任何其他解决方案来实现此目的?非常感谢你。

回答

2

假设大部分的产品都与它们关联的图片和影像有一个id

<img id="image" .. /> 

使用Firefox的铬调试工具或Firebug的尝试

console.log(assocIMG); // should return all products image url 
console.log(assocIMG[productNo]); // should return image url 

(左右线$(”图像')。src = assocIMG [productNo];)

+0

嗨RS ** console.log(assocIMG [productNo]); **这将提供从控制台正确的图像路径,但为什么剂量不工作在屏幕上?你瘦了什么?谢谢 – 2013-02-12 19:54:23

+0

你的img标签是否有id ='image'例如' 2013-02-12 20:11:57

+0

我添加了id =“image”,现在图片发生了变化。感谢您的帮助,但我如何更改如何更改href?谢谢。 – 2013-02-13 11:40:36

相关问题