Question

I'm trying to put some custom text in an invoice template (a transactional mail). I am doing this by loading a block in the template. In here i want to use some logic to display some text based on GroupId.

In Invoice_new.html

{{block type='core/template' area='frontend' template='mailcomment/mailcomment.phtml' order=$order}}

**In my new file mailcomment.phtml

<?php $customergroup = $this->getData('order')->getCustomerGroupId(); 
if ($customergroup==7) 
echo ("Some custom text")?>

Unfortuntely this does not work. Can anybody tell me what i am doing wrong?

Was it helpful?

Solution

This seems OK, so leave it as it is:

{{block type='core/template' area='frontend' template='mailcomment/mailcomment.phtml' order=$order}}

Try changing your phtml file:

<?php if ($this->getOrder()->getCustomerGroupId() == 7): ?>
    <?php echo $this->__('Yes') ?>
<?php else: ?>
    <?php echo $this->__('No') ?>
<?php endif ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top