0

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?

6
  • $this->getData('order') is given result?
    – Amit Bera
    Commented Jan 21, 2015 at 11:05
  • I used an example for getting the payment method: $paymentmethod = $this->getData('order')->getPayment()->getMethodInstance()->getCode(); This works just fine. Commented Jan 21, 2015 at 11:09
  • And this info i was trying to use: magento.stackexchange.com/questions/19015/… Commented Jan 21, 2015 at 11:13
  • are you tried this thing $paymentmethod = $this->getData('order')->getPayment()->getMethodInstance()->getCode(); on mailcomment/mailcomment.phtml file?
    – Amit Bera
    Commented Jan 21, 2015 at 11:19
  • Yes but that gets the paymentmethod in the variabel $customergroup. I would like this variable to contain the customergroupid. Commented Jan 21, 2015 at 11:43

1 Answer 1

0

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 ?>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.