Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Magento 1.4.x - Adding a static block in the sidebar
Old 02-10-2011, 01:22 AM Magento 1.4.x - Adding a static block in the sidebar
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
Wasted a couple of hours today figuring this out, so thought I would write it up for posterity.

1. You need to create the custom block (or blocks) in CMS-Static Blocks - Add New Block dialogue.
Make sure you set the store visibility correctly
i.e. if you have a multilingual store, create a block for each language version and choose the Store View for each that matches.

2. Go to the catalog.xml file which will be located:
app/design/frontend/default/YOURTHEMENAME/layout

3. Find the appropriate part of the XML file to edit. In this case we want
to add the block to the left sidebar so find the
Code:
<reference name="left">.....random code......</reference>
and add this block inside it:
Code:
<block type="cms/block" name="STATIC_BLOCK_NAME">
                <action method="setBlockId"><block_id>STATIC_BLOCK_ID</block_id></action>
            </block>
for example:

Code:
<block type="cms/block" name="left.mylinks.nav">
                <action method="setBlockId"><block_id>secondary_links</block_id></action>
            </block>
Not sure if its absolutely necessary to use a block name but I did and it works, so caveat emptor if you want to try a different way.

Will update this thread when I find out how to reposition the block, e.g. to get it to appear above the Layered Navigation block in Catalog view.
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-11-2011, 12:44 AM Re: Magento 1.4.x - Adding a static block in the sidebar
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
OK. Found the answers I needed and in the process found out why it's
useful to name your newly created block.

Lets say I want to position my Secondary Links block that I created at
the top of the right column, above the shopping cart.

The first important point, is to figure out which XML file you need to
use. This is where turning on Template Path Hints in the Admin config screen would help a lot.
It puzzled me how to get the Static block at the top of the column, above the cart,
until I realized that the cart is generated by "checkout.xml" NOT "catalog.xml".
So find the correct layout XML file and copy it into your theme directory (indicated above).

The rest is fairly straightforward.
Find this section:
Code:
<reference name="right">...random code..</reference>
and add:
Code:
<block type="cms/block" name="left.mylinks.nav" before="cart_sidebar">
                <action method="setBlockId"><block_id>secondary_links</block_id></action>
            </block>
Note the before="cart_sidebar" which indicates the position of your new block relative to the block named within quotation marks.
Less semantically correct by also acceptable is before="-" which means
place the new block before everything within that structure block.
after="cart_sidebar" or after="-" are also an options.

Giving a name to your block is necessary to aid positioning instructions like this.
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
Old 02-11-2011, 02:29 AM Re: Magento 1.4.x - Adding a static block in the sidebar
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
On an unrelated note,
if you want to use Tier Pricing for your products,
Magento has that ability natively built in.

You enter the tier pricing options and an extra
block will automatically show up in product view
giving the discount / volume percentages.

But what about Configurable Products?
You can't set a Tier options for the "Master" product.

I found the way around this is to simple manually type
in the Tier pricing information into the Product Description
field via the Admin panel. Easy.
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Magento 1.4.x - Adding a static block in the sidebar
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12140 seconds with 12 queries