jortiz565 Posted February 16, 2014 Share Posted February 16, 2014 Hello, I want to know how can I change the billing cycle default to annually instead monthly? I know I need to edit the product.tpl and maybe configureproduct.tpl but don;t know how to tell whmcs that select by default the annual payment. Any help could be grateful. Thanks, Jonathan 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 17, 2014 Share Posted February 17, 2014 which order form template are you using? 0 Quote Link to comment Share on other sites More sharing options...
jortiz565 Posted February 17, 2014 Author Share Posted February 17, 2014 which order form template are you using? I'm using vertical step. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 17, 2014 Share Posted February 17, 2014 in products.tpl, you have the following line - {if $product.pricing.annually}<option value="annually">{$product.pricing.annually}</option>{/if} you can make it default to this by adding selected="selected"... {if $product.pricing.annually}<option selected="selected" value="annually">{$product.pricing.annually}</option>{/if} this will apply to all products using the vertical steps template... you could use {if} statements to only do this for certain products or groups, but let's not complicate it if it's unnecessary for your needs! step 3 (configure) will use the choice made in step 1 as the default, so if 'annually' is selected at step 1, step 3 will automatically select it... so there should be no need to edit configureproduct.tpl in this case. btw - I think just adding the word 'selected' will work, but it's probably safer (or more correct!) to use the code above. 0 Quote Link to comment Share on other sites More sharing options...
jortiz565 Posted February 17, 2014 Author Share Posted February 17, 2014 in products.tpl, you have the following line - {if $product.pricing.annually}<option value="annually">{$product.pricing.annually}</option>{/if} you can make it default to this by adding selected="selected"... {if $product.pricing.annually}<option selected="selected" value="annually">{$product.pricing.annually}</option>{/if} this will apply to all products using the vertical steps template... you could use {if} statements to only do this for certain products or groups, but let's not complicate it if it's unnecessary for your needs! step 3 (configure) will use the choice made in step 1 as the default, so if 'annually' is selected at step 1, step 3 will automatically select it... so there should be no need to edit configureproduct.tpl in this case. btw - I think just adding the word 'selected' will work, but it's probably safer (or more correct!) to use the code above. Brian Thanks for your quick replay I will try it later today and I will let you know. What else I need to do if I just want to apply this to web histing and reseller plans? I dont want to apply this to other services like cloud or dedicated. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 17, 2014 Share Posted February 17, 2014 What else I need to do if I just want to apply this to web histing and reseller plans? I dont want to apply this to other services like cloud or dedicated. the answer to that will depend on whether you have them as product groups or individual products... if they're product groups, each with different products inside them, then you should use if statements to check for the group ID (this is obtainable from the Direct Cart Links value in the product group settings - e.g., cart.php?gid=3). in your situation, let's assume that "Web Hosting" has group ID = 1 and "Reseller" has group ID = 2 - we wrap the previous line of code in a {if} statement to check the group ID and act accordingly. so we had... {if $product.pricing.annually}<option selected="selected" value="annually">{$product.pricing.annually}</option>{/if} we can now add another if statement before this to check for the above two product groups... {if $gid eq '1' or $gid eq '2'} {if $product.pricing.annually}<option selected="selected" value="annually">{$product.pricing.annually}</option>{/if} {else} {if $product.pricing.annually}<option value="annually">{$product.pricing.annually}</option>{/if} {/if} so if web hosting/reseller, it defaults to annual - otherwise, it doesn't if you need to do this for individual products, you would use $product.pid instead of $gid - and you can also use product groups and individual products (from other groups) together in the same if statement... {if $gid eq '1' or $gid eq '2' or $product.pid eq '8'} I hope that makes sense! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 3, 2014 Share Posted March 3, 2014 I just want to know how can I check some addon by default in whm? I know there is something in the configurationproducts.tpl but can you help me on that assuming that you are still using the vertical steps order form, then you will need to edit configureproducts.tpl again as the answer is similar to my previous answer. if you only wanted one specific checkbox to be ticked, then you would need to find it's id - the easiest way to do this would be to view your browser source on the configuration page... <input type="checkbox" name="addons[1]" id="a1" in this example, the id is "a1" - ignore the "a", so $addon.id will be '1' - then in configureproducts.tpl, you'll need to replace.... <tr><td>{$addon.checkbox}</td><td><label for="a{$addon.id}"><strong>{$addon.name}</strong> - {$addon.description} ({$addon.pricing})</label></td></tr> with... <tr><td>{if $addon.id eq '1'} {$addon.checkbox|replace:'type="checkbox"':'type="checkbox" checked = "checked"'} {else}{$addon.checkbox}{/if}</td><td><label for="a{$addon.id}"><strong>{$addon.name}</strong> - {$addon.description} ({$addon.pricing})</label></td></tr> as with the previous answer, you can use this technique to check any number of checkboxes by using 'OR' in the {if} statement. 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.