Merchant Affiliate Program

Support Forum
It is currently Fri Sep 22, 2017 9:25 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Volusion 5 Integration
PostPosted: Wed Dec 26, 2007 7:06 pm 
Offline
Site Admin

Joined: Mon Mar 29, 2004 3:56 pm
Posts: 114
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();" >


Last edited by admin on Thu Jun 18, 2009 2:09 pm, edited 7 times in total.

Top
 Profile  
 
PostPosted: Wed Jan 02, 2008 4:04 pm 
Offline

Joined: Wed Jan 02, 2008 4:01 pm
Posts: 2
It is not working, what am I doing wrong.


Top
 Profile  
 
PostPosted: Wed Jan 02, 2008 5:35 pm 
Offline
Site Admin

Joined: Mon Mar 29, 2004 3:56 pm
Posts: 114
Please contact support with the URL of your website so we can review.


Top
 Profile  
 
 Post subject: not working.
PostPosted: Tue Oct 14, 2008 3:08 pm 
Offline

Joined: Tue Oct 14, 2008 3:04 pm
Posts: 1
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.


Top
 Profile  
 
 Post subject: RE: not working
PostPosted: Tue Oct 14, 2008 6:19 pm 
Offline
Site Admin

Joined: Mon Mar 29, 2004 3:56 pm
Posts: 114
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 02, 2009 11:22 am 
Offline

Joined: Sat May 02, 2009 11:21 am
Posts: 1
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?


Top
 Profile  
 
PostPosted: Sat May 02, 2009 7:18 pm 
Offline
Site Admin

Joined: Mon Mar 29, 2004 3:56 pm
Posts: 114
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.


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

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