2

I use an extension from FireGento that overrides price.html to show additional information like tax and delivery time below my magento price (German specific).

In some layout XML, the extension defines where the new price.html is output.

Example:

<!--
Adding custom product price block
-->
<catalog_category_default>
    <reference name="product_list">
        <action method="addPriceBlockType">
            <type>simple</type>
            <block>magesetup/catalog_product_price</block>
            <template>catalog/product/price.phtml</template>
        </action>
    </reference>
</catalog_category_default>

Everything works fine, but when I work with AJAX calls, my price is shown without the additional information.

Is it possible to update my layout XML for AJAX calls or it is achievable to set addPriceBlockType when I get my product collection?

2

Yes, but you need to find out the right layout handle for the AJAX calls. The AJAX request should be in the form xxx/yyy/zzz (frontname/controller/action) and the module that handles it should have a controller class in controllers/YyyController.php with a method zzzAction. In the module's layout XML in app/design/frontend/base/default/layout there should be an element similar to:

<xxx_yyy_zzz>
    ...
    <block type="catalog/product_list" name="XXXXXX">
    ...
</xxx_yyy_zzz>

Then in your own layout XML, add the following code:

<xxx_yyy_zzz>
    <reference name="XXXXXX">
        <action method="addPriceBlockType">
            <type>simple</type>
            <block>magesetup/catalog_product_price</block>
            <template>catalog/product/price.phtml</template>
        </action>
    </reference>
</xxx_yyy_zzz>

More info on how and where to add custom layout XML: What is the correct way/approach to modify a Magento template?


As for your additional question:

or it is achievable to set addPriceBlockType when I get my product collection?

You can call the method via code instead, but it's not related to the product collection, you would need to retrieve the product list block from the layout singleton and call the method (basically doing the same thing defined by the XML above, but using code):

Mage::app()->getLayout()->getBlock('XXXXXX')->addPriceBlockType(
    'simple', 'magesetup/catalog_product_price', 'catalog/product/price.phtml'
);

after loadLayout() and before renderLayout().

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.