0

Is it possible to add a block to Magento page which has dynamic content. Let's say I want to create a block in which a product is displayed. And after a certain period time 15 seconds for example the product changes and another one is displayed.

1

Yes, you have to create your phtml file then you include it in the page that you want, with xml or directly in a page code, then you customize it with js for exemple.

To include it:

1) You create the phtml file app/design/frontend/{package}/{theme}/template/catalog/product/homeproducts.phtml then you add your custom code

2) to include it via cms page:

{{block type="core/template" name="home.product" template="catalog/product/homeproducts.phtml"}}

via xml:

app/design/frontend/{package}/{theme}/layout/local.xml

<your_layout_handle> //where you want to display your block
        <reference name="root">
            <block type="core/template" name="home.product" template="catalog/product/homeproducts.phtml"/>
        </reference>
</your_layout_handle>

3) Go to your phtml that you want to display this new block then add this:

<?php echo $this->getBlockHtml('home.product'); ?>

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.