Page 1 of 1

Order Status Update from Multi Store Email

Posted: Sun Jul 22, 2012 9:56 pm
by hotvb
My case:

1. store demo (store email: main@mystore.com) - default store
2. store demo1 (store email: demo1@mystore.com)
3. store demo2 (store email: demo2@mystore.com)

when John made order from Store Demo1, he received email from demo1@mystore.com
when Alice made order from store Demo2, she received email from demo2@mystore.com

but when update order status, all notification are from main@mystore.com which is default store.

does anyone know what extension can do fix this problem, thanks in advance

*** Sales-Mail-Newsletter***
when email all customer news letter, we can choose from which store
no matter we choose which store, all the email are from default store email address
just the names are different

Re: Order Status Update from Multi Store Email

Posted: Sun Jul 22, 2012 11:56 pm
by straightlight
Good point.

A quick solution would be to edit your catalog/model/checkout/order.php file.

Find:

Code: Select all

if ($notify) {
add above:

Code: Select all

$this->load->model('setting/setting');

$store_info = $this->model_setting_setting->getSetting('config', $order_info['store_id']);
				
				if ($store_info) {
                                        $store_name = $store_info['config_name'];
					$store_address = $store_info['config_address'];
					$store_email = $store_info['config_email'];
					$store_telephone = $store_info['config_telephone'];
					$store_fax = $store_info['config_fax'];
				} else {
                                        $store_name = $this->config->get('config_name');
					$store_address = $this->config->get('config_address');
					$store_email = $this->config->get('config_email');
					$store_telephone = $this->config->get('config_telephone');
					$store_fax = $this->config->get('config_fax');
				}
Then, replace:

Code: Select all

$subject = sprintf($language->get('text_update_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_id);
with:

Code: Select all

$subject = sprintf($language->get('text_update_subject'), html_entity_decode($store_name, ENT_QUOTES, 'UTF-8'), $order_id);
Then, at the very last one in the file,

replace:

Code: Select all

$mail->setSender($order_info['store_name']);
with:

Code: Select all

$mail->setSender($store_name);
Also on the very last one:

replace:

Code: Select all

$mail->setFrom($this->config->get('config_email'));
with:

Code: Select all

$mail->setFrom($store_email);
This should do it.

Re: Order Status Update from Multi Store Email

Posted: Mon Jul 23, 2012 10:21 am
by hotvb
1. thank you very much for reply and give a solution

2. I did change by following your instruction

A: first error, after new order customer didn't receive order email
B: went back to admin back end update order status, the still from the default store email address.

3. I thought maybe need change code in root/admin/model/sale/order.php about line 683
original code: $mail->setFrom($this->config->get('config_email'));
replace by code: $mail->setFrom($store_email);
didn't get work, got error message when update order status

error message:
Notice: Undefined variable: store_email in ***/httpdocs/vqmod/vqcache/vq2-admin_model_sale_order.php on line 722
Notice: Error: E-Mail from required! in ***/httpdocs/system/library/mail.php on line 56

4. should I change any code in admin section to make it work, thanks

Re: Order Status Update from Multi Store Email

Posted: Mon Jul 23, 2012 8:43 pm
by straightlight
As stated from my previous post, these modifications are for the store-front end, not for the admin end. Although, since you're using a contribution or multiple contributions that involves the admin/model/sale/order.php file to be used from VQMod, you'll need to post your XML as an attachment so for me to see how this could be integrated in your case in order to avoid errorneous.

Re: Order Status Update from Multi Store Email

Posted: Mon Jul 23, 2012 10:48 pm
by hotvb
straightlight wrote:As stated from my previous post, these modifications are for the store-front end, not for the admin end. Although, since you're using a contribution or multiple contributions that involves the admin/model/sale/order.php file to be used from VQMod, you'll need to post your XML as an attachment so for me to see how this could be integrated in your case in order to avoid errorneous.
I found problem for the email
extension has been installed
1. multivendordropshipper
2. emailtemplate-4.1.11
because installed emailtemplate-4.1.11 caused email didn't go to customer and vender email.

that wasn't code problem

sorry for didn't mention correctly, it wasn't for front end, it is for the admin end
from admin end update order status and newsletter
email address are all from the default store email address
the front end is from the each store email address, there's no problem with OC original file

Should I make change to admin/model/sale/order.php, thanks again and sorry for the confusing.

Re: Order Status Update from Multi Store Email

Posted: Mon Jul 23, 2012 10:52 pm
by straightlight
Yes. However, you will need to make the changes where the email only implies from that specific method in admin/model/sale/order.php file.

Re: Order Status Update from Multi Store Email

Posted: Mon Jul 23, 2012 11:09 pm
by hotvb
I tried to change code admin/model/sale/order.php
under: [ function addOrderHistory] section
original code:
$mail->setFrom($this->config->get('config_email'));
replace with: $mail->setFrom($store_email);

didn't work, got error message:
Notice: Error: E-Mail from required! in ********/httpdocs/system/library/mail.php on line 56

is there any right way to change it to make from the 2nd store email address instead of the default? thanks

Re: Order Status Update from Multi Store Email

Posted: Mon Jul 23, 2012 11:28 pm
by straightlight
Just changing this line won't be sufficient, of course. You need to apply all steps from my previous post.

Re: Order Status Update from Multi Store Email

Posted: Tue Jul 24, 2012 12:53 am
by hotvb
admin/model/sale/order.php is different as catalog/model/checkout/order.php
I can't find those code to be replaced

Professional HTML Email Template & Editor for Opencart Email
http://www.opencart.com/index.php?route ... on_id=2221
they upgrade to LATEST: Email template: 4.1.12
which mention
Changelog

Version 4.1.12

Added: option to display Order picture in Customer Order emails.

Added: header text, for added small text above the header.

Fixed bug in Order Status History and Newsletter with a multi-store setup ensure that the email is sent From the correct store email.-------------but this one still no success

Re: Order Status Update from Multi Store Email

Posted: Tue Jul 24, 2012 1:02 am
by straightlight
Since this request is about a specific contribution from the market, please contact the author.

Re: Order Status Update from Multi Store Email

Posted: Thu Jul 26, 2012 2:49 pm
by hotvb
straightlight wrote:Since this request is about a specific contribution from the market, please contact the author.
it is on the market, still need something to figure out, such as mail function, default store has mail setting tab, any additional store won't have a mail tab, also default OC 1.5.3.1 smtp is not working if using google apps.

Re: Order Status Update from Multi Store Email

Posted: Sat Feb 16, 2013 4:19 am
by mediaindustries
Hi Straightlight,

I have exactly the same problem as topicstarter. I followed the instructions you gave in your first post. Found al the lines and replaced them or added lines etc. Did everything and uploaded the file.

I just tested it but it doens't work for me. I ordered and the order e-mail is okay (it already was okay) but the notification email is still from info@maindomain.com where the main store is installed.

I'm running a multistore setup with opencart 1.5.4.1. I don't use any vqmod modifications for e-mail updates or something. I attached my order.php file from catalog/model/checkout.

Thanks in advance!

Re: Order Status Update from Multi Store Email

Posted: Tue Mar 05, 2013 6:16 am
by opencart-templates
The other suggestion would never work because you need to edit the actual admin files.
You need to find the store_id from the order in the database, so that the store email address settings can be found.

You can do this by editing the: admin/model/sale/order.php
Adding:

Code: Select all

$store_settings = $this->model_setting_setting->getSetting("config", $order_info['store_id']);
$mail->setFrom($store_settings['config_email']);
Our extension fixes this issue, voucher, inserting new customer and many more as default.
hotvb wrote:admin/model/sale/order.php is different as catalog/model/checkout/order.php
I can't find those code to be replaced

Professional HTML Email Template & Editor for Opencart Email
http://www.opencart.com/index.php?route ... on_id=2221
they upgrade to LATEST: Email template: 4.1.12
which mention
Changelog

Version 4.1.12

Added: option to display Order picture in Customer Order emails.

Added: header text, for added small text above the header.

Fixed bug in Order Status History and Newsletter with a multi-store setup ensure that the email is sent From the correct store email.-------------but this one still no success

Re: Order Status Update from Multi Store Email

Posted: Tue Mar 05, 2013 5:35 pm
by mediaindustries
Hi opencart-templates,

I tried your solution (in combination with the straightlight solution for the front-end) but it didn't work for me.

Can you release a vqmod solution which only fixes this?
Fixed bug in Order Status History and Newsletter with a multi-store setup ensure that the email is sent From the correct store email.

I don't need the pdf invoice etcetera. No problem to pay for it.

Thanks in advance.

Re: Order Status Update from Multi Store Email

Posted: Sat Dec 28, 2013 10:37 am
by Cue4cheap
Edited.... Found a basic solution but not 100%. I may release it as a VQmod if I get things worked out.
Thanks.
Mike

Re: Order Status Update from Multi Store Email

Posted: Mon May 28, 2018 1:45 am
by guidone
Same problem after all these years, i'm on OC 2.2, any solution?