How to change the Magento Email Templates

by 曾经沧海
442 阅读

You’ll probably know by now that the transactional email templates in Magento are a bit, with respect, “naff”. To edit through the admin will take forever and a day so here’s a couple of useful solutions to help make things easier.

1. Locate the email templates

The Magento email templates are located in (note: “en_US” may change depending on language).

magento\app\locale\en_US\template\email\account_new.html”(24,48):
magento\app\locale\en_US\template\email\admin_password_new.html”(27,73):
magento\app\locale\en_US\template\email\newsletter_subscr_confirm.html”(28,69):
magento\app\locale\en_US\template\email\order_creditmemo.html”(23,63):
magento\app\locale\en_US\template\email\order_creditmemo.html”(75,62):
magento\app\locale\en_US\template\email\order_invoice.html”(23,63):
magento\app\locale\en_US\template\email\order_invoice.html”(75,62):
magento\app\locale\en_US\template\email\order_new.html”(23,63):
magento\app\locale\en_US\template\email\order_new.html”(79,62):
magento\app\locale\en_US\template\email\order_shipment.html”(23,63):
magento\app\locale\en_US\template\email\order_shipment.html”(81,62):
magento\app\locale\en_US\template\email\order_update.html”(26,52):
magento\app\locale\en_US\template\email\password_new.html”(24,41):
magento\app\locale\en_US\template\email\wishlist_share.html”(23,65):

2. Edit your information in

replace alt=”Magento” with alt=”your store name”

replace Magento Demo Store with your store name

replace mailto:magento@varien.com with mailto:email@yourstore.com

replace dummyemail@magentocommerce.com with email@yourstore.com

replace (800) DEMO-STORE with (0800) YOUR STORE NUMBER

replace Monday – Friday, 8am – 5pm PST with your own store opening times and timezone

3. Advanced – Automated Shell Script

Another option would be to create a shell script with all you’re information in which goes through the directories in question and replaces text as we need. Note: You will need your Store View Name and Store Name to match your domain name.

#!/bin/sh
phone=(123)456-7890

find app/locale/en_US/template/email/sales -type f -exec sed -i ’s/alt=”Magento”/alt=”{{var order.getStoreGroupName()}}”/g’ {} \;
find app/locale/en_US/template/email/sales -type f -exec sed -i ’s/Magento Demo Store/{{var order.getStoreGroupName()}} /g’ {} \;
find app/locale/en_US/template/email/sales -type f -exec sed -i ’s/mailto:magento@varien.com/sales@{{var order.getStoreGroupName()}}/g’ {} \;
find app/locale/en_US/template/email/sales -type f -exec sed -i ’s/dummyemail@magentocommerce.com/sales@{{var order.getStoreGroupName()}}/g’ {} \;

find app/locale/en_US/template/email -type f -exec sed -i ’s/alt=”Magento”/alt=”{{var customer.store.name}}”/g’ {} \;
find app/locale/en_US/template/email -type f -exec sed -i ’s/Magento Demo Store/{{var customer.store.name}} /g’ {} \;
find app/locale/en_US/template/email -type f -exec sed -i ’s/mailto:magento@varien.com/sales@{{var customer.store.name}}/g’ {} \;
find app/locale/en_US/template/email -type f -exec sed -i ’s/dummyemail@magentocommerce.com/sales@{{var customer.store.name}}/g’ {} \;

find app/locale/en_US/template/email -type f -exec sed -i “s/(800)DEMO-STORE/$phone/g” {} \;
find app/locale/en_US/template/email -type f -exec sed -i “s/(800)DEMO-NUMBER/$phone/g” {} \;
find app/locale/en_US/template/email -type f -exec sed -i “s/(800) DEMO-NUMBER/$phone/g” {} \;
find app/locale/en_US/template/email -type f -exec sed -i “s/(800) DEMO-STORE/$phone/g” {} \;
find app/locale/en_US/template/email -type f -exec sed -i ’s/Monday – Friday, 8am – 5pm PST/24×7/g’ {} \;
find app/locale/en_US/template/email -type f -exec sed -i ’s/logo_email.gif/logo.gif/g’ {} \;

发表评论