How Shopping Cart Content is Stored

Last Updated: Jul 09, 2014 04:39PM EDT


When products are added to the shopping cart, ProductCart holds the information into an array called pcCartArray. The array is first created when a ProductCart session is started, using the syntax:
dim pcCartArray(100,45)

The array holds up to 100 different products and 45 variables for each product (35 variables in v3). This means that ProductCart has a structural limitation to allowing for 100 different products added to the shopping cart at any given time. The limitation is meant to limit the amount of server resources reserved for the task. This is typically never a problem as customers don't normally add 100 different items to the shopping cart.

However, if you need to allow your customers to add more than 100 different individual products, you can do so by performing a global “find & replace” on the strings dim pcCartArray(100,45) and redim pcCartArray(100,45) replacing the number “100” with a higher one (change 45 with 35 for v3).

Looping through the shopping cart array

To keep track of the number of products (indexes) there exist in the cart array, we store a value that in the following session variable: session(“pcCartIndex”)

Each time a customer adds a new product to the shopping cart, the product and all of its attributes such as units purchased, product options, price, discounts, etc. are added to the cart array (you can find a list of properties and corresponding location in the array below). As the product is added to the cart, the “cart index” is incremented by 1 unit.

So if a customer added two products to the cart, the following would be true:
session("pcCartIndex") = 2

The index count (product count) is kept in a session variable so that ProductCart knows how many indexes exist in the shopping cart array. This makes it easy to loop through and use the contents of the array. For example, you could easily loop through and extract the Product ID and Product Name, as shown below:
 ppcCartIndex =session(“pcCartIndex”)
 for f=1 to ppcCartIndex					
  response.write "Product ID: " & pcCartArray(f,0)
  response.write "Product Name: " & pcCartArray(f,1)

List of cart array assignments

If you are customizing ProductCart, you may need to store additional product variables in the cart array and/or retrieve existing variables. The following table provides details on what each element of the array stores.
Item Content
0 ID of the product. Uniquely identifies the product.
1 Product name
2 Quantity being purchased
3 Product price
4 Array of product options - “option groups: options”
5 Total Cost of all options
6 Total weight for each product in the cart
7 Product part number (SKU)
8 ID of the child within a bundle
9 Delivery Time. (current not used)
10 Removed from cart flag. Whether the product has been removed from the shopping cart.
11 Array of individual selected options ID numbers
12 Required Accessory
13 ID of the Supplier of the Product
14 Product Cost
15 Discounts
16 ID of ConfigSession (Configurator Only)
17 Product’s default price (online price).
18 Whether customer is wholesale or part of a customer category
19 Whether the product is tax-exempt.
20 Whether the product has free/no shipping.
21 Custom input field data
22 Reward Points
23 Whether the product is oversized
24 Tax product array (when more then one tax is used)
25 Array of Individual Options Prices
26 Array of Options Prices stored as currency
27 Parent/Bundle Discount
28 Relationship - Parent Index
29 Configurator: Additional Charges Reward Points
30 Configurator: Items Discounts
31 Configurator: Additional Charges
32 Apparel Add-on: Stores an array of data. The Parent Product ID is the last element of that array.
33 IDs of Products in the Gift Registry
34 Gift wrap flag
35 Gift wrap message
36 Surcharge price for first unit of a product (v4 only)
37 Surcharge price for the additional units of the same product (v4 only)
38 integration's LinkID (v4 only)
39 ID of the sales that the product is currently part of (v4.5 and above: Sales Manager feature)
40 Currently not in use (v4 and above)
41 Currently not in use (v4 and above)
42 Currently not in use (v4 and above)
43 Currently not in use (v4 and above)
44 Currently not in use (v4 and above)
45 Currently not in use (v4 and above)


  • Support Forums
  • Video Tutorials
  • Support Request
  • Support Policy
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found