0

I am calling a block of category on Homepage to show 5 product in a row. I have set the mode to "grid" for this block. But when I shift grid view to list view inside the site on Product listing page the home page also grid view is changing to the list view. I would like to restrict the block on homepage to "grid" view. Is there any solution for this? Please advise me.

Thanks

enter image description here

1

I've not tested this, but you should be able to set the block configuration on the home page via the layout/cms.xml to force grid mode like so:

        <action method="setData">
            <key>_current_grid_mode</key>
            <value>grid</value>
        </action>

So it could look something like this:

<!-- layout handle for the default homepage action -->
<cms_index_index>
    <reference name="content">
        <block type="catalog/product_featured" name="product_featured">

            <action method="setTemplate">
                <template>catalog/product/featured.phtml</template>
            </action>

            <action method="setCategoryId">
                <catId>1</catId>
            </action>

            <action method="setColumnCount">
                <count>5</count>
            </action>

            <action method="setData">
                <key>_current_grid_mode</key>
                <value>grid</value>
            </action>

        </block>
    </reference>
</cms_index_index>
|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.