发送特定数量产品的确认电子邮件副本(Magento)

时间:2021-03-04 01:02:05

I'm building a webshop with just 2 simple products. (ID 1 and ID 2)

我正在建立一个只有2个简单产品的网上商店。 (ID 1和ID 2)

When a customer does a purchase, he receives a confirmation email with order info. Also, the store where he wants to pick up the products receives an email with order info.

当客户进行购买时,他会收到包含订单信息的确认电子邮件。此外,他想要提取产品的商店会收到一封包含订单信息的电子邮件。

Now I want to build in an extra function: An extra email with order info needs to be send to my email when a customer purchases ten or more of product with ID 1 or one or more of product with ID 2.

现在我想建立一个额外的功能:当客户购买十个或更多ID为1的产品或一个或多个ID为2的产品时,需要将包含订单信息的额外电子邮件发送到我的电子邮箱。

I am completely new to Magento and where to find the correct files to customize. So I hope someone can help me getting this to work! :)

我是Magento的新手,在哪里可以找到要自定义的正确文件。所以我希望有人可以帮助我实现这个目标! :)

1 个解决方案

#1


0  

You will need to use an observer for this

您需要使用观察者

/app/etc/modules/Yournamaspace_Orderhook.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Yournamaspace_Orderhook>
            <active>true</active>
            <codePool>community</codePool>
        </Yournamaspace_Orderhook>
    </modules>
</config>

/app/code/community/Yournamaspace/Orderhook/etc/config.xml

 <?xml version="1.0"?>
<config>
    <modules>
        <Yournamaspace_Orderhook>
            <version>1.0</version>
        </Yournamaspace_Orderhook>
    </modules>

<global>

    <models>           
        <orderhook>
            <class>Yournamaspace_Orderhook_Model</class>
        </orderhook>
    </models>

    <events>
        <sales_order_place_after>
            <observers>
                <auto_email_order>
                    <type>singleton</type>
                    <class>orderhook/observer</class>
                    <method>implementOrderEmail</method>
                </auto_email_order>
            </observers>
        </sales_order_place_after>
    </events>

</global>

Create observer file

创建观察者文件

app/code/community/Yournamaspace/Orderhook/Model/Observer.php

class Yournamaspace_Orderhook_Model_Observer
{
    public function implementOrderStatus($event)
    {

     // implement your code here for email order to speacific email address with your template
        $order = $event->getOrder();


        return $this;
    }

   }

hope this will sure help you.

希望这一定会对你有所帮助。

#1


0  

You will need to use an observer for this

您需要使用观察者

/app/etc/modules/Yournamaspace_Orderhook.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Yournamaspace_Orderhook>
            <active>true</active>
            <codePool>community</codePool>
        </Yournamaspace_Orderhook>
    </modules>
</config>

/app/code/community/Yournamaspace/Orderhook/etc/config.xml

 <?xml version="1.0"?>
<config>
    <modules>
        <Yournamaspace_Orderhook>
            <version>1.0</version>
        </Yournamaspace_Orderhook>
    </modules>

<global>

    <models>           
        <orderhook>
            <class>Yournamaspace_Orderhook_Model</class>
        </orderhook>
    </models>

    <events>
        <sales_order_place_after>
            <observers>
                <auto_email_order>
                    <type>singleton</type>
                    <class>orderhook/observer</class>
                    <method>implementOrderEmail</method>
                </auto_email_order>
            </observers>
        </sales_order_place_after>
    </events>

</global>

Create observer file

创建观察者文件

app/code/community/Yournamaspace/Orderhook/Model/Observer.php

class Yournamaspace_Orderhook_Model_Observer
{
    public function implementOrderStatus($event)
    {

     // implement your code here for email order to speacific email address with your template
        $order = $event->getOrder();


        return $this;
    }

   }

hope this will sure help you.

希望这一定会对你有所帮助。