adz1111 Posted July 24, 2017 Share Posted July 24, 2017 Hi Newbie here. I have looked quiet extensively and cannot see any obvious way of doing this. I guess it may not be possible, but I'm here hoping it is... I am trying to add a product that should display like any other product, but not have a price showing at all (or instead, maybe "£POA"). If I disable the price, the product simply doesn't appear in the "shop". The reason I need this is that it will be a very bespoke product and would require me quoting following a conversation with the client (at a minimum). So, ideally I want the product to be visible (so clients at least know it's something I offer), but instead of an "order now" button, have a "contact us for a quote" button, or even just allow me to hide the button and I can indicate in the description that they need to contact us. In advance, many thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 25, 2017 Share Posted July 25, 2017 you can't easily have dummy products in WHMCS , so you're left with 2 realistic options. 1. modify the products.tpl template to add the dummy product. 2. use an action hook to add the dummy product. the template edit will give you more flexibility as to the location of the output, the action hook would (should) continue to work after updates (without the need to re-edit the template) but would give less flexibility as to the output - unless you modified the template to change where the hook output is going to be - but if you have to do that, you might as well just edit the template! if we take standard_cart/products.tpl as an example, you can do this (i've quickly edited the template, so i'm going to post the whole file to avoid confusion as to where to add the custom code)... {include file="orderforms/standard_cart/common.tpl"} <div id="order-standard_cart"> <div class="row"> <div class="pull-md-right col-md-9"> <div class="header-lined"> <h1> {if $productGroup.headline} {$productGroup.headline} {else} {$productGroup.name} {/if} </h1> {if $productGroup.tagline} <p>{$productGroup.tagline}</p> {/if} </div> {if $errormessage} <div class="alert alert-danger"> {$errormessage} </div> {/if} </div> <div class="col-md-3 pull-md-left sidebar hidden-xs hidden-sm"> {include file="orderforms/standard_cart/sidebar-categories.tpl"} </div> <div class="col-md-9 pull-md-right"> {include file="orderforms/standard_cart/sidebar-categories-collapsed.tpl"} {foreach $hookAboveProductsOutput as $output} <div> {$output} </div> {/foreach} <div class="products" id="products"> <div class="row row-eq-height"> {foreach $products as $key => $product} <div class="col-md-6"> <div class="product clearfix" id="product{$product@iteration}"> <header> <span id="product{$product@iteration}-name">{$product.name}</span> {if $product.qty} <span class="qty"> {$product.qty} {$LANG.orderavailable} </span> {/if} </header> <div class="product-desc"> {if $product.featuresdesc} <p id="product{$product@iteration}-description"> {$product.featuresdesc} </p> {/if} <ul> {foreach $product.features as $feature => $value} <li id="product{$product@iteration}-feature{$value@iteration}"> <span class="feature-value">{$value}</span> {$feature} </li> {/foreach} </ul> </div> <footer> <div class="product-pricing" id="product{$product@iteration}-price"> {if $product.bid} {$LANG.bundledeal}<br /> {if $product.displayprice} <span class="price">{$product.displayprice}</span> {/if} {else} {if $product.pricing.hasconfigoptions} {$LANG.startingfrom} <br /> {/if} <span class="price">{$product.pricing.minprice.price}</span> <br /> {if $product.pricing.minprice.cycle eq "monthly"} {$LANG.orderpaymenttermmonthly} {elseif $product.pricing.minprice.cycle eq "quarterly"} {$LANG.orderpaymenttermquarterly} {elseif $product.pricing.minprice.cycle eq "semiannually"} {$LANG.orderpaymenttermsemiannually} {elseif $product.pricing.minprice.cycle eq "annually"} {$LANG.orderpaymenttermannually} {elseif $product.pricing.minprice.cycle eq "biennially"} {$LANG.orderpaymenttermbiennially} {elseif $product.pricing.minprice.cycle eq "triennially"} {$LANG.orderpaymenttermtriennially} {/if} <br> {if $product.pricing.minprice.setupFee} <small>{$product.pricing.minprice.setupFee->toPrefixed()} {$LANG.ordersetupfee}</small> {/if} {/if} </div> <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> </footer> </div> </div> {if $product@iteration % 2 == 0} </div> <div class="row row-eq-height"> {/if} {/foreach} {* start of dummy product *} {if $gid eq '2'} <div class="col-md-6"> <div class="product clearfix" id="dummyproduct1"> <header> <span id="dummyproduct1-name">Dummy Product</span> </header> <div class="product-desc"> <p id="product{$product@iteration}-description"> Some dummy product description... </p> </div> <footer> <div class="product-pricing" id="product{$product@iteration}-price"> <span class="price">£ POA</span> </div> <a href="contact.php" class="btn btn-success btn-sm" id="product{$product@iteration}-order-button"> <i class="fa fa-angle-double-right"></i> {$LANG.contactus} </a> </footer> </div> </div> {/if} {* end of dummy product *} </div> </div> {foreach $hookBelowProductsOutput as $output} <div> {$output} </div> {/foreach} </div> </div> </div> it's currently written to only show the dummy product in product group 2 (after the "real" products are shown), so you will likely have to change that to suit your situation - you can do that by editing the value in {if $gid eq '2'}. also, the contact us button is linked to the contact.php page... another option might be to use a Support Department and link it to there - especially if you need to use custom fields for specific information from the client. quickly tested on v7.2.3 & Standard_cart... the principle should work on other orderform templates, but the code will be different. 0 Quote Link to comment Share on other sites More sharing options...
adz1111 Posted July 28, 2017 Author Share Posted July 28, 2017 Many thanks Brian! Very helpful! I'll have a play - I just started messing with templates / hooks - bit weird compared to what I'm used too, but think I'll get there. Also, appologies for the delay - as a newbie I was waiting for the post to be moderated. Plus, it didn't notify me that it had been approved, nor that I had a reply. I'll double check my forum settings. Anyway, thanks again for taking the time. 0 Quote Link to comment Share on other sites More sharing options...
adz1111 Posted July 28, 2017 Author Share Posted July 28, 2017 Hi Brian Ok - so I have had a go. I have a custom copy of the orderforms templates - namely standard_cart and premium_cart, the parent custom folder and the 2 tpl files within it have custom names. I edited my custom standard_cart.tpl file and inserted the code you provided (which made sense). It is gid 2 as it happens, so all good. But nothing displays other than the 1 real product from gid 2. I checked that the groups are both pointing at my custom cart file... I presume this is standalone, and by that I mean any products in that group should display normally, and this one would then follow it? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 28, 2017 Share Posted July 28, 2017 Hi, Ok - so I have had a go. I have a custom copy of the orderforms templates - namely standard_cart and premium_cart, the parent custom folder and the 2 tpl files within it have custom names. I edited my custom standard_cart.tpl file and inserted the code you provided (which made sense). It is gid 2 as it happens, so all good.But nothing displays other than the 1 real product from gid 2. I checked that the groups are both pointing at my custom cart file... that part about custom standard_cart.tpl worries me - you mean that you've renamed products.tpl to something else ?? the above code is the entire standard_cart/products.tpl template - if you've just renamed standard_cart, then it should still work.... if you've customised it, then who knows. I presume this is standalone, and by that I mean any products in that group should display normally, and this one would then follow it? yes - it's standalone in that it displays the real products, then for that one specific group, it will display the dummy product. but as I said in the previous post, if you've already got custom coding in your templates, then the code may need to be different. I may need to see your site to see exactly what you've done/doing. 0 Quote Link to comment Share on other sites More sharing options...
adz1111 Posted July 28, 2017 Author Share Posted July 28, 2017 Ignore me - had my templates mixed up - all good and working now, but... Will that technique work with addons? I actually want, for certain plans, the ability to book an appointment (using external appointment software). What type of appointment you can book is plan dependant (not all plans offer that as part of the plan). Also, as it's a "feature" of a plan it's free, and the button should just take them to an external URL to go book it. It looks like I could follows the same path as products, except for the fact addons don't look like they're grouped like products are, and so I can't see how you choose a cart template. I could probably just do it like the POA product before, but what I like about addons is that only the applicable addons for a main product can be set - so folks can't order stuff that's not applicable. If I go the POA product route , I suspect if it's there to click on then people will do that. What d'ya think? Mad? 0 Quote Link to comment Share on other sites More sharing options...
adz1111 Posted July 28, 2017 Author Share Posted July 28, 2017 Brian, sorry. Looks my reply arrived as you had replied. To clarify the renaming bit - what I have done is copied the orderforms folders of standard_cart and premium_comparison, and renamed the copied folders with a ys_ prefix and then re-added those folders back under orderforms. So all the original cart templates are there with my 2 folders as extras. The theory being I can then mess around with my ys_ templates and not break anything, nor lose stuff if there's an update / upgrade. In the same way, I duplicated the six folder and renamed the dupe to something else. Was that wrong? 0 Quote Link to comment Share on other sites More sharing options...
adz1111 Posted July 28, 2017 Author Share Posted July 28, 2017 Brian Ok - all sorted including addons. Realised it took the parent from General | Ordering. Anyway - everything working as I'd hoped - really do appreciate your help - saved me a lot of time! Thanks again. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.