NOTE: The Add-to-Cart code used in this example comes from our own CustomCart commerce system. You will need to substitute the Add-to-Cart code from whatever cart system you use on your web site.
Each Add-to-Registry form must contain the correct Add-to-Cart code for the item. This is so that when someone is viewing a registry, there will be an Add-to-Cart button next to each item allowing the shopper to add the item to your cart system correctly.
First, notice that the code below is divided into two sections - both of these must appear on your product page. The top section is simply URL Encoding various fields for the final code below it.
If you know PHP fairly well, you will know that you can blend the two sections of code together. If you are new to PHP, it will be easier to keep them separate.
This is the URL Encoding for various fields used in the final Add-to-Registry form code below.
You will need to substitute your own values in the areas shaded in pink below including your entire add-to-cart form.
<cfoutput>
<--- Add to Cart form NOTE: this is sample CustomCart (our commerce system) code - substitute your add-to-cart form code --->
<cfset addtocart = URLEncodedFormat ('
<form action=http://apps.agenne.com/cart.cfm method=post>
<input type=hidden name=cid value=000>
<input type=hidden name=op value=add>
<input type=hidden name=item_desc value=My Item description>
<input type=hidden name=item_price value=49.95>
<input type=hidden name=item_id value=sku123>
<input type=submit value=Add to Cart>
</form>
|
')>
<--- Item SKU --->
<cfset item_id = URLEncodedFormat('myitemid123')>
<--- Item Description --->
<cfset item_desc = URLEncodedFormat('My Item Description')>
<--- URL to the product page for this item (optional) --->
<cfset product_page_url = URLEncodedFormat('http://www.your_product_page_url.html')>
<--- URL to the image for this item (optional) --->
<cfset product_image_url = URLEncodedFormat('http://www.your_product_image_url.jpg')>
This is the main Add-to-Registry button form as it might appear on your web pages
<form action="http://apps.agenne.com/Registry.cfm" method="post">
<input type="hidden" name="addtocart" value="#addtocart#">
<input type="hidden" name="cid" value="99">
<input type="hidden" name="op" value="add">
<input type="hidden" name="image_url" value="#product_image_url#">
<input type="hidden" name="product_page_url" value="#product_page_url#">
<!-- NOTE: item_qty field is optional. If omitted, default qty of 1 is used by Registry Valet -->
<input type="text" name="item_qty" value="1" size="3">
<input type="hidden" name="item_desc" value="#item_desc#">
<input type="hidden" name="item_price" value="49.95">
<input type="hidden" name="item_id" value="#item_id#">
<input type="submit" value="Add to Registry">
</form>
</cfoutput>