Topic: Individual shop cart arrays


grabit    -- 12-16-2012 @ 12:58 PM
  Hi Everyone
I am building a site that requires multiple listings each with their own shopping cart.
Items can be ordered only from that business(1)and i need a way to stop surfers from going to another business and adding items from their business to the cart of business(1)
At the moment if i go from business(1)'s cart contents and then go to the cart contents for another business those items show up in the cart
I guess what i need is a way to setup business(1) cart and stop items being added from another business to that cart and when they go to another business it starts a completely new cart for that individual business

the code i am using to populate the array follows:
<!--- ADD  PRODUCT TO CART ARRAY ROUTINE--->
    <cfif IsDefined("btn_add")>
<!---is this ID already in the enquiry--->
     <cfset thisID = #form.ID#>
     <!---check that this ID is not already existing in the enquiryContents--->
          <cfloop from="1" to="#arrayLen(session.shoppingcart)#" index="i">
          <cfif session.shoppingcart.ID eq #thisID#>
<!---If this ID exists in enquirycontents - send to error page IF NOT carry on and add to array--->          
          <cflocation url="shopCartItemExists.cfm?ID=#getlistinginfo.ID#">     
          </cfif>
       </cfloop>
     <a href="%5C">
    <cfset temp = arrayAppend(session.shoppingCart, structNew())>
     <cfset session.shoppingcart[arrayLen(session.shoppingcart)].custID = #getlistinginfo.ID#>
    <cfset session.shoppingcart[arrayLen(session.shoppingcart)].ID = #form.ID#>
     <cfset session.shoppingcart[arrayLen(session.shoppingcart)].prodnum = #getstock.prodnum#>
    <cfset session.shoppingcart[arrayLen(session.shoppingcart)].product = #getstock.product#>
     <cfset session.shoppingcart[arrayLen(session.shoppingcart)].price = #getstock.price#>
     <cfset session.shoppingcart[arrayLen(session.shoppingcart)].quantity = #form.Quantity#>
     <cfset session.shoppingcart[arrayLen(session.shoppingcart)].weight= #getstock.packweight#>
       <cflocation url="shopCartContents.cfm?custID=#getlistinginfo.ID#">
      </a>
  </cfif>
<!---FINISH ADDING TO CART ARRAY ROUTINE

Any help would be greatly appreciated
cheers and thanks in advance
Grabit

Thanks to you all


EasyCFM.COM ColdFusion Forums : http://archive.easycfm.com/forums
Topic: http://archive.easycfm.com/forums/viewmessages.cfm?Forum=12&Topic=15286