Magento : How to add a static CMS block to the side bar (twitter example)
This is a simple thing to achieve but the questions is asked over and over again so I thought it might worth adding a quick tutorial here. For the sake of an example we will look at how to add your twitter feed to the left hand menu.
Step one.. get the twitter code from here : http://twitter.com/about/resources/widgets/widget_profile
Style it to match the colour, size and shape of your theme.
Your final code will look something like
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 8,
interval: 6000,
width: 'auto',
height: 200,
theme: {
shell: {
background: '#333333',
color: '#ffffff'
},
tweets: {
background: '#000000',
color: '#ffffff',
links: '#4aed05'
}
},
features: {
scrollbar: true,
loop: false,
live: true,
hashtags: true,
timestamp: true,
avatars: false,
behavior: 'all'
}
}).render().setUser('dx3webs').start();
</script>
Step Two
In Magento Goto CMS > Static Blocks.
Create a new block
Title: myTwitter
Indentifier: twitter
Status: Enabled
Content: Paste your twitter code in here.
Save
Step Three
Open app/design/frontend/xxxxxx/xxxxxx/layout/catalog.xml
Add your static block to the left or right section in
<!-- Mage_Catalog -->
(near the top of the file)
For example to add to the left sidebar.. (Having already removed that damned dog call out)
<reference name="left">
<block type="cms/block" name="myTwitter" >
<action method="setBlockId"><block_id>twitter</block_id></action>
</block>
</reference>
Bingo you have a new block showing your twitter updates. Needless to say you can add any html you like.
You can see an example of this working here : http://www.5starvans.co.uk/sales/index.php/new-vehicles.html (site still a work in progress at time of writing)
- Share this:
- StumbleUpon
Related posts:
This entry was posted by admin on November 8, 2010 at 8:57 pm, and is filed under Magento. Follow any responses to this post through RSS 2.0.You can leave a response or trackback from your own site.
- Notes on Magento benchmarking..
- Magetno fix : Cant add products to admin create order
- Magento fix : Invalid method Mage_Wishlist_Model_Item::canConfigure(Array
- Create a multi-store setup in Magento
- Magento fix: Fatal error: Method Varien_Object::__tostring() cannot take arguments in /magento/lib/Varien/Object.php
- Magento fix : Local file doesn’t exist
- Magento tip: after upgrade prices on product page simple product are gone……
- Add attribute to Grid or List view
- Magento tip : add Google Checkout button to side bar shopping cart
- Magento Tip: Add simple product url to grouped product items

Thankyou, after looking at many guides i found this one to work the best.