Post by london20093 » Tue May 05, 2020 6:28 pm

v3.0.3.2

catelog/controller/mail/order.php

line 28 to 41,

Code: Select all

// We need to grab the old order status ID
		$order_info = $this->model_checkout_order->getOrder($order_id);

		if ($order_info) {
			// If order status is 0 then becomes greater than 0 send main html email
			if (!$order_info['order_status_id'] && $order_status_id) { //echo $order_info;
				$this->add($order_info, $order_status_id, $comment, $notify);
			}

			// If order status is not 0 then send update text email
			if ($order_info['order_status_id'] && $order_status_id && $notify) {
				$this->edit($order_info, $order_status_id, $comment, $notify);
			}
		}
$order_info['order_status_id'] value got from getOrder($order_id) funtion is alway '0', so the second case of sending update text email never happened, what ever it was a new order or old order.

Anyone can help me with this?

Many thanks,
Last edited by london20093 on Tue May 05, 2020 7:56 pm, edited 3 times in total.

Newbie

Posts

Joined
Wed Apr 24, 2019 10:08 pm

Post by OSWorX » Tue May 05, 2020 7:34 pm

london20093 wrote:
Tue May 05, 2020 6:28 pm
$order_info['order_status_id'] value got from getOrder($order_id) funtion is alway '0', so the second case of sending update text email never happened, what ever it was a new order or old order.
If the order _status_id is "always" 0, then you had not set the status correct.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by london20093 » Tue May 05, 2020 7:44 pm

but in the database I can see in the order table, the order status is not '0'. very strange.
my situation is all order status are fine in both front page and admin page, just the order update email is always the greeting email (normally for new orders)

Newbie

Posts

Joined
Wed Apr 24, 2019 10:08 pm

Post by straightlight » Tue May 05, 2020 7:58 pm

What are your order statuses configuration settings from your payment extension modules and from your OC admin > systems > settings > edit settings page? Have you tested an order from the admin > sales > orders page prior to checkout? What is the first order status name showing in your order when testing with the API?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by london20093 » Tue May 05, 2020 8:51 pm

Thanks for your reply!

my order statuses configuration settings from my payment extension modules 'pending'
from my OC admin > systems > settings > edit settings page > order status 'processing'

I have tested to place an new order via admin panel,
the first order status name showing in the new order when testing with the API is 'processing' (as this is the default one and I did not change it when I placed the order), new order placed (greeting) email was sent successfully.
But when I changed the order status via admin, the update email customer got is the same template as greeting email (in the email order status changed correctly), instead of update email template.

Newbie

Posts

Joined
Wed Apr 24, 2019 10:08 pm

Post by straightlight » Tue May 05, 2020 9:10 pm

But when I changed the order status via admin
Changed to which order status?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by london20093 » Tue May 05, 2020 9:36 pm

whatever status, shipped, processed, etc.
order status can always be changed correctly. just incorrect email template.

also, I did some tests, as the 'getOrder' function is from catalog/model/checkout/order.php, I believe, I can see the order status changed from non zero to zero and then changed to non-zero, totally 6 times, during the function getOrder($order_id) was called.

Newbie

Posts

Joined
Wed Apr 24, 2019 10:08 pm

Post by straightlight » Tue May 05, 2020 9:51 pm

totally 6 times, during the function getOrder($order_id) was called.
That is normal. The admin API will always pull the order ID you are requesting about when editing an order.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by london20093 » Tue May 05, 2020 10:16 pm

for example, status_id for 'shipped' is 5, I can see when I modified the order status, it changed as following in the database, 5 5 0 0 0 5 5, why in the catalog/controller/mail/order.php, it only got the value of '0', instead of '5' ? No idea.

Newbie

Posts

Joined
Wed Apr 24, 2019 10:08 pm

Post by straightlight » Tue May 05, 2020 11:05 pm

By switching the order to cancelled and submit. Then, set to processing and submit, both, from the admin > sales > orders page. Are you, then, able to receive the edit / alert email with the new order status change?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by torx » Thu May 13, 2021 1:07 am

Curious if this ever got resolved. I'm running OC 3.0.3.7 and when I change a customer's order from processing to shipped, the customer receives an email that makes it looks like they've placed an order again. Seems like they should be receiving an order update email that says something like, "Your order status has changed from "processing" to "shipped". Has anyone figured out a resolution to this issue?

Newbie

Posts

Joined
Fri Aug 23, 2013 10:25 pm

Post by straightlight » Thu May 13, 2021 1:51 am

torx wrote:
Thu May 13, 2021 1:07 am
Curious if this ever got resolved. I'm running OC 3.0.3.7 and when I change a customer's order from processing to shipped, the customer receives an email that makes it looks like they've placed an order again. Seems like they should be receiving an order update email that says something like, "Your order status has changed from "processing" to "shipped". Has anyone figured out a resolution to this issue?
OC version.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Bjulk » Tue Apr 12, 2022 6:36 pm

OpenCart 3.0.3.8

Dear all, I also experience the issue that a "new order" ("greeting") e-mail is sent upon changing the order status in the Admin.
Like torx I'm curious about the status of the issue.
I tested first cancelling the order before completing it in the Admin (requested by straitlight in 2020), but this doesn't change anything as far as I can see.
I also tested disabling all "Events" in the Admin, also with no effect.

Thanks for any information!

Newbie

Posts

Joined
Tue Apr 12, 2022 6:00 pm

Post by ADD Creative » Wed Apr 13, 2022 5:49 pm

Bjulk wrote:
Tue Apr 12, 2022 6:36 pm
OpenCart 3.0.3.8

Dear all, I also experience the issue that a "new order" ("greeting") e-mail is sent upon changing the order status in the Admin.
Like torx I'm curious about the status of the issue.
I tested first cancelling the order before completing it in the Admin (requested by straitlight in 2020), but this doesn't change anything as far as I can see.
I also tested disabling all "Events" in the Admin, also with no effect.

Thanks for any information!
What theme and extensions are you using? What is the order_status_id for an order set to in the order database table before you change the status?

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Bjulk » Thu Apr 14, 2022 10:37 pm

Thanks for your reply, ADD Creative!

To answer your questions:

What theme and extensions are you using?
→Theme: Default store theme
→Extensions: I only list below the extensions that are installed + enabled, and omit the extensions that are installed but not enabled. In summary, apart from the GDPR-extension from iSenseLabs, I think I only use “native” extensions.
Dashboard: Recent Activity; Sales Analytics; Total Customers; World Map; People Online; Total Orders; Latest Orders; Total Sales
Modules: Account; Banner|Banner 1; Category; Featured|Home page; GDPR compliance iSenseLab; Slideshow|Homepage;
Payments: Bank transfer
Reports: Customer Activity Report, Customer Orders Report, Customer Reward Points Report, Customer Searches Report, Customer Transaction Report, Marketing Report, Products Purchased Report, Products Viewed Report, Coupons Report, Sales Report, Returns Report, Shipping Report, Tax Report
Shipping: Flat rate
Themes: Default store theme
Order totals: Coupon; Store Credit; Reward Points; Shipping; Sub-Total; Taxes; Total; Gift Voucher


What is the order_status_id for an order set to in the order database table before you change the status?

I made a dummy order. The order_status_id = 1.

Many thanks for your help. Should anything in my replies be unclear, please let me know.

Kind regards, Bjulk

Newbie

Posts

Joined
Tue Apr 12, 2022 6:00 pm

Post by sw!tch » Fri Apr 15, 2022 4:16 am

Are you editing the order in the admin or updating the order status from the admin order info page?

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by Bjulk » Fri Apr 15, 2022 4:13 pm

Hello switch,
Thanks for your reply!

I modify the order status by logging in at the Admin and then clicking Sales -> Order. So, the URL contains the following route:

"/index.php?route=sale/order&user_token= "

Subsequently I edit the order and modify the status in the tab "5. Totals". The route reads:

"index.php?route=sale/order/edit&user_token="

I hope this answers your question?

Important note: after my yesterdays reply to ADD Creative (Thu Apr 14, 2022) it occurred to me that I left out a detail. I changed texts in the strings in many text files in order to make the communication with customers suitable for my delivery process. As I only changed text, carefully not deleting any "%s", I assumed that this would not change the functionality of the shop. However, one could still argue that this is an extension, so I think it should be mentioned.
Sorry if this causes inconvience.

Again, thanks for the help.

Best regards,
Bjulk

Newbie

Posts

Joined
Tue Apr 12, 2022 6:00 pm

Post by straightlight » Fri Apr 15, 2022 9:35 pm

Bjulk wrote:
Fri Apr 15, 2022 4:13 pm
Hello switch,
Thanks for your reply!

I modify the order status by logging in at the Admin and then clicking Sales -> Order. So, the URL contains the following route:

"/index.php?route=sale/order&user_token= "

Subsequently I edit the order and modify the status in the tab "5. Totals". The route reads:

"index.php?route=sale/order/edit&user_token="

I hope this answers your question?

Important note: after my yesterdays reply to ADD Creative (Thu Apr 14, 2022) it occurred to me that I left out a detail. I changed texts in the strings in many text files in order to make the communication with customers suitable for my delivery process. As I only changed text, carefully not deleting any "%s", I assumed that this would not change the functionality of the shop. However, one could still argue that this is an extension, so I think it should be mentioned.
Sorry if this causes inconvience.

Again, thanks for the help.

Best regards,
Bjulk
Please post these changes. It's possible that something went wrong during the change or one-to-many of them may require reference to already reported patches.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Bjulk » Fri Apr 22, 2022 3:59 pm

Dear straightlight,
Many thanks for your suggestion. After "mentally digesting" it and also reviewing the earlier discussion I ventured on some tests, which I summarize below.

Test 1: for a dummy order, change the status repeatedly in the admin (try many statusses) and track the status in the database.
Results: the status changes in the database as expected. At each status change the "greeting" e-mail is sent to both customer and shop owner e-mail.

Test 2a: modify table "oc_events.sql" record 21 field action --> empty this field. Change the status of a dummy order, see what happens with the e-mails.
Result: no order ("greeting") e-mails are sent to the customer e-mailaddress, but e-mails are still sent to the store owner.

Test 2b: same as 2a, but first register a new customer and place the order with the newly registered customer.
Result: a registration e-mail is sent to the customer, but no order ("greeting") e-mails to the customer. The mails to the store owner are still sent.

Based on the result of test 2a/2b I took this change in production. If I run into some trouble, I will post my experiences. Test 2a/2b occurred to me after I noted that record 21 and 22 in oc_events.sql are more or less similar (same trigger, but different action, this seemed a little bit strange to me). I'm well aware that my "solution" is not correct, but for the time being the workaround suffices.

Thanks to all contributors for your attention,

Best regards,

Bjulk

Newbie

Posts

Joined
Tue Apr 12, 2022 6:00 pm
Who is online

Users browsing this forum: No registered users and 33 guests