|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
HELP: Displaying shopping cart information.
Hi, I'm just starting to learn Coldfusion and have a problem. I'm trying to display the details iof my shopping cart before it gets checkout but nothing gets displayed. Here is my code:
PHP Code:
Please help and bear with me. Thanks! |
|
#2
|
|||
|
|||
|
I suspect that the structure of the cart variable is not what you think it is. Use <cfdump var="#session.cart#"> to confirm what is in the cart, and output the variables accordingly.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Quote:
Hi, I've tried using <cfdump var="#session.cart#"> but i'm still having the same problem. SOmehow i'm suspecting something is wrong with the cfif statement. Here is how I used <cfdump var="#session.cart#">: PHP Code:
|
|
#4
|
|||
|
|||
|
No that tooks fine. What does the cfdump show you? Also, alter the inner cfouput so that it isn't outputting a query.
Make this: <cfoutput query = "OrderProduct"> into this: <cfoutput> You're not outputting a query, you're looping over an array. |
|
#5
|
|||
|
|||
|
Quote:
Sorry I tried doing what you said, but still nothing is shown on the screen. It's just blank. Any more ideas what could be wrong? |
|
#6
|
|||
|
|||
|
Are you saying the <cfdump> is also blank? If that's the case then the problem is that there is nothing in the cart, or the structure of cart has errors.
I'd think about starting over if it's the cart. I have a whole article on building a shopping cart at builder.com. I should note that there are two errors in the code presented. The line: <cfparam name="session.cart" default="arrayNew()"> shoulde be: <cfparam name="session.cart" default="#arrayNew()#"> and the line: <cfset session.cart = arrayAppend( session.cart, structNew() )> should be <cfset arrayAppend( session.cart, structNew() )> Last edited by kiteless : March 8th, 2005 at 10:04 PM. |
|
#7
|
|||
|
|||
|
Quote:
Ok I have a site that has a form with a button that says Add To Cart and was wondering if this i'm doing the site correctly. Here is the site that has the 'Add to cart' button before i press the add to cart button. PHP Code:
|
|
#8
|
|||
|
|||
|
That seems all right to me. But you seem to be missing the point: you can submit the form and then on the action page use <cfdump var="#form#"> to dump out what's the in the form scope and decide for yourself if the right values are there.
If you're still confused I think you might just be moving too fast. You can always back up a bit, start with a simple form and a simple cart, and then slowly add things in. You don't have to go from nothing all the way to a complicated form a cart right away. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > HELP: Displaying shopping cart information. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|