Jump to content

Recommended Posts

I posted this on a forum and i got a response but it did not work for me ... 


What I'm trying to do is to get the category image to show instead of the product image. What I have done for the category product list which works is this.


This only works if you are looking at all the products in a category but not if you search for a product?



<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}">
<img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'large_default')}" style="width:140px!important;" alt="{$product.legend|escape:'htmlall':'UTF-8'}" />
</a>

I was wondering how do I get this to work all of the site? How do I make it pull the category images? Like it is above but for the whole site?


 


This was his response and i dont know what it means... 


 


You can do a multiple actions to create such an image, first of all you call for $category class in product page, so $category is not defined.


best solution is to create a assigment for $category in productController in override directory.



class ProductController extends ProductControllerCore
{
public function initContent()
{
parent::initContent();
$category = new Category($this->product->id_category_default);
$this->context->smarty->assign('category', $category);
}
}
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.