Jump to content

Is it possible to disable some multiple choice options, based on selection?


-M-

Recommended Posts

I am wondering; is it possible to disable (grey them out) multiple choice options, based on the selection of a configurable options? Obviously with the help of jQuery or JS?

 

I will give an example (all of them are configurable options):

 

Customers A wants to order a VPS (= product) and selects the following configurable option:

 

50GB/1024MB/2000GB (space/memory/datatraffic)

 

The next configurable option would be if the customer A wants extra RAM. For which we have the following options:

 

- No extra RAM

- 512 MB RAM extra

- 1024 MB RAM extra

- 2048 MB RAM extra

- 4096 MB RAM extra

 

For customer A's selection (50GB/1024MB/2000GB) only the first 3 options should be selectable, so:

 

- No extra RAM

- 512 MB RAM extra

- 1024 MB RAM extra

The other two should be unselectable or better said greyed out.

 

 

Now customer B wants something bigger and orders 200GB/4096MB/5000GB (space/memory/datatraffic) now he has only the following options available:

 

- No extra RAM

- 4096 MB RAM extra

The other three options should be unselectable (or greyed out).

 

Is this possible with the use of jQuery or Javascript? If yes, how?

If this is possible, we can also apply this to other areas.

 

If hiding the unavailable options is easier; it would be also a good solution. We just want to limit customer's choices depending on what they select in general.

 

I created two more examples, but with a photoshop mockup (or what's the word for it) to clarify things.

 

example4.png

 

example3.png

 

I think it's possible, but no clue how. Maybe there is even an easier way, other than jQuery/JS. Please advice. Many thanks!

Link to comment
Share on other sites

Well after speaking to several other WHMCS users, it has come to my attention that HostBill has this feature by default. I would like to urge WHMCS to also add this. It shouldn't be rocket science, it's just adding some kind of logic to the multiple choice fields.

 

But apparently it's not possible to add this ourselves (or companies creating hooks / modules) because the needed changes apparently have to be made in some of the encoded core files of WHMCS? Or is there another way?

 

As someone else pointed out and I quote:

You're offering a selection of CPUs to choose from. But not all of them you can offer with 128GB RAM, so what are you supposed to do? Display the 128GB under the option "Memory" for the customer to choose even if he had chosen a CPU that you can't provide it with?

 

So the solution is to create conditional configurable options and specify which options are not being displayed when certain options are selected.

 

The same could be said about (RAID) storage options or configurations; single HDD/SSD, RAID1, RAID5, RAID6, RAID10, etc.

Some controllers are able to do RAID 10, but not RAID 5.

Link to comment
Share on other sites

Well after speaking to several other WHMCS users, it has come to my attention that HostBill has this feature by default. I would like to urge WHMCS to also add this. It shouldn't be rocket science, it's just adding some kind of logic to the multiple choice fields.

there may have been requests for this feature going back well over a year or two (perhaps even longer) - it was certainly discussed early in the beta forum for v6 and I guess that was nearly a year ago now.

 

But apparently it's not possible to add this ourselves (or companies creating hooks / modules) because the needed changes apparently have to be made in some of the encoded core files of WHMCS? Or is there another way?

i'd be really surprised if you need access to the core files for this - though I could well be wrong... :?:

 

the way I see it is that you're not manipulating the core ordering process or passing new variables, you're just wanting to hide certain options based on previous choices - that sounds more like a display issue to me solvable using jquery.

 

I doubt anyone has posted how to do this with WHMCS - I can't recall any posts on this here apart from those in Marketplace offering to pay someone for a solution... so I suspect it can be done, but it won't be simple - especially when you factor in that you need to add some rules logic to the solution... could be one of those situations where it's hard to commercialise the solution, and too complicated to explain as a tutorial! :roll:

 

I can see some of the changes that you'd need to make to the template to make this possible, then it's a case of working out getting the jquery code to interact with how WHMCS displays the options... that sounds more like a task for a few uninterrupted quiet hours on a Sunday with a mug of tea beside me rather than a busy midweek afternoon!

 

if I get the chance at the weekend, i'll try and take a look at this... no promises on whether I can do it or not though!

Link to comment
Share on other sites

there may have been requests for this feature going back well over a year or two (perhaps even longer) - it was certainly discussed early in the beta forum for v6 and I guess that was nearly a year ago now.

 

Discusses, but never followed upon. * shrugs *

 

i'd be really surprised if you need access to the core files for this - though I could well be wrong... :?:

 

Sounds weird to me as well, but I am no coder nor developer. I think it's just something which can be done with jQuery, but then again (see first part of this sentence).

 

the way I see it is that you're not manipulating the core ordering process or passing new variables, you're just wanting to hide certain options based on previous choices - that sounds more like a display issue to me solvable using jquery.

 

That's what I thought as well. You aren't editing any values, you just hide them, or even better "grey" them out and making them unselectable completely. The values are still there, but you just cannot select them. I don't understand why this should be so hard to implement it.

 

I doubt anyone has posted how to do this with WHMCS - I can't recall any posts on this here apart from those in Marketplace offering to pay someone for a solution... so I suspect it can be done, but it won't be simple - especially when you factor in that you need to add some rules logic to the solution... could be one of those situations where it's hard to commercialise the solution, and too complicated to explain as a tutorial! :roll

 

yeah, I have searched as well in various ways, but came up empty handen. Created even a support ticket (against better knowing obviously) and they pointed me out that I could create a 'request' and pointed me also to an existing 'request' which was already dated over a year ago. Several people thought it was a good idea, however nothing was done with it unfortunately. And to be honest; if I have to rely on WHMCS to implement this function, well... let's just say I know better nowadays. ;)

 

He also gave better examples than I ever could or think of; for example storage or even RAID configurations. Some servers (or controllers in this case) cannot handle RAID 5 and 6, but can handle RAID 1 and 10. Greying out those options would give us much more control on what we can offer obviously.

 

I can see some of the changes that you'd need to make to the template to make this possible, then it's a case of working out getting the jquery code to interact with how WHMCS displays the options... that sounds more like a task for a few uninterrupted quiet hours on a Sunday with a mug of tea beside me rather than a busy midweek afternoon!

 

if I get the chance at the weekend, i'll try and take a look at this... no promises on whether I can do it or not though!

 

I understand you aren't promising anything, but I already appreciate the gesture. It's more than I received from support. They apparently only point me to the requests page and to (mostly) outdated 'apps' in their appstore. Some of those apps are dated 2009 (7 years old). * shrugs *

 

Wouldn't it be possible to make a jQuery search for text for example "config option A1" and if that is selected "config options B2, B3, B4" are greyed out (or unselectable). Something in that sort?

 

Reminder: I am not scripter, developer nor do I know anything about programming so take my "idea" with a pinch of salt. Just trying to help out.

 

Anyways, once again, thank you at least for taking interest in this. Highly appreciated as always.

 

Regards

Link to comment
Share on other sites

Discusses, but never followed upon. * shrugs *

the whole v6 beta forum got hidden by Matt, and my recollection is that there was some useful code and information in there... anyway, my PM to him to get it reinstated (and read-only) didn't even get a reply... oh well

 

That's what I thought as well. You aren't editing any values, you just hide them, or even better "grey" them out and making them unselectable completely. The values are still there, but you just cannot select them. I don't understand why this should be so hard to implement it.

greying-out is the idea i'm looking to try first - I know how to do that outside of WHMCS, so it can't be that different... surely!

 

yeah, I have searched as well in various ways, but came up empty handed. Created even a support ticket (against better knowing obviously) and they pointed me out that I could create a 'request' and pointed me also to an existing 'request' which was already dated over a year ago. Several people thought it was a good idea, however nothing was done with it unfortunately. And to be honest; if I have to rely on WHMCS to implement this function, well... let's just say I know better nowadays. ;)

another one who has seen the light! :idea:

 

you never quite know with WHMCS - they could be working on this now and looking to add it to v6.3... or we could all be sat here using v8 still waiting for the feature to be added.

 

He also gave better examples than I ever could or think of; for example storage or even RAID configurations. Some servers (or controllers in this case) cannot handle RAID 5 and 6, but can handle RAID 1 and 10. Greying out those options would give us much more control on what we can offer obviously.

oh don't mention RAID to me, i'm doing server upgrades today... :roll:

 

i'm going to stick with your images for now as the example to test with - i'll be able to set them up locally on the v6 dev... if I can get the solution for that working, then we can expand from there...

 

I understand you aren't promising anything, but I already appreciate the gesture. It's more than I received from support. They apparently only point me to the requests page and to (mostly) outdated 'apps' in their appstore. Some of those apps are dated 2009 (7 years old). * shrugs *

shrugging is really useful with WHMCS - it gets you through the day. :)

Link to comment
Share on other sites

Sorry brian!, but wanted to reply earlier, but had a busy evening yesterdat and today was also busy.

 

the whole v6 beta forum got hidden by Matt, and my recollection is that there was some useful code and information in there... anyway, my PM to him to get it reinstated (and read-only) didn't even get a reply... oh well

 

I don't understand why they don't give you access. You are one of, if not, the most valuable forum members here and always providing help.

 

greying-out is the idea i'm looking to try first - I know how to do that outside of WHMCS, so it can't be that different... surely!

 

* crossing fingers *

 

another one who has seen the light! :idea:

 

:lol:

 

you never quite know with WHMCS - they could be working on this now and looking to add it to v6.3... or we could all be sat here using v8 still waiting for the feature to be added.

 

Would be nice if they kept people up-to-date imho.

 

oh don't mention RAID to me, i'm doing server upgrades today... :roll:

 

I hope the upgrades went well. :idea:

 

i'm going to stick with your images for now as the example to test with - i'll be able to set them up locally on the v6 dev... if I can get the solution for that working, then we can expand from there...

 

Works for me :)

 

shrugging is really useful with WHMCS - it gets you through the day. :)

 

* shrugs * ::!:

Link to comment
Share on other sites

  • 2 weeks later...
Any updates with this brian?

Or didn't you have had the chance to take a look at it?

ye of little faith - this is not the WHMCS Feature Requests Dept where you can wait for years and still not see any end result - I said that I was would try to take a look at it on Sunday and I did! :)

 

so I am now in a position to answer your important questions on this...

 

Q. Can it be done without access to core WHMCS files?

A. Yes. :idea:

 

Q. Is it perfect and bug-free?

A. Not yet. :roll:

 

take a look at the video below as to what it can do so far - probably better viewed full screen with captions on... so I won't embed the video here...

 

https://youtu.be/wlGWi3clXcY

 

first let me tell you about the good points before I move on to the current issues...

 

I can create relationships between radio, checkboxes, text boxes and even sliders... I just need to figure out dropdowns and then that's the complete set! :idea:

 

any radio or checkbox can manipulate any other (or multiple) radio/checkbox/text/sliders - certainly the radio/checkbox link that you originally asked about works, but I thought i'd take a look at the other options... working on the theory that someone will ask about them!

 

all options auto-calculate the price correctly - you can't see it on the video when I move the sliders because I moved them back to the zero before the summary could update - what an idiot! - but they do work!

 

so to the issues...

 

1. it doesn't currently work with "standard_cart" - I know why it doesn't, so i'm trying to figure out if there is a way to code around it or whether i'll need to write another version that works with standard_cart... you can't believe the time I wasted on Sunday looking at perfectly good code and wondering why it wasn't working! *sighs*

 

it works with Modern (as shown in the video), probably most custom carts not based on SC and would even work on v5 I suspect - it can also be used on any WHMCS v6 page outside of the cart too... there's nothing really specific to WHMCS about the code, so it would work outside of WHMCS (though that bit I knew already).

 

2. changing the billingcycle loses the relationships - that's annoying... oh I hate jquery coding!

 

3. there's an issue with disabled sliders still passing on their values - though that should be easier to fix... disabled radio values aren't passed, but still a lot of test ordering to do before its finished.

 

4. there's also a problem with default radio values - but there's a simple solution to that though.

 

the changes required so far are just a handful of edits to the configureproduct.tpl template and adding the js code... now that I understand the relationships, I can see that the .js code could be written as a hook and there might be a away to make an addon out of it (e.g some visual way for newbies to link the options)... though whether I would want to do that would depend on if I can iron out the wrinkles, or find a collaborator who's more knowledgeable at jquery... worst case, i'd write what I know as a tutorial and leave others to solve the issues!

 

that will probably wait until v6.3 has had its full release - with WHMCS making changes to the orderforms (though nothing in the release notes yet), i'd be reluctant to release anything public until tested on v6.3 - i'm not going to get the chance to install the RC until at least next week, and I might leave it until the full release anyway.

 

so, all being well, I'll try to work on this further on Sunday. :)

Link to comment
Share on other sites

Well thats really something positive brian!

Really awesome man. :))

 

Yikes. So it doesn't work with standard_cart. * shrugs *

That's the only cart I actually use. Or at least modified versions of it. Oh well. :P

...it's weird though? Maybe because it uses those iCheck images (or whatever it's called)?

 

Well the billingcycle is normally selected as first thing, so it doesn't matter that much I guess.

 

Anyways, no rush at all. I am really happy you decided to take a look into things and even working on it. Looking at the video it already looks awesome. And makes me wonder why on earth this wasn't added years ago in the first place. Really strange.

 

As said above; take your time and don't let it ruin your day by wasting to much time on this! :)

 

Regards

Link to comment
Share on other sites

  • 2 weeks later...

+1

 

We need this as will :)

 

I have asked about something like that in http://forums.whmcs.com/showthread.php?100599-Configurable-Option-Dependent-Dropdown-list-need!

 

 

 

Regardless of what its called or the way it worked, (hiding/disabling) or what ever to get the job done.

 

We all need to have "Configurable Option Dependencies" or "Configurable Option Relationships" or whatever it is called ;)

 

 

Thank you brian!

 

Very nice work so far, :idea:

Just can't wait to get my hands on it :)

 

Have I mentioned before that I love you brian! :roll:

Link to comment
Share on other sites

  • 2 weeks later...
Any new updates on this brian?

i've made some progress, but there are still bugs. :roll:

 

I haven't bothered to upgrade to v6.3 yet... sounds like it's too buggy to risk, so i'll wait for v6.3.1 - but reading the release notes and changelog, i'm not necessarily seeing anything that could cause an issue... so i'll continue playing with it in v6.2.2 :)

 

I lost one Sunday on this due to Easter, and it's now the end of the tax-year in the UK, so i'm not sure if i'll be working on this this weekend, but I will finish it as soon as I can. :idea:

Link to comment
Share on other sites

i've made some progress, but there are still bugs. :roll:

 

I haven't bothered to upgrade to v6.3 yet... sounds like it's too buggy to risk, so i'll wait for v6.3.1 - but reading the release notes and changelog, i'm not necessarily seeing anything that could cause an issue... so i'll continue playing with it in v6.2.2 :)

 

I lost one Sunday on this due to Easter, and it's now the end of the tax-year in the UK, so i'm not sure if i'll be working on this this weekend, but I will finish it as soon as I can. :idea:

 

No rush Brian, I was only wondering what the status was. :)

Thanks again so far. :)

 

Yes, you have to get your taxes in order. ;):S

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