Jump to content

Product Images Inherit From Category Image


Recommended Posts

Hello, is it possible and does anybody know a way that i can use the featured Product Category Image for all products listed in that specific category.

 

I have about 6 main Product Categories with 100's of products which i do not have images for so i would like to use the same image as i used for the Category

 

Thanks Chris

Link to comment
Share on other sites

I am not sure the category object is available in product-list.tpl, but you can try with

{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}

The problem here would be that you can't really check if the product image exists, inside smarty. THerefore, a better approach would be to modify the categorycontroller.php file.
Edit

assignProductList()

And before it assigns cat products here

'cat_products' => &$this->cat_products,


Use a foreach to go through them. THen use file_exists to check if their product image exists. If not, convert the above to the php counterpart and grab the category image link, referring to the category as $this->category

Link to comment
Share on other sites

×
×
  • Create New...