An item can be put into the cart without going through our product page from your main
site, and even without putting it in our database.
Since the product page is
normally created dynamically from the product database, and the reference number is used for keeping up
with what is being ordered, this will require you to use the reference number for
the item to be added, instead of the normal search type functions associated
with the category and item name. This is necessary to make sure that only
one item matches what is being ordered.
The format of the request is as follows, and allows the customer to enter the
quantity.
<form method="post" action="http://www.king-cart.com/cgi-bin/cart.cgi">
<input type=hidden name=store value=[your store id]>
<input type=text name="item-[REF]|Category|price|item name|image tag|weight" size="3">
<input type="submit" name="add_to_cart_button.x" value="Add To Cart">
Please note: By convention the square brackets ( [ and ] ) mean that what is
within the square brackets is a variable and must be replaced with a proper
value. For instance [your store id] must be replaced with what your store
id is. Also when you do that the square brackets should not be put in
there. If you leave the square brackets in it can cause problems such as
loss of cart contents.
If the cart can determine what page the submission was made from, then it
will return to that page, otherwise it will return to the front page of the
shopping cart. Virtually all browsers will give the original page
information to the cart so this will rarely fail for anyone.
If you want the cart to go to any specific page on the internet after adding
the item, then the following tag can be added to the above:
<input type=hidden name="return_page" value="http://www.domain/page.html">
where the value is any page on the internet. If you want it to display the
cart contents then simply select "Enable One Button Ordering" in the program
settings and the "continue shopping" button will then return to the
appropriate page as given above.
If you have any options you can put them in like this:
<select name=option|1|[REF]>
<option value="%%error%%"> Size
<option value="#12"> #12
<option value="#8"> #8
<option value="#5"> #5
</select>
If you have a second option then the select tag for it would be:
<select name=option|2|[REF]>
and so forth for as many options as you want.
Then the form must be closed:
</form>
To do this you must know the reference number and substitute it in place of
[REF] above. Once you have added an item to the
product database then you will be able to click on the "edit a product" link
at the top of the manager. Each item will have a reference number associated
with it. It will be the same as the number at the beginning of the item
line if you uploaded the product database. DO NOT SORT YOUR DATABASE IF YOU
ARE DOING THIS. Sorting will renumber all the items, and all the links will
then be wrong.
The product database is used to retrieve the product information or confirm
that each item matches the price and
so forth in the data sent with the post. You can leave out everything
following the item-#, if that information is in the database. Many carts do not do this, and
thus can be easily hacked by a customer who wants to "name their own price".
King Cart will check the price given in the above link to the price in the
database and then will give the customer the HIGHER price. It also does the
same thing for the shipping weight. The name of the item in the database
cannot be overridden by the post unless it is blank. This is to prevent a
hacker changing the name of the item of an inexpensive item to an expensive
item, which would have the same effect as changing the price to a lower
price.
If you still want to do it the way that other carts (such as pay pal and cool-cart) do it, without checking
against the price in the database then you can do the following:
1. Use item # of 0. The database starts with 1. This allows you to not have a matching db item.
2. Put what you want to display in the cart contents in the above link.
Make sure you never put a lower price in the link than is in the database
if you are using a database check.
If you do the higher price will be used, and the customer could get
irritated. The higher price and shipping is always used to defeat any attempts by a
customer to cheat you by editing the post, yet still allow you to either
sell at a higher price than in the database, or to not use a database at
all, and put it all on the command line by putting the data in the post
input tag. The price can conform to the standard discount price schedule format, and
the cart will recognize and use it.
We do not recommend this since it will be vulnerable to hacking
the post as most other carts are. If you do decide to use the item-0 direct
add, then in the miscellaneous section of the Program Settings page you
should enter the domain that the buy button will be on to prevent this
type of hacking.
Note: The price can be full discount pricing if you like if you use the same
format the database uses as outlined at prices.html.
Any fields you are not using in the cart display, or you wish to simply retrieve from the
database can be left out of the tag.
This includes the category, price, item name, image tag and weight. Only the
item-[item #] is absolutely necessary, but if you are not doing a database lookup, then
if you don't put in the item name, it will be difficult to know what was ordered from the log
file and email, and if you don't put in a price, the price will be 0.
If you are not displaying an image in the cart contents table, then the image tag should be left blank.
The image tag can be a bit complicated, since it is inside of another tag,
the browser will think that it is an image and mess up the tag. Thus the
following substitutions must be made in it:
" - ~qq~
< - ~lt~
> - ~gt~
= - ~eq~
# - ~lb~
But as stated above, you will most likely not want to have an image in the
cart contents table anyway, so normally you would just leave this field
blank.
Note that the entire form for any specific item that is in the database can
be copied and pasted from the "Show Links" for any item in the "Edit a
Product" page in the manager.
Be sure to either put your referring url in the box at the bottom of the
program settings screen, or put Disallow in there
Note: Since the customer will be able to return to your site and add
additional items from your site, they MUST have cookies enabled to preserve
their cart contents from one cart addition to another. If the
customer stays on our site for their entire order then cookies are not
needed.