0

I want to sent one email when we adding new product & another different email when we editing present product?

1 Answer 1

0

Try this,

config.xml

Add your template here

app\locale\en_US\template\email\templatename.html



 <events>
    <catalog_product_save_after>
                <observers>
                    <yourmodule>
                        <type>singleton</type>
                        <class>yourmodule/observer</class>
                        <method>catalog_product_save_after</method>
                    </yourmodule>
                </observers>
            </catalog_product_save_after>
        </events>
 <template>
        <email>
            <my_custom_template module="module">
                <label>template name</label>
                <file>templatename.html</file>
                <type>html</type>
            </my_custom_template>

        </email>
    </template>

Observer.php

class YourNamespace_YourModule_Model_Observer
{
public function catalog_product_save_after($observer)
    {
        $product = $observer->getProduct();
        // Your mail code
    }
7
  • How to know new product action or edit product action
    – Vishal
    Nov 18, 2016 at 5:22
  • Before send mail you need to check this product id it's available or not in Database
    – Magento 2
    Nov 18, 2016 at 6:36
  • product id shows both action or do you know how check this condition code?
    – Vishal
    Nov 18, 2016 at 6:48
  • simple if product id is available that's edit product else it's new product
    – Magento 2
    Nov 18, 2016 at 6:53
  • First check this code you get mail or not after save product
    – Magento 2
    Nov 18, 2016 at 6:55

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.