2

I have created a custom field when submitting an order called: Delivery Date.

I want to display this in my transactional e-mail that is being sent after placing the order.

When i code it like this:

"var order.getCreatedAtFormated('long')":"Order Created At (datetime)",
"var order.getDeliveryDate()":"Delivery Date",

It will display the delivery date like 2015/03/31

the Order Created At, will display it like: 31/03/2015.

I have tried adding 'long' but that doesn't work. How can i format this custom date like the created at date?

1

You need to extend Mage_Sales_Model_Order and add your own custom method like the one for getCreatedAtFormated(). I am assuming you can create an extension or look up how to do that, your new method should look something like this:

class My_Sales_Model_Order extends Mage_Sales_Model_Order
{
    public function getDeliveryDateFormated($format)
    {
        return Mage::helper('core')->formatDate($this->getDeliveryDate(), $format, true);
    }
}

You can then call it in your template just like the other one:

var order.getDeliveryDateFormated('long')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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