简体   繁体   English

在magento中的可配置产品上显示关联产品的图像

[英]Displaying associated product's image on configurable product in magento

I have used this tutorial to achieve this. 我使用本教程来实现这一目标。 but when I change the option I'm having this error: 但是当我更改选项时,我遇到了这个错误:

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

is there anyone can help me with this? 有没有人可以帮我这个? Magento ver. Magento ver。 1.7.0.2 1.7.0.2

or could you advise me any other solution to make this happen? 或者你能告诉我任何其他解决方案来实现这一目标吗? thank you very much. 非常感谢你。

Assuming that most of your product have images associated to them and your image have an id 假设您的大多数产品都有与之关联的图片,并且您的图片具有ID

  <img id="image" .. />

Using chrome debugging tool or firebug for firefox try 使用chrome调试工具或firebug for firefox试试

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

(around line $('image').src = assocIMG[productNo];) (约$('image')行.src = assocIMG [productNo];)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM