Blu_ Posted December 26, 2014 Share Posted December 26, 2014 Hello! I've come to a stump in the road when trying to develop my own WHMCS theme.. I've been trying to limit the client's cart so that they are only allowed to have one of the 6 total products. I'm also trying to limit a client's active services.. Let me explain a little more. Basically I'm not sure how to limit a clients active services so that after they order one of the 6 products, and it sets as active, they cannot order another product from the 6 total products. Also, to enforce this I'd like to limit the client's cart to only 1 item.. For example.. If they add item 1 to their cart, and try to add item 2 to their cart it'll replace the original with the new one item and not have both of them in the cart.. Let me know if this is possible, i'm really not sure how I could go about this. P.S -is there a way to "call" or "display" the number of items in the clients cart at that given time? I'm not sure if theres a smarty command as I couldn't find it in the documentation. Thanks for reading! Link to comment Share on other sites More sharing options...
brian! Posted December 26, 2014 Share Posted December 26, 2014 there's a free addon that can limit products in the cart - i'm unsure if it deals with the current cart, but should prevent them reordering the same product again. https://www.jetserver.net/whmcs-product-limiter the alternative method would be to write a hook, which I guess would be a query to the database to count the number of active products for the logged in client, and then pass it back to the cart... with regards to the number of items in the cart, the threads below might help... http://forum.whmcs.com/showthread.php?70291-Show-Cart-Items-and-Pricing-Project http://forum.whmcs.com/showthread.php?88643-View-Cart-Icon-only-when-items-are-in-cart http://forum.whmcs.com/showthread.php?81499-If-cart-has-product-gt-Show-Cart-Link the first is a free addon, but their site will be down until the New Year... the other two will explain about using the session to determine the number of items... Link to comment Share on other sites More sharing options...
Lightning Host Posted January 24, 2018 Share Posted January 24, 2018 You can replace the continue button in viewcart.tpl with this: {if $cartitems > 1 || $clientsstats.productsnumactive eq "1"} <div class="text-right"> <a href="#" class="btn btn-success btn-lg btn-checkout disabled" id="checkout"> You already applied! <i class="fa fa-arrow-right"></i> </a><br /> </div> {else} <div class="text-right"> <a href="cart.php?a=checkout" class="btn btn-success btn-lg btn-checkout{if $cartitems == 0} disabled{/if}" id="checkout"> {$LANG.orderForm.checkout} <i class="fa fa-arrow-right"></i> </a><br /> </div> {/if} Link to comment Share on other sites More sharing options...
Recommended Posts