EasyCFM.COM ColdFusion Forums / Coding Help! / Individual shop cart arrays

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Individual shop cart arrays

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

grabit
12-16-2012 @ 12:58 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 497
Joined: Jun 2003

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


Website Designed and Developed by Pablo Varando.