0

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. 1.7.0.2

or could you advise me any other solution to make this happen? thank you very much.

1 Answer 1

2

Assuming that most of your product have images associated to them and your image have an id

  <img id="image" .. />

Using chrome debugging tool or firebug for firefox try

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

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

5
  • Hi R.S console.log(assocIMG[productNo]); this gives correct image path from the console but why dose not work on the screen? what do you thin? thanks
    – Erdem Ece
    Feb 12, 2013 at 19:54
  • Does your img tag have an id='image' e.g <img id="image" ..? Feb 12, 2013 at 20:11
  • I have added id="image" and now pictures changes. thank for your help but how can I change the <a href="" ? because when you click image popup comes up and expands the image. but the popup image is still old image. <a href="images/img.jpg"><img src="images/img.jpg" /></a> how can i change the a href? thank you.
    – Erdem Ece
    Feb 13, 2013 at 11:40
  • You could either (1) give the a tag a class name/id e.g <a href='..' id='image_href' then $('image_href').href=assocIMG[productNo]; or (2) `$('image').previous('a').href = assocIMG[productNo];' Feb 13, 2013 at 11:58
  • fantastic. I thank you so much sir. thanks for your help and I hope I'm going learn this javascript as well as you. thank you!! I gave my a tag id="image_href" and used .href() everyhing is working. thanks so much. I can't vote you i don't have enough points:(
    – Erdem Ece
    Feb 13, 2013 at 13:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.