xrep
xrep

Reputation: 195

Prestashop - default category image

Prestashop version 1.6.9

Unfortunately I have lots of categories that don't have pictures so the page looks when browsing category like this https://i.sstatic.net/hWOG3.jpg . Another weird thing is that the picture is returned with 404 status code.

Now, I want to use some default image when there is no special image for category.

How can I achieve this?

Upvotes: 2

Views: 8599

Answers (1)

gskema
gskema

Reputation: 3221

That's kind of strange, because that image is used everywhere, where the image is set, but doest exist in file.

The image used here is img/404.gif, but if you change it, it will be used in other places too.

If you want to change category images (sub-category images I assume?) then you should modify the template files of your theme and add a link to your custom image. For example,

themes/default-bootstrap/category.tpl @ Line: 80

{if $subcategory.id_image}
    <img class="replace-2x" src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium_default')|escape:'html':'UTF-8'}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{else}
    <img class="replace-2x" src="{$img_cat_dir}default-medium_default.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />
{/if}

Upvotes: 2

Related Questions