Kelby Posted May 27, 2020 Share Posted May 27, 2020 Hello, I need to display a text in clientareaproducts.tpl if the product is a server, if the product is hosting or reseller I display another text: {if $productinfo.type eq "server"} {elseif $productinfo.type eq "hostingaccount"}{else}{/if} How to do it? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 28, 2020 Share Posted May 28, 2020 18 hours ago, Kelby said: How to do it? you almost had it... {if $producttype eq "server"}SERVER{elseif $producttype eq "hostingaccount"}HOSTING{else}OTHER{/if} 0 Quote Link to comment Share on other sites More sharing options...
Kelby Posted May 28, 2020 Author Share Posted May 28, 2020 {if $producttype eq "server"}{elseif $producttype eq "hostingaccount"} <li class="divider"></li> <li><a href=""><i class="glyphicon glyphicon-refresh"></i> {$LANG.clientareanavchangepw}</a></li> {else} <li class="divider"></li> <li><a href=""><i class="glyphicon glyphicon-refresh"></i> {$LANG.clientareanavchangepw}</a></li> {/if} </ul> </div> This code isn't working for me 0 Quote Link to comment Share on other sites More sharing options...
kbwebsol Posted May 28, 2020 Share Posted May 28, 2020 27 minutes ago, Kelby said: {if $producttype eq "server"}{elseif $producttype eq "hostingaccount"} <li class="divider"></li> <li><a href=""><i class="glyphicon glyphicon-refresh"></i> {$LANG.clientareanavchangepw}</a></li> {else} <li class="divider"></li> <li><a href=""><i class="glyphicon glyphicon-refresh"></i> {$LANG.clientareanavchangepw}</a></li> {/if} </ul> </div> This code isn't working for me Your Code Like to this.... {if $producttype eq "server"} <li class="divider"></li> <li><a href=""><i class="glyphicon glyphicon-refresh"></i> {$LANG.clientareanavchangepw}</a></li> {elseif $producttype eq "hostingaccount"} <li class="divider"></li> <li><a href=""><i class="glyphicon glyphicon-refresh"></i> {$LANG.clientareanavchangepw}</a></li> {/if} </ul> </div> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 28, 2020 Share Posted May 28, 2020 16 minutes ago, Kelby said: This code isn't working for me it would work... but perhaps you're editing the wrong template - depending on where the output is going to be, and what the module being used it, you might need to use the cPaenl template rather than the clientareaproductdetails.tpl template. btw - the logic of that if statement is that if producttype equals server, then do nothing - but if you're going to do nothing for a condition, you don't really need to include that condition. if you wanted the first line to be if product is server OR hostingaccount, then do something, it would be... {if $producttype eq "server" OR $producttype eq "hostingaccount"} 0 Quote Link to comment Share on other sites More sharing options...
Kelby Posted May 28, 2020 Author Share Posted May 28, 2020 If the product is a VPS server then not showing the ChangePassword option. If the product is a reseller cPanel WHM or cPanel account then show the option to change password. How to achieve that ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 28, 2020 Share Posted May 28, 2020 8 minutes ago, Kelby said: How to achieve that ? depending on where you're outputting this, you might need to change multiple templates.... 8 minutes ago, Kelby said: If the product is a VPS server then not showing the ChangePassword option. that could be for one of two reasons... either you're using your template code above that says to do nothing if it's a server - if so, WHMCS is doing what you ask and outputting nothing if the current service is a server. or you're editing the wrong template and you might need to be looking at clientareaproductdetails.tpl 0 Quote Link to comment Share on other sites More sharing options...
Kelby Posted May 28, 2020 Author Share Posted May 28, 2020 In My Products & Services page, I added a menu, And I need to show the Password Modification option only for WHM reseller and cPanel account, not for Servers. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 28, 2020 Share Posted May 28, 2020 4 minutes ago, Kelby said: In My Products & Services page, I added a menu, And I need to show the Password Modification option only for WHM reseller and cPanel account, not for Servers. aah then that's a different question about a different page - out of the box, the products/services page wouldn't know the product type of a service... the best you can probably do without resorting to additional database checks would be to use $service.module in your condition and employ that to determine whether the current service it's a hosting product, server etc. 0 Quote Link to comment Share on other sites More sharing options...
Kelby Posted May 28, 2020 Author Share Posted May 28, 2020 How to use $service.module? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 28, 2020 Share Posted May 28, 2020 3 minutes ago, Kelby said: How to use $service.module? your best friend for something like this is to add {debug} to the template, refresh the page and you should get a popup window of most available smarty arrays/variables... then by examining the $service array in there, you should be able to tell which variables are available to you - specifically in your case, module (I think it's in there), and you can check those values to see if you can identify server product(s). if yes, then it's just another if statement... {if $service.module eq "some value"}do something{/if} 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 29, 2020 Share Posted May 29, 2020 I should have also added that you should remove {debug} from the template when you've finished needing it. 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.