quantity_max with radio buttons

adenwattsadenwatts Member
in Help edited June 2008
I'm trying to use radio buttons to allow customers to choose one of four tiered monitoring options (all at different prices).

The reason I'm using radio buttons is because they are positioned in a table that compares the different plans.

Here is how I'm I have it set up right now:

<input type="hidden" name="2:name" value="Step 2: Monitoring" />
<input type="hidden" name="2:price" value="34" />
<input type="hidden" name="2:quantity_max" value="1" />

<input type="radio" name="2:Monitoring Plan" value="BASIC{p+0}" />
<input type="radio" name="2:Monitoring Plan" value="PLUS{p+5}" />
<input type="radio" name="2:Monitoring Plan" value="PRO{p+10}" checked="checked" />
<input type="radio" name="2:Monitoring Plan" value="PRO+{p+15}" />

The Problem is that if the customer adds one of the monitoring plans (e.g. BASIC) to their cart and then chooses the "continue shopping" option and changes to a different plan (e.g. PRO), even though I have quantity_max set to 1, it allows them to have both monitoring plans in the cart (albeit, one max of each plan).

Right now I just set it up to empty the cart before adding new items, but that won't work when we start selling additional equipment; I'd really like to figure out how to make the quantity_max parameter work with radio buttons.

Thanks,

Aden Watts
Comments
  • lukeluke FoxyCart Team
    Just to be clear, you're asking for is mutually exclusive products, right? Like, if you buy one of these items with these options then make sure the cart doesnt also have one of those items with those options?

    Interesting problem. If I'm hearing you right, it's not really a radio button issue as much as it's a mutually exclusive product issue. From one point of view, the user could always just remove the product they don't want to buy. Maybe we could build a flag that would ensure the product name itself is unique in the cart, regardless of the options. That would then ensure the quantity_max was working as you expect it to.

    Thanks for bringing ideas to the table and helping us improve our system.
  • Yeah. I think you're understanding it right. A product flag that set a quantity limit based on a product name regardless of the options would do just what we're looking for. But, shouldn't ALL radio buttons be "mutually exclusive;" otherwise why not just use checkboxes?

    Do you think you'll be able to do anything about this anytime soon?
  • lukeluke FoxyCart Team
    It might be more of an edge case since we haven't had any other requests for it. Most stores, as an example, would have no problem if you wanted to buy one blue t-shirt and one red one. One way you might be able to handle this on your end is to use the JSON within the cart template. As an example, when someone adds a new product to the cart, you could loop through the json object and, if a duplicate is found, set the quantity field on the cart to "0" for that item. This should force the user to update before they can checkout which should remove that duplicate item from the cart.

    Make sense? If you need help working with the JSON, please let us know. Other than that, we might be able to add this to a future release, but we'd like to cover things that most people will find useful instead of adding complexity that might be confusing.

    Is there anyone else out there who would like this functionality?

    If so, please add it to the wiki and vote for it: http://wiki.foxycart.com/feature_requests
  • brettbrett FoxyCart Team
    We're actually planning on making the cart itself editable with API type functionality, which would actually make this easier for you.

    Definitely an interesting question though. I could certainly see this as being useful...

    Even for the t-shirt idea... if you have 5 red and 100 blue, you want to set a quantity_max on just the red.

    I think it'd make more sense to do this by product code, rather than name. The name could stay the same but the code would change with different options.

    But for the time being, Luke's idea should work. And if you need help with the JSON just let us know.
  • adenwattsadenwatts Member
    edited June 2008
    I could see how doing it by product code rather than name would be very good for sites with inventory products.

    But, we are basically selling a subscription. And it seems like anyone offering subscriptions that come in different levels (e.g. basic, premium, etc.) would want to be able to set a quantity_max by name. And, anyone that chooses to use radio buttons with foxycart (I must be the only one so far) would probably want to set a quantity_max by name (or at least some how make foxycart work with radio buttons the way radio buttons are supposed to work).

    Anyways, I really like what you are doing with foxycart. I just wish I knew javascript so I could take advantage of all the flexibility foxycart allows.
  • brettbrett FoxyCart Team
    I've added a "flexible min/max qty" item on our feature request page:
    http://wiki.foxycart.com/feature_requests

    Please vote for that so we have a reminder for it. Not sure when we'll get to it, but for the time being the emptying of the cart works, right?
  • Is it possible to vote for more than one feature request (because I already voted for something else)?
  • brettbrett FoxyCart Team
    Yeah... Hmmm... I'll need to rethink the way we're doing that. For now though we'll just remember that you want it. It's on the list there, which is good.
Sign In or Register to comment.