Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. The items are displayed in a table format with the item id and description
  2. The quantity field is named ADD_<item ID> where <item ID> is put into the field name with ${item.getMerchantItemID()}
  3. The quantity field is initialized to an empty value and not 1 so that only those items they specify a quantity for will be added to the cart.
Note

This scenario should only be used on group page templates.

Multiple items with quantity box and drop down options

This scenario builds on the prior wholesale form, but also adds support for drop down options associated with the item.

Code Block
languagehtml/xml
themeDJango

<form method="POST" action="${checkoutUrl}">
  <input type="hidden" name="merchantId" value="${merchantID}"/>

  <table>
    <tr>
      <td>Item ID</td>
      <td>Description</td>
      <td>Options</td>
      <td>Quantity</td>
    </tr>
  #foreach($item in $group.getItems())
    <tr>
      <td valign="top">
        ${item.getMerchantItemID()}
      </td>
      <td valign="top">
        ${item.getDescription()}
      </td>
      <td valign="top">

        #foreach ($itemOption in $item.getOptions())
          #if ($itemOption.getType() == "dropdown")
            <input type="hidden" name="ADD_${item.getMerchantItemID()}_OptionName$velocityCount" value="$itemOption.getName()" />
            $itemOption.getName() <select name="ADD_${item.getMerchantItemID()}_OptionValue$velocityCount">
              #foreach ($dropDownValue in $itemOption.getDropDownValues())
                <option>$dropDownValue</option>
              #end
            </select> <br />
          #end    
        #end

      </td>
      <td valign="top">
        <input type="text" name="ADD_${item.getMerchantItemID()}" value=""/>
      </td>
    </tr>
  #end
  </table> <br />

  <input type="submit" value="add to cart"/>
</form>

Things to note about this code:

  1. The options passed in on a multi-item form using the two inputs named ADD_<item ID>OptionName# and ADD<item ID>_OptionValue#
Note

This scenario should only be used on group page templates.