Page 1 of 1

Delayed inventory update causing overselling

Posted: Wed Jun 07, 2017 5:45 am
by misdirekted
Hi! We have a cart running 2.0.3.1 that gets a fair amount of traffic and we recently have had instances of a temporary mismatch between the store inventory numbers and the number of items actually sold, causing us to oversell items that we do not have stock for. When we realized what was happening, we quickly modified stock to 0, so that the store wouldn't allow customers to add to cart. This lasted for a day or two before it updated to reflect the correct amount sold. ex -60 quantity.

Meanwhile, the numbers in the products purchased reports were accurately tracking the actual number of items sold, so the store was still recording the sales, but the inventory was not updating.

When we try to replicate the issue, the inventory updates instantly. ???

Does anybody know how this might happen? Thank you very much!

Re: Delayed inventory update causing overselling

Posted: Wed Jun 07, 2017 7:19 am
by IP_CAM
it would only last for a day, if you would NOT reset/clear the OcMod Cache,
every single time, after doing 'anything' in/from the Admin Section. And at best,
clear out VqMod/VqCache/... as well, if you have such installed.
Ernie

Re: Delayed inventory update causing overselling

Posted: Wed Jun 07, 2017 7:58 am
by misdirekted
IP_CAM wrote:
Wed Jun 07, 2017 7:19 am
it would only last for a day, if you would NOT reset/clear the OcMod Cache,
every single time, after doing 'anything' in/from the Admin Section. And at best,
clear out VqMod/VqCache/... as well, if you have such installed.
Ernie
Iiiiiinteresting! I will try that and see if we have any other problems like this in the future. What is the reasoning for this?

Re: Delayed inventory update causing overselling

Posted: Wed Jun 07, 2017 10:21 am
by IP_CAM
OcMod caches Files, constructed out of OC default Source Files, combined with
OcMod Extension contained Add/Change/Replace Content. Such a CACHED File is then
used INSTEAD of it's Original default SOURCE-File, to be Part of the final OUTPUT-Data,
requested/sent from/to the Visitor-Browser.

Those Files are then usually stored/cached/called/seen, until modified again, by some other
extension, or by removal of an existing extension, having some effect on such a File.

But if you modify some Data or File, somewhere, it does not automatically make OC 'realize'
this new FACT, and so act accordingly, but it still presents outdated VALUES, until an OcMod
Reset/Refresh has been made.
OcModded Cache Files are placed in the: system/storage/modification/... Subdirectory,
and placed in subdirectories, named like their native Source Files.
And strictly technically, such files could replace default source, and then no longer require OcMod,
to function as they do with/by OcMod! :D

And everything in this modification/..Subdirectory, exept for the index.php, could eventually be deleted
manually, to clean out this section for sure, and in full, from time to time, and to avoid keeping failed Installs
and other crab for no good reason at all. It all will be rebuilt again, whatever is required. ;)

And since VqMod comes AFTER OcMod, the same thing may happen to VqCache'd FILES as well,
therefore, the VqCache/... always needs to be cleared out as well, to make sure, it's all GO again. :laugh:

Good Luck!
Ernie
PS. Infos valid only up to OC v.2.2, I never worked on later things... ::)
VqMOD CONTENT IS NOT VALID, if JNeuhoff's CUSTOM VqMod is installed!

Re: Delayed inventory update causing overselling

Posted: Wed Jun 07, 2017 11:33 am
by misdirekted
IP_CAM wrote:
Wed Jun 07, 2017 10:21 am
OcMod caches Files, constructed out of OC default Source Files, combined with
OcMod Extension contained Add/Change/Replace Content. Such a CACHED File is then
used INSTEAD of it's Original default SOURCE-File, to be Part of the final OUTPUT-Data,
requested/sent from/to the Visitor-Browser.

Those Files are then usually stored/cached/called/seen, until modified again, by some other
extension, or by removal of an existing extension, having some effect on such a File.

But if you modify some Data or File, somewhere, it does not automatically make OC 'realize'
this new FACT, and so act accordingly, but it still presents outdated VALUES, until an OcMod
Reset/Refresh has been made.
OcModded Cache Files are placed in the: system/storage/modification/... Subdirectory,
and placed in subdirectories, named like their native Source Files.
And strictly technically, such files could replace default source, and then no longer require OcMod,
to function as they do with/by OcMod! :D

And everything in this modification/..Subdirectory, exept for the index.php, could eventually be deleted
manually, to clean out this section for sure, and in full, from time to time, and to avoid keeping failed Installs
and other crab for no good reason at all. It all will be rebuilt again, whatever is required. ;)

And since VqMod comes AFTER OcMod, the same thing may happen to VqCache'd FILES as well,
therefore, the VqCache/... always needs to be cleared out as well, to make sure, it's all GO again. :laugh:

Good Luck!
Ernie
PS. Infos valid only up to OC v.2.2, I never worked on later things... ::)
VqMOD CONTENT IS NOT VALID, if JNeuhoff's CUSTOM VqMod is installed!
Wow such a thorough and detailed response - thank you so much! Is there a reason why the cached inventory info was eventually updated to reflect the correct inventory values after a one-day delay?

Btw, do you ever do freelance opencart work? I inherited this OC installation from the previous developer, and I admit Opencart is not my forte...but sometimes it would be nice to have someone so knowledgeable to help out if/when things get squirrely. You seem like you know the system inside and out 8)

Re: Delayed inventory update causing overselling

Posted: Wed Jun 07, 2017 3:53 pm
by sculptex
Sorry, but I think all that is a red herring.
What is your Processing Order Status in System > Settings > Option?
If this is not pending or whatever the successful payment status is for your chosen payment gateway, you will have this problem, as it is waiting for the order status to be manually updated.

Re: Delayed inventory update causing overselling

Posted: Thu Jun 08, 2017 12:53 am
by misdirekted
sculptex wrote:
Wed Jun 07, 2017 3:53 pm
Sorry, but I think all that is a red herring.
What is your Processing Order Status in System > Settings > Option?
If this is not pending or whatever the successful payment status is for your chosen payment gateway, you will have this problem, as it is waiting for the order status to be manually updated.
Hmm...that's another good point. I think I have everything set up correctly, as it usually deducts inventory properly...but I took screenshots of my settings in the attached image. We use Paypal Pro and Paypal Payments Standard for our transactions. Does this all look correct?

Re: Delayed inventory update causing overselling

Posted: Thu Jun 08, 2017 7:59 am
by misdirekted
IP_CAM wrote:
Wed Jun 07, 2017 7:19 am
it would only last for a day, if you would NOT reset/clear the OcMod Cache,
every single time, after doing 'anything' in/from the Admin Section. And at best,
clear out VqMod/VqCache/... as well, if you have such installed.
Ernie
Okay, so I cleared the OCmod and VQmod cache, but now my website does not force HTTPS anymore. I checked config.php and everything is set to https://
What happened?

Re: Delayed inventory update causing overselling

Posted: Thu Jun 08, 2017 4:06 pm
by sculptex
Re: stock
Looking at PayPal payments standard completed status, why is this set to processing? This may cause an issue. Does the stock problem only occur with this gateway? Why have you got two PayPal options anyway?

Re: SSL
Have you got any mods that force SSL? With ocmods you must now refresh the modifications, with vqmod its automatic.

Re: Delayed inventory update causing overselling

Posted: Fri Jun 09, 2017 1:33 am
by misdirekted
sculptex wrote:
Thu Jun 08, 2017 4:06 pm
Re: stock
Looking at PayPal payments standard completed status, why is this set to processing? This may cause an issue. Does the stock problem only occur with this gateway? Why have you got two PayPal options anyway?

Re: SSL
Have you got any mods that force SSL? With ocmods you must now refresh the modifications, with vqmod its automatic.
Good point, should I change that to completed? I figured that once the transaction goes through, it marks it as processing, then once we package and ship the orders, we mark as complete. We have PayPal payments pro to charge directly on the website, and Paypal standard if they want to be redirected to the paypal website.

I think the SSL problem was one of our OCmods, which I was able to fix. But now I also notice that order confirmation emails are not being sent out... ???

Re: Delayed inventory update causing overselling

Posted: Fri Jun 09, 2017 2:49 am
by sculptex
Actually, when I looked I remembered that the PayPal statuses regard the Payment Status Completed, not the Order Status, so yes it should go to Pending and as long as the Pending is ticked in the Processing Order Status as you have, it should work correctly!?!

We had a problem a while back with stock overselling when we cancelled an order and we hadn't realized it put all those items back in stock, are you sure its nothing like that causing the stock problem?

Not sure about the email if you've not changed anything and you don't have any related mods. Have you checked the error log?

Re: Delayed inventory update causing overselling

Posted: Fri Jun 09, 2017 3:59 am
by misdirekted
sculptex wrote:
Fri Jun 09, 2017 2:49 am
Actually, when I looked I remembered that the PayPal statuses regard the Payment Status Completed, not the Order Status, so yes it should go to Pending and as long as the Pending is ticked in the Processing Order Status as you have, it should work correctly!?!

We had a problem a while back with stock overselling when we cancelled an order and we hadn't realized it put all those items back in stock, are you sure its nothing like that causing the stock problem?

Not sure about the email if you've not changed anything and you don't have any related mods. Have you checked the error log?
I don't believe that is the issue, as the inventory delay happened across the board with a number of different products around the same time, and we had not cancelled any orders for any of those products.

I hadn't checked the error log, but I just did and there are no errors except one that has been repeating over and over for several months:

Code: Select all

[08-Jun-2017 13:07:14 America/Denver] PHP Deprecated:  mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home3/poppycli/public_html/system/library/db/mysql.php on line 7
Crap, so there's a new problem...how do I fix that ??? :bash:

Re: Delayed inventory update causing overselling

Posted: Fri Jun 09, 2017 5:08 am
by sculptex
That should be as simple as changing your db driver to mysqli in your root and admin config.php files

Code: Select all

define('DB_DRIVER', 'mysqli');
You might be as well to set up a test site and try to pinpoint and recreate the problem with the stock as I suspect you don't want to mess about with a live store.

Re: Delayed inventory update causing overselling

Posted: Fri Jun 09, 2017 5:23 am
by misdirekted
sculptex wrote:
Fri Jun 09, 2017 5:08 am
That should be as simple as changing your db driver to mysqli in your root and admin config.php files

Code: Select all

define('DB_DRIVER', 'mysqli');
You might be as well to set up a test site and try to pinpoint and recreate the problem with the stock as I suspect you don't want to mess about with a live store.
Oh okay sweet; thanks for the tip - will do that right now. I appreciate your assistance very much!
I'm starting to wonder if there's a hosting problem...I'll try and see if they have been having any issues. I am receiving emails for new customer notifications, but not for the order confirmations. So weird...