<MvCOMMENT>
|
| Miva Merchant v4.x
|
| This file and the source codes contained herein are the property 
| of Miva Corporation.  Use of this file is restricted to the specific 
| terms and conditions in the License Agreement associated with this 
| file.  Distribution of this file or portions of this file for uses
| not covered by the License Agreement is not allowed without a written 
| agreement signed by an officer of Miva Corporation.
| 
| Copyright 1998-2001 Miva Corporation.  All rights reserved.
| http://www.miva.com/
|
| dBase III Database Layer
| $Source: /home/cvs/merchant/Merchant/features/usl/usl_ad.mv,v $
|
| Prefix         : MER-USL-AD-
| Next Error Code: 4    
| Next Text ID   : 71   
|
</MvCOMMENT>

<MvCOMMENT>
|
| Upsell
|
</MvCOMMENT>

<MvFUNCTION NAME = "Upsell_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.Upsell_Code" VALUE = "{ ltrim( rtrim( g.Upsell_Code ) ) }">
	<MvASSIGN NAME = "g.Upsell_Required_Percent" VALUE = "{ ltrim( rtrim( g.Upsell_Required_Percent ) ) }">
	<MvASSIGN NAME = "g.Upsell_Price" VALUE = "{ ltrim( rtrim( g.Upsell_Price ) ) }">
	<MvASSIGN NAME = "g.Upsell_Percent" VALUE = "{ ltrim( rtrim( g.Upsell_Percent ) ) }">

	<MvIF EXPR = "{ NOT len( g.Edit_Upsell ) }">
		<MvIF EXPR = "{ len( g.Upsell_Code ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-USL-AD-00000">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a product code</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'UPSL', 'Upsell_Code', l.error_message ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Product_Find_Code( g.Upsell_Code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-USL-AD-00001">
				<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ g.Upsell_Code }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product '%product%' not found</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'UPSL', 'Upsell_Code', l.error_message ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ Upsell_Find_Product_ID( Products.d.id ) }">
		<MvIF EXPR = "{ l.found }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-USL-AD-00002">
				<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ g.Upsell_Code }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product '%product%' is already configured for upsale</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'UPSL', 'Upsell_Code', l.error_message ) }">
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.Upsell_Required_Percent ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'UPSL', 'Upsell_Required_Percent', g.Validation_Message ) }">
	</MvIF>

	<MvIF EXPR = "{ g.Upsell_By_Percent }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.Upsell_Percent ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'UPSL', 'Upsell_Percent', g.Validation_Message ) }">
		</MvIF>
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_Required( g.Upsell_Price ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'UPSL', 'Upsell_Price', g.Validation_Message ) }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ g.Upsell_Product_Count }">
		<MvASSIGN NAME = "l.count" VALUE = "1">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.upsell_id" VALUE = "{ Product_Find_Code( g.Edit_Upsell ) }">
		<MvWHILE EXPR = "{ l.count LE g.Upsell_Product_Count }">
			<MvIF EXPR = "{ g.Upsell_Product_Assigned[ l.count ] AND g.Upsell_Product_ID[ l.count ] EQ l.upsell_id }">
				<MvLOCALIZED NAME = "l.error_message" ID = "MER-USL-AD-00006">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">An upsold product may not require itself</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvFUNCTIONRETURN VALUE = "{ FieldError( 'PROD', 'Upsell_Product_Assigned[' $ l.count $ ']', l.error_message ) }">
			</MvIF>
			<MvASSIGN NAME = "l.count" VALUE = "{ l.count + 1 }">
		</MvWHILE>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "USL_Navigation" STANDARDOUTPUTLEVEL = "compresswhitespace">
	<MvLOCALIZED NAME = "l.label" ID = "MER-USL-AD-00007">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Upsale</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE  = "{ LeftNavigation_Level( 2, 'UPSL(' $ Stores.d.id $ ')', 'Screen=UPBE&Store_Code='$ encodeattribute( Stores.d.code ), 'Main', l.label ) }">
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ CanI( 'UPSL', 0, 1, 0, 0 ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvLOCALIZED NAME = "l.label" ID = "MER-USL-AD-00008">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Upsold Product</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.left_nav" VALUE = "{ LeftNavigation_Dot( 3, 'Screen=UPSL&Store_Code='$ encodeattribute( Stores.d.code ), 'Main', l.label ) }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Upsell_Insert" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ CanI( 'UPSL', 0, 1, 0, 0 ) }">
	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ Upsell_Validate() }">
			<MvIF EXPR = "{ g.Upsell_By_Percent }">
				<MvASSIGN NAME = "l.price" VALUE = "{ g.Upsell_Percent }">
			<MvELSE>
				<MvASSIGN NAME = "l.price" VALUE = "{ g.Upsell_Price }">
			</MvIF>

			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Insert( Products.d.id, g.Upsell_Required_Percent, g.Upsell_By_Percent, l.price ) }">

			<MvIF EXPR = "{ l.ok }">

				<MvLOCALIZED NAME = "g.Message" ID = "MER-USL-AD-00010">
					<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ encodeentities( Products.d.name ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Upsale for Product '%product%' added</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvASSIGN NAME = "g.Edit_Upsell" VALUE = "{ g.Upsell_Code }">
			</MvIF>
		</MvIF>
	<MvELSE>
		<MvASSIGN NAME = "g.Message" VALUE = "">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Upsell_Update">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.upsell_product_name" VALUE = "">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ CanI( 'UPSL', 0, 0, 1, 0 ) }">
	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ Upsell_Validate() }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( g.Edit_Upsell ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.upsell_product_name" VALUE = "{ Products.d.name }">
				<MvIF EXPR = "{ g.Upsell_By_Percent }">
					<MvASSIGN NAME = "l.price" VALUE = "{ g.Upsell_Percent }">
				<MvELSE>
					<MvASSIGN NAME = "l.price" VALUE = "{ g.Upsell_Price }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Update( Products.d.id, g.Upsell_Required_Percent, g.Upsell_By_Percent, l.price ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.product" VALUE = 1>
				<MvWHILE EXPR = "{ l.ok AND ( l.product LE g.Upsell_Product_Count ) }">
					<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.assigned" VALUE = "{ UpsellXProduct_Find( Products.d.id, g.Upsell_Product_ID[ l.product ] ) }">

					<MvIF EXPR = "{ g.Upsell_Product_Assigned[ l.product ] }">
						<MvIF EXPR = "{ NOT l.assigned }">
							<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellXProduct_Insert( Products.d.id, g.Upsell_Product_ID[ l.product ] ) }">
						</MvIF>
					<MvELSE>
						<MvIF EXPR = "{ l.assigned }">
							<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellXProduct_Delete( Products.d.id, g.Upsell_Product_ID[ l.product ] ) }">
						</MvIF>
					</MvIF>

					<MvASSIGN NAME = "l.product" VALUE = "{ l.product + 1 }">
				</MvWHILE>
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "g.Edit_Upsell" VALUE = "{ g.Edit_Upsell }">
				<MvLOCALIZED NAME = "g.Message" ID = "MER-USL-AD-00011">
					<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ encodeentities( l.upsell_product_name ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Upsale for Product '%product%' updated</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
			</MvIF>
		</MvIF>
	<MvELSE>
		<MvASSIGN NAME = "g.Message" VALUE = "">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Upsell_Delete">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ CanI( 'UPSL', 0, 0, 0, 1 ) }">
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( g.Edit_Upsell ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Delete( Products.d.id ) }">
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvLOCALIZED NAME = "g.Message" ID = "MER-USL-AD-00012">
				<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ encodeentities( Products.d.name ) }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Upsale for Product '%product%' deleted</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvASSIGN NAME = "g.Edit_Upsell" VALUE = "">
			<MvASSIGN NAME = "g.Tab" VALUE = "">

			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.update_leftnav" VALUE = "{ Update_LeftNavigation() }">
		</MvIF>
	<MvELSE>
		<MvASSIGN NAME = "g.Message" VALUE = "">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "UpsaleSettings_Validate">
	<MvASSIGN NAME = "g.Upsell_Products_Shown" VALUE = "{ ltrim( rtrim( g.Upsell_Products_Shown ) ) }">
	<MvASSIGN NAME = "g.Upsell_Products_Sell" VALUE = "{ ltrim( rtrim( g.Upsell_Products_Sell ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_WholeNumber_NonNegative_Required( g.Upsell_Products_Shown ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'SETT', 'Upsell_Products_Shown', g.Validation_Message ) }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_WholeNumber_NonNegative_Required( g.Upsell_Products_Sell ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'SETT', 'Upsell_Products_Sell', g.Validation_Message ) }">
	</MvIF>

	<MvIF EXPR = "{ g.Upsell_Products_Sell GT g.Upsell_Products_Shown }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-USL-AD-00017">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Max Number of Upsold Products must be less than or equal to Products to Show</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'SETT', 'Upsell_Products_Sell', l.error_message ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "Upsell_BatchEdit_Validate">
	<MvASSIGN NAME = "g.Upsell_Price" VALUE = "{ ltrim( rtrim( g.Upsell_Price ) ) }">
	<MvASSIGN NAME = "g.Upsell_Percent" VALUE = "{ ltrim( rtrim( g.Upsell_Percent ) ) }">
	<MvASSIGN NAME = "g.Upsell_Required_Percent" VALUE = "{ ltrim( rtrim( g.Upsell_Required_Percent ) ) }">

	<MvIF EXPR = "{ len( g.Edit_Upsell ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_Required( g.Upsell_Price ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'USBE', 'Upsell_Price', g.Validation_Message ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.Upsell_Percent ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'USBE', 'Upsell_Percent', g.Validation_Message ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.Upsell_Required_Percent ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'USBE', 'Upsell_Required_Percent', g.Validation_Message ) }">
		</MvIF>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "Action_UpsellOptions_Update" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.valid" VALUE = "1">
	<MvASSIGN NAME = "l.modified" VALUE = "0">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'UPSL', 0, 0, 1, 0 ) }">

	<MvASSIGN NAME = "l.valid2" VALUE = "{ Upsell_BatchEdit_Validate() }">

	<MvIF EXPR = "{ l.valid2 }">
		<MvIF EXPR = "{ len( g.Edit_Upsell ) AND l.can_modify }">
			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Find_Product_ID( g.Edit_Upsell ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvIF EXPR = "{ g.Upsell_By_Percent }">
					<MvASSIGN NAME = "l.price" VALUE = "{ g.Upsell_Percent }">
				<MvELSE>
					<MvASSIGN NAME = "l.price" VALUE = "{ g.Upsell_Price }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellBatchEdit_Update( Upsell.d.product_id,
																								 g.Upsell_Required_Percent,
																								 g.Upsell_By_Percent,
																								 l.price ) }">
				<MvASSIGN NAME = "g.Edit_Upsell" VALUE = "">
				<MvASSIGN NAME = "l.modified" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ CanI( 'UPSL', 0, 0, 0, 1 ) }">
	<MvIF EXPR = "{ l.ok AND ( NOT len( g.Edit_Upsell ) ) }">
		<MvASSIGN NAME = "l.upsell" VALUE = 1>
		<MvWHILE EXPR = "{ l.ok AND ( l.upsell LE g.Upsell_Count ) }">
			<MvIF EXPR = "{ g.Upsell_Remove[ l.upsell ] }">
				<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Find_Product_ID( g.Upsell[ l.upsell ] ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellEdit_Delete( Upsell.d.product_id ) }">
					<MvASSIGN NAME = "l.modified" VALUE = "1">
				</MvIF>
			</MvIF>
			<MvASSIGN NAME = "l.upsell" VALUE = "{ l.upsell + 1 }">
		</MvWHILE>
	</MvIF>

	<MvASSIGN NAME = "l.valid" VALUE = "{ UpsaleSettings_Validate() }">

	<MvIF EXPR = "{ l.valid }">
		<MvIF EXPR = "{ l.ok AND l.can_modify }">
			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellOptions_Update( g.Upsell_Products_Shown, g.Upsell_Products_Sell ) }">
			<MvASSIGN NAME = "l.modified" VALUE = "1">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND l.valid AND l.valid2 AND l.can_modify }">
		<MvIF EXPR = "{ l.modified }">
			<MvLOCALIZED NAME = "g.Message" ID = "MER-USL-AD-00021">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Upsale updated</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
		<MvELSE>
			<MvASSIGN NAME = "g.Message" VALUE = "">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Screen_Upsale_BatchEdit" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add"	  VALUE = "{ CanI( 'UPSL', 0, 1, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'UPSL', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'UPSL', 0, 0, 0, 1 ) }">

	<MvIF EXPR = "{ g.Load_Fields }">
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellOptions_Find() }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "g.Upsell_Products_Shown" VALUE = "{ UpsellOptions.d.prod_shown }">
			<MvASSIGN NAME = "g.Upsell_Products_Sell" VALUE = "{ UpsellOptions.d.prod_sell }">
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ _DB_Store_Open_Upsell() }">
	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ NOT g.Have_List_Fields }">
			<MvASSIGN NAME = "g.Upsell_Stack" VALUE = "">
			<MvASSIGN NAME = "g.Upsell_Search" VALUE = "">
			<MvASSIGN NAME = "g.Upsell_Offset" VALUE = 0>
			<MvASSIGN NAME = "g.Upsell_Display" VALUE = "{ g.Admin_User_PageLen }">
		<MvELSE>
			<MvASSIGN NAME = "g.Upsell_Display" VALUE = "{ int( g.Upsell_Display ) }">
			<MvIF EXPR = "{ g.Upsell_Display LT 1 }">
				<MvASSIGN NAME = "g.Upsell_Display" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvLOCALIZED NAME = "l.title" ID = "MER-USL-AD-00022">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Upsale</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin_screen" VALUE = "{ BeginScreen( l.title, 'SETT', 'Help:upsl.html' ) }">
	<INPUT TYPE = "hidden" NAME = "Have_List_Fields" VALUE = 1>

	<MvLOCALIZED NAME = "l.tab_list" ID = "MER-USL-AD-00023">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">USBE:Upsold Products,SETT:Settings</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.draw_tabs" VALUE = "{ DrawTabs( 'USBE', l.tab_list ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin_content" VALUE = "{ BeginContent() }">
	<SCRIPT LANGUAGE = "JavaScript">
<!--
function EditUpsell( upsell_code )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Edit_Upsell' ].value = unescape( upsell_code );
		document.forms[ Screen ].elements[ 'Action' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].submit();
	}
}

//-->
	</SCRIPT>

	<MvHIDE FIELDS = "g.Edit_Upsell">

	<MvIF EXPR = "{ g.Tab EQ 'SETT' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00024">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Upsold Products to Show:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD WIDTH = "100%" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" SIZE = 5 NAME = "Upsell_Products_Shown" VALUE = "{ encodeentities( g.Upsell_Products_Shown ) }">
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00025">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Max Number of Upsold Products to Select:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B><BR></FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "5" NAME = "Upsell_Products_Sell" VALUE = "{ encodeentities( g.Upsell_Products_Sell ) }">
			</FONT>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.Upsell_Products_Shown, g.Upsell_Products_Sell">
	</MvIF>

	<MvIF EXPR = "{ g.Tab EQ 'USBE' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>
		<TR><TD>
			&nbsp;
		</TD><TD ALIGN = "right" VALIGN = "middle" WIDTH = "100%">
			&nbsp;
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00026">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Search:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD ALIGN = "right" VALIGN = "middle" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvASSIGN NAME = "g.Upsell_Search" VALUE = "{ ltrim( rtrim( g.Upsell_Search ) ) }">
			<INPUT TYPE = "text" NAME = "Upsell_Search" VALUE = "{ encodeentities( g.Upsell_Search) }" SIZE = 20>
			<A HREF = "JavaScript:ListReload( 'Upsell_Offset', 'Upsell_Stack' );">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_search" VALUE = "{ DrawImgButton_Search(0) }">
			<MvEVAL EXPR = "{ l.button_search }"></A>
			</FONT>
		</TD></TR>
		</TABLE>

		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR>

		<MvIF EXPR = "{ len( g.Edit_Upsell ) EQ 0 AND l.can_delete }">
			<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>			
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00027">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Remove</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			<BR>
			<MvLOCALIZED NAME = "l.check_all" ID = "MER-USL-AD-00067">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Check All</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvLOCALIZED NAME = "l.uncheck_all" ID = "MER-USL-AD-00068">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Uncheck All</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<A HREF = "JavaScript:CheckAll( 'Upsell_Remove', 1 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'checkall.gif' }" ALT = "{ l.check_all }"></A>
			&nbsp;	
			<A HREF = "JavaScript:CheckAll( 'Upsell_Remove', 0 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'uncheckall.gif' }" ALT = "{ l.uncheck_all }"></A>
			</TD>
		</MvIF>

		<TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00028">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product Code</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00029">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Threshold Percent</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00030">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Pricing</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00031">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Price</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-USL-AD-00032">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP COLSPAN = 2>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.add" VALUE  = "{ CanI( 'UPSL', 0, 1, 0, 0 ) AND CanI( 'PROD', 1, 0, 0, 0 ) }">
			<MvIF EXPR = "{ l.add }">
				<MvLOCALIZED NAME = "l.alt" ID = "MER-ADM-01341">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Upsold Product</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<A HREF = "{ g.sessionurl $ 'Screen=UPSL&Store_Code=' $ encodeattribute( g.Store_Code ) }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_newx" VALUE = "{ DrawImgButton_NewX( 0, l.alt ) }">
				<MvEVAL EXPR = "{ l.button_newx }"></A>
			<MvELSE>
				&nbsp;
			</MvIF>
			</FONT>
		</TD></TR>

		<MvASSIGN NAME = "l.shown" VALUE = 0>
		<MvASSIGN NAME = "l.lastoffset" VALUE = 0>

		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_FindOffset_All( g.Upsell_Offset, g.Upsell_Search ) }">

		<MvWHILE EXPR = "{ ( l.shown LT g.Upsell_Display ) AND l.nextoffset AND l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_ID( Upsell.d.product_id ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.shown" VALUE = "{ l.shown + 1 }">

				<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
				<MvELSE>
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
				</MvIF>
				<MvASSIGN NAME = "g.Upsell_By_Percent" VALUE = "{ Upsell.d.percent }">
				<MvIF EXPR = "{ ( len( g.Edit_Upsell ) NE 0 ) AND
								( g.Edit_Upsell EQ Upsell.d.product_id ) AND l.can_modify }">
					<MvIF EXPR = "{ NOT g.Data_Entry_Error }">
						<MvASSIGN NAME = "g.Upsell_Required_Percent" VALUE = "{ Upsell.d.req_percnt }">

						<MvIF EXPR = "{ g.Upsell_By_Percent }">
							<MvASSIGN NAME = "g.Upsell_Price" VALUE = "0.00">
							<MvASSIGN NAME = "g.Upsell_Percent" VALUE = "{ Upsell.d.price }">
						<MvELSE>
							<MvASSIGN NAME = "g.Upsell_Price" VALUE = "{ Upsell.d.price }">
							<MvASSIGN NAME = "g.Upsell_Percent" VALUE = "0.00">
						</MvIF>
					</MvIF>

					<TR><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "hidden" NAME = "{ 'Upsell_Product_ID[' $ l.shown $ ']' }" VALUE = "{ encodeentities( Products.d.id ) }">
						<MvEVAL EXPR = "{ encodeentities( Products.d.code ) }">
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" NAME = "Upsell_Required_Percent" VALUE = "{ encodeentities( g.Upsell_Required_Percent ) }" SIZE = 15 ONCHANGE = "SetModified();">
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<SELECT NAME = "Upsell_By_Percent">
						<MvLOCALIZED NAME = "l.option" ID = "MER-USL-AD-00033">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Absolute</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( '', g.Upsell_By_Percent, l.option ) }">

						<MvLOCALIZED NAME = "l.option" ID = "MER-USL-AD-00034">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( '1', g.Upsell_By_Percent, l.option ) }">
						</SELECT>
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" NAME = "Upsell_Price" VALUE = "{ encodeentities( g.Upsell_Price ) }" SIZE = 10 ONCHANGE = "SetModified();">
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" NAME = "Upsell_Percent" VALUE = "{ encodeentities( g.Upsell_Percent ) }" SIZE = 10 ONCHANGE = "SetModified();">%
						</FONT>
					</TD><TD ALIGN = "right" VALIGN = "top" BGCOLOR = "{ l.bgcolor }" WIDTH = "100%" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<A HREF = "JavaScript:EditUpsell( '' );">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_edithere" VALUE = "{ DrawImgButton_EditHere('1') }">
						<MvEVAL EXPR = "{ l.button_edithere }"></A>
						
						<A HREF = "{ g.sessionurl $ 'Screen=UPSL&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Upsell=' $ encodeattribute( Products.d.code ) }">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_edit" VALUE = "{ DrawImgButton_Edit('0') }">
						<MvEVAL EXPR = "{ l.button_edit }"></A>
						</FONT>
					</TD></TR>
				<MvELSE>
					<TR>
					<MvIF EXPR = "{ ( len( g.Edit_Upsell ) EQ 0 ) AND ( l.can_delete ) }">
						<TD VALIGN = "top" ALIGN = "center" BGCOLOR = "{ l.bgcolor }">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "hidden" NAME = "{ 'Upsell[' $ l.shown $ ']' }" VALUE = "{ encodeentities( Upsell.d.product_id ) }">
							<INPUT TYPE = "checkbox" NAME = "{ 'Upsell_Remove[' $ l.shown $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvEVAL EXPR = "{ encodeentities( Products.d.code ) }">
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvEVAL EXPR = "{ encodeentities( Upsell.d.req_percnt ) }">
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ Upsell.d.percent }">
							<MvLOCALIZED ID = "MER-USL-AD-00035">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent of Total</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						<MvELSE>
							<MvLOCALIZED ID = "MER-USL-AD-00036">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Absolute</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ NOT Upsell.d.percent }">
							<MvEVAL EXPR = "{ encodeentities( Upsell.d.price ) }">
						<MvELSE>
							<MvLOCALIZED ID = "MER-USL-AD-00037">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US"><I>n/a</I></MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>
						</FONT>
					</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ Upsell.d.percent }">
							<MvEVAL EXPR = "{ encodeentities( Upsell.d.price ) }">%
						<MvELSE>
							<MvLOCALIZED ID = "MER-USL-AD-00038">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US"><I>n/a</I></MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>
						</FONT>
					</TD><TD ALIGN = "right" VALIGN = "top" BGCOLOR = "{ l.bgcolor }" NOWRAP WIDTH = "100%">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ l.can_modify }">
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encoded" VALUE = "{ JavaScriptEncode( Upsell.d.product_id ) }">
							<MvEVAL EXPR = "{ '<A HREF = "JavaScript:EditUpsell( \'' $ l.encoded $ '\' );">' }">
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_edithere" VALUE = "{ DrawImgButton_EditHere('0') }">
							<MvEVAL EXPR = "{ l.button_edithere $ '</A>' }">
						<MvELSE>
							&nbsp;
						</MvIF>
						<A HREF = "{ g.sessionurl $ 'Screen=UPSL&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Upsell=' $ encodeattribute( Products.d.code ) }">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_edit" VALUE = "{ DrawImgButton_Edit('0') }">
						<MvEVAL EXPR = "{ l.button_edit }"></A>
						</FONT>
					</TD></TR>
				</MvIF>
			</MvIF>

			<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">
			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_FindNext_All( l.nextoffset, g.Upsell_Search ) }">
		</MvWHILE>

		<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvHIDE FIELDS = "g.Upsell_Stack, g.Upsell_Offset">
			<MvIF EXPR = "{ l.shown }">
				<B><MvEVAL EXPR = "{ g.Upsell_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
			<MvELSE>
				<B>0-0</B>
			</MvIF>
			</FONT>
		</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = "7">
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvIF EXPR = "{ len( g.Upsell_Stack ) }">
				<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListPrevious( \'Upsell_Offset\', \'Upsell_Stack\' );">' }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_prev" VALUE = "{ DrawImgButton_Previous('0') }">
				<MvEVAL EXPR = "{ l.button_prev $ '</A>' }">
			</MvIF>

			 <INPUT TYPE = "text" NAME = "Upsell_Display" VALUE = "{ encodeentities( g.Upsell_Display ) }" SIZE = 5> <A HREF = "JavaScript:ListReload( 'Upsell_Offset', 'Upsell_Stack' );">
			 <MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_refresh" VALUE = "{ DrawImgButton_Refresh('0') }">
			 <MvEVAL EXPR = "{ l.button_refresh }"></A>
			 <INPUT TYPE = "hidden" NAME = "Upsell_Count" VALUE = "{ encodeentities( l.shown ) }">

			 <MvIF EXPR = "{ l.nextoffset }">
				<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'Upsell_Offset\', \'Upsell_Stack\', ' $ l.lastoffset $ ' );">' }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_next" VALUE = "{ DrawImgButton_Next('0') }">
				<MvEVAL EXPR = "{ l.button_next $ '</A>' }">
			 </MvIF>
			</FONT>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.Upsell_Stack, g.Upsell_Search, g.Upsell_Offset, g.Upsell_Display, g.Upsell_Count, g.Upsell_Required_Percent, g.Upsell_By_Percent, g.Upsell_Price, g.Upsell_Percent">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.endcontent" VALUE = "{ EndContent() }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.drew_button" VALUE = "{ DrawButtons( 'UUST:[UPDATE]:UPSL:0:1:0' ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end_screen" VALUE = "{ EndScreen() }">

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Screen_Upsell" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvLOCALIZED NAME = "l.title" ID = "MER-USL-AD-00039">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Upsold Product</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvASSIGN NAME = "l.action" VALUE = "IPSL">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add"	VALUE = "{ CanI( 'UPSL', 0, 1, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'UPSL', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'UPSL', 0, 0, 0, 1 ) }">

	<MvIF EXPR = "{ len( g.Edit_Upsell ) EQ 0 AND l.can_add EQ 0 }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok"	VALUE = "{ Screen_Blank() }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvIF EXPR = "{ len( g.Edit_Upsell ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( g.Edit_Upsell ) }">

		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Find_Product_ID( Products.d.id ) }">
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvLOCALIZED NAME = "l.title" ID = "MER-USL-AD-00040">
				<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ encodeentities( Products.d.name ) }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Edit Upsold Product: %product%</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvIF EXPR = "{ g.Load_Fields }">
				<MvASSIGN NAME = "g.Upsell_Required_Percent" VALUE = "{ Upsell.d.req_percnt }">

				<MvIF EXPR = "{ Upsell.d.percent }">
					<MvASSIGN NAME = "g.Upsell_By_Percent" VALUE = 1>
					<MvASSIGN NAME = "g.Upsell_Price" VALUE = "0.00">
					<MvASSIGN NAME = "g.Upsell_Percent" VALUE = "{ Upsell.d.price }">
				<MvELSE>
					<MvASSIGN NAME = "g.Upsell_By_Percent" VALUE = 0>
					<MvASSIGN NAME = "g.Upsell_Price" VALUE = "{ Upsell.d.price }">
					<MvASSIGN NAME = "g.Upsell_Percent" VALUE = "0.00">
				</MvIF>
			</MvIF>
		</MvIF>
	<MvELSE>
		<MvIF EXPR = "{ g.Load_Fields }">
			<MvASSIGN NAME = "g.Upsell_Code" VALUE = "">
			<MvASSIGN NAME = "g.Upsell_Required_Percent" VALUE = "0.00">
			<MvASSIGN NAME = "g.Upsell_By_Percent" VALUE = "1">
			<MvASSIGN NAME = "g.Upsell_Price" VALUE = "0.00">
			<MvASSIGN NAME = "g.Upsell_Percent" VALUE = "0.00">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ NOT g.Have_List_Fields }">
		<MvASSIGN NAME = "g.Upsell_Product_Stack" VALUE = "">
		<MvASSIGN NAME = "g.Upsell_Product_Search" VALUE = "">
		<MvASSIGN NAME = "g.Upsell_Product_Show" VALUE = "All">

		<MvASSIGN NAME = "g.Upsell_Product_Offset" VALUE = 0>
		<MvASSIGN NAME = "g.Upsell_Product_Display" VALUE = "{ g.Admin_User_PageLen }">
	<MvELSE>
		<MvASSIGN NAME = "g.Upsell_Product_Display" VALUE = "{ int( g.Upsell_Product_Display ) }">
		<MvIF EXPR = "{ g.Upsell_Product_Display LT 1 }">
			<MvASSIGN NAME = "g.Upsell_Product_Display" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin_screen" VALUE = "{ BeginScreen( l.title, l.action, 'Help:upsl.html' ) }">
		<INPUT TYPE = "hidden" NAME = "Have_List_Fields" VALUE = 1>

		<MvIF EXPR = "{ len( g.Edit_Upsell ) }">
			<MvHIDE FIELDS = "g.Edit_Upsell">
		</MvIF>

		<MvIF EXPR = "{ len( g.Edit_Upsell ) }">
			<MvLOCALIZED NAME = "l.tab_list" ID = "MER-USL-AD-00041">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">UPSL:Upsold Product,PROD:Required Products</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.tab" VALUE = "{ DrawTabs( 'UPSL', l.tab_list ) }">
		<MvELSE>
			<MvLOCALIZED NAME = "l.tab_list" ID = "MER-USL-AD-00042">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">UPSL:Upsold Product</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.tab" VALUE = "{ DrawTabs( 'UPSL', l.tab_list ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin_content" VALUE = "{ BeginContent() }">

		<MvIF EXPR = "{ g.Tab EQ 'UPSL' }">
			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00043">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product Code:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD WIDTH = "100%" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ g.Edit_Upsell }">
					<MvEVAL EXPR = "{ encodeentities( Products.d.code ) }">
				<MvELSE>
					<INPUT TYPE = "text" SIZE = 20 NAME = "Upsell_Code" VALUE = "{ encodeentities( g.Upsell_Code ) }"> <A HREF = "JavaScript:PopupProductLookup( 'Upsell_Code' );">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.lookup" VALUE = "{ DrawImgButton_Lookup(0) }">
					<MvEVAL EXPR = "{ l.lookup }"></A>
				</MvIF>
				</FONT>
			</TD></TR>

			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00044">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Threshold Percentage of Order Total:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B><BR></FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" SIZE = "20" NAME = "Upsell_Required_Percent" VALUE = "{ encodeentities( g.Upsell_Required_Percent ) }"> %
				</FONT>
			</TD></TR>

			<TR><TD NOWRAP VALIGN = "top">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00045">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Pricing:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD NOWRAP>
				<TABLE BORDER = 0 CELLPADDING = 0 CELLSPACING = 0>
				<TR><TD>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-USL-AD-00046">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Absolute Price:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawRadio( 'Upsell_By_Percent', '', g.Upsell_By_Percent, l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" NAME = "Upsell_Price" VALUE = "{ encodeentities( g.Upsell_Price ) }" SIZE = 10>
					</FONT>
				</TD></TR>

				<TR><TD>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-USL-AD-00047">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent of Original Price:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawRadio( 'Upsell_By_Percent', '1', g.Upsell_By_Percent, l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" NAME = "Upsell_Percent" VALUE = "{ encodeentities( g.Upsell_Percent ) }" SIZE = 10> %
					</FONT>
				</TD></TR>
				</TABLE>
			</TD></TR>
			</TABLE>
		<MvELSE>
			<MvHIDE FIELDS = "g.Upsell_Code, g.Upsell_Required_Percent, g.Upsell_By_Percent, g.Upsell_Price, g.Upsell_Percent">
		</MvIF>

		<MvIF EXPR = "{ g.Tab EQ 'PROD' }">
			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
			<TR><TD ALIGN = "left" VALIGN = "middle" WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "hidden" NAME = "Upsell_Product_Show" VALUE = "{ encodeentities( g.Upsell_Product_Show ) }">

				<A HREF = "JavaScript:ListReloadField( 'Upsell_Product_Offset', 'Upsell_Product_Stack', 'Upsell_Product_Show', 'All' );">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_all" VALUE = "{ DrawImgButton_All( g.Upsell_Product_Show EQ 'All' ) }">
				<MvEVAL EXPR = "{ l.button_all }"></A>

				<A HREF = "JavaScript:ListReloadField( 'Upsell_Product_Offset', 'Upsell_Product_Stack', 'Upsell_Product_Show', 'Unassigned' );">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_unassign" VALUE = "{ DrawImgButton_Unassigned( g.Upsell_Product_Show EQ 'Unassigned' ) }">
				<MvEVAL EXPR = "{ l.button_unassign }"></A>

				<A HREF = "JavaScript:ListReloadField( 'Upsell_Product_Offset', 'Upsell_Product_Stack', 'Upsell_Product_Show', 'Assigned' );">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_assign" VALUE = "{ DrawImgButton_Assigned( g.Upsell_Product_Show EQ 'Assigned' ) }">
				<MvEVAL EXPR = "{ l.button_assign }"></A>

				</FONT>
			</TD><TD ALIGN = "right" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00048">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Search:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "right" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvASSIGN NAME = "g.Upsell_Product_Search" VALUE = "{ ltrim( rtrim( g.Upsell_Product_Search ) ) }">
				<INPUT TYPE = "text" NAME = "Upsell_Product_Search" VALUE = "{ encodeentities( g.Upsell_Product_Search ) }" SIZE = 20>
				<A HREF = "JavaScript:ListReload( 'Upsell_Product_Offset', 'Upsell_Product_Stack' );">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_search" VALUE = "{ DrawImgButton_Search(0) }">
				<MvEVAL EXPR = "{ l.button_search }"></A>
				</FONT>
			</TD></TR>
			</TABLE>

			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
			<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00049">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Assigned</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT><BR>
				<MvLOCALIZED NAME = "l.check_all" ID = "MER-USL-AD-00069">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Check All</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.uncheck_all" ID = "MER-USL-AD-00070">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Uncheck All</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<A HREF = "JavaScript:CheckAll( 'Upsell_Product_Assigned', 1 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'checkall.gif' }" ALT = "{ l.check_all }"></A>
				&nbsp;
				<A HREF = "JavaScript:CheckAll( 'Upsell_Product_Assigned', 0 );"><IMG BORDER = 0 SRC = "{ 'graphics/' $ s.miva_language $'/admin/uncheckall.gif' }" ALT = "{ l.uncheck_all }"></A>
			</TD><TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00050">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Code</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD BGCOLOR = "#000080" WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-USL-AD-00051">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Name</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.prod_add" VALUE = "{ CanI( 'PROD', 0, 1, 0, 0 ) }">
				<MvIF EXPR = "{ l.prod_add }">
					<MvLOCALIZED NAME = "l.alt" ID = "MER-USL-AD-00052">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Product</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<A HREF = "{ g.sessionurl $ 'Screen=PROD&Store_Code=' $ encodeattribute( g.Store_Code ) }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_newx" VALUE = "{ DrawImgButton_NewX( 0, l.alt ) }">
					<MvEVAL EXPR = "{ l.button_newx }"></A>
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD></TR>

			<MvASSIGN NAME = "l.shown" VALUE = 0>
			<MvASSIGN NAME = "l.lastoffset" VALUE = 0>

			<MvIF EXPR = "{ ( g.Upsell_Product_Show EQ 'All' ) OR ( g.Upsell_Product_Show EQ 'Unassigned' ) }">
				<MvASSIGN NAME = "l.assigned" VALUE = 0>
			</MvIF>

			<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'Assigned' }">
				<MvASSIGN NAME = "l.assigned" VALUE = 1>
			</MvIF>

			<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'All' }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.nextoffset" VALUE = "{ Product_FindOffset_All( g.Upsell_Product_Offset, g.Upsell_Product_Search ) }">
			</MvIF>

			<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'Unassigned' }">
				<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_Product_FindOffset_Unassigned( Upsell.d.product_id, g.Upsell_Product_Offset, g.Upsell_Product_Search ) }">
			</MvIF>

			<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'Assigned' }">
				<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_Product_FindOffset_Assigned( Upsell.d.product_id, g.Upsell_Product_Offset, g.Upsell_Product_Search ) }">
			</MvIF>

			<MvWHILE EXPR = "{ ( l.shown LT g.Upsell_Product_Display ) AND l.nextoffset }">
				<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'All' }">
					<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.assigned" VALUE = "{ UpsellXProduct_Find( Upsell.d.product_id, Products.d.id ) }">
				</MvIF>

				<MvASSIGN NAME = "l.shown" VALUE = "{ l.shown + 1 }">

				<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
				<MvELSE>
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
				</MvIF>

				<TR><TD ALIGN = "center" BGCOLOR = "{ l.bgcolor }" VALIGN = "top">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvIF EXPR = "{ l.can_modify }">
						<MvIF EXPR = "{ l.assigned }">
							<INPUT TYPE = "checkbox" NAME = "{ 'Upsell_Product_Assigned[' $ l.shown $ ']' }" VALUE = "Yes" CHECKED ONCLICK = "SetModified();">
						<MvELSE>
							<INPUT TYPE = "checkbox" NAME = "{ 'Upsell_Product_Assigned[' $ l.shown $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
						</MvIF>
					<MvELSE>
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.check_assign" VALUE = "{ DrawCheck_Assigned( l.assigned ) }">
					</MvIF>
					</FONT>
				</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "hidden" NAME = "{ 'Upsell_Product_ID[' $ l.shown $ ']' }" VALUE = "{ encodeentities( Products.d.id ) }">
					<MvEVAL EXPR = "{ encodeentities( Products.d.code ) }">
					</FONT>
				</TD><TD BGCOLOR = "{ l.bgcolor }" WIDTH = "100%" VALIGN = "top">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvEVAL EXPR = "{ encodeentities( Products.d.name ) }">
					</FONT>
				</TD><TD ALIGN = "right" BGCOLOR = "{ l.bgcolor }" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ CanI( 'PROD', 1, 0, 0, 0 ) }">
					<MvIF EXPR = "{ l.ok }">
						<A HREF = "{ g.sessionurl $ 'Screen=PROD&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Product=' $ encodeattribute( Products.d.code ) }">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_edit" VALUE = "{ DrawImgButton_Edit('0') }">
						<MvEVAL EXPR = "{ l.button_edit }"></A>
					<MvELSE>
						&nbsp;
					</MvIF>
					</FONT>
				</TD></TR>

				<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">

				<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'All' }">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.nextoffset" VALUE = "{ Product_FindNext_All( l.nextoffset, g.Upsell_Product_Search ) }">
				</MvIF>

				<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'Unassigned' }">
					<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_Product_FindNext_Unassigned( Upsell.d.product_id, l.nextoffset, g.Upsell_Product_Search ) }">
				</MvIF>

				<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'Assigned' }">
					<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_Product_FindNext_Assigned( Upsell.d.product_id, l.nextoffset, g.Upsell_Product_Search ) }">
				</MvIF>
			</MvWHILE>

			<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
				<MvHIDE FIELDS = "g.Upsell_Product_Stack, g.Upsell_Product_Offset">
				<MvIF EXPR = "{ g.Upsell_Product_Show EQ 'All' }">
					<MvIF EXPR = "{ l.shown }">
						<B><MvEVAL EXPR = "{ g.Upsell_Product_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
					<MvELSE>
						<B>0-0</B>
					</MvIF>
				<MvELSE>
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_newx" VALUE = "{ Show_BoldNA() }">
				</MvIF>
				</FONT>
			</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = 3>
				<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
				<MvIF EXPR = "{ len( g.Upsell_Product_Stack ) }">
					<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListPrevious( \'Upsell_Product_Offset\', \'Upsell_Product_Stack\' );">' }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_prev" VALUE = "{ DrawImgButton_Previous('0') }">
					<MvEVAL EXPR = "{ l.button_prev $ '</A>' }">
				</MvIF>

				 <INPUT TYPE = "text" NAME = "Upsell_Product_Display" VALUE = "{ encodeentities( g.Upsell_Product_Display ) }" SIZE = 5> <A HREF = "JavaScript:ListReload( 'Upsell_Product_Offset', 'Upsell_Product_Stack' );">

				 <MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_refresh" VALUE = "{ DrawImgButton_Refresh('0') }">
				 <MvEVAL EXPR = "{ l.button_refresh }"></A>
				 <INPUT TYPE = "hidden" NAME = "Upsell_Product_Count" VALUE = "{ encodeentities( l.shown ) }">

				 <MvIF EXPR = "{ l.nextoffset }">
					<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'Upsell_Product_Offset\', \'Upsell_Product_Stack\', ' $ l.lastoffset $ ' );">' }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_next" VALUE = "{ DrawImgButton_Next('0') }">
					<MvEVAL EXPR = "{ l.button_next $ '</A>' }">
				 </MvIF>
				</FONT>
			</TD></TR>
			</TABLE>
		<MvELSE>
			<MvHIDE FIELDS = "g.Upsell_Product_Stack, g.Upsell_Product_Search, g.Upsell_Product_Show, g.Upsell_Product_Offset, g.Upsell_Product_Display">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.endcontent" VALUE = "{ EndContent() }">

		<MvIF EXPR = "{ len( g.Edit_Upsell ) }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.draw_button" VALUE = "{ DrawButtons( 'UUSL:[UPDATE]:UPSL:0:1:0,DUSL:[DELETE]:UPSL:0:0:1' ) }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.draw_button" VALUE = "{ DrawButtons( 'IUSL:[ADD]:UPSL:1:0:0' ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end_screen" VALUE = "{ EndScreen() }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "USL_ProductEditScreen_UpsaleTab" STANDARDOUTPUTLEVEL = "text,html,compresswhitespace">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_view_upsale" VALUE = "{ CanI( 'UPSL', 1, 0, 0, 0 ) }">
	<MvIF EXPR = "{ l.can_view_upsale }">
		<MvLOCALIZED NAME = "l.moretabs" ID = "MER-USL-AD-00053">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">UPSL:Upsold Products</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.moretabs }">
</MvFUNCTION>

<MvFUNCTION NAME = "USL_ProductScreen_Display_UpsaleTab" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
	<TR>

	<TD BGCOLOR = "#000080">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-USL-AD-00054">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product Code</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD BGCOLOR = "#000080">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-USL-AD-00055">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Threshold Percent</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD BGCOLOR = "#000080">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-USL-AD-00056">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Pricing</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD BGCOLOR = "#000080">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-USL-AD-00057">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Price</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD BGCOLOR = "#000080" COLSPAN = 2>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-USL-AD-00058">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP COLSPAN = 2>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
			&nbsp;
		</FONT>
	</TD></TR>

	<MvASSIGN NAME = "l.shown" VALUE = 0>
	<MvASSIGN NAME = "l.lastoffset" VALUE = 0>

	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_Required_FindFirst( Products.d.id, g.Upsell_Offset ) }">
	<MvWHILE EXPR = "{ ( l.shown LT g.Upsell_Display ) AND l.nextoffset }">
		<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_ID( UpsellXProduct.d.product_id ) }">
		<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Find_Product_ID( UpsellXProduct.d.product_id ) }">
			<MvASSIGN NAME = "l.shown" VALUE = "{ l.shown + 1 }">

			<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
			<MvELSE>
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
			</MvIF>
				<TR><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvEVAL EXPR = "{ encodeentities( Products.d.code ) }">
					</FONT>
				</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvEVAL EXPR = "{ encodeentities( Upsell.d.req_percnt ) }">
					</FONT>
				</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvIF EXPR = "{ Upsell.d.percent }">
						<MvLOCALIZED ID = "MER-USL-AD-00059">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent of Total</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
					<MvELSE>
						<MvLOCALIZED ID = "MER-USL-AD-00060">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Absolute</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
					</MvIF>
					</FONT>
				</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvIF EXPR = "{ NOT Upsell.d.percent }">
						<MvEVAL EXPR = "{ encodeentities( Upsell.d.price ) }">
					<MvELSE>
					<MvLOCALIZED ID = "MER-USL-AD-00061">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US"><I>n/a</I></MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</MvIF>
					</FONT>
				</TD><TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvIF EXPR = "{ Upsell.d.percent }">
						<MvEVAL EXPR = "{ encodeentities( Upsell.d.price ) }">%
					<MvELSE>
					<MvLOCALIZED ID = "MER-USL-AD-00062">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US"><I>n/a</I></MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</MvIF>
					</FONT>
				</TD><TD ALIGN = "right" VALIGN = "top" BGCOLOR = "{ l.bgcolor }" COLSPAN = 3>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<A HREF = "{ g.sessionurl $ 'Screen=UPSL&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Upsell=' $ encodeentities( Products.d.code ) }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_edit" VALUE = "{ DrawImgButton_Edit('0') }">
					<MvEVAL EXPR = "{ l.button_edit }"></A>
					</FONT>
				</TD></TR>
			</MvIF>
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ Upsell_RequiredProduct_Find( UpsellXProduct.d.req_prod, UpsellXProduct.d.product_id ) }">
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.nextoffset" VALUE = "{ Upsell_Required_FindNext( UpsellXProduct.d.req_prod, l.nextoffset ) }">
	</MvWHILE>

	<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
		<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
		<MvHIDE FIELDS = "g.Upsell_Stack, g.Upsell_Offset">
		<MvIF EXPR = "{ l.shown }">
			<B><MvEVAL EXPR = "{ g.Upsell_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
		<MvELSE>
			<B>0-0</B>
		</MvIF>
		</FONT>
	</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = "7">
		<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
		<MvIF EXPR = "{ len( g.Upsell_Stack ) }">
			<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListPrevious( \'Upsell_Offset\', \'Upsell_Stack\' );">' }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_prev" VALUE = "{ DrawImgButton_Previous('0') }"><MvEVAL EXPR = "{ l.button_prev $ '</A>' }">
		</MvIF>

		 <INPUT TYPE = "text" NAME = "Upsell_Display" VALUE = "{ encodeentities( g.Upsell_Display ) }" SIZE = 5> <A HREF = "JavaScript:ListReload( 'Upsell_Offset', 'Upsell_Stack' );">
		 <MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_refresh" VALUE = "{ DrawImgButton_Refresh('0') }">
		 <MvEVAL EXPR = "{ l.button_refresh }"></A>

		 <INPUT TYPE = "hidden" NAME = "Upsell_Count" VALUE = "{ encodeentities( l.shown ) }">
		 <MvIF EXPR = "{ l.nextoffset }">
			<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'Upsell_Offset\', \'Upsell_Stack\', ' $ l.lastoffset $ ' );">' }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_next" VALUE = "{ DrawImgButton_Next('0') }">
			<MvEVAL EXPR = "{ l.button_next $ '</A>' }">
		 </MvIF>
		</FONT>
	</TD></TR>
	</TABLE>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "FieldError" PARAMETERS = "tab, field, message" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.Tab" VALUE = "{ l.tab }">
	<MvASSIGN NAME = "g.Error_Field" VALUE = "{ l.field }">
	<MvASSIGN NAME = "g.Error_Field_Message" VALUE = "{ l.message }">
	<MvASSIGN NAME = "g.Data_Entry_Error" VALUE = 1>

	<MvFUNCTIONRETURN VALUE = 0>
</MvFUNCTION>

<MvFUNCTION NAME = "USL_Provision_Update_UpsellOptions" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">

	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellOptions_Find() }">

	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.prod_shown" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">

	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.prod_sell" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
			
	<MvIF EXPR = "{ len( l.prod_shown ) }">
		<MvASSIGN NAME = "UpsellOptions.d.prod_shown" VALUE = "{ l.prod_shown }">
	</MvIF>
	<MvIF EXPR = "{ len( l.prod_sell ) }">
		<MvASSIGN NAME = "UpsellOptions.d.prod_sell" VALUE = "{ l.prod_sell }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellOptions_Update( UpsellOptions.d.prod_shown, UpsellOptions.d.prod_sell ) }">

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "USL_Provision_Add_Update_Upsell" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.req_percnt" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.percent" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
			
	<MvIF EXPR = "{ NOT len( l.product_code ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-USL-AD-00063">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product code required</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-USL-AD-00000', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ Upsell_Find_Product_ID( Products.d.id ) }">
	
	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.percent ) }">
			<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "Upsell.d.percent" VALUE = "{ PRV_Parse_Boolean( l.percent ) }">
		</MvIF>
		<MvIF EXPR = "{ len( l.req_percnt )}">
			<MvASSIGN NAME = "Upsell.d.req_percnt" VALUE = "l.req_percnt">
		</MvIF>
		<MvIF EXPR = "{ len( l.price ) }">
			<MvASSIGN NAME = "Upsell.d.price" VALUE = "l.price">
		</MvIF>
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Update( Products.d.id, Upsell.d.req_percnt, Upsell.d.percent, Upsell.d.price ) }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "l.percent" VALUE = "{ PRV_Parse_Boolean( l.percent ) }">

		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Insert( Products.d.id, l.req_percnt, l.percent, l.price ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "USL_Provision_Delete_Upsell" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
			
	<MvIF EXPR = "{ NOT len( l.product_code ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-USL-AD-00064">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product Code Required</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-USL-AD-00001', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ Upsell_Find_Product_ID( Products.d.id ) }">
	
	<MvIF EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ Upsell_Delete( Upsell.d.product_id ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>


<MvFUNCTION NAME = "USL_Provision_Upsell_Add_Product" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.required_product" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
			
	<MvIF EXPR = "{ NOT len( l.product_code ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-USL-AD-00065">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product Code Required</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-USL-AD-00002', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ Upsell_Find_Product_ID( Products.d.id ) }">
	
	<MvIF EXPR = "{ NOT l.found }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ l.ok AND ( len( l.required_product ) ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.required_product ) }">
		<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ UpsellXProduct_Find( Upsell.d.product_id, Products.d.id ) }">

		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellXProduct_Insert( Upsell.d.product_id, Products.d.id ) }">
		</MvIF>

		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.required_product" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	</MvWHILE>

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "USL_Provision_Upsell_Remove_Product" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.required_product" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
			
	<MvIF EXPR = "{ NOT len( l.product_code ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-USL-AD-00066">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Product Code Required</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-USL-AD-00003', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ Upsell_Find_Product_ID( Products.d.id ) }">
	
	<MvIF EXPR = "{ NOT l.found }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	
	<MvWHILE EXPR = "{ l.ok AND ( len( l.required_product ) ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.required_product ) }">
		<MvIF EXPR = "{ NOT l.ok }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.found" VALUE = "{ UpsellXProduct_Find( Upsell.d.product_id, Products.d.id ) }">

		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Feature_USL_DB }" NAME = "l.ok" VALUE = "{ UpsellXProduct_Delete( Upsell.d.product_id, Products.d.id ) }">
		</MvIF>

		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.required_product" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	</MvWHILE>

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>
