Jump to content

After ordering products with no stock gets disabled


IgorOsnitsky

Recommended Posts

Dear SIrs. 

First of all many thanks for Your contribution - it is very useful even for people with no initial skills in programming and experience in Prestashop. 

I read this forum since 2014 with many thanks for all of You sharing experience and helping to others. 

I have asked the question in the https://www.prestashop.com/forums/topic/248566-tutorial-how-to-automatically-disable-out-of-stock-products/, and have got some answers and recommends from Eolia but no solution yet. 

Maybe wider circle could help me.

The problem is: 

Prestashop 1.6.1.7   /  Store Commander

*************************************************************************************************************************************************

Sometimes we need to solve another task - how to make all of products active even when the stock is 0 .

We have used Eolia's Update Elements (free version making the product disabled when the stock=0) addon with success and thanks to author as we usually have > 10,000 products  -  each 1 pc in stock.  

So the products were disabled just after ordering and everything going smooth and clear.  Worked great!

Now we need to improve SEO (to avoid 404 pages) and customers' usability (to get the link to the product page in the product history -  order-detail.tpl file in the template was edited) so we do need to keep the products active even with zero stock.

We decided to use import CSV feature (using Store Commander in fact)  to change product status (to active) and visibility (both, catalog, search or none).

After disabling and unistalling Update ELements I have found a very strange behaviour. 

1.  When I change both the product status (to Active) and visibility (to any status) - everything is good (Checked in DB and B/O)

2. But after some time products statuses get disabled for all of products with zero stock. As it could be with Update Elements addon enabled :-).  

3. After some testing and exploring I have found that the statuses of zero stock products are changed just after any order placed (as it was with UpdateElements addon enabled). 

Not only for the products ordered but for all of zero stocked products (>5,000 products), 

4. I experimented with different visibility (both, catalog, search or none) and active status to enable. 

Everything is fine just after updating in DB but after any order all of products with no stock are changed to disabled and urls go to 404 page

***************************************************************************************************************************************************************

I have received some answers and support from Eolia but have not solved the problem yet

He has recommended me to look deeper into  /classes/Product.php, /classes/PaymentModule.php or /classes/order/OrderHistory.php

The only file changed after last CMS update is PaymentModule.php but I do not know what to look. (Should I compare changed copy with original one?)

I do not have experience in exploring the code.  What parts of files to look over? Where could be the problem?

Any ideas would be appreciated

Thank You in advance

Edited by IgorOsnitsky (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...