Jump to content

Category image displayed in category header


Recommended Posts

Hi,

 

I'm new to Prestashop, and currently configuring the default template for my web shop in 1.6.0.8.

 

I have created categories and subcategories and added a few products.

 

Now, when selecting a category from the navigation bar, for example "Douche en bad" it looks like

screen 1 in  the attachment. For all the available subcategories It says "no image available".

 

I don't want that, so I upload an image to a subcategory. The result is good, as shown in screen 2.

 

But now the header for that subcategory (one level down) looks like screen 3. And that I do not want.

 

I have checked all parameters I could find concerning images and categories, but so far no luck in solving this.

 

Can anyone help me?

 

Thank you.

 

 

 

post-823640-0-66733200-1406744455_thumb.png

post-823640-0-18286600-1406744456_thumb.png

post-823640-0-35836700-1406744458_thumb.png

  • Like 1
Link to comment
Share on other sites

I would love the answer to this also!  Same problem - if there is no image added to a sub-category, then you get an ugly "no image available" block on the main category screen.  If you add an image that looks good on the main category screen, you get a tiny, weird looking image with a cropped off label on the main screen.

Any way to keep the little image on the main category screen, but just keep the blank gray strip on the subcategory screen?

Link to comment
Share on other sites

Hi EstherNL - I just found another thread that fixed this for me.  I had to edit one of the source files - but it isn't really  hard to do.

 

The post I got this from:

http://www.prestashop.com/forums/topic/316569-remove-thumbnail-from-subcategory/?hl=%2Bsubcategory+%2Bimage

 

To make the code change:

 

1. Open your FTP client, whatever that happens to be. 

2. Copy the following file to your local desktop:  /your_web_sitelthemes/theme_name/category_tpl

NOTE:  Make sure you save a copy of the category_tpl file someplace safe in case you want to return to the default someday - or in case you make a mistake editing!

3.  Open the file in an editor like Notepad.

4.  Scroll until you find this section:


<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}" class="img">
      {if $subcategory.id_image}
       <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html'}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
      {else}
       <img src="{$img_cat_dir}default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
      {/if}
     </a>

You have two options for the code:

1. Safest - Comment out the section to completely remove the thumbnails for the sub-categories

 

To comment out, you simply add a few characters at the beginning and end of the code section, and I like to add a note about what it was, and why I commented it out like this (add the parts that are in bold red):


<!-- commented out sub-category thumbnail code 8/2/2014   

<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}" class="img">
      {if $subcategory.id_image}
       <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html'}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
      {else}
       <img src="{$img_cat_dir}default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
      {/if}
     </a>

End sub-category thumbnail code-->

2. Another option is to simply delete the code section shown above entirely.  If you are very sure you will never want those thumbnails again, you can remove the code completely.  I would still add a comment about where the code reference was just in case. 

 

The part that makes text in this type of code a comment is adding  <!--  at the beginning, and --> at the end of the section you wish to have the code skip.

Sorry if this is too involved or too entry level.  Didn't know if you would be comfortable editing code so figured I'd add instructions.

Commenting out this code solved my issue by removing the thumbnails that showed "No Image Available" on my site.

Alison

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...