Forum

Thread tagged as: Problem, Shop

So if I use product as the name for all the select boxes, the item is added to the cart, but it shows

[productHasVariants] => 1

and there is no variant_desc

If I use anything other that product for the name, nothing gets added to the cart at all.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Here's what I'm using:

<perch:if exists="has_variants">
    <perch:input id="product" type="select" options="<perch:shop id="_variant_opts" type="hidden" />" placeholder="Please choose" required="true" class="form-control" /> 
<perch:else />
    <perch:input id="product" type="hidden" value="<perch:shop id="productID" type="hidden" env-autofill="false" />" />
</perch:if>

Mmm, thing is I need to separate them out so it is clear what each option is. They are both colours, but one is for material and one is for feather so it can be confusing using just one select box.

Drew McLellan

Drew McLellan 2638 points
Perch Support

In HTML terms, how would that work if you were building it statically?

I don't know - I am used to Prestashop lol! I need the option 'groups' to be listed separately as 'Yellow, Blue' in one select box is confusing. There are way to many options (67 of each) to show them as radio buttons.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is "Yellow, Blue" a valid variant?

Sorry - been on holiday! Yes, it is Yellow material, Blue feather (my client is a milliner) although just listing Yellow, Blue; Yellow, Green; Blue, Yellow...etc in a select box is super confusing! Would be fine if it was XS, Blue; S, Blue; L, Blue, etc as it is a little more obvious, but when the two options are both a list of colours it is not so clear.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that is confusing. You'd need to name your options thing like "Blue feather" at current to have that clarified.

Hmm, that's a shame - would have looked really neat and tidy with two select boxes. Any thoughts on adding this functionality in the future? It is standard among many ecommerce platforms to have a number of separate select boxes for each option.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You don't have to use our select box - you can template your own options. Have you tried that?

Yes, but as I said previously in this thread, what I had tried had resulted in an empty cart!

This is what I was trying to get working:

<perch:productopts>
  <fieldset>
    <legend><perch:productopt id="title" /></legend>
<perch:input type="select" required="true" id="<perch:shop id="optionKey" />" name="os<perch:shop id="perch_item_index" />" options="  <perch:productvalues><perch:productvalue id="valueTitle" />|<perch:productvalue id="valueID" />,</perch:productvalues>" />

  </fieldset>
</perch:productopts>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, then I'm not sure I have a solution for your particular needs.

Hmm. I'll have to make do I suppose - it just seems odd to me that we are able to separate them into groups of radio buttons but not groups of select boxes.