Miva Merchant Fanplayr Integration

Integration with Miva Merchant involves adding Fanplayr script to your template files.

Adding the Script to your Template

The tracking script needs to be put on each page. It's best to put it in the footer. Note that you have to replace the < ACCOUNT_KEY > with the value given to you by your Fanplayr representative and < CURRENCY > with the ISO 4217 of your store currency.

You can find the footer in your admin by going to:

  • User Interface

  • Settings
  • Then scroll down to Global Header & Footer
<script>
(function(d, w, s) {
  var f = w.fanplayr = w.fanplayr || { _i:[] };
  var m = f.miva = f.miva || {};  

  m.currency = '< CURRENCY >';
  m.accountKey = '< ACCOUNT_KEY >';

  m.pageSnip = '&mvte:page:code;';
  m.products = [];

  m.baseUrl = '&mvt:global:baseurl;';
  m.cartUrl = '&mvt:urls:bask:rr;';

  // OPTIONAL Session Offers
  // m.sessionOffersPrefix = 'fp_';
  // m.sessionOffersSelector = '#l-bask-coupon';

  if ( m.pageSnip !== 'INVC' ) {
    <mvt:foreach iterator="item" array="global_minibasket:items">
      m.products.push({
        id: '&mvt:item:product:code',
        sku: '&mvt:item:product:sku',
        price: '&mvt:item:price',
        quantity: '&mvt:item:quantity',
        name: '&mvt:item:product:name',
        image: '&mvte:item:imagetypes:main' || '&mvt:item:product:image'
      });
    </mvt:foreach>

    m.lineItemCount = '&mvt:global_minibasket:basketitemsonly_count';
    m.numItems = '&mvt:global_minibasket:basket_count';
    m.subTotal = '&mvt:global_minibasket:total;';
    m.categoryId = '&mvt:cattree_categories[1]:code;';
    m.categoryName = '&mvt:cattree_categories[1]:name;';
    m.productId = '&mvt:item:code;';
    m.productName = '&mvt:item:name;';
    m.productSku = '&mvt:item:parts[1]:sku;';
    m.productPrice = '&mvt:item:base_price;';
    m.productUrl = '&mvt:product:link;';
    m.productImage = '&mvt:product:image;';
    m.discount = '&mvt:global_minibasket:coupons[1]:total';
    m.discountCode = '&mvt:global_minibasket:coupons[1]:code';
  } else {
    <mvt:foreach iterator="item" array="order:groups">
      m.products.push({
        id: '&mvt:item:product:code;',
        sku: '&mvt:item:product:sku;',
        price: '&mvt:item:price;',
        quantity: '&mvte:item:quantity;',
        name: '&mvt:item:product:name;',
        image: '&mvte:item:imagetypes:main' || '&mvt:item:product:image;'
      });
    </mvt:foreach>

    m.order = {};
    m.order.id = '&mvt:order:id;';
    m.order.subTotal = '&mvt:order:subtotal;';
    m.order.discount = '&mvt:coupon:total;';
    m.order.discountCode = '&mvt:coupon:code;';
    m.order.shipping = '&mvt:order:charges[1]:amount;';
    m.order.tax = '&mvt:ga_tracking:total_tax;';
    m.order.email = '&mvt:order:bill_email;';
    m.order.firstName = '&mvt:order:bill_fname;';
    m.order.lastName = '&mvt:order:bill_lname;';
    m.order.customerEmail = '&mvt:store:email;';
    m.order.customerId = '&mvt:order:cust_id;';
  }

  var js = d.createElement(s);
  var fjs = d.getElementsByTagName(s)[0];
  js.async = true;
  js.src = 'https://d38nbbai6u794i.cloudfront.net/customers/miva/adaptor/adaptor.js';
  fjs.parentNode.insertBefore(js, fjs);
})(document, window, 'script');
</script>

Session Offers

You can enable Session Offers by uncommenting (removing the // before each line) in the "OPTIONAL Session Offers" section as seen above. For example:

m.sessionOffersPrefix = 'fp_';
m.sessionOffersSelector = '#l-bask-coupon';

The values you will need to set:

sessionOffersPrefix

This should be set as the prefix you are going to use for your Fanplayr specific coupons. It can be any value, but needs to only appear at the beginning of Fanplayr coupons.

sessionOffersSelector

This needs to be the jQuery selector to your coupon entry field. If you need any help, please contact your Fanplayr representative.

results matching ""

    No results matching ""