0

I need some solution.

I'm using Magento, I have only 6 product in my shop, on every product page I have added a static block, problem is that this block is the same on every product page. I would like something like this. F.ex. On product called "Doll" static block displays an img of a doll, on product "Gun", we will see the gun image. How to do it? I thought about something like this: (I don't know php so I will write my mind image)

If in div TITLE is a word DOLL then img src="/doll.jpg"

if in div TITLE is word GUN then img src="/gun.jpg"

How to write it in php from A do Z?

Thank you.

1
  • Why not have a different block for each product? Since you have only 6 products this should be easy. Commented Aug 25, 2013 at 20:36

1 Answer 1

1

no need to create block for each product.just add below code in your product page

$name = strtolower(Mage::getModel('catalog/product')->load($_product->getProductId())->getName());

img src="<?php echo $name.'jpg'?>"

may this code help.

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, It doesn't work. I added your code in view.phtml (this is product view file) and it doesn't work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.