1

I have a 5 or more categories. There is a specific category set for a 1-column-layout and another are as 2-column-left layout.

For a 1-column-layout category i want to show limited product like 6 product limit after that pagination will appear and same for second specific category show product 10 after that show pagination.

please see image.

enter image description here In Layout Update Xml field add xml code for product limit.

3
  • @Nolwennig, i have used like that but it's not working. so can tell me that what should be issue there? my code is like that in xml: <referenceContainer name="content"> <referenceBlock name="product_list_toolbar"> <action method="setDefaultGridPerPage"> <argument name="limit" xsi:type="string">3</argument> </action> </referenceBlock> </referenceContainer> – Sarfaraj Sipai Nov 16 '17 at 6:20
  • @Nolwennig, hello Have you get anything about this ... ? – Sarfaraj Sipai Dec 12 '17 at 9:15
0

Try this, i've tested and worked in my project:
This was related to module Magento_CatalogSearch etc/search_request.xml
Step 1: create new module.
Step 2: create file etc/search_request.xml with this content:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="urn:magento:framework:Search/etc/search_request.xsd">
    <request query="catalog_view_container" index="catalogsearch_fulltext">
        <dimensions>
            <dimension name="scope" value="default"/>
        </dimensions>
        <queries>
            <query xsi:type="boolQuery" name="catalog_view_container" boost="1">
                <queryReference clause="must" ref="category"/>
                <queryReference clause="must" ref="price"/>
                <queryReference clause="must" ref="visibility"/>
            </query>
            <query xsi:type="filteredQuery" name="category">
                <filterReference clause="must" ref="category_filter"/>
            </query>
            <query xsi:type="filteredQuery" name="price">
                <filterReference clause="must" ref="price_filter"/>
            </query>
            <query xsi:type="filteredQuery" name="visibility">
                <filterReference clause="must" ref="visibility_filter"/>
            </query>
        </queries>
        <filters>
            <filter xsi:type="termFilter" name="category_filter" field="category_ids" value="$category_ids$"/>
            <filter xsi:type="rangeFilter" name="price_filter" field="price" from="$price.from$" to="$price.to$"/>
            <filter xsi:type="termFilter" name="visibility_filter" field="visibility" value="$visibility$"/>
        </filters>
        <aggregations>
            <bucket name="price_bucket" field="price" xsi:type="dynamicBucket" method="$price_dynamic_algorithm$">
                <metrics>
                    <metric type="count"/>
                </metrics>
            </bucket>
            <bucket name="category_bucket" field="category_ids" xsi:type="termBucket">
                <metrics>
                    <metric type="count"/>
                </metrics>
            </bucket>
        </aggregations>
        <from>0</from>
        <!-- custom change size, which will make limit 10 products in category page -->
        <size>10</size>
    </request>
</requests>

Which actually change in the code is you set size = 10, or what ever number you want.

-1

Based on Magento/Catalog/view/frontend/layout/catalog_category_view.xml and on Magento/Theme/Block/Html/Pager.

You can try with something like this:

<referenceContainer name="content">
  <referenceBlock name="product_list_toolbar_pager">
    <action method="setLimit">
      <argument name="limit" xsi:type="string">3</argument>
    </action>
  </referenceBlock>
</referenceContainer>

or using xsi:type="number" instead of xsi:type="string":

<argument name="limit" xsi:type="number">3</argument>
                                 ^^^^^^
4
  • i have done same as above but it's not working – Sarfaraj Sipai Dec 13 '17 at 5:58
  • nothing in log? – Nolwennig Dec 13 '17 at 9:55
  • Thanks for reply, but still not any change i think there is a custom theme issue. if you have any idea about his then let me known thanks once again. – Sarfaraj Sipai Dec 13 '17 at 10:57
  • try with built-in theme and compare processflowif needed – Nolwennig Dec 13 '17 at 11:03
-1

As far as I am aware for this to work you need to have the value entered in Products per Page on Grid Allowed Values (Stores > Configuration > Catalog > Catalog > Storefront) then it is available to use via XML using:

<referenceBlock name="product_list_toolbar">
    <action method="setDefaultGridPerPage">
         <argument name="limit" xsi:type="string">20</argument>
    </action>
</referenceBlock>

see also - Magento LayoutXML Update Default Products per Page Grid

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.