RaptorX Posted October 26, 2017 Share Posted October 26, 2017 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 More sharing options...
moy2010 Posted October 26, 2017 Share Posted October 26, 2017 If we did this at render time, so to say, I guess it would require a SQL query per displayed/requested product to check the stock quantities. I that's true, wouldn't that be inefficient? Link to comment Share on other sites More sharing options...
RaptorX Posted October 26, 2017 Author Share Posted October 26, 2017 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 More sharing options...
moy2010 Posted October 26, 2017 Share Posted October 26, 2017 But if you do it at product.tpl, what will you display then? Link to comment Share on other sites More sharing options...
RaptorX Posted October 26, 2017 Author Share Posted October 26, 2017 @moy2010 I only display products that are on stock. If it has 0 stock the template simply ignores it. Link to comment Share on other sites More sharing options...
moy2010 Posted October 27, 2017 Share Posted October 27, 2017 Yes, but what I mean is, do you display a blank page when a user clicks on a product with 0 stock? Link to comment Share on other sites More sharing options...
SLiCK_303 Posted October 27, 2017 Share Posted October 27, 2017 If I have a product that is out of stock, but I am going to re-stock it, then I like to still show it, that way people can ask about it, or put it in their wish lists. If I am not going to restock it, then I disable it, or delete it from my database. Link to comment Share on other sites More sharing options...
RaptorX Posted October 27, 2017 Author Share Posted October 27, 2017 @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 More sharing options...
moy2010 Posted October 27, 2017 Share Posted October 27, 2017 Got it. 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? I guess that your approach is useful for unique or rare products that cannot be easily found elsewhere. Link to comment Share on other sites More sharing options...
RaptorX Posted October 27, 2017 Author Share Posted October 27, 2017 @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 More sharing options...
30knees Posted January 21, 2018 Share Posted January 21, 2018 This could be an idea, too: https://forum.thirtybees.com/topic/1330/improvement-suggestion-and-help-how-to-implement-relating-to-default-combinations Link to comment Share on other sites More sharing options...
dosbiner Posted January 21, 2018 Share Posted January 21, 2018 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 source: vekia Link to comment Share on other sites More sharing options...
30knees Posted January 21, 2018 Share Posted January 21, 2018 Great tip, thanks! I guess this could be modified to change the default combination instead of visibility. I'll look into it. Link to comment Share on other sites More sharing options...
Chandra Posted January 21, 2018 Share Posted January 21, 2018 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 More sharing options...
dosbiner Posted January 22, 2018 Share Posted January 22, 2018 @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 More sharing options...
Chandra Posted January 22, 2018 Share Posted January 22, 2018 @dosbiner Thanks. But I would like the catalog and search to have the products available. I just want to highlight the in stock ones, so it is easier for the customer to order. Link to comment Share on other sites More sharing options...
datakick Posted January 22, 2018 Share Posted January 22, 2018 @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 More sharing options...
Chandra Posted January 22, 2018 Share Posted January 22, 2018 @datakick Seems a good idea, thank you. Let me try a trigger to update products in home category. Link to comment Share on other sites More sharing options...
datakick Posted January 22, 2018 Share Posted January 22, 2018 @chandra let me know if you need any help with that Link to comment Share on other sites More sharing options...
Chandra Posted January 22, 2018 Share Posted January 22, 2018 @datakick said in Show On Stock products only by default?: @chandra let me know if you need any help with that Will do. You are too good, this and the review module! Link to comment Share on other sites More sharing options...
Chandra Posted July 23, 2018 Share Posted July 23, 2018 Ended up creating a free module to show 'in stock' products: https://forum.thirtybees.com/post/19476 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now