Magento Email Templates

前端 未结 5 1194
我寻月下人不归
我寻月下人不归 2021-01-14 06:11

How can I set different email templates for Customer Order Confirm email and Admin copy of the same.

I need to add some extra content for the Admin email copy.

相关标签:
5条回答
  • 2021-01-14 06:25

    you can check and edit the HTML files in app > locale > en_US > templates > email

    0 讨论(0)
  • 2021-01-14 06:33

    This extension does it: http://codecanyon.net/item/send-new-order-email-to-admin/3198802

    Totally worth the $10 given all the time I wasted trying to get the other answer here working. I had just finished making my own custom module for the contact form, but the other solutions here didn't work.

    0 讨论(0)
  • 2021-01-14 06:42

    Please keep in mind that you are overruling the Sales and not the Catalog.

    So to prevent searching why the above code is not working use "sales" instead of "catalog" in the config.xml.

    0 讨论(0)
  • 2021-01-14 06:49

    I am assuming that you are currently using the "copy" feature to send the admin email. Let me know if that's not the case. Because the same email is currently being sent to multiple recipients, it would be difficult to change the content for each recipient. You could send multiple emails with a little bit of code, though, which would allow you to use a different email template for each. This could be achieved by creating a new class:

    class MyModule_Model_Sales_Order extends Mage_Sales_Model_Order {
    
        /**
         * Sending email with order data
         *
         * @return Mage_Sales_Model_Order
         */
        public function sendNewOrderEmail() {
            parent::sendNewOrderEmail();
    
            /**
             * Your admin email sending code here. Copy it out of the sendNewOrderEmail
             * function in Sales_Order.
             */
    
            return $this;
        }
    }
    

    And then telling Magento to override the core class inside your module config:

    <config>
        <global>
            <models>
                <mymodule>
                    <class>MyModule_Model</class>
                </mymodule>
                <sales>
                    <rewrite>
                        <order>MyModule_Model_Sales_Order</order>
                    </rewrite>
                </sales>
            </models>
        </global>
    </config>
    

    You'll need to create the template you want and be sure that your overridden model uses that template instead.

    0 讨论(0)
  • 2021-01-14 06:50

    Change tag catalog to sales and add namespace with class name, Eg: if namespace is Custom then add Custom_MyModule_Model and Custom_MyModule_Model_Sales_Order, so the resulting XML file would be:

    <config>
        <global>
            <models>
                <mymodule>
                    <class>Custom_MyModule_Model</class>
                </mymodule>
                <sales>
                    <rewrite>
                        <order>Custom_MyModule_Model_Sales_Order</order>
                    </rewrite>
                </sales>
            </models>
        </global>
    </config>
    
    0 讨论(0)
提交回复
热议问题