![]() |
pcCartArray |
Post Reply ![]() |
Author | |
SharpDataInc ![]() Groupie ![]() Joined: 10-August-2010 Location: Chicago Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() 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
|
|
![]() |
|
Brett ![]() Groupie ![]() ![]() Joined: 22-April-2008 Location: Phoenix, AZ Status: Offline Points: 89 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
SharpDataInc ![]() Groupie ![]() Joined: 10-August-2010 Location: Chicago Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |