To integrate MyGiftList with a site that uses the the X-Cart Shopping Cart,
http://www.x-cart.com, for e-commerce, cut and paste the "Add to MyGiftList" HTML code below into the product.php template page.
Place the below code after your Add to Cart button in the code. Each x-cart store will have a different Add to Cart button.
Remember to change "Your Affiliate ID" below to your MyGiftList Affiliate ID and "Your Store Name" below to the name of your store.
Code:
<!-- BEGIN MyGiftList Code -->
<!-- change "Your Affiliate ID" below to your MyGiftList Affiliate ID -->
<!-- change "Your Store Name" below to the name of your store -->
<BR>
<a href='javascript:xcartMGLpopup("Your Affiliate ID","Your Store Name","istar");' ><img src="http://images.mygiftlist.com/gif/AddtoMyGiftList7e.gif" width=68 height=26 border=0 alt="Click to Add to MyGiftList!"></a>
<script language=javascript>
function xcartMGLpopup(refsource, storename, cartname) {
var p;
var u;
var m;
var d;
var giftPrice;
var giftName;
var giftDescription;
var giftImage;
var q;
var x;
u = "";
p = document.forms["orderform"];
if (p) {
giftName = document.title;
x = giftName.lastIndexOf("::");
if (x > 0) {
giftName = giftName.substring(x+3);
}
giftImage = document.getElementById('product_thumbnail').src;
giftDescription = "";
giftPrice = document.getElementById('product_price').innerHTML;
for (var i = 0; i < p.elements.length; i++) {
if (p.elements[i].name.indexOf("product_options") == 0 ) {
m = p.elements[i].selectedIndex;
if (m > -1) {
u = u + p.elements[i].options[m].text + ", ";
}
}
if (p.elements[i].name.indexOf("amount") == 0 ) {
q = p.elements[i].value;
u = u + "Quantity=" + q + ", ";
}
}
}
if ( u != "" ) {
u = u.substr(0, u.length-2);
u = "I would like these options: " + u;
}
u = u + ". " + giftDescription;
u = "http://www.mygiftlist.com/register_gift.asp?refSource=" + escape(refsource) + "&giftURL=" + escape(document.URL) + "&giftName=" + escape(giftName) + "&giftPrice=" + escape(giftPrice) + "&giftRetailer=" + escape(storename) + "&giftCart=" + escape(cartname) + "&giftQuantity=" + escape(q) + "&giftDescription=" + escape(u) + "&giftImage=" + escape(giftImage);
var mgl = window.open(u,"MGL","width=720,height=500,top=60,left=100,resizable,scrollbars");
}
</script>
<!-- End MyGiftList Code -->