How to make the category images responsive to screen size in Classic (default) theme in Prestashop 1.7


Firstly Edit the theme.css to remove any image size restrictions. 

\ themes \ classic \ asset \ css \ theme.css -> find -> .block-category .category-cover img -> delete/comment width and height values.

.block-category .category-cover img {

/* width: 141px; */

/* height: 180px; */

}

Next edit the category-header.tpl:

/themes/classic/templates/catalog/_partials/category-header.tpl

Edit the following lines to make the image class img-fluid

{if !empty($category.image.large.url)}

<div class="category-cover">

<img class="img-fluid" src="{$category.image.bySize.category_default.url}" alt="{if !empty($category.image.legend)}{$category.image.legend}{else}{$category.name}{/if}" loading="lazy">

</div>

{/if}

Now, clear cache and recompile template files from the performance menu in the prestashop backoffice.

Comments

Popular posts from this blog

How reinstall Prestashop 1.7 keeping the existing database

How to change the displayed name for a payment module in Prestashop

Using 'Group By' to Select the Row with the 'max(date)' and Updating it