php - Magento custom email template date format -


i want format date , time directly in e-mail template in shipping email estimate shipping date.

i tried way:

{{var order.getshippingarrivaldate() format="y-m-d"}}

and way

{{var order.getshippingarrivaldate()|formatdatetime: y-m-d}}

even tried way

{{var date("d-m-y",strtotime(order.getshippingarrivaldate()|formatdatetime: y-m-d))}}

but both ways not working. there possibility format date/time directly in email template?

magento's email template processor pretty basic , has few helper functions, none of format dates. instead of formatting date in template, format in class sends emails , pass formatted value parameter template.

alternatively, add formatting method within order class (you'll need rewrite order model so):

public function getshippingarrivaldateformatted ($format) {     return mage::helper('core')->formatdate($this->getshippingarrivaldate(), $format, true); } 

and reference within email template:

<!--@vars {"var order.getshippingarrivaldateformatted('short')":"arrival date"} @-->          ... <p>arriving on {{var order.getshippingarrivaldateformatted('short')}}</p> 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -