Calculating Price Using Width, Length, and Quality

Our "carpet shop" demo illustrates how to sell cloth, carpet, or something similar which needs a shopping cart intelligent enough to understand different widths, lengths, and quality grades of an item. Americart tracks all these, dynamically adjusting the price to meet the product. Americart can sell virtually anything, in any combination.

Love Carpet, Inc.

Antso Velvet Carpet

Enter Linear Feet:
This style carpet sells at $8.00 per linear foot. Some options are extra.

This example shows how to sell a product with options that affect the cost. We've also illustrated how to sell different lengths and widths of a given item. View the source code to see the construction. Pay careful attention to how we have each option (opx) affecting cost listed in the cost field of the hidden variable item. The color option which does not affect cost need not be mentioned in the item variable.

  <form action="" method="post">
<img align="left" src="velvet.jpg" alt="Image" />
<input type="hidden" name="item" value="s-8882^ve-1^Antso Velvet Carpet^op1op12op5^op3^^^lin ft.^10^" />
<!--Item fields are (from left to right):
part number
per item shipping fee (optional)
per item insurance (optional)
unit of measure (optional)
shipping weight per unit (optional)
link to picture (optional)
<strong>Antso Velvet Carpet</strong><br />
<input type="hidden" name="op5" value=" - $8.00" />
<!--base price per linear foot-->
<select name="op1">
<option value="=error= You must select either 12' or 15' roll width"> Select Width </option>
<option value="12' - $0.00"> 12' (base price) </option>
<option value="15' - $2.25"> 15' (add $2.25/lin ft) </option>
<br />
<select name="op12">
<option value="=error= You must select 1/4, 1/2, or 5/8 in. pile depth"> Select Pile Depth </option>
<option value="1/4 in pile - $0.00"> 1/4 in. pile (base price) </option>
<option value="1/2 in pile - $1.00"> 1/2 in. pile (add $1.00/lin ft.) </option>
<option value="5/8 in pile - $1.50"> 5/8 in. pile (add $1.50/lin ft.) </option>
<br />
<select name="op8">
<option value="=error= You must choose a carpet color."> Select Color </option>
<option value="Color:PG"> Pine Bough Green </option>
<option value="Color:CR"> Crimson Tide </option>
<option value="Color:MB"> Midnight Blue </option>
<option value="Color:TS"> Tequila Sunrise </option>
<br />
Enter Linear Feet:
<input type="text" name="op3" value="0" />
<br />
<input align="center" type="image" border="0" name="add" src="/images/addtocart.gif" />
<div style="clear:both"></div>
This style carpet sells at $8.00 per linear foot. Some options are extra.

Copyright. All rights reserved. Americart - 2011