Zen Cart Logo
Forums / General Questions / Order status being set as zero, so orders not showing in list.

Order status being set as zero, so orders not showing in list.

Locked

Views: 869

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
14 Oct 2010, 9:38 AM
#1
refreshmentshop avatar

refreshmentshop

New Zenner

Join Date:
Oct 2008
Posts:
21
Plugin Contributions:
0

Order status being set as zero, so orders not showing in list.

When we update the status of an order in the admin, the new status gets added to the 'orders_status_history' table in the database, as it should... but a few seconds later, a second record is also added, but with an orders_status_id of 0.

It seems as though the form on admin/orders.php is being submitted again, but with no data... So a blank record is being added to the database. The problem is, orders with no status, don't appear in the Orders list in the admin. So the only way to view the order, is to open a different order, then manually change the order number in the address bar to the one that is missing.

As far as I can work out, the problem with the form being sent twice, appears to be with our local network, possibly because we have two shared broadband lines, but we haven't tracked this down yet.

But my question is; can I manually modify some files to stop Zencart from adding a record to 'orders_status_history' if the 'orders_status_id' is blank or zero?

I've had a quick look in orders.php, but the way Zencart spreads what it is doing, between loads of different functions and files, confuses the hell out of me. :dontgetit

There is an IF statement on line 95:

if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {

...which encloses the only insert query I can see on line 138.

So I'm assuming it is checking the status from the form is different from the last one on this order, before it will set it. But then if the status from the form is simply null or zero, then the record can still be added.

Am I safe to change it to something like:

if ( ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) && $status) {

...with the '&& $status' simply checking that $status (the value from the form) has a value.

I think this is right, but I just thought I would check with you guys before I break something I haven't thought about.

Cheers.

14 Oct 2010, 4:40 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Order status being set as zero, so orders not showing in list.

refreshmentshop:

When we update the status of an order in the admin, the new status gets added to the 'orders_status_history' table in the database, as it should... but a few seconds later, a second record is also added, but with an orders_status_id of 0.

It seems as though the form on admin/orders.php is being submitted again, but with no data... So a blank record is being added to the database.
I've tried several approaches to try and recreate those symptoms, and I can't.

18 Oct 2010, 2:57 PM
#3
refreshmentshop avatar

refreshmentshop

New Zenner

Join Date:
Oct 2008
Posts:
21
Plugin Contributions:
0

Re: Order status being set as zero, so orders not showing in list.

That's OK, my mod seems to have done the trick anyway, with no adverse effects.

Like I said, it seems to be a weird quirk of our network, and it is only happening when one of our staff is updating the status... I can't recreate the bug on my machine either.

It was happening on most of the orders he was updating, but after this mod, it hasn't happened at all.