I can't get my Session Variables to Work~!!!!!  

Here is my create/add item action page:

<!--- Make sure that all of the necessary attributes are passed in --->
<cfif isdefined("attributes.CatalogId") and
isdefined("attributes.SectionID") and isdefined("attributes.price") and
isdefined("attributes.quantity") and isdefined("attributes.pk")>
                <cfscript>
                        if (not(isdefined("session.cart"))) {
// Check to make sure that the Shopping cart structure exists. 
                                session.cart = structnew();

                                }

                        // The item structure we are going to use to store
the items in the cart
                        // is going to have five parts...
                        //              1.  The catalog id
                        //              2.  The section ID
                        //              3.  The price per unit
                        //              4.  The quantity
                        //              5.  PK
                                                
                        tempvalue =
listtoarray('#attributes.catalogid#,#attributes.sectionID#,#attributes.price
#,#attributes.quantity#,#attributes.PK#');

                        // if the item is not yet in the cart, simply add it
to the cart
                        if (not(structKeyExists(session.cart,
attributes.pk))) {
        
StructInsert(session.cart,attributes.pk,tempvalue);
                        }

                        // if the item is already in the cart, update the
item quantity
                        else {
        
tempvalue[4]=session.cart[attributes.pk][4]+attributes.quantity;
        
StructUpdate(session.cart,attributes.pk,tempvalue);
                        }                       
                </cfscript>
</cfif>


HERES THE DELETE:

                <cfscript>
                        // Check to make sure that the Shopping cart
structure exists. 
                        if (isdefined("session.cart")) {        

                                // Make sure that the key to be deleted
exists
                                if (StructKeyExists(session.cart,
attributes.pk)) {
                                        
                                        // Decrement the quantity by one if
there are multiple items
                                        if (session.cart[attributes.pk][4]
gt 1) { 
        
session.cart[attributes.pk][4] = session.cart[attributes.pk][4]-1;
                                        }
                                        
                                        // Delete the item from the cart if
there is only one
                                        else {
                                                structDelete(session.cart,
attributes.pk); 
                                        }
                                }
                        }
                </cfscript>



Heres the URL:  webmaster.wsboces.org/catalog.cfm



______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to