Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

how to include a static cm-block in an tab on the prodoct view
 
Herr Mark-Oliver Kaemmerer
Jr. Member
 
Total Posts:  2
Joined:  2011-02-07
 

Hello,

how can i implement some static cms-blocks in tabs in my product view.

The view.phtml looks like this:

<div class=\"product-collateral\">
  
<?php echo $this->getChildHtml(\'info_tabs\'?>

   
....

</
div>

In the catalog.xml it looks like this:

...
                <
block type=\"catalog/product_view_tabs\" name=\"product.info.tabs\" as=\"info_tabs\" template=\"catalog/product/view/tabs.phtml\" >
                    <
action method=\"addTab\" translate=\"title\" module=\"catalog\">
                        <
alias>description</alias>
                        <
title>Product Description</title>
                        <
block>catalog/product_view_description</block>
                        <
template>catalog/product/view/description.phtml</template>
                    </
action>
                    <
action method=\"addTab\" translate=\"title\" module=\"catalog\">
                        <
alias>upsell_products</alias>
                        <
title>We Also Recommend</title>
                        <
block>catalog/product_list_upsell</block>
                        <
template>catalog/product/list/upsell.phtml</template>
                    </
action>
                    <
action method=\"addTab\" translate=\"title\" module=\"catalog\">
                        <
alias>additional</alias>
                        <
title>Additional Information</title>
                        <
block>catalog/product_view_attributes</block>
                        <
template>catalog/product/view/attributes.phtml</template>
                    </
action>
                    <
action method=\"addTab\" translate=\"title\" module=\"catalog\">
                        <
alias>product_reviews</alias>
                        <
title>Product Reviews</title>
                        <
block>advancedreviews/product_reviews</block>
                        <
template>advancedreviews/product/reviewstab.phtml</template>
                    </
action>

                   ===> 
at this point i want to implement the static cms-block like this
                 
                 I know that this is not working
! ( 
                 <
block type=”cms/block” name=”cms_Ihr_Seitenbezeichner”>
                      <
action method=”setBlockId”><block_id>Ihr_Seitenbezeichner</block_id></action>
                  </
block>)

                </
block>
...

The static block has the
title: Special Offers
and the
blockname is:  special_offers

How can i implement this via xml in the tabs?

I know the snippet below, but dont know how to bring this things together!

<block type=”cms/block” name=”cms_Ihr_Seitenbezeichner”>
<action method=”setBlockId”><block_id>Ihr_Seitenbezeichner</block_id></action>
</block>

Please Help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Hello
Unfortunately the addTab method requires block type and template, so you cannot add it using ‘cms/block’.
But you can can try this workaround.

The main idea is to put the content you need in a template file like magento wants it for the addTab methods.
Here it goes.

Create a phtml file lets call it: ‘custom/static_block.phtml’
with this content:

<?php echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('Ihr_Seitenbezeichner'); ?>

Now in the xml you can use this:

<action method="addTab" translate="title" module="catalog">
                        <
alias>cms_Ihr_Seitenbezeichner</alias>
                        <
title>Seitenbezeichner</title>
                        <
block>core/template</block>
                        <
template>custom/static_block.phtml</template>
                    </
action>

Let me know if it works
Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
atif_kht
Jr. Member
 
Total Posts:  25
Joined:  2011-01-11
 
tzyganu - 25 March 2013 06:48 AM

Hello
Unfortunately the addTab method requires block type and template, so you cannot add it using ‘cms/block’.
But you can can try this workaround.

The main idea is to put the content you need in a template file like magento wants it for the addTab methods.
Here it goes.

Create a phtml file lets call it: ‘custom/static_block.phtml’
with this content:

<?php echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('Ihr_Seitenbezeichner'); ?>

Now in the xml you can use this:
<action method="addTab" translate="title" module="catalog">
                        <
alias>cms_Ihr_Seitenbezeichner</alias>
                        <
title>Seitenbezeichner</title>
                        <
block>core/template</block>
                        <
template>custom/static_block.phtml</template>
                    </
action>

Let me know if it works
Marius.

Hi, everything fine but except for one small change and after that it will work like a charm smile below is the change:

<?php echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('Ihr_Seitenbezeichner')->toHtml(); ?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top