Jump to content

1.5 request: Automatically disable/hide product when out of stock


Recommended Posts

This have been a highly requested feature for years on the Prestashop community and I think it´s finally time for the Prestashop-team to implement it in 1.5.

The ability to automatically disable and not to show out-of-stock products is so essential in many buisness-models.

 

Ex.

If you have one-off products.

 

Many products- a lot of work to manually disable all the out-of-stock products.

 

You want to sell what have in stock and NOT out-of-stock products. Customers who like an out-of-stock product that shows in Prestashop tends not to buy your other products that you have in stock!

 

 

I have looked att 5-6 other e-commerce systems and Prestashop is the ONLY one that dont have this feature. So please this would be a big improvement of Prestashop.

Link to comment
Share on other sites

Hello Danman,

I transmit your request to the developper in charge of stock management to see if it's possible to add this in 1.5. Anyway feature request is now frozen on 1.5, so if its too complicated to add it now you will need to wait a bit more (1.5.1 or 1.6).

 

Thank you anyway, in my opinion this is a must have feature and I hope this won't be too complicated to add ;)

 

Regards

  • Like 1
Link to comment
Share on other sites

just incase it is not to late. I really want this feature. I think it one of the most requested features. I am surprised that it was not put in ages ago.

 

please can we have this, even if 1.5 is delayed a little more. This one is worth it.

 

ie antique ring shop. most of the rings will be unique and never to be sold again.

 

all the best

 

shoulders

  • Like 1
Link to comment
Share on other sites

Hi shoulders, I like this idea as well. But this shoud be a standard module with settings how to act when an item is out of stock/s. Those settings should be global and on product level.

 

Also imagine having several stocks (warehouses). And one shop could ship from all warehouses.How to handle it in that case?

 

And some products may be only temporary out of stock, customers should be able to pre-order them even when out of stock. Other products may never come back to stock (outgoing, old products).

 

A modul capable of handling all those settings and cases would be very welcome.

Link to comment
Share on other sites

this should be part of the core from my point of view. i dont understand why you would need a module (but i am not a programmer). it would be annoying to install a module for this or deal with question on how to turn it on etc.. however having the feature as a module rather that not having it would be a major plus.

 

maybe this could be sneaked in to a later realease of 1.5 as it is a major missing feature along with multiple image uploading (see my signature, include that if you want) and postcode handling of addresses (see my signature for research on the UK and an appropriate sql script)

 

tar

Link to comment
Share on other sites

  • 6 months later...

Hi there, for the PS versions <= 1.4.8 is quite simple.

Make a folder in your modules dir and name it like you want. Than create a php file in it with the following code:

<?php
include(dirname(__FILE__).'../../../config/config.inc.php');
include(dirname(__FILE__).'../../../init.php');

$products = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product` SET active=0 WHERE quantity=0');
die ('OK');
?>

Just an example snippet, use at your own risk and modify to your needs!

When you trigger the script via cronjob it will set all products with quntity 0 to inactive.

Best regards, trip

Edited by Trip (see edit history)
  • Like 1
Link to comment
Share on other sites

Hello Trip,

 

Thanks for your advice.

I added the file and folder on Modules:

 

/modules/hideoutofstock/hideoutofstock.php

 

with content.

 

<?php

include(hideoutofstock(__hideoutofstock.php__).'/../../config/config.inc.php');

include(hideoutofstock(__hideoutofstock.php__).'/../../init.php');

 

$products = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product` SET active=0 WHERE quantity=0'); die ('OK'); ?>

 

I have a cron job created like this: wget -q --spider "http://www.mysite.com/modules/HideOutOfStock/HideOutOfStock.php" 2>&1>dev/null , which I already run

 

But out of stock items are still online, look: mysite

 

What am I doing wrong????

 

Thanks a lot!

 

Steven

Link to comment
Share on other sites

Hi Steven,

I don't know what is wrong. I've the script running now for 2 years. Did you test it just by calling the url manually? Anyway. This is my workaround there are better ways to implement it. You can do whatever you want with it but I can not give warranty nor can I give support for it.

Best regards, trip

Link to comment
Share on other sites

Thx shoulders, I will see if I can pack it in a module or something as soon as 1.5. is out.

I have not dived into the code so far and maybe with the advanced stock management it is getting more complicated. I do not have product combinations and stuff so as I said, modify and test it on your test system. For me it works fine and I just wanted to show that it is no rocket science to implement it.

Best regards, trip

Link to comment
Share on other sites

Funny thing here is I see no reason to hide out of stock products, as I have my store set to not allow orders of out of stock products and that disables the add to cart button.

When a product is out of stock a customers can enter their email address and be notified when product is back in stock for myself that is perfect.

If a product that is out of stock were disabled to the point where it did not show the customer would most likely just think you did not carry it and move on to another store.

With the Email notification of out of stock products the customers most likely will return to purchase at another time and not just figure you don't carry that item.

Just my thoughts.

Link to comment
Share on other sites

Valid point, but when you have 3000 products and let's say 70% are sold out than it might not raise confidence to the customer.

Also people may have lot's of unique products so there are scenarios and you are free to trigger the feature whenever you want to clean up your store.

I like the backend of ps but I had to program some extra modules like an ajax driven product mass updater because when have to work with the software on a daily basis then you really understand what features are lacking. I do not want to spent hours a day updating my stock when I can achieve this in seconds. There is a difference between theory and reality and I do not expect developers to know that but we are the ones who are working with the software and I think, know better what we need or not.

Best regards, trip

  • Like 3
Link to comment
Share on other sites

I am no developer just a user just like you and I understand that there may be times that this could be used as long as it is easy to change from on to off.

However I still believe in showing all products in stock or not as an avid internet shopper I like to know what is available and where.

Lets say I was looking for widgets and a search brought up your site but I could not find them I would not return to your site the next time I needed one, however if I found it and it was out of stock I might email you to find out the status of restocking or return at another time when I needed more widgets.

We all have different ideas and opinions and by mixing them all together we all end up better off.

Once again just my thought on this subject.

Link to comment
Share on other sites

Yepp,

2 years ago I had the situation that maybe 30 percent of my products where sold out. When these are unique items it is tedious to disable them all by hand and customers might think that the shop is not maintained anymore. I heard of shops managing 40 or 50 thousand products. I have better things to do than switching the availability off all day long. When a unique product is sold out why should I leave it online? I do not say everybody needs it or should use it but I do not understand all the discussion like we can not implement it in 1.5. and so on because it is just a few lines of code. Maybe it would be an enhancement to code a script that disables every product which is unavailable for a given time e.g. 1 month. Maybe I will do something like that when I have the time.

Best regards, trip

Link to comment
Share on other sites

Well, tdr170 has a point, isn´t he?

From my point of view it can be frustrating finding too many out of stock items.

On the other hand we can lose many customers who are willing to wait, or maybe buy something similar instead, if they dont find what they were looking for originally.

Food for thought.....

Link to comment
Share on other sites

I would think that tdr170's suggestion would make the most business sense.

 

for him.

 

not all shops have the same business models. I have one client who sells antique rings and jewellery. These items are all unique, once they have been sold there will be no more. So she definately wants to disable these items when they have been sold and to have this process automatic.

 

I believe that this festure is as important as an easy upgrade process. If it is an option you can turn it on or off to suit your needs.

Edited by shoulders (see edit history)
  • Like 2
Link to comment
Share on other sites

I was wondering whether that line "$products = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'product` SET active=0 WHERE quantity=0;" can't be run after each order. Add a simple flag to enable it and the mod is ready.

 

Just my little two cents...

Agree it's a good feature, but now the developers only fix a bugs, they do not do any improvements. And it's a good way - let they release a stable 1.5 product, then add any improvements.

I also post some improvment proositions, warehouse reordering is one of them.

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...
  • 3 months later...
  • 1 month later...

I too think this is a major shortcomming in Prestashop. When I started using it didn't even think of the possibility that such option would not be available. To me it's a core functionality that absolutely should be present in such a versatile webshop application. I hope it will be implemented soon, but to be honest it should have been in there by now...

  • Like 2
Link to comment
Share on other sites

I too think this is a major shortcomming in Prestashop. When I started using it didn't even think of the possibility that such option would not be available. To me it's a core functionality that absolutely should be present in such a versatile webshop application. I hope it will be implemented soon, but to be honest it should have been in there by now...

 

you can always set up mysql trigger :)

Link to comment
Share on other sites

there is a template solution for this which is not ideal but people have some success. I dont have the link but it is on this forum somewhere.

 

I've tested the template solution but there's a problem with the number of products on a page. We have a shop with almost exclusively one of a kind products, so it would leave a lot of gaps. I don't think anyone has come up with a solution for the number of items on a page problem? Thanks though.

Link to comment
Share on other sites

I too think this is a major shortcomming in Prestashop. When I started using it didn't even think of the possibility that such option would not be available. To me it's a core functionality that absolutely should be present in such a versatile webshop application. I hope it will be implemented soon, but to be honest it should have been in there by now...

 

You are absolutely right. This have been an issue since the beginning of Prestashop. But the PrestaTeam just don´t get it....

It doesen´t matter how many issuereports, Forge etc. that have been reported over the years. The PrestaTeam just don´t get it!

I have given up....

  • Like 1
Link to comment
Share on other sites

here is a simple mysql trigger which will active/deactive product (when quantity = 0 - deacitive) when quantity >0 - active)

CREATE TRIGGER updatestock AFTER UPDATE ON ps_stock_available
FOR EACH ROW
BEGIN
UPDATE ps_product_shop SET active=0 WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity=0);
UPDATE ps_product_shop SET active=1 WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity>0);
END

 

here is a full tutorial about creating this trigger in own prestashop / mysql database:

Prestashop trigger to disable out of stock products

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

Hi there,
I am successfully testing this solution here for about 1 month with 1.5.4.X
Make a folder in your modules dir and name it like you want. Than create a php file in it with the following code:

<?php
include(dirname(__FILE__).'../../../config/config.inc.php');
include(dirname(__FILE__).'../../../init.php');
 
$product_ids = Db::getInstance()->ExecuteS('SELECT id_product FROM `'._DB_PREFIX_.'product` WHERE quantity=0 AND active=1');
 
 
foreach ($product_ids as $product_id)
{
echo $product_id['id_product']."<br>";
 
 
$product = new Product($product_id['id_product']); 
if(($product->hasAttributes()==0) && (Product::getQuantity($product_id['id_product']) <= 0))
{
if (!Validate::isLoadedObject($product))
die('error: invalid id');
 
$product->active = 0;
$product->save();
 
 
}
}
 
 
die ('OK');
 
?>
Use at your own risk and modify to your needs! And please test it on a test installation first. I only have simple products without attributes so I could not verify all possible cases ;)
When you trigger the script via cronjob it will set all products with quantity 0 to inactive but it ignores products which have attributes.
When I first tiggered the script I noticed that few products had errors because of invalid chars so I had to fix the issues first witch was imo a good chance to validate the product objects.

Best regards, trip Edited by Trip (see edit history)
Link to comment
Share on other sites

  • 2 months later...

We have released module to automatically hide 'Out of Stock' products for 1.4 and 1.5.

no core or db changes... :)

Note: if you have the product set to allow order either at the product level or global preferences level the product will not be hidden by our module.

EDIT: THIS MODULE IS NO LONGER OFFERED.  THANKS

Link to comment
Share on other sites

  • 8 months later...

We have released module to automatically hide 'Out of Stock' products for 1.4 and 1.5.

 

no core or db changes... :)

 

Note: if you have the product set to allow order either at the product level or global preferences level the product will not be hidden by our module.

 

Here is the forum link for your review:

http://www.prestasho...ions-14-and-15/

 

Hi The link above to the forum doesn't work?

 

Was there ever a module created to hide out of stock items?

Link to comment
Share on other sites

×
×
  • Create New...