Merchant Affiliate Program

OpenCart integration
Page 1 of 1

Author:  admin [ Wed Dec 19, 2012 6:02 pm ]
Post subject:  OpenCart integration

To integrate MyGiftList with a site that uses the shopping cart software for e-commerce, cut and paste the "Add to MyGiftList" HTML code below into the file /catalog/view/theme/default/template/product/product.tpl template of your cart. If you are using a custom theme, you would need to change that product.tpl file. This code was tested with OpenCart 1.5.4.

The code should go immediately after the Add to Wishlist button code. The Add to Wishlist button is this code snippet:
<div><a onclick="addToWishList('<?php echo $product_id; ?>');"><?php echo $button_wishlist; ?></a><br />

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

<!-- 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 -->

<input type="image" onclick='javascript:opencartMGLpopup(this.form,"Your Affiliate ID","Your Store Name","opencart");return false;' src="" width=68 height=26 border=0 alt="Click to Add to MyGiftList!">

<script language=javascript>
function opencartMGLpopup(refsource, storename, cartname) {
  var elements = document.getElementsByClassName('price');
  var str = elements[0].innerHTML;
  var price = parseFloat(str.replace(/,/g,'').replace(/^[^-0-9]*/,''));
   var u;
   u = "" + escape(refsource) + "&giftURL=" + escape(document.URL) + "&giftName=" + escape(document.title) + "&giftPrice=" + escape(price) + "&giftRetailer=" + escape(storename) + "&giftCart=" + escape(cartname);
   var mgl =,"MGL","width=700,height=600,top=60,left=100,resizable,scrollbars");

<!-- End MyGiftList Code -->

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group