21
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 ...
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 ...
11
votes
Accepted
Add custom block on listing page : Magento2
You can do that if you create new module to override this block: vendor\magento\module-catalog\Block\Product\ListProduct.php
to override this block, you need to create di.xml at app\code\Vendor\...
10
votes
Magento 2 remove category filter from list page filters?
Better to use as:
<?php
if($filter->getRequestVar() != 'cat') {
// ...
}
?>
9
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 ...
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 ...
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 :
<...
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 ...
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 ...
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-...
6
votes
Accepted
Product list by category in CMS page
For Magento 1.9.2.x, You need to create permission for 'catalog/product_list' block from 'System->Permissions->Blocks'
6
votes
Accepted
Change list.phtml to show products of multiple categories in same block
Good question!
The trick here is to extend a block based on catalog/product_list.
I think the best way here is to add some xml to the "Layout Update XML" section.
<reference name="content">
...
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"?>
<...
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 ...
6
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\...
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 ...
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::...
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....
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(...
5
votes
Accepted
catalog_product_collection_load_after - identify the "right" collection
You can use the event catalog_block_product_list_collection.
This one is dispatched in the product list block.
5
votes
Accepted
product ids separate with # on success page
Go to the success page template app/design/frontend/base/default/template/checkout/success.phtml (for base theme)
Aafter <?php if ($this->getOrderId()):?> add:
<?php
$order = ...
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="-"/>
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(
......
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"&...
4
votes
Sorting Product List by more than one attribute
Placed into/as answer, as comments will not be appropriate.
This expand on the accepted answer:
Did I find a bug? magento 1.9.2
If you use the code, as suggested in the accepted answer: $collection-&...
4
votes
Magento does not display all imported products within the categories
Possible causes for products that do not appear on the frontend (I include those that you already ruled out for sake of completeness):
the products' "visibility" attribute might be set to "Not ...
4
votes
Add custom block on listing page : Magento2
Currently you cannot do this because all logic of product output is hardcoded in list.phtml template.
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-...
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 ...
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->...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
product-list × 590magento2 × 132
magento-1.9 × 119
product × 74
category × 59
magento-1.7 × 42
collection × 33
sorting × 32
layout × 30
product-attribute × 28
product-collection × 27
attributes × 26
catalog × 25
products × 25
magento-1.8 × 24
configurable-product × 24
blocks × 23
magento-1 × 19
magento-2.1 × 18
category-products × 18
layered-navigation × 17
list.phtml × 17
price × 16
module × 15
catalogsearch × 14