Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Shopping Cart Quantity Issue !! Help!

Posted on 2004-04-30
10
384 Views
Last Modified: 2013-12-24
I'm having an issue with my shopping cart.  When I set up my quantity it for some reason is outputting the numbers incorrectly as if it's not in the array.  By this I mean :
Quantity     in Stock     SKU
[1,1,33]     Yes            8306    
[1,5]         Yes             5564  
[1,5]         No               3482
Everytime I add a new product and update the quantity it adds it to the current Variable in my URL for instance ?pID=8306.. If I change the quantity of another product in my shopping cart, because 8306 is selected in my URL it will add a delim like 1,2 or something of that nature.  Sorry If i'm somewhat confusing i'm a novice developer.  Here is a snippet of my code=

<cfif ListFind(ArrayToList(Session.vCart.ProdID),#url.pID#) NEQ 0>
<cfset ThisItem = ListFind(ArrayToList(Session.vCart.ProdID), #url.pID#)>
 <cflock timeout="2" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
<cfset Session.vCart.Qty[ThisItem]=FORM.Qty>
</cflock>              
            
 <cfif isDefined('form.updatesubmit') IS "TRUE" AND ListFind(ArrayToList(Session.vCart.Qty),#form.qty#) NEQ 0>
<cfset ThisItem = ListFind(ArrayToList(Session.vCart.Qty), #form.qty#)>
<cflock timeout="2" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
<cfset Session.vCart.Qty[ThisItem] = Session.vCart.Qty[ThisItem]>
<cfset Session.vCart.Qty[ThisItem] = FORM.qty>
</cflock>
</cfif>
<cfelse>
<cfset ThisItem=ArrayLen(Session.vCart.ProdID) +1 >
<!--- === [ Add to cart ] === // --->
<cflock timeout="5" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
<cfset Session.vCart.ProdID[ThisItem]=#url.pID#>
<cfset Session.vCart.Qty[ThisItem]=FORM.Qty>
</cflock>
</cfif>

I have gotten it so the products input correctly, however the quantities do not work.  Does anyone have any suggestions at all?  I wasn't sure if i have to set up some sort of array or what, but any help you can provide will GREATLY help me out! Thanks!

Dave
0
Comment
Question by:ctdigital
  • 2
  • 2
  • 2
  • +1
10 Comments
 
LVL 3

Expert Comment

by:mvwmail
ID: 10963625
You have one of your FORM.qty in #'s whilst all the others are not? Not had enough coffee to actually work through the code
0
 
LVL 3

Expert Comment

by:mvwmail
ID: 10963643
<cfset Session.vCart.Qty[ThisItem]=FORM.Qty>

should maybe read

<cfset Session.vCart.Qty[ThisItem]=#FORM.Qty#>
0
 
LVL 1

Author Comment

by:ctdigital
ID: 10976903
That was accidental, but irregardless has no different outcome whichever way I do it.  I still have not figured out the problem for this, and sorry for the delayed response over the weekend.
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 2

Expert Comment

by:netuser1976
ID: 10981551
I think you have some mismatched <cfif> <cfelse> </cfif> - atleast in what you've posted..

My other suspicion is this line. I dont understand why you need this ...

<cfset Session.vCart.Qty[ThisItem] = Session.vCart.Qty[ThisItem]>
0
 
LVL 2

Expert Comment

by:netuser1976
ID: 10981558
Oops.. Sorry I should take back what I posted about mismatched cfif/cfelse
0
 
LVL 1

Author Comment

by:ctdigital
ID: 10985879
<cfset Session.vCart.Qty[ThisItem] = Session.vCart.Qty[ThisItem]>

That statement still shouldnt affect it, and am currently still working on this..
0
 
LVL 1

Accepted Solution

by:
poorgod earned 145 total points
ID: 11009453
ok, this may be wrong, but i'll give it a shot.
are the form fields all named Qty?
i mean, if the form page has more than one Qty field in it, like,
<input type="text" name="Qty" value="1">
<input type="text" name="Qty" value="5">
<input type="text" name="Qty" value="10">
then in the next page, form.qty will give you the value "1,5,10"
instead of that you might use something like
<input type="text" name="Qty8306" value="1">
<input type="text" name="Qty5564" value="5">
<input type="text" name="Qty3482" value="10">
and then in the action page,
<cfset Session.vCart.Qty[ThisItem]=evaluate("FORM.Qty#url.pID#")>

Hope the helps
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Are you using email marketing software? If not, you're missing out on effortless marketing and the reaching of desired conversion rates through email marketing software.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question