2013-02-12 137 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

相關問題