Skip to content
  • There are no suggestions because the search field is empty.

How Shopping Cart Content is Stored [Migration Draft]

Overview


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)
 Next
 

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.