magentotransactional-email

Magento - Get Transactional Email Variables


I was just reading over

http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/system_email_template/index#email_variables

Anyone know how I can find these variables on my own? The wiki page says they may not actually work, and the variable I am trying to work with is {{var shippingMethod}}, however, it is returning blank.

I am wondering, one if that is the correct variable name, and two, if that is the correct variable name, what function do I need to add to my custom shipping method?

Thank you!

Jeff


Solution

  • Here's the piece of code that migiht help You:

    public function sendMail() {
        $mailTemplate = Mage::getModel('core/email_template');
        $template = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE); // template id of email template
        $email = Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT); // recipient example: example@yahoo.com
        $mailTemplate->setDesignConfig(array('area'=>'frontend'))
            ->sendTransactional(
            $template,
            Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY),
            $email,
            null,
            array(
                'subject'   => $this->getSubject(),
                'line'      => $this->getLine(),
                'message'   => $this->getMessage()
            )
        );
        $translate->setTranslateInline(true);
        return $this;
    }
    

    the array of

            array(
                'subject'   => $this->getSubject(),
                'line'      => $this->getLine(),
                'message'   => $this->getMessage()
            )
    

    can be get by {{var subject}} {{var line}} {{var message}}


    Then how to get shippingMethod ??

    You must getModel of shipping method and load the shipping method first and then set it to the array.