Show static blocks in the description

step-by-step:

1. Create the attribute switcher
2. Create the cms blocks
3. Modifiy the view.phtml

1. Create the attribute switcher
Admin - Catalog - Attributes - Manage Attributes - Add New Attribute

Attribute Code: info01
Scope: Global (or what you want)
Catalog Input Type for Store Owner: Yes/No
following lines as default
....
....
....
....
Visible on Product View Page on Front-end: No
...
...

Click left site - Manage Label Option
Admin Info 01

SAVE Attribute

Repeat the Add New Attribute with info02, info03, info04 .... so much cms blocks you will have.

-----------------------------------------------------------------------------------------
Now the atrributes becomes a homeland where do you can use this.
Every Product have a Attribute Set. Standard = Default.
So i.e. we put the new Attributes in the default Set.

Admin - Catalog - Attributes - Manage Attributes sets - select Default.

On the right site you will see the new attributes.
Click on the first and hold the mouse switch, move it on the left block below i,e, sku.
Repeat this with all other new attributes.

SAVE Attribute Set.
-----------------------------------------------------------------------------------------

2. Create the cms blocks

Admin - CMS - Static Blocks - Add New Block

Block Title: infoblock 01
Identifier: infoblock01 (importend. no space in the line)
Store View: All Store View (or what you like)
Status: Enabled
Content:

your text, format with html tags



SAVE Block.

Repeat this for all you different blocks with Identifier infoblock02, infoblock03, ....

------------------------------------------------------------------------------------------

Last step
3. Modifi the view.phtml in your theme, i,e, in the default theme:

app\design\frontend\default\default\template\catalog\product\view.phtml

This line make the showing for block1 if the atrribute switcher= yes for block1 for a product.
Info01 ==1) { echo $this->getLayout()->createBlock('cms/block')->setBlockId('infoblock01')->toHtml() ;}?>

Copy this lines at this place in the code do you like to see the blocks, i.e. below the productname.



productAttribute($_product, $this->htmlEscape($_product->getName()), 'name') ?>


Info01 ==1) { echo $this->getLayout()->createBlock('cms/block')->setBlockId('infoblock01')->toHtml() ;}?>
Info02 ==1) { echo $this->getLayout()->createBlock('cms/block')->setBlockId('infoblock02')->toHtml() ;}?>
....
....
Info10 ==1) { echo $this->getLayout()->createBlock('cms/block')->setBlockId('infoblock10')->toHtml() ;}?>
Save the view.phtml and clear cache in Admin.
Now you can in the Admin panel in Catalog - Manage Product - for new or added products the blocks switching on and off (default = off).

Hope this helps and enjoy :)

Comments

Popular posts from this blog

Spain's nuclear legacy

sql joins