Print Page | Close Window

pcCartArray

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Using ProductCart
Forum Description: Running your store with ProductCart
URL: https://forum.productcart.com/forum_posts.asp?TID=4485
Printed Date: 05-March-2025 at 2:39pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: pcCartArray
Posted By: SharpDataInc
Subject: pcCartArray
Date 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



Replies:
Posted By: Brett
Date 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.


Posted By: SharpDataInc
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net