Magento - Add a static block to the left column - magento

How would I go about adding a static block on my left column on the category pages?
I would like the static block to go underneath the main column so that it looks like this: http://imgur.com/iopEesf
Thank-you.

override catalog.xml layout file in your template.
in and
<catalog_category_layered>
<reference name="left">
<block type="cms/block" name="block-name">
<action method="setBlockId"><block_id>block_id</block_id></action>
</block>
</reference>
</catalog_category_layered>
<catalog_category_default>
<reference name="left">
<block type="cms/block" name="block-name">
<action method="setBlockId"><block_id>block_id</block_id></action>
</block>
</reference>
</catalog_category_default>

Related

MAGENTO SIDEBAR BLOCK NOT SHOW

I had a three block on my left sidebar.
when I am calling this three block as shown below, it shows only last block. First and second blocks are not showing
<reference name="left">
<remove name="catalog.leftnav" />
<block type="catalog/navigation" before="-"name="left-nav-brand" template="catalog/product/brand_sidebar.phtml"></block>
<block type="cms/block" name="left-nav">
<action method="setBlockId">
<block_id>left-nav</block_id>
</action>
</block>
<block type="catalog/product_list" name="catalog.product.latest" template="catalog/product/latest.phtml"></block>
</reference>
What would be the possible cause ?

Append custom block after addtocart button on the product view page

I try to do it by custom module xml with this code
<catalog_product_view>
<reference name="product.info">
<block type="custom/myblock" name="myblock" after="addtocart" template="custom/myblock.phtml"/>
</reference>
</catalog_product_view>
but it doesn't work. If I change the reference name to content, it goes fine, but I would like to put it after the addtocard button.
How to assign custom block there?
try this its working
<catalog_product_view>
<reference name="product.info">
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml">
<block type="custom/myblock" name="myblock" template="custom/myblock.phtml"/>
</block>
</reference>
</catalog_product_view>
Try this, updated block type.
<catalog_product_view>
<reference name="product.info">
<block type="core/text_list" name="myblock" after="addtocart" template="custom/myblock.phtml"/>
</reference>
</catalog_product_view>

Add block using Custom Layout Updates to category

I am trying use the Custom Layout Update field of a category to add something to the left sidebar for just this category but can't quite get it to work. I had it working before so I know I can do it but then my client accidentally deleted the category.
This works, so I know I have the ability to add something - but I don't want a static block:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-">
<action method="setBlockId"><block_id>designer_sidebar</block_id></action>
</block>
</reference>
I want to include a phtml file from my theme folder and trying this, but can't get it to output anything:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-" template="catalog/category/view_sidebar.phtml" />
</reference>
<reference name="left">
<block type="core/template" name="Designer Sidebar" template="catalog/category/view_sidebar.phtml"/>
</reference>

Edit category lay-out, but apply parts to products

I've got a custom category view.phtml for this category:
http://www.touchfix.nl/onderdelen
The sub-categories use their parent's XML-update, which is:
<reference name="catalog_category_default">
<reference name="content">
<remove name="category.products" />
<block type="catalog/category_view" name="alphabase.parts" template="catalog/category/view.parts.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.parts.phtml"></block>
</block>
</reference>
</reference>
<reference name="right">
<remove name="cms_waaromkiezen" />
<block type="cms/block" name="block_speerpunten_onderdelen">
<action method="setBlockId"><block_id>block_speerpunten_onderdelen</block_id></action>
</block>
</reference>
<reference name="head">
<action method="addCss"><stylesheet>css/categoryblocks.css</stylesheet></action>
</reference>
I want to achieve that the changes to "right" are also applied to products in these categories.
But when I apply these changes to products too in category settings, the "content" reference screws up my page and it returns a blank page.
How can I reference the catalog_category view, so that the "content" update is only done when in category view and not in product view?
catalog_category_default isn't a reference, it's a handle
have you tried changing to:
<catalog_category_default>
I managed to do the trick with the following:
<reference name="content">
<reference name="category.products">
<action method="setTemplate"><template>catalog/category/view.repair.phtml</template></action>
<reference name="product_list">
<action method="setTemplate"><template>catalog/product/list.repair.phtml</template></action>
</reference>
</reference>
</reference>
<reference name="right">
<remove name="cms_waaromkiezen" />
<block type="cms/block" name="block_speerpunten_reparatie">
<action method="setBlockId"><block_id>block_speerpunten_reparatie</block_id></action>
</block>
</reference>
<reference name="head">
<action method="addCss"><stylesheet>css/categoryblocks.css</stylesheet></action>
</reference>
The difference was not to delete the blocks and add new ones with the correct template, but to change the template files of the corresponding items. I can now also refer to the product view block with <reference name="product.info">, which will be my next step.

Magento: Assign Static Block to All Store's Homepages

<cms_index_index>
<reference name="content">
<block type="cms/block" name="home-page-block">
<action method="setBlockId"><block_id>home-page-block</block_id></action>
</block>
</reference>
<cms_index_index>
The above code adds Static Block to Homepage, I have added a static block as per above code. But its not displayed on all stores. As All stores are using same theme.
If app/design/frontend/yourtheme/something/layout/local.xml contains:
<layout>
<cms_index_index>
<reference name="content">
<block type="cms/block" name="home-page-block">
<action method="setBlockId"><block_id>home-page-block</block_id></action>
</block>
</reference>
</cms_index_index>
</layout>
In backend I have a static block with block identified home-page-block
Its contens is displayed in all store views.

Resources