Introduction
Using the ItemType
and SpecialItemData
fields in tandem allows you to create very complex and sophisticated remote carting functions for your store. Because there are multiple ways of using our remote carting functionality (all of which can benefit from this article), we are going to take a platform agnostic approach. For example, when referencing itemtype parameter with a value of “discount”, depending which remote carting method you are using, there are different ways of implementing this.
If you are using the link method, your link might look like this:
<a href=”www.mystore.com/addtocart.aspx?itemtype=discount”> Click Here! </a>
However, when using the form method, your form html could contain:
<form method=”POST” action=” www.mystore.com/addtocart.aspx”>
<input type=”hidden” name=”itemtype” value=”discount”>
</form>
Or, using the javascript api, you could have a script that looks like this:
<script type="text/javascript">
Ac.cart.add({
Itemtype: discount
}, function(response){
});
</script>
Of course, all of the above methods need more information add an item to the cart. However, for the rest of the article, instead of trying tackle any particular one or all methods for every example, the information will just be referred to as the parameter (shown as “itemtype”, if you refer to the examples above) and the value (shown as “discount” in the examples above).
As mentioned previously, the ItemType
and SpecialItemData
parameters are designed to be used together such that you can pass very complex configuration information to the storefront. In the ItemType
you specify what type of information is going to be passed while the SpecialItemData
contains the actual information to be used.
Parameter Options
The following is a list of the possible values that can be passed to the ItemType
parameter. and how it will affect what can be passed SpecialItemData
.
- Normal
ItemType
- Denotes that the current item being passed is a regular item. This is the same as not passing the ItemType
parameter.
SpecialItemData
- Anything supplied here will be ignored.
- Info
ItemType
- Marks the item to be considered as information only for admin users. It is not shown to customers.
SpecialItemData
- Whatever is passed here will be stored to the comments sections of the order and can be seen from the View Order or Edit Order screen by admins only.
- Error
ItemType
- Indicates that this item should be treated as an error message.
SpecialItemData
- The information passed here will be displayed to the user as an error message on the cart page.
- Tax
ItemType
- Specifies that the item contains information about overriding the tax rate
SpecialItemData
- pass in a number to use it as the tax rate for the cart. For example, pass .07 in order to charge 7% tax on the order.
>
- Discount
ItemType
- Denotes that the current item is considered a percentage rate discount.
SpecialItemData
- This should be your discount configuration. It must be a whole number such as 50 for a 50% discount, etc. If this is used, the item description will be displayed as the name of the discount.
- DiscountFlat
ItemType
- Denotes that the current item is considered a flat rate discount.
SpecialItemData
- This option is similar to passing Discount except that it applies a flat dollar amount discount to the order. So in this case, the information passed will be the dollar amount to subtract from the order total, such as 50 for $50 dollars, 24.75 for $24.75 off, etc. If this is used, the item description will be displayed as the name of the discount.
- DiscountChange
ItemType
- Passing this actually enables passing quantity discounts, sometimes refered to as advanced pricing or quantity break pricing.
SpecialItemData
- This should contain the formula for the quantity breaks. This differs slightly in that this item type is applied to actual cart items, although it only works for phantom items (e.g. items that are not in the catalog, so you won't want to pass an ItemID or an existing Item Number). In this instance, instead of adding a separate cart item, you would flag an actual cart item as the DiscountChange type if you wanted to embed quantity discounts. The supported formulas for creating these types of discounts is as follows:
5=P.95|6=P.8
1. When the quantity is changed to 5, change the price to 95% of the original price
2. When the quantity is changed to 6 or more, change the price to 80% of the original price
10=F2.00|20=F5.00
1. When the quantity is changed to 10 or more, subtract $2 from the original unit price
2. When the quantity is changed to 20 or more, subtract $5 from the original unit price
10=C9.50|15=C8.50|20=C7.50
1. When the quantity is changed to 10 or more, change the unit price to $9.50
2. When the quantity is changed to 15 or more, change the unit price to $8.50
3. When the quantity is changed to 20 or more, change the unit price to $7.50
- Shipping
ItemType
- Specifying shipping as the type of item will allow you to create a formula for calculating the the shipping price
SpecialItemData
should contain that formula. The syntax for this formula is as follows:
base+0.00
- Use the standard cart shipping calculation (so essentially no effect)
base+10.00
- Add $10 to the cart calculated shipping cost
base+-5.00
- Subtract $5 from the cart calculated shipping cost
base*3
- Multiply the cart calculated shipping cost by 3
base*2+5.00
- Double the cart calculated shipping cost and add $5 to that
base*3+-10.00
- Triple the cart calculated shipping cost and subtract $10 from that
flat10.00 or 10.00
- Charge a flat $10 shipping
subtotal*3.5+10.00
- Multiply the order subtotal by 3.5 and add $10 to that
subtotal*10
- Multiply the order subtotal by $10 and use that as the shipping
omit
- Do not charge shipping