开发者

Magento - how to hide the time in the transctional Emails

开发者 https://www.devze.com 2023-04-04 11:20 出处:网络
I\'m searching how to hide the time and show only the date in the \"new order\" email: I have seen that it\'s generated with this code :

I'm searching how to hide the time and show only the date in the "new order" email:

I have seen that it's generated with this code :

({{var order.getCreatedAtFormated(''long'')}})

but I don't find a solution how to show only the d开发者_JS百科ate.

Thanks for help.


Supported formatting types are: long, medium , full, short

thanks for the comment:

HOW SHOULD I HELP MYSELF FINDING THIS OUT

first thing if you don't know how to interact wit method search for it in codebase as this reveals in what file the method is defined and you can see what parameters it takes in and how it processes the parameters

grep ' getCreatedAtFormated' app/code/ -rsn
app/code/core/Mage/Sales/Model/Order.php:1988:    public function getCreatedAtFormated($format)

ok, now we found that file , open up and see the line 1988 has the method

/**
 * Get formated order created date in store timezone
 *
 * @param   string $format date format type (short|medium|long|full)
 * @return  string
 */
public function getCreatedAtFormated($format)
{
    return Mage::helper('core')->formatDate($this->getCreatedAtStoreDate(), $format, true);
}

cool now you see it is actually using core helper's formatDate method. Go ahead open up that file

app/code/core/Mage/Core/Helper/Data.php:135:    public function formatDate($date=null, $format='short', $showTime=false)

you can see from grep that it takes in third parameter that you can't pass to that method as it wraps this with forced in value.

So your solution is to use the helper and get the variable order.getCreatedAtStoreDate() and pass it to helpers formatting method

0

精彩评论

暂无评论...
验证码 换一张
取 消