0

I am very new to Magento and have to add a Button to each product in product category view and all other product lists (not detail product view).

I nearly found an answer in Add block to each product in category view, but I don't want to override any original files. So that solution seems not working for me.

I tried to extend Mage_Catalog_Block_Product_List, but I do not really find an appropriate function to use.

Please, can anybody help me?

1 Answer 1

1

You can use _afterToHtml method

class Company_Module_Block_Model extends Mage_Core_Block_Template
{
    protected function _afterToHtml($html)
    {
        return $html . '<div>Some text is here</div>';
    }
}

Or parse your $html as you like

1
  • Thanks! Extending Mage_Core_Block_Template this way gives me an error: Invalid method Webshopxcalibur_Block_Model::addColumnCountLayoutDepend(Array( [0] => empty [1] => 6 ) ) I tried also to extend Mage_Catalog_Block_Product_List by overriding _afterToHtml($html). It gave me the correct output, but only once at the end of the whole list. I want my output at each product of the list. Do you have any idea? Apr 13, 2015 at 8:33

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.