Jump to content

Displaying images on category page, and custom thumbnails


saracoratello

Recommended Posts

Hello,

 

I have prestashop 1.4.7

 

My problem is that i want to show on category pages two images, not only one. And i do not have too much idea how to do this.

 

adding this code to Controller/CategoryController.php in process function

 

 

$image_array=array();
for($i=0;$i<count($cat_products);$i++)
  {
   $image_array[$i]= $this->category->getProductsimg($cat_products[$i]['id_product']);
  }
self::$smarty->assign('productimg',(isset($image_array) AND $image_array) ? $image_array : NULL);

 

and this into my-theme/product-list.tpl

 

{foreach from=$productimg key=key1 item=pimage}
 {foreach from=$pimage key=key2 item=pimage2}
   {if $product.id_product==$pimage2.id_product}
     <img src="{$link->getImageLink($product.link_rewrite,$product.id_product|cat:"-"|cat:$pimage2.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} class="{$key2}" />
    {/if}
  {/foreach}
{/foreach}

 

is not helping, and i do not have any other ideas.

 

And if some of you know how to set custom thumbnail ( i want crop image on my own) in this view, it will be awesome!

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...