House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Shopping Cart Delivery Charge

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Shopping Cart Delivery Charge

You can carry a variable through your cfloop/cfoutput query to hold the running William Seiter 05/15/2008 05:45 PM
The surcharge is for each product, you can only buy one main product at at time Jason Congerton 05/15/2008 05:28 PM
Do you already have a query with your shopping cart? If so, just use a Mary Jo Sminkey 05/15/2008 05:14 PM
sorry i must be half asleep, you can use the sum function. so the full function Richard White 05/15/2008 04:40 PM
if there isnt a function in sql that can do that then there is a function on Richard White 05/15/2008 04:39 PM
i think the best way would be to do this is directly through sql in one query. Richard White 05/15/2008 04:32 PM
Hi Jason Congerton 05/15/2008 04:13 PM

05/15/2008 05:45 PM
Author: William Seiter Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56405#305376 You can carry a variable through your cfloop/cfoutput query to hold the running total of the surcharges. You can also hit the database with a new call for the sum, as other have mentioned. You can also do: <cfset allsurcharges = ArraySum(ListToArray(ValueList([querycolumnname])))> William ----- Excess quoted text cut - see Original Post for more -----
05/15/2008 05:28 PM
Author: Jason Congerton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56405#305375 The surcharge is for each product, you can only buy one main product at at time (multiple purchases are treated as trade), you can also add multiple accessories (which have no delivery charge) Shopping cart items are stored in the session. I am exploring the sum route at the moment. Thank you all for your response. > Do you already have a query with your shopping cart? If so, just use a > query-of-query (with SUM()). You don't mention if the surcharge is by > product or by each item, but you may need to also be sure to factor in > the product quantity. > > --- Mary Jo >
05/15/2008 05:14 PM
Author: Mary Jo Sminkey Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56405#305374 Do you already have a query with your shopping cart? If so, just use a query-of-query (with SUM()). You don't mention if the surcharge is by product or by each item, but you may need to also be sure to factor in the product quantity. --- Mary Jo
05/15/2008 04:40 PM
Author: Richard White Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56405#305371 sorry i must be half asleep, you can use the sum function. so the full function would be select sum(surcharge) from products where productid in(<cfqueryparam value="theListOfProductIds#" list="yes" cfsqltype="cf_sql_varchar">) and surcharge <> "" ----- Excess quoted text cut - see Original Post for more -----
05/15/2008 04:39 PM
Author: Richard White Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56405#305369 if there isnt a function in sql that can do that then there is a function on cflib to get a columntotal http://cflib.org/udf.cfm?ID=887 so you can run that one query then pass the resulting column into the columnTotal udf and thats it, you will have the total surcharge... ----- Excess quoted text cut - see Original Post for more -----
05/15/2008 04:32 PM
Author: Richard White Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56405#305368 i think the best way would be to do this is directly through sql in one query. you can build a list with the ids of all the products the customer has selected, then in 1 query... select surcharge from products where productid in(<cfqueryparam value="theListOfProductIds#" list="yes" cfsqltype="cf_sql_varchar">) and surcharge <> "" i am not sure but there must be a function in sql that adds up all the values in a column - maybe someone else can suggest it - but this sql statement then saves all the time that a loop would take and would just return the results where those products you have entered have a surcharge, then it is just a matter of adding it up. but as i said there must be a sql function you can use within this same function to do that ----- Excess quoted text cut - see Original Post for more -----
05/15/2008 04:13 PM
Author: Jason Congerton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56405#305363 Hi I am building a shopping cart which calculates shipping charges, some products also have an additional surcharge. Which is where i am stuck, The additional surcharge is stored within the product table. What i thought was to loop through the products in the cart,  query the products database to get the surcharge or surcharges, loop through the query results for the individual surcharges. If this is the correct way, how do i then add the surcharges up and account for when the loop finishes. Jason
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference