Skip to main content
The 2024 Developer Survey results are live! See the results
22 votes
Accepted

How to change listing per page option?

Go to admin Store > Configuration > Catalog > Storefront Now there are two things Products per Page on Grid Allowed Values Enter your desired no here with comma like 12,24,48,96 Products ...
Manoj Deswal's user avatar
  • 5,805
13 votes
Accepted

Magento 2 remove category filter from list page filters?

You have to override core file into your theme, Category layered navigation comes form core file, vendor/magento/module-layered-navigation/view/frontend/templates/layer/view.phtml You have to get ...
Rakesh Jesadiya's user avatar
12 votes
Accepted

Uncaught TypeError: url.indexOf is not a function

Cause: Here's jquery 3 release note: https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/ Removed deprecated event aliases (https://github.com/jquery/jquery/issues/2286) .load, .unload, and ...
Mukesh Chapagain's user avatar
10 votes

Magento 2 remove category filter from list page filters?

Better to use as: <?php if($filter->getRequestVar() != 'cat') { // ... } ?>
MagePsycho's user avatar
  • 4,628
8 votes

Remove Compare from Product List in Magento 2.1.6

Update your extended catalog_category_view.xml file and Find it at your extended theme path app/design/frontend/vendorname/themename/Magento_Catalog/layout/catalog_category_view.xml To remove ...
Manoj Deswal's user avatar
  • 5,805
8 votes
Accepted

In magento2,Category Sorting Product list: How to remove position from attributes?

quick workaround can be add a condition in theme templates file Magento_Catalog/templates/product/list/toolbar/sorter.phtml like if $key != 'position' then don't add in drop down options : <...
Naveed Asim's user avatar
  • 3,657
8 votes
Accepted

How to get product video in product listing page in magento 2?

You can get Media collection of particular product by loading it in custom helper as below: <?php namespace Your\Module\Helper; use Magento\Catalog\Api\ProductRepositoryInterface; class Data ...
Himmat Paliwal's user avatar
7 votes

How to get the product collection based on catalog & cart price rules?

For catalog rule, if you look at vendor/magento/module-catalog-rule/Model/Rule You will find method getMatchingProductIds() which return an array of all matching products for a particular rule. So ...
Amit Singh's user avatar
  • 1,775
7 votes
Accepted

how to use different template file for category magento 2

You need to create a xml file catalog_category_view_id_{{id}}.xml under your theme > Magento_Catalog > layout and change list file. For detail : http://sumankc.com/2016/12/10/different-template-for-...
Suman K.C's user avatar
  • 1,159
6 votes

How to override product list page

You have to just write below xml code in your module file, In your module layout file, app/code/Vendor/Modulename/view/frontend/layout/catalog_category_view.xml File, <?xml version="1.0"?> <...
Rakesh Jesadiya's user avatar
6 votes

Magento 2 remove category filter from list page filters?

Since this is the top result in Google for my search "magento 2 remove category filter from layered navigation", and all the answers suggest entirely replacing a template file (which is subject to ...
John Hall's user avatar
  • 449
6 votes
Accepted

I am facing some difficulties while calling .phtml file in list.phtml of magento

The code won't work on list page because, In the reference link, the module is to display custom products which are assigned to a product. It gets data from a singl product and add it to the related ...
Jaimin Sutariya's user avatar
6 votes
Accepted

Magento 2 How can I show custom options on product list page?

I've implement code for it. Please create block class Don't use Object Manager directly on template. I've used this for demo. <?php $_objectManager = \Magento\Framework\App\ObjectManager::...
Kul's user avatar
  • 1,807
6 votes
Accepted

Magento2 : Product list phtml file for each page

So a quick answer on this : You can find the list.phtml in catalog_category_view.xml under the line of <block class="Magento\Catalog\Block\Product\ListProduct" name="category....
CompactCode's user avatar
  • 2,477
5 votes

Magento get products by website id and store id

Try this $websiteIds = array(Mage::app()->getStore()->getWebsiteId()); $storeId = Mage::app()->getStore()->getStoreId(); $collection = Mage::getModel('catalog/product')->getCollection(...
Abdul's user avatar
  • 9,701
5 votes
Accepted

Moving layered navigation below product toolbar in layout.xml

The solution i came up with is as follows: <move element="catalog.leftnav" destination="category.product.list.additional" before="-"/>
Sophie Baxter's user avatar
5 votes

Returning wishlist item collection for currently logged in user

To do so you need to use the Magento\Wishlist\Controller\WishlistProviderInterface interface. Inject this class in your constructor: protected $wishlistProvider; public function __construct( ......
Raphael at Digital Pianism's user avatar
5 votes

how to use different template file for category magento 2

Created customlist.phtml from list.phtml or copied the code of list.phtml and create Assign customlist.phtml in admin side (admin → category → Layout section) <referenceContainer name="content"&...
Rohit Goel's user avatar
5 votes

How to show visual swatch color on product listing page magento2

<?php/***********Display Color Attribute************/?> <?php $om = \Magento\Framework\App\ObjectManager::getInstance(); $attribute = $om->get(\Magento\Catalog\Api\...
Baharuni Asif's user avatar
5 votes
Accepted

How to hide add to cart button for particular products on all page in magento 2

Try to use afterIsSalable() plugin using this below way : app/code/Vendor/Module/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Rohan Hapani's user avatar
  • 17.5k
4 votes

Magento 2 - Quantity Field on Related Products Listing

Replace the content of if ($showCart) ...... endif with below code. <?php if ($showCart): ?> <div class="product actions product-item-actions"> <form data-role="tocart-...
Jarnail S's user avatar
  • 4,707
4 votes

Change configurable swatches order in Magento 2

You have to edit configurable product, in configurable tab (product edit page) you can view option for Edit Configurations. Click on Edit Configurations, you can see select attribute screen, go to ...
Suresh Chikani's user avatar
4 votes

How to retrieve which layered navigation filters are applied in product list page in Magento 2?

You can do this with the layer resolver (Magento\Catalog\Model\Layer\Resolver). Example code: public function __construct( \Magento\Catalog\Model\Layer\Resolver $layerResolver ) { $this->...
Giel Berkers's user avatar
  • 12.3k
4 votes
Accepted

How to override product list page

you can rewrite the block Step # 1 – Create a di.xml file in a folder FME/Test/etc <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
Qaisar Satti's user avatar
  • 32.5k
4 votes
Accepted

Magento 2 - Get product main image without loading the whole product

You can try following way: public function __construct( \Magento\Framework\App\ResourceConnection $resourceConnection ) { $this->resourceConnection = $resourceConnection; } And now: $...
Sohel Rana's user avatar
4 votes

How to add custom text after price in list page Magento 2

The contents of the price box defined in the template are rewritten by Magento_Catalog/js/price-box.js after page load. That bit of javascript contains the template used for the price box. You can use ...
Pmclain's user avatar
  • 2,648
4 votes

How can I create multiple category pages in Magento 2?

you mention wrong block name please check below code <referenceContainer name="content"> <referenceBlock name="category.products"> <block name="product_list" class="Magento\...
Sunil Patel's user avatar
  • 2,117
4 votes
Accepted

how to get virtual product data in product listing page and show in configurable product in magento 2?

First of: don't use the object manager directly. And your getting the error because current_product is not set on a product listing page. If you look at list.phtml, you see a loop that iterates ...
Giel Berkers's user avatar
  • 12.3k
4 votes

Magento2 : Pagination - jump to top of page

You can do it by using jquery, add the following script in phtml file. <script> require(['jquery', 'jquery/ui'], function($){ $(".class of your nav button").click(function() { $("html, ...
Waqar's user avatar
  • 974
3 votes
Accepted

Magento2 > Safely disable Add-To-Cart buttons

You can do this by just changing the settings of the products. For instance, set up a product to not be "saleable", or to have no stock and disable "out of stock" messages site-wide. Then configure ...
philwinkle's user avatar
  • 35.8k

Only top scored, non community-wiki answers of a minimum length are eligible