Jump to content

[solved] Stock issues


Recommended Posts

Hello,

 

I recently started using Prestashop v1.5.3 and I just can't get my head around the stock / quantity things in the system.

 

Basically it's like this - I have over 1000 products in my shop; some are 'single' products, some are 'complicated' products, which mean they have various combinations.

 

What I want to achieve is the following:

whenever a 'single' product is sold out, or when a 'complicated' products is completely sold out (so there is no stock for ANY of the combinations); then don't show the product in the category view. If there is any stock; either for a single product or for at least one of the combinations, then show the product in the category view.

 

I did the following things already:

in the database, set all ps_product.quantity on 0

in the database, set all ps_product_attribute.quantity on 0

in the backend settings, set the following values:

Allow ordering of out-of-stock products : NO

Enable stock management : YES

Enable advanced stock management : NO

 

which I think should mean that none of the products should be visible in the frontend.

 

yet, all the products are always visible on the category page. the 'add to cart' button is disabled, which is good, but I would really like to see that all products are hidden.

 

Also, there are the ps_stock*** tables in the database, I guess they are connected to my issue, can anyone help me explain what I do wrong, and what those tables do ?

 

thanks.

Link to comment
Share on other sites

ps_stock tables as the name said is strictly related to the stock (advanced stock manager feature), if you want to change qunatities of products - you should apply changes there

 

you can read more about advanced stock manager here:

http://doc.prestashop.com/display/PS15/Advanced+Stock+Management

 

or in this thread:

http://www.prestashop.com/forums/topic/1568[spam-filter]understanding-advanced-stock-management/

Link to comment
Share on other sites

  On 5/14/2013 at 8:10 AM, vekia said:

ps_stock tables as the name said is strictly related to the stock (advanced stock manager feature), if you want to change qunatities of products - you should apply changes there

 

you can read more about advanced stock manager here:

http://doc.prestasho...tock+Management

 

or in this thread:

http://www.prestasho...ock-management/

 

okay, thanks. so since I'm not using advanced stock manager, it means I can completely ignore those tables, right? and all my stock will be managed by using the ps_product.quantity and ps_product_attribute.quantity fields. so as soon as one of those values will be higher than 0, it means a product is available to be sold. this is all still correct?

 

then second question is about hiding products in the category view when there is no stock, how do I do that ?

Link to comment
Share on other sites

1. You've got right, you can ignore those tables when you don't use advanced stock manager.

Then, if quantity field value will (ps_product) be higher than 0 your customers will be able to order stuff. It all depends on settings that you mentioned in first post:

 

  Quote
Allow ordering of out-of-stock products : NO

 

2. As far as i know this isn't possible by default. All you have to do is to change the core of prestashop (categories/product and pages like new products, specials etc.)

 

the other thing is to write the SQL query / phpscript with cronjob / trigger in sql which will be changing the active field (ps_product) to 0 when quantity = 0

Link to comment
Share on other sites

thanks.

 

  On 5/14/2013 at 8:27 AM, vekia said:

the other thing is to write the SQL query / phpscript with cronjob / trigger in sql which will be changing the active field (ps_product) to 0 when quantity = 0

 

I just did the UPDATE ps_product SET active = 0 WHERE quantity = 0 query, it said that over 1000 rows were affected. yet, when I refresh my category page it still shows me products.

Link to comment
Share on other sites

that's correct :-)

we forgot about this table together :-)

 

If you are able, you can create SQL Trigger to change ps_product.active=0 / ps_product_shop.active=0

no sql queries, no worries, just triggers :P

Link to comment
Share on other sites

Sure, you can mark own topics as solved, here is an instruction:

 

  Quote
To mark a topic as [solved] :

- Edit the first post of your topic by clicking on the "Edit" button,

- Click on the "Use full editor" button,

- Add the "[solved]" string at the beginning of your topic title and click on the "Submit Modified Post" button.

[solved] tag is really helpfull for other community members, so we will be grateufll if you will follow steps above in the future :-)

 

regards

  • Like 1
Link to comment
Share on other sites

I am relatively sure that they changed the way the quantities are stored in at least 1.5.4.1. Afaik they are now stored in ps_stock_available no matter if multistore ist enabled or not. Anyway if you plan to use automated stock manipulation imo it is now cleaner and better to use the method

StockAvailable::setQuantity($id_product, $id_product_attribute, $quantity, $id_shop = null)

and let the core decide what to do. This way you are more future proof ;)

All the best, trip

  • Like 1
Link to comment
Share on other sites

  On 5/14/2013 at 9:44 AM, Trip said:

I am relatively sure that they changed the way the quantities are stored in at least 1.5.4.1. Afaik they are now stored in ps_stock_available no matter if multistore ist enabled or not. Anyway if you plan to use automated stock manipulation imo it is now cleaner and better to use the method

StockAvailable::setQuantity($id_product, $id_product_attribute, $quantity, $id_shop = null)

and let the core decide what to do. This way you are more future proof ;)

All the best, trip

 

you've got absolutely right, i checked latest version sources and how it works in back office, and it works exactly as you said. Well, in my opinion this method is much better than method in old ps version.

Link to comment
Share on other sites

×
×
  • Create New...