質問

I cannot edit my magento theme for now - I'm trying to do this through the back admin. I am also by no means an expert, so please forgive me.

I need one category to have a default grid value of 48 products instead of our set default value of 24. 48 is a value that is allowed in our product grid.

I tried the following code by entering it into the category Design Layout Update XML section, but it is not working.

<referenceContainer name="content"> 
<block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"><action method="setDefaultGridPerPage"> 
<argument name="limit" xsi:type="string">48</argument>
</action>              
</block>
</referenceContainer>

How can I go about changing the default value via back admin?

Thanks in advanced!

役に立ちましたか?

解決

To set a default grid value of 48 products for one category, you have to set "Products per Page on Grid Allowed Values" configuration in Store > Configuration > Catalog >Catalog > Store Front > Products per Page on Grid Allowed Values add 48. enter image description here You will have to then move to catalog > categories (select the category in which you have to set default grid value to 48) > Design > Layout Update XML add below lines

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

他のヒント

You have to set 48 as value allowed in "Products per Page on Grid Allowed Values" ... in Store > Configuration > Catalog > Catalog > Store Front > Products per Page on Grid Allowed Values.

enter image description here

Go to catalog > categories and select the category in which you have to set default grid value to 48. Go to tab Design > Layout Update XML and add this: enter image description here

You can paste from here:

<referenceContainer name="content">
  <referenceBlock name="product_list_toolbar">
    <action method="setAttribute">
      <argument name="name" xsi:type="string">_current_limit</argument>
      <argument name="value" xsi:type="number">48</argument>
    </action>
  </referenceBlock>
</referenceContainer>
ライセンス: CC-BY-SA帰属
所属していません magento.stackexchange
scroll top