0

I have a problem to rewrite/override Mage_Catalog_Block_Product_List_Toolbar.

Here is my code:

etc/modules/Codesky_CatalogProduct.xml

<?xml version="1.0"?>
<config>
      <modules>
        <Codesky_CatalogProduct>
          <active>true</active>
          <codePool>local</codePool>
        </Codesky_CatalogProduct>
      </modules>
</config>

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Codesky_CatalogProduct>
            <version>0.0.1</version>
        </Codesky_CatalogProduct>
    </modules>
    <global>
        <blocks>
            <catalogproduct>
                <class>Codesky_CatalogProduct_Block</class>
            </catalogproduct>
            <catalog>
                <rewrite>
                    <product_list_toolbar>Codesky_CatalogProduct_Block_Product_List_Toolbar</product_list_toolbar>
                </rewrite>
            </catalog>
        </blocks>
    </global>
</config>

Codesky_CatalogProduct_Block_Product_List_Toolbar.php

class Codesky_CatalogProduct_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar
{
    /**
     * Retrieve available limits for current view mode
     *
     * @return array
     */
    public function getAvailableLimit()
    {
        return array(30 => 30, 60 => 60, 90 => 90);
    }
}

Why it's not working. Magento still use method getAvailableLimit() from core file.

  • Have you tried clear cache and session? This code, you are trying for basic category view page, right? – kunj May 17 '18 at 4:39
0

Use below config.xml and make path according to Codesky_CatalogProduct_Block_Catalog_Product_List_Toolbar and override your function whatever you want :

<?xml version="1.0"?>
<config>
  <modules>
    <Codesky_CatalogProduct>
      <version>0.1.0</version>
    </Codesky_CatalogProduct>
  </modules>
  <global>
  <blocks>
      <catalogproduct>
        <class>Codesky_CatalogProduct_Block</class>
      </catalogproduct>
            <catalog>
                <rewrite>
                    <product_list_toolbar>Codesky_CatalogProduct_Block_Catalog_Product_List_Toolbar</product_list_toolbar>
                </rewrite>
            </catalog>
    </blocks>
  </global>
</config> 
| improve this answer | |

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.