Do you have any examples of cart code that I could refer to?

For examples on how to use the cart code, please see our example pages.

How do I tag an item for use by virtualCART®?

There are a lot of variants, but the basic method uses a very simple form submitted to our server:

<form action="http://[cart-id].vcartserver.com/store/addToCart.aspx" method=POST>
<input type=hidden name=item value="[cart-id]^pn-1^description^5.00^1">
<input type=image name=add src="/anything.gif">
</form>

Line 1) Opens the form and points it to virtualCART®
Line 2) The "item" variable contains the info about the product.
Line 3) The graphic used as the submit button.
Line 4) Close the form.

What is that up-arrow character that is inside the "item" variable?

That is the ^ character, and we use it to separate different fields combined into a single variable. "item" contains 10 separate fields, the first five of which are mandatory:

cart-id ^ part number ^ description ^ cost ^ quantity

This method avoids having five separate "hidden" variables to convey the same information, saving time and space.

How can I allow different sizes of a given item?

Examples are in the demo pages, but here is a sample of html code you'd put inside the form tags:

<select name=op1>
<option 1>Cinnamon</option>
<option 2>Irish Creme</option>
<option 3>Bavarian Chocolate</option>
</select>

This method is very basic. Whichever option they select is appended to the product description in the cart display and the order form you receive.

All options variables are named op1, op2, etc. Why is that?

That is true for regular single item method tags. The cart ignores all variables it does not recognize.

Currently, it looks at: "item", and "op1", "op2", ... "op31", "op32"

Some options in the demo pages are mentioned inside the "item" variable and some are not. Why?

Options can be one of two classes, simple, or special. Simple options are those not affecting price, quantity, or shipping fee. Just place them inside the <form></form> tags, and virtualCART® will append their data to the product description in the cart display. Size, color, those sorts of things. Special options are those which effect the price or quantity of an item. To use them properly, you must have the option name listed in the appropriate field of the "item" variable so virtualCART® will know what to do with the data sent. Regardless of simple or special, they are still named op1-32. See below and in the example pages to see how to get options variables to modify item prices and quantities.

How do I use a special option to allow customers to put more than one of a certain item into their cart at a time?

Let's say someone wanted 100 feet of rope. Putting 1 foot in and increasing quantity 99 times would be ridiculous, and so we offer the following:

<input type=hidden name=item value="[cart-id]^pn-1^rope^5.00^op2">
<input type=text name=op2 size=3 value="1">

Notice that in the quantity field of the "item" variable, instead of the usual 1, we put op2. That tells the cart to substitute the value of option op2 into that field. If the customer puts 100 into the op2 text box, he gets 100 feet of rope instead of one!

One of my options affects the price of the item. How do I tag that?

List the option affecting price in the cost field of the item variable:

<input type=hidden name=item value="[cart-id]^xyz^item desc^op1^1">

This tells the cart to look in op1 to find the price:

<select name=op1>
<option value="Large - $4.00">Large</option>
<option value="Medium - $3.00">Medium</option>
<option value="Small - $1.50">Small</option>
</select>

Notice the "space dash space" in the various op1 value fields? That must be there to separate the description from the cost.

I want to offer more than one option affecting price. Can I do that?

Yes. List options affecting price in the cost field of the item variable:

<input type=hidden name=item value="[cart-id]^xyz^item desc^op1op2op3^1">

The cart looks in op1,op2, and op3 for price related information. Each of those options can also contain descriptive text, but may be price only.

<!--sets the base price-->
<input type=hidden name=op1 value=" - $5.00">

<!--add a couple bucks for giftwrap-->
Check for giftwrap <input type=checkbox name=op2 value="giftwrap - $2.00">

<select name=op3>
<option value="Large - $4.00">Large</option>
<option value="Medium - $3.00">Medium</option>
<option value="Small - $1.50">Small</option>
</select>

I'm selling yards of carpet, not each of carpet. How do I change my unit of measure?

We offer both a default unit of measure and a line item unit of measure "override" for that "oddball" product.

In your shopping cart control panel, select what you want your normal unit of measure to be. Most choose "ea.". If you need something different for a certain item, you must encode it into the item variable:

value="[cart-id]^xyz^item desc^5.00^1^^^yds."

Note that unit of measure is the eighth field of "item". Even though you did not use field 6 and 7 in the above example you must still maintain the field separators to avoid throwing off the count.

One of my options lowers the cost. How do I code that?

Just put in a negative value for the cost:

<input type=checkbox name=op2 value="no giftwrap - $-2.00">

I need to allow personalization of an item, and I have three lines of text which can be added. How can that be coded for readability in the cart?

Yes. Separate the text boxes with hidden labels.

<input type=hidden name=op1 value="<br>Line 1:">
<input type=text name=op2>
<input type=hidden name=op3 value="<br>Line 2:">
<input type=text name=op4>
<input type=hidden name=op5 value="<br>Line 3:">
<input type=text name=op6>

Cart display description would be:
Line 1: 1st box text
Line 2: 2nd box text
Line 3: 3rd box text

If number two was left out by customer:
Line 1: 1st box text
Line 2:
Line 3: 3rd box text

It works because the cart counts up when processing op variables, so op1 as "<br>Line 1:" would go in, then it would be followed by the value of op2, which contains the data for line 1.

Here is a complete example. We also add a color choice:

Buy our Address Labels!

<form action="http://[cart-id].vcartserver.com/store/addToCart.aspx" method=POST>
<input type=hidden name=item value="[cart-id]^pn^Address Labels^9.99^1">
<input type=hidden name=nodash value=" ">
<input type=hidden name=op1 value="<br>Line 1:">
Line 1: <input type=text name=op2>
<input type=hidden name=op3 value="<br>Line 2:">
Line 2: <input type=text name=op4>
<input type=hidden name=op5 value="<br>Line 3:">
Line 3:<input type=text name=op6>
Choose color:<select name=op7>
<option value="<br>Color: Gold">Gold
<option value="<br>Color: Silver">Silver
</select>
<input type=image name=add src="anything.gif">
</form>


Note 1: Including <br> in a variable value sent to the cart is a special case. It will cause the cart display to drop the description down to the next line for readability, and in the emailed order will map back out to a carriage return.

Note 2: The hidden "nodash" variable being set to a space will cause the cart to NOT use the default dash character as the separator between op values appended to the escription field. Since we are using <br>, having dashes also would not look good.

I want to use the quote (") symbol in my description, but it messes up the item variable. Is there a work around?

If you wish to use the quote (") symbol in your description you must use &quot;

What does "/oc dir unreadable! This usually occurs when a cart-id code is not formed correctly in the 'item' variable." mean?

It means that virtualCART® doesn't understand the item tag that you are trying to pass over to it.

Please check that your cart ID is written properly. Sometimes quotes (") in the description may cause the item tag to pass a premature string of information.

Why is it that when I click add to cart, it says my item is free?

This is because in your item tag, the price is either not being passed over or it's sending something other than numbers. You may want to check that the options of the product too if you are using options (especially if they are price modifiers).

I click add to cart and it says my shopping cart is empty! What's going on?

Your item tag is not passing over the quantity value for the item. Without the quantity, virtualCART® assumes that 0 (zero) quantity is passed over. Hence, "your cart is empty".

Is it possible for you to help me with the coding?

Actually, you can help yourself with our cart code generator located in your shopping cart control panel. This system will help you generate your item tags and "Add to Cart", as well as "View Cart" and "Checkout" buttons based on your input.

The virtualCART® item tags are very confusing. What are they and what are they supposed to look like?

The item tag is field separated variable. What this means is that the item tag consists of several different information about the product separated by a field separator (in this case a ^). This is what each field corresponds to:

"[cart-id]^partnumber^description^cost^quantity^ship_cost^insurance_cost^unit_of_measure^weight^photo"

Here's an example of how an item code will look like:

"[cart-id]^PN-xyz^This is a widget^5.00^1^2.30
^.50^ea.^10^http://www.yourdomain.com/mypic.gif"

Of course not all fields are required. Only the first 5 fields are necessary. The weight field (field 9) is only necessary if you are using real time shipping calculation.

Can I create a single pull down that will effect more than one product variable?

Instead of having the <select> pull down be an "op" variable modifying the hidden "item" variable, use the item variable itself as the select. That way you can change all fields at once, even making a single pull down to allow an entire list of totally different products to be chosen for adding to the cart. The code would be like this:

<form action="http://[cart-id].vcartserver.com/store/addToCart.aspx" method=POST>
<select name=item>

<option selected value="[cart-id]^pn1^1st item descrip^9.99^1^^^^5.2">
the first item</option>

<option value="[cart-id]^pn2^2nd item descrip^19.99^1^^^^8.2">
the second item</option>

</select>
<input type=image name=add src="anything.gif">
</form>

end faq

Can't find the answers you are looking for in this section?  Please don't hesitate contacting our support staff by submitting a support ticket.