We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    If you want to add a block after the price on the category page, and for this implementation, you can use the observer core_block_abstract_to_html_before.

    You can implement the logic with the below steps:
    File path: app/code/local/{namespace}/{yourmodule}/etc/config.xml

    <?xml version="1.0"?>
    <config>
        <global>
        <!-- ... -->
            <models> 
                <namespace_modulename>
                    <class>Namespace_Modulename_Model</class>
                </namespace_modulename>
            </models>
        </global>
        <frontend>
            <events>
                <core_block_abstract_to_html_before>
                    <observers>
                        <namespace_modulename>
                            <type>model</type>
                            <class>namespace_modulename/observer</class>
                            <method>insertBlock</method>
                        </namespace_modulename>
                    </observers>
                </core_block_abstract_to_html_before>
            </events>
        </frontend>
    </config>

    The next step is creating the observer and your template file.
    File path: app/code/local/{namespace}/{yourmodule}/Model/Observer.php

    <?php
    class Namespace_Modulename_Model_Observer
    {
        public function insertBlock($observer)
        {
            /** @var $_block Mage_Core_Block_Abstract */
            /*Get block instance*/
            $_block = $observer->getBlock();
            /*get Block type*/
            $_type = $_block->getType();
           /*Check block type*/
            if ($_type == 'catalog/product_price') {
                /*Clone block instance*/
                $_child = clone $_block;
                /*set another type for block*/
                $_child->setType('test/block');
                /*set child for block*/
                $_block->setChild('child', $_child);
                /*set our template*/
                $_block->setTemplate('filename.phtml');
            }
        }
    }
    ?>

    You can add the template to app/design/frontend/<package>/<theme>/filename.phtml .
    And finally, here is a template filename.phtml code:

    <?php echo $this->getChildHtml('child') ?>

     

    Fill the below form if you need any Magento relate help/advise/consulting.

    With Only Agency that provides a 24/7 emergency support.

      Get a Free Quote