Netedge Posted November 30, 2017 Share Posted November 30, 2017 Hi, I am using "modern" template to show products on my WHMCS. I want to hide products whenever it goes out of stock and show only available products. How can I do that? Link to comment Share on other sites More sharing options...
brian! Posted November 30, 2017 Share Posted November 30, 2017 8 hours ago, Netedge said: I am using "modern" template to show products on my WHMCS. I want to hide products whenever it goes out of stock and show only available products. How can I do that? in /templates/orderforms/modern/products.tpl, you could add an {if} statement after {foreach from=$products key=num item=product} {if $product.qty gt 0 or $product.qty eq ""} and add a closing {if} before the {/foreach} Link to comment Share on other sites More sharing options...
Netedge Posted December 5, 2017 Author Share Posted December 5, 2017 Hi, Its not working for me. Can you please update this file and send it back to me? products.tpl Link to comment Share on other sites More sharing options...
brian! Posted December 5, 2017 Share Posted December 5, 2017 9 hours ago, Netedge said: Its not working for me. Can you please update this file and send it back to me? if you wanted to just disable the "Order Now" buttons for out of stock products, you could just do this... <div class="text-right"> {if $product.qty eq '0' or $product.qty|strstr:'-'} <button class="btn btn-danger btn-lg" disabled> {$LANG.outofstock} {else} <a href="cart.php?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}" class="btn btn-success btn-lg"><i class="fa fa-shopping-cart"></i> {$LANG.ordernowbutton}</a> {/if} </div> products.tpl also, remember that the "Modern" hasn't been updated in years. https://docs.whmcs.com/Standard_Order_Form_Templates#Depreciated_Order_Form_Templates Quote "Boxes" and "Modern" no longer receive updates and may not be compatible with the latest features. They are provided for legacy users only. if you want to remove product blocks that are out of stock, it's probably going to be easier to write a hook to manipulate the array - otherwise, you'll have blank spaces... although just marking them as out of stock would be easier! Link to comment Share on other sites More sharing options...
Netedge Posted December 5, 2017 Author Share Posted December 5, 2017 Hi, I don't want to disable only order now button but to hide entire product which is out of stock. Link to comment Share on other sites More sharing options...
Netedge Posted December 5, 2017 Author Share Posted December 5, 2017 Ok, I will check other options instead of Modern. Which one do you suggest? Link to comment Share on other sites More sharing options...
Netedge Posted December 5, 2017 Author Share Posted December 5, 2017 I just changed it to standard cart. Where should I put this line " {foreach from=$products key=num item=product} " ? Link to comment Share on other sites More sharing options...
Netedge Posted December 5, 2017 Author Share Posted December 5, 2017 Also I would like to know where should I put the code of out of stock in this file? products.tpl Link to comment Share on other sites More sharing options...
Netedge Posted December 5, 2017 Author Share Posted December 5, 2017 I have changed my order page to "Standard Cart" now. Link to comment Share on other sites More sharing options...
brian! Posted December 5, 2017 Share Posted December 5, 2017 if you're going to use standard cart, forget the attached file. 13 minutes ago, Netedge said: Also I would like to know where should I put the code of out of stock in this file? change... <a href="cart.php?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}" class="btn btn-success btn-sm" id="product{$product@iteration}-order-button"> <i class="fa fa-shopping-cart"></i> {$LANG.ordernowbutton} </a> to the code in the thread below... Link to comment Share on other sites More sharing options...
Recommended Posts