Possible to let user define contents of product?

cindygcindyg Member
in Help edited April 2013
We have a product that will allow the user to identify the contents (mixed flavors of chocolate). They are essentially purchasing 6 boxes of chocolate for a large quantity discount and free shipping, and we want to allow them to select the flavors that are in that case of 6 boxes.

I don't see any way to give the user that flexibility in their cart, without listing all the different combinations (ridiculous).

Anyone know of a way to add a field to a product allowing the user to define their desired contents within the existing check out process? Perhaps some conditional logic, so if a quantity of 1 is put into the field for that product, a field appears asking for their desired flavor mix? If a 2 is put in, they would get 2 fields to define their flavor mixes for each case, and so on.
Comments
  • fc_adamfc_adam FoxyCart Team
    @cindyg,

    Yep - you'd use javascript to dynamically change the form as the quantity field changes. How you approach that depends on how your customers can actually select things. So for example, some people have approached it in the past where they have all of the different flavours as checkboxes, and they allow people to select checkboxes only up to the quantity that they have - so if they have 3 in the quantity, they can't select more than three checkboxes.

    Another approach you could take is the flavours in a select dropdown, and duplicate that field for each quantity, so the customer is forced to select a flavour for each box, which could be the same or different.

    You could also just duplicate a text input - although that will rely on people filling in valid flavours for your product - but is achievable all the same.

    Would any of those approaches work for you?
  • cindygcindyg Member
    Yes, these could work. I'll work with our developer to input this in our form.
  • cindygcindyg Member
    @fc_adam

    Once we create the form to accommodate the user selection of flavors, how do we pass those values into the receipt, so that the user and our fulfillment team know what should be in the mix?
  • fc_adamfc_adam FoxyCart Team
    @cindyg,

    You just set it up as an product attribute, and it will be passed through with the product. You'd just have to give the relevant inputs a unique name for the form.
  • Hi @fc_adam

    I am a little confused about custom attributes. What I have so far is an input for quantity of a product, then inputs for 4 different flavors of the product (and a total). So the main product is name="3:quantity".
    <input type="text" name="3:quantity" class="casesTotal2cups" size="2" value="0" />
    

    I have tried the following, but neither passed on the information to the cart html:

    1. The results with &flavor= appended:
    sc-withflavorappended.png
    <label for="3:quantity&flavor=darkChoc">Qty</label> <input type="text" name="3:quantity&flavor=darkChoc" id="darkChoc" size="2" value="0" class="sleeve2cups" /> Dark Sun Cups
    <label for="3:quantity&flavor=milkChoc">Qty</label> <input type="text" name="3:quantity&flavor=milkChoc" id="milkChoc" size="2" value="0" class="sleeve2cups" /> Milk Sun Cups
    <label for="3:quantity&flavor=Caramel">Qty</label> <input type="text" name="3:quantity&flavor=Caramel" id="caramelCups" size="2" value="0" class="sleeve2cups" /> Caramel Cups
    <label for="3:quantity&flavor=Mint">Qty</label> <input type="text" name="3:quantity&flavor=Mint" id="mintCups" size="2" value="0" class="sleeve2cups" /> Mint Cups
    Total: <input type="text" id="total2cups" value="" size="40" style="float: none;" />
    


    2. The results with using just a unique name:
    sc-quantityFlavor.png
    <label for="3:quantityDarkChoc">Qty</label> <input type="text" name="3:quantityDarkChoc" id="darkChoc" size="2" value="0" class="sleeve2cups" /> Dark Sun Cups
    <label for="3:quantityMilkChoc">Qty</label> <input type="text" name="3:quantityMilkChoc" id="milkChoc" size="2" value="0" class="sleeve2cups" /> Milk Sun Cups
    <label for="3:quantityCaramel">Qty</label> <input type="text" name="3:quantityCaramel" id="caramelCups" size="2" value="0" class="sleeve2cups" /> Caramel Cups
    <label for="3:quantityMint">Qty</label> <input type="text" name="3:quantityMint" id="mintCups" size="2" value="0" class="sleeve2cups" /> Mint Cups
    Total: <input type="text" id="total2cups" value="" />
    


    Ideally I would like the cart (as well as the checkout, receipt, and email) to display the totals for each flavor, with the flavor name next to it, like this (though I am not familiar with how to get that text to appear there):

    sc-ideal.png


    Thanks for any help you can provide,
    Cindy
  • fc_adamfc_adam FoxyCart Team
    @cindyg,

    Could you link me to your add to cart page so we can take a look at your form and cart setup? It looks like you're hiding the attribute name in your cart - and just displaying the value.
  • fc_adamfc_adam FoxyCart Team
    @cindyg,

    It was as I though - you have some CSS on your cart template which is hiding the product attribute labels by hiding this element ".fc_cart_item_option_name". If you remove that, it will add back in the name label, so you'd have something like this:

    Dark Sun Cups: 4
    Milk Sun Cups: 2

    Note that whatever you set as the custom attribute name in the add to cart form is what it is as the label. So you'll need to make sure you format that correctly. For example, you might set the quantity input like this:
    <input type="text" name="1:Dark Sun Cups" value="0" />
    
  • Thank you so much! I would have never figured that out since I didn't create the cart initially and had no idea the default CSS had been altered. In my brain it was more complicated than that :) Also, the name value being the output is good to know; so it just uses whatever is after the 1: ... again, never would have assumed that. Many thanks!!
Sign In or Register to comment.