Follow these steps to install the Zen Cart PHP Shopping Cart with MyGiftList functionality: 

1. Sign up to be a MyGiftList Merchant Affiliate.  You will receive a MyGiftList Affiliate ID after you sign up.  Signing up is free.
http://www.mygiftlist.com/affiliates

2. Download the Free Zen Cart PHP Shopping Cart Script. This code was tested with Zen Cart v1.3.7 but may work for others.

http://www.zen-cart.com/modules/mydownloads/


3. After downloading the free shopping cart and installing it on your site, you can add the MyGiftList Gift Registry to your site by cutting and pasting HTML code into the includes/templates/template_default/templates/tpl_product_info_display.php file if you are using the default template that came with Zen Cart.  If you have a different template, then find your specific tpl_product_info_display.php file.

4. Open up the tpl_product_info_display.php file in your HTML editor and find this line of code:

            echo $display_button;
            ?>

5. Paste the following code DIRECTLY after this code and before the </div>:

<!-- BEGIN MyGiftList Code --> 
<!--  Add this code before the </form> end tag for the Add to Cart button --> 
<!--  change "Your Affiliate ID" below to your MyGiftList Affiliate ID --> 
<!--  change "Your Store Name" below to the name of your store --> 

<br><br>
<input type="image" onclick='javascript:zenMGLpopup(this.form,"Your Affiliate ID","Your Store Name","zen-cart");return false;' src="http://images.mygiftlist.com/gif/AddtoMyGiftList7e.gif" width=68 height=26 border=0 alt="Click to Add to MyGiftList!"> 

<textarea rows=1 cols=10 name=giftName style="display:none"><?php echo $products_name; ?></textarea>
<input type=hidden name=giftPrice value="<?php echo $specials_price ? $specials_price : $products_price; ?>">
<textarea rows=1 cols=10 name=giftDescription style="display:none"><?php echo $products_model . " " . stripslashes($products_description); ?></textarea>
<input type=hidden name=giftImage value='<?php echo DIR_WS_IMAGES . $products_image; ?>'>

<script language=javascript> 
function zenMGLpopup(f, refsource, storename, cartname) { 
	var giftPrice = ""; 
	var giftName = ""; 
	var giftDescription = ""; 
	var m; 
	var u = ""; 
	var n; 
    
	if (f) { 
    	giftPrice = f.giftPrice.value;
		giftName = f.giftName.value;
		giftDescription = f.giftDescription.value;
	  
		for (var i = 0; i < f.elements.length; i++) {
			m = f.elements[i].selectedIndex; 
			n = f.elements[i].name

			if (m > -1) { 
				u = u + f.elements[i].options[m].text + ", "; 
	        } 
			if (f.elements[i].name == "cart_quantity" ) { 
            	u = u + "Quantity=" + f.elements[i].value + ", "; 
			} 
    	} 
	}
	if ( u != "" ) { 
      u = u.substr(0, u.length-2); 
      u = "I would like these options: " + u; 
      giftDescription = u + ".  " + giftDescription; 
	} 

	u = "http://www.mygiftlist.com/register_gift.asp?refSource=" + escape(refsource) + "&giftURL=" + escape(document.URL) + "&giftName=" + escape(giftName) + "&giftRetailer=" + escape(storename) + "&giftCart=" + escape(cartname) + "&giftPrice=" + escape(giftPrice) + "&giftDescription=" + escape(giftDescription); 
	var mgl = window.open(u,"MGL","width=720,height=500,top=60,left=100,resizable,scrollbars"); 
} 
</script> 

<!-- End MyGiftList Code -->



6. Change the below 2 lines in the code you just added by replacing Your Store Name with the name of your store and Your Affiliate ID with your MyGiftList Affiliate ID: 

<input type=hidden name=giftRetailer value="Your Store Name"> 
<input type=hidden name=RefSource value="Your Affiliate ID"> 

7. That's it! 

Alternatively, you can replace the tpl_product_info_display.php file of your web site with the tpl_product_info_display-1.3.7.php file included in this zip file and then perform Step 6 above.

Please direct all questions to support@mygiftlist.com.
