3

In Expresso Store, I want to show all modifiers for a certain product instead of putting them in a dropdown. I saw this post which shows how to transform it into radio buttons, but it is not exactly what I need. I would like to have a quantity box next to each modifier option. The client should select an option first and then have to fill in a quantity, but he should be able to just enter a quentity next to the option of his choice.

How can I solve this?

1

I was looking for a solution of such problem, later figured out myself. Sharing here my solution if anybody still looks for it -

{exp:store:product_form return="/store_example/checkout"}

  {exp:channel:entries channel="products" orderby="product_order" sort="asc" disable="categories|member_data|pagination" dynamic="no" entry_id="3" }
    {exp:store:product entry_id="{entry_id}" disable_form="yes"}

      <section id="product_{count}" class="product">
      <h2>{title} // {price} 
          {if no_modifiers}<input type="text" class="qty" name="items[{count}][item_qty]" size="1" placeholder="Quantity" /> &nbsp;
          <input type="checkbox" data-qt_field_name="items[{count}][item_qty]" name="select_item">{/if}</h2>

      {modifiers}
        <p>
          <label>{modifier_name}</label>
          {if modifier_instructions}<small>{modifier_instructions}</small><br />{/if}
          {if modifier_type == 'var' OR modifier_type == 'var_single_sku'}
  <div class="checkbox">
            {modifier_options}


    <label>
      {option_name} 
      <input type="text" class="qty" name="items[{count}{option_id}][item_qty]" size="1" placeholder="Quantity" />
      <input type="checkbox" name="items[{count}{option_id}][{modifier_input_name}]" value="{option_id}" class="select_item" checked="checked" />
    </label>

            <input type="hidden" name="items[{count}{option_id}][entry_id]" value="{entry_id}" />


            {/modifier_options}
  </div>            

          {if:else}
            <input type="text" name="items[{count}][{modifier_input_name}]" />
          {/if}
        </p>
      {/modifiers}

    {if no_modifiers}
    <input type="hidden" name="items[{count}][entry_id]" value="{entry_id}" />
    {/if}


      <p>&nbsp;</p>
      </section>

    {/exp:store:product}
  {/exp:channel:entries}

  <p>
    <input type="submit" name="submit" value="Add to Cart" />
  </p>

{/exp:store:product_form}

You might see, i've checked on for option modifier field. You've to do the same or change its value to check ON using javascript before form submission.

| improve this answer | |
0

It sounds like you need the Product Form tag. The product form tag allows you to create forms which add multiple products to the cart at once (you need this if you want customers to specify quantities for more than one product and add them all at once).

It looks like this:

{exp:store:product_form}
  {exp:channel:entries channel="products" dynamic="no" limit="5"}
      {exp:store:product disable_form="yes" entry_id="{entry_id}"}
          <!-- add to cart form / product details -->
    {exp:store:product}
  {/exp:channel:entries}
{/exp:store:product_form}

Normally this works with individual products, so you will probably need some creative templating using the query module if you want to let customers add different variations of the same product to their cart at the same time.

| improve this answer | |
  • I was actually looking for something like adding a quantity field within the modifiers loop. – Bart Rylant May 12 '13 at 11:33
  • It's not possible to add a quantity field within the modifiers loop, because the idea of the modifiers loop is that the customer chooses which combination of options they would like to add to their cart. If you have more than one quantity field then you are adding multiple products to the cart at once. – Adrian Macneil May 12 '13 at 23:22
  • Also the modifier doesn't always match exactly to a product. If the product has more than one modifier then it wouldn't be possible to add just that modifier to the cart. (e.g. if you have Small/Large and Red/Green shirts, it's not possible to add a "red shirt" to the cart - the customer would also need to specify which size they need. – Adrian Macneil May 12 '13 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.