Forums / General Questions / sold out products do not come back online after order deletion

sold out products do not come back online after order deletion

Locked

Started by edadk on 18 Oct 2010, 2:46 PM · Views: 1,203

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
18 Oct 2010, 2:46 PM
#1
edadk avatar

edadk

Zen Follower

Join Date:
Nov 2008
Posts:
191
Plugin Contributions:
0

sold out products do not come back online after order deletion

Hi,

Here is the scenario -

Customer places order for the last piece of stock. Item goes out of stock with zero quantity and goes offline (red-lighted).

Later, order is canceled so I delete the order using the "restock product" checkbox.

For all items, including items that were out of stock, stock level increases back to previous level. But products that were at zero stock level and offline due to sold-out status remain red-lighted/offline.

The end result is that I have items that are in stock but offline.

I'm running 1.39g but I don't think this is new to this version.

thanks,

Ed

18 Oct 2010, 3:45 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: sold out products do not come back online after order deletion

You would need to customize the code to reset the products_status to 1 when an Order is deleted and the stock is updated to > 0 ...

The other option is to set your Stock Settings to just mark products as Sold Out and leave the products_status set to 1 when products are out of stock and then, when the stock is > 0 it will automatically switch back to available ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Oct 2010, 4:04 PM
#3
edadk avatar

edadk

Zen Follower

Join Date:
Nov 2008
Posts:
191
Plugin Contributions:
0

Re: sold out products do not come back online after order deletion

Hi and thank you for the reply.

Thanks for the suggestions but our store is not set up like that. We don't want to show items to customers that they cannot buy, it only frustrates them.

This used to work the way I need it to in OSC, I will look over the old code and see if I can figure out how to get the items back online without messing things up.

But it does seem like an item that goes out of stock from an order that is subsequently deleted should come back online when the order is gone since the product is indeed available again (notwithstanding that fact that orders shouldn't really be deleted to begin with).

thanks again,

Ed

Ajeh:

You would need to customize the code to reset the products_status to 1 when an Order is deleted and the stock is updated to > 0 ...

The other option is to set your Stock Settings to just mark products as Sold Out and leave the products_status set to 1 when products are out of stock and then, when the stock is > 0 it will automatically switch back to available ...

18 Oct 2010, 4:32 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: sold out products do not come back online after order deletion

In the function file general.php for the Admin is:
function zen_remove_order($order_id, $restock = false) {

You could customize the update to the products table based on the total quantity ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Oct 2010, 4:55 PM
#5
edadk avatar

edadk

Zen Follower

Join Date:
Nov 2008
Posts:
191
Plugin Contributions:
0

Re: sold out products do not come back online after order deletion

Ok, on my test site I have added this code to the function:

$db->Execute("update " . TABLE_PRODUCTS . " set products_status = 1 where products_quantity > 0 and products_id = '" . (int)$order->fields['products_id'] . "'");

I added that in the WHILE loop between the table_products update statement and the order->movenext() statement.

I'll be testing it for a while to see if there are any side effects, but on first test it seems to be ok.

Do you notice any obvious mistakes?

thanks,

Ed

18 Oct 2010, 5:08 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: sold out products do not come back online after order deletion

Not off the top of my head ... but let us know how this works for you ...

Personally, I would have a testing directory of my site that is a copy of my Live site and a test database that I can copy and overwrite with a copy of my Live Site so that I can test things like this ...

It is always a good idea to know what will happen, before the customer does ... :lamo:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Oct 2010, 5:42 PM
#7
edadk avatar

edadk

Zen Follower

Join Date:
Nov 2008
Posts:
191
Plugin Contributions:
0

Re: sold out products do not come back online after order deletion

Thanks for the warning. Yes, it's on my dev site, not live. I'll wait a while to see if there are any side effects before trying it on the production site.

thanks for all the help,

Ed