Jump to content

Limit customer only able to add one plan from each category to cart and...


Recommended Posts



There are a few questions which I would like to ask:


1) So I am currently trying to make my clients only able to add one plan from each different category into the cart. After adding plan A from category A to the cart, the client will saw a message stating 'If you would like to add plan B of category A, you will have to remove plan A from the cart first. Would you like to remove plan A?' if he/she is trying to add another plan from the same category.


2) Also, if they had already purchased one of the plans of that category, they will not be able to purchase another plan of that category. They are only able to UPGRADE to the next higher plan of that category.




3) I had noticed that clients are unable to check out if they use Bank Transfer. It seems that they will stuck at 'Please wait while we redirect you to the payment gateway...'. This always happens whenever I tried to amend viewcart.tpl of modern template.


Anyone has any idea on how to do so/solve?


I will be glad to receive any forms of information, thank you!

Edited by Jolline
Found additional problems/issues
Link to comment
Share on other sites



Okay I had solved all.



I not very sure why but I noticed that at 'Please wait while we redirect you to the payment gateway...' page, there's suppose to be a function to submit the form after 5seconds but the function isn't calling. Hence, I amend the setTimeout('autoforward();',5000); to setTimeout('document.viewinvoiceform.submit()',5000);. I had named the form as viewinvoiceform and that's how I can submit using the name.

Edited by Jolline
Link to comment
Share on other sites


I added all of the code into configureproduct.tpl of orderforms template:


I simply get the productid from $_SESSION['cart']['products'] (session for cart) for the added product and do a query to retrieve the group id it belongs to. Then I check if the current product's group id ($this->_tpl_vars['productinfo']['gid']) is the same as the added product. If yes, I use jQuery to alert a confirm box whether the client would like to delete the product.


If the client clicked yes, I will use ajax to remove that product from cart and the user can proceed on by clicking checkout. If no, I will just hide the checkout button.



I got that answer from a forum http://forum.whmcs.com/showthread.php?41258-limit-one-product-per-customer before asking this question but I didn't know users are able to upgrade their plans through Services > My Services. (First time using WHMCS ^^;)

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.

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