Show a Magento block based on variable

Posted on May 23, 2012 by ext4mage There have been 0 comments

Want to show a Magento block in PDF based on a variable

In the PDF you want to show a Magento block element, if the value of a specific variable is something. Below is the code that shall be put into the text element in you PDF template.

First we test if a variable (order_payment_data_method) is equal a text (installment), if it is do nothing, if it is not print something (<span style="display: none;">). Then we reference the block that we want to show (Magento style). Last we test again and prints something if not equal (</span>)

##strstr({{order_payment_data_method}}, 'installment') ? '' : ''##
    {{ block id="paysolution_pdf" }}
##strstr({{order_payment_data_method}}, 'installment') ? '' : ''##

Related product:
  HTML2PDF extension

This post was posted in Guides and was tagged with magento, block, invoice layout, design