ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Using ProductCart
  New Posts New Posts RSS Feed - pcCartArray
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

pcCartArray

 Post Reply Post Reply
Author
Message
SharpDataInc View Drop Down
Groupie
Groupie


Joined: 10-August-2010
Location: Chicago
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote SharpDataInc Quote  Post ReplyReply Direct Link To This Post Topic: pcCartArray
    Posted: 16-May-2011 at 9:08am

When to change values in the pcCartArray at checkout (ver 3.51). I have a customer who has a promotion when purchasing an item it adds another to the cart on the fly. Mind you they are usign HTML as the storefront (how silly it is, but its what they want), so I add the item using the multiple item code and all is good. However, if they could get multiple items in the cart for the "promo" item, which is a no no. I want to edit the pcCartArray variable array and change the item quantity to 1 in the checkout.asp.

So its coded to loop through the items in the array and check for a InStr on the word "PROMO" in the product part number (element 7) and change the quantity value to 1.
 
I have this at line 211 (after it makes sure there is items in the cart):
 
pcCartArray(f,7) would have a value of "CSLT-1006PROMO" and quantity would be changed to 1.
 
For f=1 To ppcCartIndex     
 If InStr(pcCartArray(f,7), "PROMO") Then
   pcCartArray(f,2) = 1
 End If
Next
 
This doesnt seem to be updating the cart array quantity. Is this in the right spot? I want to do it before the total is calcuated...
 
Sharp Data Incorporated
Back to Top
Brett View Drop Down
Groupie
Groupie
Avatar

Joined: 22-April-2008
Location: Phoenix, AZ
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote Brett Quote  Post ReplyReply Direct Link To This Post Posted: 16-May-2011 at 2:49pm
I'm not sure what exactly you're asking here, but without looking too far into it I'd say that you need to change the "f" variable. I believe that's the one which holds the current item in the shopping cart array. Maybe try f+1? Or else see where f is being set and adjust your code accordingly.

*edit*

Oh just realized that already loops through all f values. I'd then suggest looking at ppcCartIndex or whatever that variable is that f is counting up to. I believe that variable determines how many items are in the cart, so if you want to add another one you'll probably have to increment that and then use the corresponding value to hold the new item in the array.

Edited by Brett - 16-May-2011 at 2:50pm
Back to Top
SharpDataInc View Drop Down
Groupie
Groupie


Joined: 10-August-2010
Location: Chicago
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote SharpDataInc Quote  Post ReplyReply Direct Link To This Post Posted: 16-May-2011 at 4:24pm
Actually in checkout.asp its:

ppcCartIndex=Session("pcCartIndex")

so,

For f=1 To ppcCartIndex     
If InStr(pcCartArray(f,7), "PROMO") Then
   pcCartArray(f,2) = 1
End If
Next

I am looping through and changing a quantity value to 1 in the pcCartArray. So "f" would be the current item in the cart item count from ppcCartIndex, then when I hit the item I want in the loop ("PROMO") SKU it should be able the change the quantity to 1. So I am not adding, I am editing a element value in the array.
Sharp Data Incorporated
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.