Merchant Affiliate Program

Support Forum
It is currently Sat Nov 18, 2017 12:22 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Nexternal Integration
PostPosted: Fri Mar 08, 2013 4:59 pm 
Offline
Site Admin

Joined: Mon Mar 29, 2004 3:56 pm
Posts: 114
To integrate MyGiftList with a site that uses the Nexternal Shopping Cart, http://www.nexternal.com, for e-commerce, cut and paste the "Add to MyGiftList" HTML code into the "Bottom HTML" input box in the Nexternal Order Management System. To find this field, login to your Nexternal Order Management System and click on Layout in the left menu. Then scroll down to Advanced Layouts and click Edit. The Bottom HTML field is under Bordering HTML on the next screen.

Place the below code at the end of the field right after this tag:

Code:
<!-- /#footer -->


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

You will also want to create a new Gift Registry page in your Nexternal store and add the Login Code so visitors can create, find, and login to their registries from your website.


Code:
<!-- MyGiftList Add Button Code Begin -->
 
<div id="mgldiv1" style="display: none;"><a href='javascript:nexternalMGLpopup("Your Affiliate ID","Your Store Name","nexternal");' ><img s!tyle="padding-left:10px;" src="http://cdn.mygiftlist.com/buttons/red_registry_5a.png" border=0 alt="Click to Add to Registry!"><!-- <img style="padding-left:10px;" src="http://images.mygiftlist.com/gif/AddtoMyGiftList7e.gif" width=68 height=26 border=0 alt="Click to Add to Registry!">--></a></div>
 
<script language=javascript>
function nexternalMGLpopup(refsource, storename, cartname) {
   var p;
   var u;
   var m;
   var d;
   var giftPrice;
   var q;
   var giftName;
   var giftImage;
   
   u = "";
   p = document.forms["aspnetForm"];
   if (p) {
      for (var i = 0; i < p.elements.length; i++) {
         if (p.elements[i].name.indexOf("SELECT___") == 0 ) {
            m = p.elements[i].selectedIndex;
            if (m > -1) {
                u = u + p.elements[i].options[m].text + ", ";
            }
         }
      }
   }
 
   if ( u != "" ) {
      u = u.substr(0, u.length-2);
      u = "I would like these options: " + u;
   }
 
   giftPrice = scrapePrice("price");
   //if (!(isNumber(giftPrice))) { giftPrice = scrapePrice("Our Price:"); }
   //if (!(isNumber(giftPrice))) { giftPrice = scrapePrice("List Price:"); }
   //if (!(isNumber(giftPrice))) { giftPrice = scrapePrice("Price"); }
   if (!(isNumber(giftPrice))) { giftPrice = ""; }
   //alert(giftPrice);
   giftName = scrapeProductName("name");
   if (giftName == null) { giftName = document.title; }
   
   giftImage = "";
   
   if (!(document.getElementsByClassName("nextProdImage")[0] == undefined)) {
      giftImage = document.getElementsByClassName("nextProdImage")[0].src;
   }
   
   q = 1;
   if (!(document.getElementsByTitleName("Enter Quantity")[0] == undefined)) {
      q = document.getElementsByTitleName("Enter Quantity")[0].value;
      }
   
 
   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) + "&giftImage=" + escape(giftImage) + "&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.getElementsByClassName("nextPrice")[0] == undefined)) {
       h = document.getElementsByClassName("nextPrice")[document.getElementsByClassName("nextPrice").length-1].innerHTML;
      //alert(h);
   
       if (h) {
          x = h.indexOf(s);
         if (x > -1) {
            x = h.indexOf("content=", x);
            //alert(x);
            if (x > -1) {
                x = x + 9; // length of content= + 1
                y = h.indexOf('"', x);
               //alert(y);
                if (y > -1) {
                    p = h.substr(x, y-x);
               } else {
                    p = h.substr(x, 15);
                }
            }
         }
      }
   }
    //alert(p);
   return p
}


function scrapeProductName(s) {
 var p = null;
 var x = 0;
 var y = 0;
 var h;

    if (!(document.getElementsByClassName("nextProdName")[0] == undefined)) {
       h = document.getElementsByClassName("nextProdName")[document.getElementsByClassName("nextProdName").length-1].innerHTML;
   }
   return h
}
 
// check to see if input is number
function isNumber(val) {
 if ((val==null) || (isNaN(val))) {
  return false;
 } else {
  return true;
 }
}
 

window.onload = function(){   
   if ( !document.getElementsByClassName ) {   
        document.getElementsByClassName = function( classname ) {   
         var elArray = [];   
           var tmp = document.getElementsByTagName("*");   
           var regex = new RegExp("(^|\s)" + classname + "(\s|$)");   
         for ( var i = 0; i < tmp.length; i++ ) {   
            if ( regex.test(tmp[i].className) ) {   
               elArray.push(tmp[i]);   
              }   
           }   
      return elArray;   
      };   
   }   
   if ( !document.getElementsByTitleName ) {   
        document.getElementsByTitleName = function( titlename ) {   
         var e2Array = [];   
           var tmp = document.getElementsByTagName("*");   
           var regex = new RegExp("(^|\s)" + titlename + "(\s|$)");   
         for ( var i = 0; i < tmp.length; i++ ) {   
            if ( regex.test(tmp[i].title) ) {   
               e2Array.push(tmp[i]);   
              }   
           }   
      return e2Array;   
      };   
   }   
};   

function moveAddToMGLbutton() {

   if (!(document.getElementsByClassName("nextProdImage")[0] == undefined)) {
       document.getElementsByClassName("nextAddToCartButton")[0].appendChild(document.getElementById("mgldiv1"));
      document.getElementById("mgldiv1").style.display = 'block'
   }
}

moveAddToMGLbutton();


</script>
<!-- MyGiftList Add Button Code End -->



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group