Jump to content

Cannot add product to cart when out of stock


WhyEs

Recommended Posts

Hi,

 

We're in the middle of upgrading our shops from 1.5.6.2 to 1.6.1.0 and we're running into a bit of trouble. When a product is out of stock, it cannot be added to cart, even though it is allowed in the backend (preferences > products > 'Allow ordering of out-of-stock products' -> Yes).

 

Now, we're using a batch import script which injects new products into our database. Up to 1.5.6.2, this worked fine but this might be the cause of the problem. When a new product is introduced into Prestashop and I look it up in the backend using catalog > products > [product] > quantities, 'When out of stock' is set to 'deny orders', even though the default setting says 'Default: Allow orders as set in the Products Preferences page'. Only by manually changing this setting to 'Allow orders', the out of stock product can be added to cart.

 

For the upgrade, we made a copy of our 1.5.6.2 shop which was upgraded using the upgrade add-on. We then took a fresh install of 1.6.0.14 which was hooked to the upgraded database. After that, we upgraded to 1.6.1.0 and this is where we are now.

 

I did some tests to find out which parts of the database are responsible for this so I could write some sort of hack to batch-enable all products after injecting them, but I just can't find out what's going on.

 

For testing sake, I even tried bypassing the $allow_oosp-checks in product-list.tpl and product.tpl, and disabling the error messages in CartController.php. The 'add to cart' button was no longer greyed out in the template, but instead of the 'This product is not in stock' error, a 'You already have the maximum quantity available for this product' error appeared.

 

Questions:

 

1) Is this a known issue and if yes, how to solve this?

2) If not 1), is there a way to batch-wise allow all products to be ordered when out of stock?

 

Thanks in advance!

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

How are you adding the new stock item  - manually or via CSV? With CSV there is a column to set that. So if using CSV you could be overriding the default setting during the upload

Link to comment
Share on other sites

How are you adding the new stock item  - manually or via CSV? With CSV there is a column to set that. So if using CSV you could be overriding the default setting during the upload

 

Neither. First, an import table is created in our database using a CSV file. Then, another script picks each product and directly injects them into ps_product (and all the other relevant tables).

Edited by WhyEs (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...