Advertisement

02.29.2008 at 09:22AM PST, ID: 23204372
[x]
Attachment Details

Coldfusion: Shopping Cart: Set Minimum Quantity

Asked by jabronicus in Cold Fusion Markup Language

Tags:

I have an item in my store that has a minimum order of 15 items. I submit this to my shopping cart with

<cfif qBrowse.ItemID EQ '57F0165A-19B9-ED8D-DE47BEF4A0B3D6DB'>
     <input name="Qty" type="hidden" value="15" />
<cfelse>
    <input name="Qty" type="hidden" value="1" />
</cfif>

On Checkout.cfm I give the customer the chance to update #, remove item or to checkout. I can't figure out at this point how to keep this particular item from being updated to a number less than 15.Start Free Trial
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:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
<cfif IsDefined('FORM.Update.y')>
  <cfset numberOfItems = "#ArrayLen(Session.Cart.ItemID)#">
  <cfloop from="1" to="#numberOfItems#" index="ThisItem">
    <cfset Session.Cart.Qty[ThisItem] = form["Qty" & ThisItem]>
  </cfloop>
</cfif>
 
cfset ordertotal = 0>
  <cfloop from="1" to="#ArrayLen(Session.Cart.ItemID)#" index="ThisItem">
    <cfoutput>
      <cfquery name="getItem" datasource="#DSN#">
        SELECT items.itemPrice
                    ,items.itemID
                    ,items.itemName
                    ,items.CategoryID
                    ,category.CategoryImageSmall
                    ,category.CategoryID
         FROM items, category
         WHERE items.itemID = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#Session.Cart.ItemID[ThisItem]#">
        AND category.CategoryID = items.CategoryID
      </cfquery>
      <cfset total = 0>
       <cfset total = total + (getItem.itemPrice * Session.Cart.Qty[ThisItem]) >
        <tr>
           <td><img src="/images/#Session.Cart.CategoryImageSmall[ThisItem]#" alt="#Session.Cart.ItemName[ThisItem]#"/></td>
          <td>#Session.Cart.ItemName[ThisItem]#</td>
          <td><input name="ItemID#ThisItem#" type="hidden" value="#Session.Cart.ItemID[ThisItem]#" />
                 <input class="quantity" name="Qty#ThisItem#" type="text" value="#Session.Cart.Qty[ThisItem]#" />
                 <br />
                 <a class="removeItem" href="#CGI.SCRIPT_NAME#?id=#ThisItem#">x remove</a>
                 <input name="ItemName#ThisItem#" type="hidden"  value="#Session.Cart.ItemName[ThisItem]#" />
                 <input name="CategoryImageSmall#ThisItem#" type="hidden" value="#Session.Cart.CategoryImageSmall[ThisItem]#" />
          </td>
          <td>#LSCurrencyFormat(total,'local')#</td>
         </tr>
      </cfoutput>
<!---Create row for total--->
       <cfset ordertotal = ordertotal  + total + Shipping>
</cfloop>
       <tr>
          <td colspan="2" class="total"><input name="Update" type="image" src="/images/update-basket_lrg.gif" alt="Update Basket"  />
<!---Clear Basket Button, first make sure there is nothing in the basket--->
          <cfif ordertotal EQ 0>
         <cfelse>
         <a href="<cfoutput>#CGI.SCRIPT_NAME#?basket=clear</cfoutput>"> <img border="0" src="/images/clear_basket_lrg.gif" alt="Clear Basket" /> </a>
</cfif>
        </td>
<td>
    Shipping and Handling: <br />
      Total:
 </td>
   <td>
     &nbsp;$6.00<br />
	<cfoutput>#LSCurrencyFormat(ordertotal,'local')#</cfoutput>
   </td>
</tr>
</tbody>
</table>
</form>
[+][-]02.29.2008 at 09:35AM PST, ID: 21015545

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.29.2008 at 09:47AM PST, ID: 21015647

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.29.2008 at 10:03AM PST, ID: 21015805

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Cold Fusion Markup Language
Tags: Coldfusion
Sign Up Now!
Solution Provided By: _agx_
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.01.2008 at 10:01AM PST, ID: 21022729

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628