0

I am trying to limit the products per page to six from the current twelve. Also trying to make the dropdown options 6, 12, 24 for different product displays. I currently have the file ../app/design/frontend/rwd/default/layout/catalog.xml where I made the following changes in this block:

<catalog_category_layered translate="label">
        <label>Catalog Category (Anchor)</label>

        <reference name="left_first">

            <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
                <block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
            </block>
        </reference>
        <reference name="content">
            <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                    <block type="core/text_list" name="product_list.name.after" as="name.after" />
                    <block type="core/text_list" name="product_list.after" as="after" />
                    <!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
                    <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                        <block type="page/html_pager" name="product_list_toolbar_pager"/>
                        <action method="setDefaultListPerPage"><limit>6</limit></action>
                        <action method="setDefaultGridPerPage"><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>12</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>24</limit></action>
                        <!-- The following code shows how to set your own pager increments -->
                        <!--
                            <action method="setDefaultListPerPage"><limit>4</limit></action>
                            <action method="setDefaultGridPerPage"><limit>3</limit></action>
                            <action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
                            <action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
                            <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                            <action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
                            <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
                            <action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action>
                            <action method="addPagerLimit"><mode>grid</mode><limit>6</limit></action>
                            <action method="addPagerLimit"><mode>grid</mode><limit>9</limit></action>
                            <action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
                        -->
                    </block>
                    <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                    <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                    <!-- Since the addColumnCountLayoutDepend does not work, we are manually setting the max columns -->
                    <action method="setColumnCount"><count>4</count></action>
                </block>
            </block>
        </reference>
    </catalog_category_layered>

As you can see I have added

<block type="page/html_pager" name="product_list_toolbar_pager"/>
                        <action method="setDefaultListPerPage"><limit>6</limit></action>
                        <action method="setDefaultGridPerPage"><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>12</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>24</limit></action>

to make these changes. I do not see any changes though. Not in products displayed nor in the dropdown where numbers can be selected. How come.

NB Themes now in /app/design/frontend are base, default and rdw (current package name).

NBB As shown in comments I can change dropdown values in backend config > catalog, but I somehow cannot change the no. of products shown that way by default. Twelve remain all the same.

catalog

Here is the full catalog list.phtml https://gist.github.com/jasperf/54815aeaa685a1b282675cf675dceb8a located at app/design/frontend/rwd/default/template/catalog/product/list.phtml

  • 2
    You can also change those values in the backend in System > Configuration > Catalog. Maybe you should give that a try too – Raphael at Digital Pianism Feb 3 '17 at 13:19
  • Will have a look see there too. Thanks. Do hope to learn to do this in the code as well though. – rhand Feb 3 '17 at 13:21
  • Dropdown values I could change to 6,12,24, but though I indicated 6 per grid layout I still see 12 and then pagination – rhand Feb 3 '17 at 13:32
  • clear the cache @rhand – Gopal Patel Feb 3 '17 at 14:30
  • I agree with @RaphaelatDigitalPianism that this is a setting in Magento that you could adjust. Presuming you prefer editing this in the code itself, there could be multiple reasons why the change is not applied: the cache is not cleared (clear the /var/cache/ directory) or maybe you're not editing the correct template file (i.e. you have a custom theme installed and you should edit those files instead of the ones from the default rwd theme). – Niels Feb 3 '17 at 14:51
1

From your question I am not able to get if you have a default category view or a layered category view.
Update the same thing in <catalog_category_default> tag.
Also, update your code like below.

<block type="page/html_pager" name="product_list_toolbar_pager">
    <action method="setDefaultListPerPage"><limit>6</limit></action>
    <action method="setDefaultGridPerPage"><limit>6</limit></action>
    <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
    <action method="addPagerLimit"><mode>list</mode><limit>12</limit></action>
    <action method="addPagerLimit"><mode>list</mode><limit>24</limit></action>
<block>

You need to set these values inside product_list_toolbar_pager block. More reference

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.