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 to Convert an ImageIcon to a Base64 encoded String in Java

How to install a network Star TSP700II installed on Windows XP in Windows 10

Problems when generating and uploading JSON from CSV for GSTR1