I have an ecom app I put together sometime ago. I need to allow for tired
pricing for a customer so when some one updates their basket I need to 1.) do a
check on the product and see if it has tiered pricing. 2.) if it does I need to
determine the correct tier. 3.) apply the update to the basket. I have been
going through this several times and I can not figure it out. Can some one give
asistance.
<cfif ArrayLen(Session.arrBasket) neq 0>
<!---show products added to basket if there are any in it------->
<!--- use this to find tiers --->
<cfquery name="gettiers" datasource="#Request.App.datasource#">
SELECT prodfrom, prodto, price FROM tiers
WHERE productid = '#getProductDetail.ProductID#'
ORDER BY prodfrom
</cfquery>
<!----table headers--->
<table border="0" width="95%" align="center" cellspacing="0" cellpadding="3">
<tr>
<td align="left"><b><font size="2" face="Arial, Helvetica,
sans-serif">Item<br>
</font></b></td>
<td align="center"><b><font size="2" face="Arial, Helvetica,
sans-serif">Qty.<br>
</font></b></td>
<td align="right"><b><font size="2" face="Arial, Helvetica,
sans-serif">Price<br>
</font></b></td>
<td align="right"><b><font size="2" face="Arial, Helvetica,
sans-serif">Total<br>
</font></b></td>
<td><b><font size="2" face="Arial, Helvetica, sans-serif"></font></b></td>
</tr>
<!---user can update basket quantities in this form------->
<form name="basket" action="index.cfm?action=Shop&thisPage=Basket&do=Update"
method="post">
<!----loop over basket and output each item's values (name, price,
qty)------->
<cfloop from="1" to = "#ArrayLen(Session.arrBasket)#" index = "Request.idx">
<font size="2" face="Arial, Helvetica, sans-serif"><cfoutput></font>
<!----set array into local variables for ease of use------->
<cflock scope="SESSION" timeout="30">
<cfscript>
NumberItems = ArrayLen(Session.arrBasket);
ProductID = Session.arrBasket[Request.idx][1];
ProductName = Session.arrBasket[Request.idx][2];
Price = Session.arrBasket[Request.idx][3];
Qty = Session.arrBasket[Request.idx][4];
</cfscript>
</cflock>
<tr>
<td> <font size="2" face="Arial, Helvetica, sans-serif"><a
href="index.cfm?action=Shop&thisPage=Detail&thisProduct=#ProductID#">#ProductName#</a>
</font></td>
<td align="center"> <font size="2" face="Arial, Helvetica, sans-serif">
<!---show current quantity------->
<input type="Text" name="Quantity_#Request.idx#" value="#Qty#"
size="2" maxlength="2">
<br>
</font></td>
<!---price------->
<td align="right"><font size="2" face="Arial, Helvetica,
sans-serif">#DollarFormat(Price)#<br>
</font></td>
<!----- product price times quantity = subtotal------>
<td align="right"><font size="2" face="Arial, Helvetica,
sans-serif">#DollarFormat(Price * Qty)#<br>
</font></td>
<td align="center"> <font size="2" face="Arial, Helvetica, sans-serif">
<!----use thisIdx variable with the value of current loop iteration
as the position holder
for this element in the array so that it can be removed. ------->
<a
href="index.cfm?action=Shop&thisPage=Basket&do=Remove&thisProduct=#ProductID#&thisidx=#Request.idx#">
</cfoutput>
remove</a> <br>
</font></td>
</tr>
<!----create subtotal------->
<cfparam name = "Basket.SubTotal" default = 0>
<cfscript>
Basket.SubTotal = (evaluate(Basket.SubTotal +
(Session.arrBasket[Request.idx][3] * qty)));
</cfscript>
</cfloop>
<tr>
<td colspan="2" align="left"> <font size="2" face="Arial, Helvetica,
sans-serif">
<input type="image" src="images/buttons/update.gif" border="0"
name="update">
</font>
</form>
<font size="2" face="Arial, Helvetica, sans-serif"></td></font>
<!----output the subtotal ( qty * price for each item)---->
<td align="right" colspan="3"><font size="2" face="Arial, Helvetica,
sans-serif">
<b>SubTotal</b>
<cfoutput>#DollarFormat(Basket.SubTotal)#</cfoutput> </font></td>
</tr>
<tr>
<td colspan="5">
<p align="center"><font size="2" face="Arial, Helvetica, sans-serif"><br>
<a href="index.cfm?action=Checkout&thisPage=billinfo"
class="subtsm"><img src="images/buttons/checkout.gif" border="0"></a></font></p>
</td>
</tr>
</table>
<!---end check for length of basket array------->
<cfelse>
<p align="center"><font size="2" face="Arial, Helvetica, sans-serif"><b><font
color="#CC0000">There
are no items in your basket.</font></b></font></p>
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206154
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54