How to change column count in listing page Magento2? -
i want make product listing page use 3 columns instead of 4 default columns.
i've got categories on magento2 web, , products on each category. want them show 3 columns count, shows 4 default columns count, how can change plz me this.
magento 2 don't have option set column count magento 1.
to change 4 3 (for theme based on luma) need change css , reset image size.
css code need change inside magento_catalog module, file:
_listings.less
and this:
.media-width(@extremum, @break) when (@extremum = 'min') , (@break = @screen__l) { .products-grid .product-item { width: 100%/5 } .page-layout-1column .products-grid .product-item { width: 100%/6 } .page-layout-3columns .products-grid .product-item { width: 100%/4 } .page-products .products-grid .product-items { margin: 0; } .page-products .products-grid .product-item { width: 24.439%; margin-left: calc(~"(100% - 4 * 32.439%) / 3"); padding: 0; &:nth-child(3n+1) { margin-left: 0; } } .page-products.page-layout-1column .products-grid .product-item { width: 100%/5 } .page-products.page-layout-3columns .products-grid .product-item { width: 100%/4 } }
to have 3 columns, change (i recommend add code _theme.less):
.media-width(@extremum, @break) when (@extremum = 'min') , (@break = @screen__l) { .products-grid .product-item { width: 100%/4 } .page-layout-1column .products-grid .product-item { width: 100%/5 } .page-layout-3columns .products-grid .product-item { width: 100%/3 } .page-products .products-grid .product-items { margin: 0; } .page-products .products-grid .product-item { width: 32.439%; margin-left: calc(~"(100% - 3 * 32.439%) / 2"); padding: 0; &:nth-child(3n+1) { margin-left: 0; } } .page-products.page-layout-1column .products-grid .product-item { width: 100%/4 } .page-products.page-layout-3columns .products-grid .product-item { width: 100%/3 } }
after in
/your_theme/etc/view.xml
change small image width , height. 240 , 300, change 300 , 330.
refresh , it.
Comments
Post a Comment