Merchant Affiliate Program
http://forums.mygiftlist.com/affiliates/kb/

3dCart Integration
http://forums.mygiftlist.com/affiliates/kb/viewtopic.php?f=7&t=96
Page 1 of 1

Author:  admin [ Tue Feb 12, 2008 6:38 pm ]
Post subject:  3dCart Integration

To integrate MyGiftList with a site that uses the 3DCart Shopping Cart, http://www.3dcart.com, for e-commerce, cut and paste the "Add to MyGiftList" HTML code below into the product detail template you have chosen to use for your site. The template file is usually called listing_0.html and can be found in the /assets/templates/common folder in the FTP site for your store.

Place the below code right after this tag:

Code:
<input type="button" onClick="check_and_add(document.add);" name="Add" value="[product_addtocart]" class="btn" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'">


and before the </td> tag.

Remember to change "Your Affiliate ID" below to your MyGiftList Affiliate ID and "Your Store Name" below to the name of your store.


Code:
<!-- MyGiftList Add Button Code Begin -->
<BR> 
<a href='javascript:threedcartMGLpopup("Your Affiliate ID","Your Store Name","3dcart");' ><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 threedcartMGLpopup(refsource, storename, cartname) {
   var p;
   var u;
   var m;
   var d;
   var giftPrice;
   var q;
   
   u = "";
   p = document.forms["add"];
   if (p) {
      for (var i = 0; i < p.elements.length; i++) {
         if (p.elements[i].name.indexOf("Size-") == 0 ) {
            m = p.elements[i].selectedIndex;
            if (m > -1) {
                u = u + "Size=" + p.elements[i].options[m].text + ", ";
            }
         }
         if (p.elements[i].name.indexOf("Color-") == 0 ) {
            m = p.elements[i].selectedIndex;
            if (m > -1) {
                u = u + "Color=" + p.elements[i].options[m].text + ", ";
            }
         }
         if (p.elements[i].name.indexOf("qty-") == 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;
   }
 
   giftPrice = scrapePrice("Price:");
   if (!(isNumber(giftPrice))) { giftPrice = ""; }
   
 
   u = "http://www.mygiftlist.com/register_gift.asp?refSource=" + escape(refsource) + "&giftURL=" + escape(document.URL) + "&giftName=" + escape(document.title) + "&giftPrice=" + escape(giftPrice) + "&giftRetailer=" + escape(storename) + "&giftCart=" + escape(cartname) + "&giftQuantity=" + escape(q) + "&giftDescription=" + escape(u);
   var mgl = window.open(u,"MGL","width=700,height=500,top=60,left=100,resizable,scrollbars");
}
 
function scrapePrice(s) {
   var p = null;
   var x = 0;
   var y = 0;
   var h;
   if ( document.getElementById("price") ) {   
      h = document.getElementById("price").innerHTML;
      x = 0;
       //x = h.indexOf(s);
      //if (x > -1) {
         x = h.indexOf("$", x);
         if (x > -1) {
            x = x + 1;
            y = h.indexOf("<", x);
            if (y > -1) {
               p = h.substr(x, y-x);
            } else {
               p = h.substr(x, 99);
            }
         }
      //}
   }
   return p;
}
 
// check to see if input is number
function isNumber(val) {
   if ((val==null) || (isNaN(val))) {
      return false;
   } else {
      return true;
   }
}
 
</script>
<!-- MyGiftList Add Button Code End -->

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/