Jump to content

Billing clycle: Annually as default


jortiz565

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :idea:

 

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! :)

Link to comment
Share on other sites

  • 2 weeks later...
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated