Glenskie Posted April 8, 2014 Share Posted April 8, 2014 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); } } Quote Link to comment https://forums.phpfreaks.com/topic/287617-create-link-for-product-image-in-prestashop/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.