Si Posted June 5, 2014 Share Posted June 5, 2014 Does anyone know if it's possible to hide products from all visitors to your site, but only make the products show when they have purchased another product. ie, all customers must first purchase product A and cannot see product B when they have purchased product A, they will then be able to see product B and purchase it. ie, is there a conditional statement method of doing this or some other way? Thanks in advance. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2014 Share Posted June 5, 2014 perhaps something along these lines... http://forum.whmcs.com/showthread.php?89775-How-can-I-restrict-products-to-other-products 0 Quote Link to comment Share on other sites More sharing options...
Si Posted June 5, 2014 Author Share Posted June 5, 2014 Hi Brian, Thanks for the reply. I had looked at that, but I don't see how client groups allows hiding/showing of certain products. At least it's not part of the default settings in it. Unless there's another way I'm missing. ? 0 Quote Link to comment Share on other sites More sharing options...
Si Posted June 5, 2014 Author Share Posted June 5, 2014 It's this clientgroup variable that is getting me. I've put {debug} at the top of the viewcart.tpl page and can only see this: clientgroupdiscount => "Client Discount" The discount I have set for my group is 0.00 because I don't want to give a discount, but use the group variable to only show clients in that group certain hidden products. So if my client group is called 'disounted group' would I be correct in assuming I put this somewhere: {if $clientgroupdiscount eq 'discounted group'} display hidden {else} and then the normal display {/if} I know the syntax of the above is wrong but can you help further or am I totally barking up the wrong tree here? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2014 Share Posted June 5, 2014 Hi Si, re-reading your question again, i'm a little confused as to the time required between them buying A and them seeing B... similar to the above thread, I was assuming you just wanted to hide B from everyone who hadn't bought A. another option here might be to make B a hidden product, but include a link to it in the welcome email/receipt for those that purchase A... so no-one would see it visiting the site, unless they used that link. the point about using client groups was just as a quick way to identify a certain group of customers - with them identified, products.tpl could then be modified to check for them... though exactly how would I guess depend on the order form template. but basically, in the foreach loop that displays the products, you'd throw in an {if} conditional statement, which would be something along the lines of... {if $product.pid eq 10 and $clientgroup.id eq 1}show product{else}don't show{/if} that code won't be exactly right, but I think the idea would work. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2014 Share Posted June 5, 2014 It's this clientgroup variable that is getting me. I've put {debug} at the top of the viewcart.tpl page and can only see this: clientgroupdiscount => "Client Discount" that's from the language file - ignore that. The discount I have set for my group is 0.00 because I don't want to give a discount, but use the group variable to only show clients in that group certain hidden products. So if my client group is called 'disounted group' would I be correct in assuming I put this somewhere: {if $clientgroupdiscount eq 'discounted group'} display hidden {else} and then the normal display {/if} I know the syntax of the above is wrong but can you help further or am I totally barking up the wrong tree here? it's always good practice to use ID values rather than names - IDs should be unique, client group names might not necessarily be - you can give the same name to multiple Client Groups, but they'll each have different IDs. I threw a {debug} into products.tpl - the variable you will want to use is $clientsdetails.groupid if they are not logged in, the variable won't exist. if they are logged in but not in any client group, it will equal 0 if they are logged in and in a client group, it will equal the id of that group. 0 Quote Link to comment Share on other sites More sharing options...
Si Posted June 5, 2014 Author Share Posted June 5, 2014 Brian, I really appreciate your help in this. This is the code I have: [color="#FF0000"]{if $product.pid eq 25 and $clientsdetails.groupid eq 5} [/color] <div class="row"> <ul class="list-unstyled"> {foreach key=num item=product from=$products} <li class="col-xs-12 col-sm-3"><div class="pricing-tables{if $num == 1} selected{else}{/if}"> <h3 class="lighter">{$product.name}</h3> {if $product.featuresdesc}<div class="desc">{$product.featuresdesc}</div><div class="hr hr8 hr-dotted"></div>{else}{/if} <div class="rate"> <i class="icon-tags pull-right white bigger-175"></i> {if $product.bid}{$LANG.bundledeal}{if $product.displayprice} {$product.displayprice}{/if}{elseif $product.paytype eq "free"}{$LANG.orderfree}{elseif $product.paytype eq "onetime"}{$product.pricing.onetime} {$LANG.orderpaymenttermonetime} {else}{if $product.pricing.hasconfigoptions}{$LANG.startingfrom}:<br /> {/if} <div class="price"> <div class="amount">{$product.pricing.minprice.price}</div> <div class="currency"><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}</div> </div> {/if}<br /> </div> {foreach from=$product.features key=feature item=value} <ul><li><i class="fa fa-angle-right text-blue"></i> {$value} {$feature}</li></ul> {/foreach} <br /> <small>{if $product.qty!=""}<em>({if $product.qty eq "0"}{$LANG.outofstock}{else}{$product.qty} {$LANG.orderavailable}{/if})</em>{/if}</small><br /> <button type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}'" class="btn btn-warning" />{if $product.pricing.hasconfigoptions}{$LANG.orderconfigure}{else}{$LANG.ordernowbutton}{/if} <i class="icon-chevron-right"></i></button> <br /><br /> </div><br /></li> {/foreach}</ul> [color="#FF0000"]{else}[/color] <div class="row"> <ul class="list-unstyled"> {foreach key=num item=product from=$products} <li class="col-xs-12 col-sm-3"><div class="pricing-tables{if $num == 1} selected{else}{/if}"> <h3 class="lighter">{$product.name}</h3> {if $product.featuresdesc}<div class="desc">{$product.featuresdesc}</div><div class="hr hr8 hr-dotted"></div>{else}{/if} <div class="rate"> <i class="icon-tags pull-right white bigger-175"></i> {if $product.bid}{$LANG.bundledeal}{if $product.displayprice} {$product.displayprice}{/if}{elseif $product.paytype eq "free"}{$LANG.orderfree}{elseif $product.paytype eq "onetime"}{$product.pricing.onetime} {$LANG.orderpaymenttermonetime} {else}{if $product.pricing.hasconfigoptions}{$LANG.startingfrom}:<br /> {/if} <div class="price"> <div class="amount">{$product.pricing.minprice.price}</div> <div class="currency"><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}</div> </div> {/if}<br /> </div> {foreach from=$product.features key=feature item=value} <ul><li><i class="fa fa-angle-right text-blue"></i> {$value} {$feature}</li></ul> {/foreach} <br /> <small>{if $product.qty!=""}<em>({if $product.qty eq "0"}{$LANG.outofstock}{else}{$product.qty} {$LANG.orderavailable}{/if})</em>{/if}</small><br /> <button type="button" value="{$LANG.ordernowbutton}"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&{if $product.bid}bid={$product.bid}{else}pid={$product.pid}{/if}'" class="btn btn-warning" />{if $product.pricing.hasconfigoptions}{$LANG.orderconfigure}{else}{$LANG.ordernowbutton}{/if} <i class="icon-chevron-right"></i></button> <br /><br /> </div><br /></li> {/foreach}</ul> [color="#FF0000"]{/if} [/color] The {if} code is in red and then I've duplicated the normal product table display above and beneath the {else} but something else must be required. I've tried hiding the product (it's in the same product group) and that seems to over-ride anything else here. I wonder if there is something in the two sections (which are the same) which needs to be added or taken away. ie that relates to the hidden group. ? 0 Quote Link to comment Share on other sites More sharing options...
Si Posted June 5, 2014 Author Share Posted June 5, 2014 Just in case anyone needs a solution for this, I found it. It's called "Show Hidden Product Groups based on Client Group" and it's here: https://www.serverping.net/clients/cart.php?gid=3 Thanks for your help Brian. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 5, 2014 Share Posted June 5, 2014 that must be why i knew the idea would work, I must have subconsciously seen the link before! btw, I think the solution to your {if} problem above would be to put it after the {foreach} and use {if ($product.pid neq 25) or ($product.pid eq 25 and $clientsdetails.groupid eq 5)} anyway, glad you found a solution. 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.