Jump to content

Billing cycle by URL


rev

Recommended Posts

Hi

 

It's a really simple question about changing billing cycle by URL. Let's see:

 

http://demo.whmcs.com/cart.php?a=add&pid=1&billingcycle=annually

 

Yes, it works for products but what if we are NOT linking a product directly but a category aka group? I explain. With this URL i'm linking a category.

 

http://demo.whmcs.com/cart.php?gid=1

 

Now i want to change the billing cycle:

 

http://demo.whmcs.com/cart.php?gid=1&billingcycle=annually

 

It doesn't work :? Do you know any workaround before i go on with template editing?

Link to comment
Share on other sites

I got it :D It's really easy, just a question of seconds. It works with the standard URL even with categories. Use this URL normally:

 

http://demo.whmcs.com/cart.php?gid=1&billingcycle=annually

 

Now simply $_GET['billingcycle'] in your products.tpl and echo it at the very end of your onclick function (the action of your Order now button) like follows:

 

onclick="window.location='{$smarty.server.PHP_SELF}?a=add&pid={$product.pid}{php}echo $whatever;{/php}'"

 

$whatever is the variable in the URL -> &billingcycle=$hello

$hello is the billing cycle -> monthly, quarterly, semiannually, annually etc.

 

That's it. If you want to make it clean remember to add an if(empty()); control to verify that $whatever appears in the onclick only if it has been set.

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