Jump to content
thirty bees forum

Show On Stock products only by default?


RaptorX

Recommended Posts

Is there a reasoning why TB (actually PS and transfered to TB) made it so that products that are not on stock are shown by default on stores?

I am not sure if I am the only one but wouldnt most merchants want to show only products on stock by default?

Maybe some day we could have an option in settings to "Show only products on stock" by default instead of hacking our way into the .tpl file or using cron jobs for this simple task. Or is it just me?

Link to comment
Share on other sites

Well... when you load the product.tpl page you already have an array of the products.

Thats how I hack this issue at the moment, I go to the .tpl and if the product has 1 or more then it shows it otherwise it doesnt... I am sure you dont require any additional queries because I certainly dont need to add one to achieve it.

Link to comment
Share on other sites

@moy2010 no...

Say you click a category and there are 25 products... If 5 products are out of stock I want the page to just show the 20 that are on stock.

@slick_303 yes I get that situation. In my case I would rather not spend time answering customers regarding items that are not available because I can't restock that easily.

As soon as it is out of stock I don't show it... When I have it available again then I let the store show it again.

Link to comment
Share on other sites

@moy2010 said in Show On Stock products only by default?:

If the product page was indexed by Google and it appears on search results, do you display the product page it a user clicks on it?

That's something I didn't think about. I dont mind them clicking and seeing the product that way since they wont be able to add it to the cart.

The issue is that I tell my customers "The page only shows what is available" becasue they ask OVER and OVER again "Whats available today?"

I think my situation is not very common since the type of store I run has completely new products every months or so, and products I sold this month will not come back (probably ever). That's due to the kind of suppliers I have here in this country. I am really restricted on that topic tbh.

I am trying to fix that Importing goods directly from china but Importing to Dominican Republic is a royal pain in every sense.

Link to comment
Share on other sites

  • 2 months later...

it can be done with MySQL trigger, I've using this method and works great. Open your phpMyAdmin > click your database > go to triggers (between events & designer tab) > and add trigger

Trigger name: changevisibilityafterupdate Table: psstock_available Time: After Event: UPDATE Defitnion: BEGIN UPDATE ps_product_shop SET visibility="none" WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity=0); UPDATE ps_product_shop SET visibility="both" WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity>0); END Definer: just leave it blank

the result will looks like this 0_1516544083316_Screenshot from 2018-01-21 21-14-24.png

source: vekia

Link to comment
Share on other sites

How easy would it be to create a 'In Stock' tab similar to 'Best Sellers' and 'New Products' (that shows up if there are some actually)?

I would love to move such a tab to be the first - that way a user sees only the in stock ones by default and can move to other tabs to see all products. I guess it is safe from a google indexing perspective as well.

Thoughts please?

Link to comment
Share on other sites

@chandra I think no need for that, try MySQL trigger method from my post above, your shop will hide out of stock products from catalog and search (not disable the produtcs), so someone still can access the products using direct url including traffic from google seo or social media share link.

Link to comment
Share on other sites

@chandra you could create a dedicated category for Products on stock and update the trigger above to associate / dissociate products to this category.

Then you could configure Featured products on the homepage module to show this category.

Alternative is to modify the source code of that module.

Link to comment
Share on other sites

  • 6 months later...

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...