0

I want to have the following function in my store, I have two payments methods: CC and Bank Transfer Payment

  1. if the CC method was used, after the order was placed I need to send one email to the vendor company with product name and quantity. For vendor we can use a attribute that will contain email for each vendor in part.

    1. If Bank Transfer Payment was used, then we need to have a button in the back-end in order to can start the same action but manually.

How I can do something like this? Someone can point me in the correct direction?

1

I will not give you full code, But I will guide you step by step

Use this event in this event you will get all data related to order

sales_order_place_after

Here is the example of code how to use this event

Not triggering sales_order_place_after observer

Get order item from order and from order item load product and get supplier data from your product

you can use this thread for this

Get item from order id

you don't have to load $order you already have that in event.

Write code to send email here is the code how to write code to send email

How to send email using magento

  • thank you I have a idea too, but I need some code here if you can help will be perfect, thank you – Robert Oct 12 '17 at 13:00
  • from above three point, which code you want from my side – Murtuza Zabuawala Oct 12 '17 at 13:01
  • tell me again please, I don't understand very well – Robert Oct 12 '17 at 13:17
  • I have given three steps in my answer create event, get product data, and send email, for what you want code from the above – Murtuza Zabuawala Oct 12 '17 at 13:22
  • for example what I can do to check if the payment method is CC, how I can check if the product contain nokia for example attribute and if yes then select it and send email, how I can add the backend button in the orders if the payment method is Bank Transfer Payment – Robert Oct 12 '17 at 13:46

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.