Jump to content

Images in subcategory


Wijn & Olijfolie
 Share

Recommended Posts

Hello,

I’ve a problem with my prestashop. I have many categories and subcategories within these categories.

The problem is that if i did not add an image to an subcategorie (a car) you’ll always see the “No image available”. But I dont want this, I want the subcategories (cars) to view under eachother.

What i mean is this:

This is te situatian at the moment:
http://autovloeistof.nl/screenshots/huidig.JPG

And I want this:
http://autovloeistof.nl/screenshots/doel.JPG

Share this post


Link to post
Share on other sites

To remove the subcategory images, change lines 37-44 of category.tpl (in PrestaShop v1.3.1) from:

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





to:

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


*}



That will make just the subcategory names appear horizontally. To make them vertical, you will need to change the /* category.tpl */ section on line 1402 of global.css from:

/* category.tpl */
h2.category_title { font-size: 1.3em }
body#category #subcategories li { margin-right: 10px }
div.cat_desc { margin: 0 1em }
body#category div#subcategories ul.inline_list li a img { display: inline }



to something like:

/* category.tpl */
h2.category_title { font-size: 1.3em }
body#category #subcategories li { margin-right: 10px; display: block }
div.cat_desc { margin: 0 1em }
body#category #subcategories { text-align: center }

Share this post


Link to post
Share on other sites

Thank you for the answer, but it's not quite accurate from what I had in mind, I meant the following.

I have one main subcatgory, this is a subcategory with many car brands:
http://www.autovloeistof.nl/screenshots/carbrands_main_subcategory.JPG


Within this subcategory I've the 2nd subcategory, where you can choose between gasoline or diesel:
http://www.autovloeistof.nl/screenshots/carbrands_2nd_subcategory.JPG


And within this subcategory I've the 3rd subcategory where you can choose the specific car:
http://www.autovloeistof.nl/screenshots/carbrands_3rd_subcategory.JPG

In this 3rd subcategory i want to display only text without the annoying image "No image available"
http://autovloeistof.nl/screenshots/doel.JPG

Share this post


Link to post
Share on other sites

In that case, change lines 37-44 of category.tpl (in PrestaShop v1.3.1) from:

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





to:

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


*}



And the /* category.tpl */ section on line 1402 of global.css from:

/* category.tpl */
h2.category_title { font-size: 1.3em }
body#category #subcategories li { margin-right: 10px }
div.cat_desc { margin: 0 1em }
body#category div#subcategories ul.inline_list li a img { display: inline }



to something like:

/* category.tpl */
h2.category_title { font-size: 1.3em }
body#category #subcategories li { margin-right: 10px }
body#category #subcategories a.no-image { display: block; text-align: center }
div.cat_desc { margin: 0 1em }

Share this post


Link to post
Share on other sites

  • 3 months later...

Hi! I would also like to remove the "no image available" image unless I have uploaded an image for a product. Can you please give me the code needed for version 1.3.6.0 that will allow me to make this happen? I would really appreciate it. Also, the product.tpl file, is that the file located in the /themes/prestashop file?

Thank you,

Amy

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More