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

Showing static block with if statement based on product attribute
 
kristoftuin
Newbie
 
Total Posts:  0
Joined:  2010-10-06
 

Hi all,
I have a shop where I sell plants.  http://www.gardenplants.be
Some of them can be sent by mail, others are delivered by own transport.
To do this, I made the attribute ‘pakketverzending’ (Yes/No)

For simple products, this attribute is shown in the list on product view page.
For grouped products, I put in some code to show this attribute for every simple product in the table.
<?php echo $this->__('Pakketverzending mogelijk: ') ?><?php echo $this->htmlEscape($_item->getAttributeText('pakketverzending'))?>

My issue now, is that I would love to fit in a static block, and this static block has to contain a link to a page with some information regarding the costs en modalities for delivery.  Basically, i want one static block for those products that can be sent by mail, and another static block for the product I deliver myself. 

Now I used this code, which did something, but not allways the right thing.  Can anyone help me?

<?php if ($_product->Pakketverzending == 0) {echo $this->getLayout()->createBlock('cms/block')->setBlockId('levering')->toHtml() ;} else {echo $this->__('Pakketverzending mogelijk: ') ?><?php echo $this->htmlEscape($_item->getAttributeText('pakketverzending'));}?>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top