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

Volusion 5 Integration
http://forums.mygiftlist.com/affiliates/kb/viewtopic.php?f=7&t=92
Page 1 of 1

Author:  admin [ Wed Dec 26, 2007 7:06 pm ]
Post subject:  Volusion 5 Integration

To integrate MyGiftList with a site that uses the Volusion 5 Shopping Cart, http://www.volusion.com, for e-commerce, cut and paste the "Add to MyGiftList" HTML code below into the template you have chosen to use for your site. The template file can be found in the LiveEdit File Editor under Design in the Admin area for your store. This code has been tested with version 5.0 of Volusion.

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

Code:
</html>


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 -->
 
<div id="mgldiv1" style="Z-INDEX: 111; position:absolute; display: none">
 
<a href='javascript:volusion5MGLpopup("Your Affiliate ID","Your Store Name","volusion5");' ><img src="http://images.mygiftlist.com/gif/AddtoMyGiftList7e.gif" width=68 height=26 border=0 alt="Click to Add to MyGiftList!"></a>
 
</div>
 
<script language=javascript>
function volusion5MGLpopup(refsource, storename, cartname) {
   var p;
   var u;
   var m;
   var d;
   var giftPrice;
   var q;
   var giftName;
   
   u = "";
   p = document.forms["MainForm"];
   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 (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("Sale 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 = ""; }
   
   giftName = scrapeProductName("productname");
   if (giftName == null) { giftName = document.title; }
 
   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);
   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("content_area") ) {   
     h = document.getElementById("content_area").innerHTML;
     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);
    }
   }
  }
 
 }
 return p
}


function scrapeProductName(s) {
 var p = null;
 var x = 0;
 var y = 0;
 var h;
 if ( document.getElementById("content_area") ) {   
     h = document.getElementById("content_area").innerHTML;
     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);
    }
   }
  }
 
 }
 return p
}
 
// check to see if input is number
function isNumber(val) {
 if ((val==null) || (isNaN(val))) {
  return false;
 } else {
  return true;
 }
}
 
</script>
 
 
<SCRIPT language=javascript>
 
var IE4 = (document.all) ? true : false;
var NS4 = (document.layers) ? true : false;
 
function docjslib_getImageXfromLeft(imgID) {
  if (NS4) return eval(imgID).x
  else return docjslib_getRealLeft(imgID);
}
function docjslib_getImageYfromTop(imgID) {
  if (NS4) return eval(imgID).y
  else return docjslib_getRealTop(imgID);
}
function docjslib_getRealLeft(imgElem) {
   xPos = eval(imgElem).offsetLeft;
   tempEl = eval(imgElem).offsetParent;
     while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
     }
   return xPos;
}
function docjslib_getRealTop(imgElem) {
   yPos = eval(imgElem).offsetTop;
   tempEl = eval(imgElem).offsetParent;
   while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
     }
   return yPos;
}
       
function moveButton() {
   var x;
   var y;
   if (document.forms["MainForm"]) {
      for (var i = 0; i < document.forms["MainForm"].elements.length; i++) {
         if (document.forms["MainForm"].elements[i].name.indexOf("ProductCode") == 0 ) {
            if ( document.getElementById ) {
               x = docjslib_getImageXfromLeft(document.getElementById("content_area"));
               x = x + 710;
               x = x + 'px';
               document.getElementById("mgldiv1").style.left = x;
               y = docjslib_getImageYfromTop(document.getElementById("content_area"));
               y = y + 30;
               y = y + 'px';
               document.getElementById("mgldiv1").style.top = y;
               document.getElementById("mgldiv1").style.display = '';
            }
         }
      }
   }
}
 
moveButton();
</script>
<!-- MyGiftList Add Button Code End -->


You will also want to modify the <body> tag to include calling the moveButton() function when onResize is called like this:

Code:
<body id="body"  onResize="moveButton();" >

Author:  jbugajski [ Wed Jan 02, 2008 4:04 pm ]
Post subject:  Re: Volusion 5 Integration

It is not working, what am I doing wrong.

Author:  admin [ Wed Jan 02, 2008 5:35 pm ]
Post subject:  Please contact support with the URL of your website

Please contact support with the URL of your website so we can review.

Author:  greenbabynyc [ Tue Oct 14, 2008 3:08 pm ]
Post subject:  not working.

hi, my website is www.greenbaby-nyc.com and it doesn't seem to be working. Can you see what I am doing wrong? Thank you.

Author:  admin [ Tue Oct 14, 2008 6:19 pm ]
Post subject:  RE: not working

Hi,

If you look at the HTML source of your page, you will see that when you copy and paste the Add to MyGiftList code, that &nbsp; code is being added to your site.

You may want to copy and paste the Add to MyGiftList code into Notepad and then into Volusion to see if this gets rid of the &nbsp; code.

Author:  thenatureschild [ Sat May 02, 2009 11:22 am ]
Post subject: 

I'm a new MyGiftList.com user, and I was able to add this code to my Volusion site, but I need to adjust the position of the button. How do I do this?

Author:  admin [ Sat May 02, 2009 7:18 pm ]
Post subject:  To adjust the button positon

In the code snippet above, you will see two lines of code:

x = x + 710;
.
.
.
y = y + 30;


You can move the button left or right by changing 710 to a smaller or bigger number.

You can move the button up or down by changing 30 to a smaller or bigger number.

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