Announcement

Collapse
No announcement yet.

Conditional Options?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditional Options?

    We've been using 3Dcart for quite a while, but up until this point, we haven't needed to utilize the options, advanced options, or options template features.
    What I am wondering is can any of these options be conditional with respect to another option? The simplest example I can think of is this:

    Let's say that you sell gift items and you want to be able to allow the buyer to add a gift card to the product they are purchasing. Maybe this gets set up as a non-required check box option. The customer can add it to their item for a fee, but they are not required to.

    However, once the customer selects the option, they need to write something in the card. You don't want them to be able to complete the order after selecting the gift card option, until they have written something in the text field.

    So, my question is this: Can I create an option that is non-required AND a secondary option that is only required if the first option is selected?

    My guess is that this can't be done with the standard option templates. Has anyone tried this before with any success?

  • #2
    Use option template so that you can apply this to any product at will. Name the option and set up as non-required. Select "Text Area" as option type. Add the option as you would like it to be seen, i.e. "Gift Message". Add the option price, if any.

    You don't need a conditional option. The cart will only include this option if something is typed in the text box.

    Maybe this will work for you.
    Luxlife

    Comment


    • #3
      Thank you for the reply, but this isn't exactly what I was asking.

      What I am trying to do is to require the user to enter text in a field only if the base option (check box) is selected. If they select this option, then we need additional information from them in the form of several text fields. If they have selected the base option, we don't want to allow them to checkout until they have filled in the additional text fields. Conversely, we don't want to force them to enter this additional info if they have not selected the base option.

      Comment


      • #4
        Originally posted by onering View Post
        Thank you for the reply, but this isn't exactly what I was asking.

        What I am trying to do is to require the user to enter text in a field only if the base option (check box) is selected. If they select this option, then we need additional information from them in the form of several text fields. If they have selected the base option, we don't want to allow them to checkout until they have filled in the additional text fields. Conversely, we don't want to force them to enter this additional info if they have not selected the base option.
        The only way to do this is to hard code it into your template file. You are able to get the Option ID once you create the option, then write javascript to do things based on which option id's are selected.

        You can see an example here:

        Gift Options

        Its not exactly what your talking about, but it uses the same principles. I am figuring out which option is selected, and then showing and hiding images based on that, you would simply show or hide other options.

        Comment


        • #5
          Thank you for the reply. This definitely looks similar to what I am trying to accomplish. I'm not great with javascript, so I'm not sure I totally understand what you have done here.

          Whatever I do with these options will need to be applied across the board to several thousand products, so in this case it looks like using option templates are the only feasible way to do this. I envision having somewhere in the neighborhood of a dozen different option templates, which are all nearly identical except for the name and price.

          Have you only had to modify the listing_0 template file? Also, it looks like you have the script being hosted remotely. Any additional info would be helpful.

          Comment


          • #6
            You could set up the item twice, one with the options and another without. If there a number of these, the products with the options could be placed in a separate category. Or, if they must remain in the same category, use the sorting features to control the initial display.

            This approach does not require coding.
            Luxlife

            Comment

            Working...
            X