1

I am trying to get this piece of code to work in magento 1.7.0...

it only displays the magento placeholder image...

if i change "image" to "small_image" it works fine

everything is set up in the back end the radio buttons are selected for the product images... I have cleared the cache also...

this is happening in the list.phtml file ...

can someone kind enough tell me what i am doing wrong or WHY its not working... i have been searching all over i found one solution after 3 days of searching and it didn't work....

$_item is not defined so a i get a call to a non object error...

here's a link to the answere

https://stackoverflow.com/questions/11995206/get-base-product-image-in-magento

<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(171, 259);
  • Why not set products to use the same image path for small_image as they are currently using for image? – benmarks May 9 '13 at 12:04
5

You are in the template of the product list. Magento collections don't load all the attributes by default, image e.g. is not loaded.

Go to the backend Catalog > Attributes > Manage Attributes > image and set "Show in product Listing" to "yes"

  • When I go to Catalog > Attributes > Manage Attributes > image I don't see an option to 'Show in product listing'. The only editable parts are the scope and the 'apply to'. Has this changed in different versions? – Michael Jun 8 '15 at 7:52
  • 2
    Ok, I've found an answer to my question. stackoverflow.com/a/18579834 – Michael Jun 8 '15 at 7:55
2

There is an answer on https://stackoverflow.com/questions/15885942/magento-original-image-resize-only-shows-placeholder-image

Not sure if it's possible to merge two questions in some mode.

  • yea i got an answer on stackoverflow i am going to delete this one or we should leave it as is... just in case there is a link going to the other answer anyways... – Drmjo Apr 8 '13 at 23:54
  • $product->load IS WRONG. DON'T DO IT! – Fabian Blechschmidt May 9 '13 at 11:33
  • Explanation - sorry to not writing it down with the complainment. Magento uses EAV to save all the attributes in one table (more or less - details...) and if you want to load a product you have to join a few times into this table. To avoid too much joins magento collections only load the attributes you need. You can "easily" change this and add attributes. Using load() in a foreach means: loading 30 products with 1 query and then shoot 1 query per product to the db -> really bad performance. – Fabian Blechschmidt May 9 '13 at 12:21
1

Check if the GD library is loaded in your php.ini:

extension=php_gd2.dll

If it's not loaded, Magento will just silently not resize the image and return the default placeholder.

1

Make sure that that developer mode is set to false this can be done from the root .htaccess file by setting this to the end of the file:

SetEnv MAGE_IS_DEVELOPER_MODE "true"

and what this will do is set:

Mage::setIsDeveloperMode(true); to Mage::setIsDeveloperMode(false); in the index.php file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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