Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Troubles displaying categories and products
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

Hello everybody.

Since I have installed Magento on my computer using easy php, I have problems to display categories and products pages.
I have added categories and products to my catalog, but they’re not displayed on those pages.

Products pages :

I have for example a product called Nike Blue, so the product page url is index.php/default/nike-blue.html.
In this page I can see every data of the product except pictures who are replaced by the default placeholder.

Categories pages :

I have for example a category of products called “Shoes”, so the category page url is index.php/default/shoes.
In this page blocks of the left and right columns display correct informations, but the main column, at the center, doesn’t display anything...
But in the search module of my home page, if I type for example Nike, the result page display well my product in a grid or list view.

So I have worked on other parts of the customization of my magento store, but now it’s time to solve those problems and I haven’t found any solution inspecting my layout files, templates etc…

Thanks !

 
Magento Community Magento Community
Magento Community
Magento Community
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

Ok, I’ve got news.

In the template file media.phtml ( template/catalog/product/view/media.phtml ), if I replace the line 30

<img id="image" src="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />

By this code :

<img id="image" src="<?php echo $_product->getImageUrl() ?>" />

The picture of the product is displayed…

Any idea to deal with this problem ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 
altansar - 15 July 2008 07:36 AM

Ok, I’ve got news.

In the template file media.phtml ( template/catalog/product/view/media.phtml ), if I replace the line 30

<img id="image" src="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />

By this code :

<img id="image" src="<?php echo $_product->getImageUrl() ?>" />

The picture of the product is displayed…

Any idea to deal with this problem ?

Hi altansar,

Don’t know what part of world you come from, but I think you absolutely want to keep the code you posted in the first message.  ‘alt’ attribute is very important, you give a descriptive alt text that echos your image, you may have better chance for people find you via search engine. Lack of ‘alt’ text may get you into trouble - Targets get sued by it. If you are from Europe, I think EU countries have tougher, better law with accessibility compliant.

The code should work. It looks for ‘image’ attribute. I think you maybe forgotten something in the Images in the product page, or you exluded your images there?

 
Magento Community Magento Community
Magento Community
Magento Community
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

Hi Chinese Dream.

Of course I’m aware of the importance of the alt attribute for images. My sample code was just an example to show the community my problem, not the code i’m going to use…

But I don’t think I have a problem with my products on the backend, here is a screenshot of a product :

Screenshot

I have problems with several functions of magento.
In my media.phtml, the file who displays the pictures on a product page, the following object doesn’t instanciate properly :

$this->helper('catalog/image')->init($_product'image')

as the function

$this->getGalleryImages()

who doesn’t return anything.
As I said in my first post of the topic, When I go on a category page, there are no products displayed but the layered navigation display well the “shop by” block with correct attributes.
I have only one website, with one store and one store view.

If anyone has encountered same problem before, I will be very glad to have a part of the solution.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

In the file media.phtml, when I make a print_r on $_product instantiated by

$_product $this->getProduct()
, here is the part dedicated to the pictures, all seems to be ok.

[media_gallery] => Array ( [images] => Array ( [0] => Array ( [value_id] => 2 [file] => /h/e/header_1.jpg [label] => [position] => 1 [disabled] => 0 [label_default] => [position_default] => 1 [disabled_default] => [1] => Array ( [value_id] => 5 [file] => /c/e/ceinture.jpg [label] => [position] => 2 [disabled] => 0 [label_default] => [position_default] => 2 [disabled_default] => ) )

The 2 pictures of my products /h/e/header_1.jpg and /c/e/ceinture.jpg have correct paths. Perhaphs a problem with the path appended before this url ?
In my backend this path seems to be ok : {{root_dir}}/media

Anyone have an idea ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

bump !

If someone has experienced the same problem or has a part of the solution, I will be very glad.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

Need some help please smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwoods
Jr. Member
 
Avatar
Total Posts:  27
Joined:  2008-04-23
Boston MA
 
altansar - 15 July 2008 07:36 AM

Ok, I’ve got news.

In the template file media.phtml ( template/catalog/product/view/media.phtml ), if I replace the line 30

<img id="image" src="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />

By this code :

<img id="image" src="<?php echo $_product->getImageUrl() ?>" />

The picture of the product is displayed…

Any idea to deal with this problem ?

If you view the source for the two methods above, what gets put as the image src attribute? Is the path incorrect for the first version? How do the two compare?

 
Magento Community Magento Community
Magento Community
Magento Community
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

Hi JWoods,

for the first version of the code, the original code, the function $this->helper(’catalog/image’)->init($_product, ‘image’); return the path of the placeholder image, not the path of my product image. I have this problem for every products of my catalog.

The second method works, but it does not fit to what we need. In order to use the functions dealing with images ( resize, watermak ... ), I need to instantiate an image object, like in the first method.

I really don’t understand why the original code of version 1.0 doesn’t works with my products.

 
Magento Community Magento Community
Magento Community
Magento Community
 
altansar
Member
 
Total Posts:  51
Joined:  2008-07-08
 

I think I have a problem with url rewriting, that could be why my categories pages does not displays any products.

for example if I have a category named clothes,
the url : http://store.com/storeview/clothes does’nt work, I have to type http://store.com/index.php/storeview/clothes . The page is found but there are no products displayed ...

So how could I access to the pages without having to type index.php ?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top