[ic] Method to change pricing based on size selected

Josh Wex josh@quixer.com
Tue, 02 Jan 2001 12:40:34 -0800

After many hours, I have discovered a way to do pricing based on size.  The default interchange demo had a malfunctioning quantity pricing as well, so the changes also reflect that being fixed.  I use the default database, and use excel (I'm a newbie!) to modify the products.txt and pricing.txt files to add items.  

1)  Modify your catalog.cfg CommonAdjust line and AutoModifier and UseModifier settings:
	CommonAdjust   pricing:sku,q2,q5,q10,q25,q100, ;products:price, ==size:pricing 

	AutoModifier   pricing:sku    

	UseModifier   size 

2) I have the following columns for my products.txt file:

	sku	description	title	template_page	comment	display	image	price	wholesale	category	nontaxable	weight	size	color	        
            gift_cert	   related	featured	download	dl_type	dl_location	inactive

    If the products has a few different sizes, then specify "S=Small,M=Medium,L=Large" under the size column for the product.  If there is only one size, then leave the size     field blank.

3)  In your pricing.txt file modify the columns to look like:

	sku     price_group     q2      q5      q10     q25     q100    S       M       L

    (sku refers to the product #, price_group should be 1, set q2 etc to the price you want to charge for orders of a quantity of 2, same goes for q5, q10, q25, q100, it is ABSOLUTELY necessary to fill in all the quantity columns with the correct price (not 0).  You can set any of the S M L fields to reflect the price added to the base price you define in your products.txt file.  

4) Modify your results.html and results_big.html file:

  My section of code includes:

<td valign=top>
    <form action="[process-target]" method="post">
	<input type="hidden" name="mv_session_id" value="[data session id]">
	<input type="hidden" name="mv_todo" value="refresh">
	<input type="hidden" name="mv_order_item" value="[item-code]">
	<input type="hidden" name="mv_separate_items" value="1">

	<font __FFACE__ size=2>

<!-- MY CODE  -->
[if-item-field size]
	    [item-accessories size]
<!-- END MY CODE -->

	    <input type=text name=mv_order_quantity size=2 value="1">&nbsp;
	    <input type=submit value="Buy"

   That way, the user can select the size of the price before he hits the check out button (in demo you change size after hitting check out button ew).

5)  In your /dbconf/default_db file, edit it to look like the following:

	Database            pricing      pricing.txt           TAB
	Database            pricing      KEY                   sku
	Database            pricing      NUMERIC           q2
	Database            pricing      NUMERIC           q5
	Database            pricing      NUMERIC           q10
	Database            pricing      NUMERIC           q25
	Database            pricing      NUMERIC           q100
	Database            pricing      NUMERIC           S
	Database            pricing      NUMERIC           M
	Database            pricing      NUMERIC           L      

Rename your old pricing.gdbm and products.gdbm file.  Upload your new products.txt and pricing.txt file.   In akopia's admin User Interface, under Administration->Tables->Pricing -> Export, export the pricing file.  Do the same for the products file.  This will create a new pricing.gdbm and products.gdbm file.  Apply changes, and do a interchange --restart.  This should activate all changes.

Good luck, and thanks to cursor for his help!