0

I want to add a second static block to the bottom of every category page in my magento 1.9 store.

Like this site

I want a description on top of the products but also a larger description at the bottom.

I am very familiar with magento and hard coding but it seems I get stuck here. I search the web for ours but no solution.

I could manage it to get a static block at the footer but then on every page it is the same text and I want different text at each category.

Nolwennig
  • 1,613
  • 24
  • 29
BG media
  • 1
  • 1

1 Answers1

1

You can do this through layout.xml. To add a static block simply add:

<block type="cms/block" name="block_key">
    <action method="setBlockId">
        <block_id>block_key</block_id>
    </action>
</block>

to the content node on the category section. Then you can call it via:

    <?php echo $this->getChildHtml('block_key'); ?>

where ever you would like in your template.

To add custom text you can use the magic set method which you will add to the custom design section on the category page.

<reference name="block_key">
    <action method="setCustomText">
         <text>This is my custom text</text>
    </action>
</reference>

Then within your template/block you can get this from using the following :

<?php echo $this->getCustomText(); ?>

Let me know if this works for you.

Will Pike
  • 53
  • 8
  • thank you for replying will pike,i tried it but it didnt work, i have the following questions for you will pike ,in wich folder do you out the getChildHtml('block_key'); ?> in the vieuw .phtml? and what is or do you mean with the block key the block id is clear but the block key? .. do i have to fill in something other than block key?, – BG media Aug 12 '15 at 10:41
  • my next question is you say magic set put this code This is my custom text on the category page ,do you mean vieuw.phtml? and in wich folder do i put it ? – BG media Aug 12 '15 at 10:41
  • and i also do not have a layout.xml only a local.xml – BG media Aug 12 '15 at 10:46
  • @ will isnt there just a way to make a nice form in the admin with top discription and bottom discription like the default discription is now?and that its also a default after changing the code so that putting in text is clean and easy like the default discription right know? – BG media Aug 12 '15 at 10:56
  • @BGmedia you can create any number of layout.xml files. local.xml is for default. but you can declare any layout.xml file you want in your config.xml – Will Pike Aug 12 '15 at 14:57
  • thank you for your answer but its to short for me can you literally discribe steb by step so that its super clear to everybody .now its just to vague ,just discribe step by step how its done. thanks in advance – BG media Aug 12 '15 at 15:45
  • including the folder paths please – BG media Aug 12 '15 at 15:47
  • #BGmedia there are a lot of resources out there that can help you understand things like layout and static blocks. Let me give you some of the better ones: Static Block: [link](http://bradfrost.com/blog/web/magento-static-blocks/) Custom Layout [link](http://code.tutsplus.com/tutorials/custom-layouts-and-templates-with-magento--cms-21419) Creating your first module: [link](http://www.smashingmagazine.com/2012/03/basics-creating-magento-module/) I think you will find everything you are looking for in those. – Will Pike Aug 13 '15 at 11:33
  • thank you for the links .But why is it so hard for you to show it step by step just like the first responce how its done so that i and other people can see exactly what you mean, we would really appreciate that . – BG media Sep 01 '15 at 11:38
  • if only you could tell me how to get the categorie discription below product list instead of above that also would be a great deal of help and this answer did not work https://magento.stackexchange.com/questions/52913/problem-with-magento-category-description-please-help/80536#80536 – BG media Sep 01 '15 at 12:18
  • i have made a new block calld footertekst and put at the xml updates at the categorie this code your_static_block but nothing happend and it has to be verry simpel like this http://docs.trollweb.no/display/polarthemes/Adding+a+static+block+below+the+products+in+a+category so what do i do wrong ? and i did changed the your static block to footertekst – BG media Sep 01 '15 at 12:38