How do I integrate Post Affiliate Pro with my Miva Merchant 5 store?
(right click here and save file for a text version)
If you're just doing overall tracking, not particular product tracking, the steps are below. You must be familiar with MM5 Page Templates and editing them. Post Affiliate Pro must be properly installed.
First, you need the Emporium Plus Tool Kit module installed properly:
http://www.emporiumplus.com/merchant2/merchant.mvc?Screen=PROD&Product_Code=1AA00223
Be sure to enable the toolkit Item in the Items for all pages.
At the bottom of the Global Header, place the following code. Replace pap_xxxxxxxx with YOUR pap code, and replace www.yourdomain.com with YOUR domain.
<!-- start affiliate code -->
<mvt:if expr="g.Secure">
<script id="pap_xxxxxxxx" src="https://www.yourdomain.com/affiliate/scripts/track.js" type="text/javascript">
</script>
<script type="text/javascript">
<!--
papTrack();
//-->
</script>
<mvt:else>
<script id="pap_xxxxxxxx" src="http://www.yourdomain.com/affiliate/scripts/track.js" type="text/javascript">
</script>
<script type="text/javascript">
<!--
papTrack();
//-->
</script>
</mvt:if>
<!-- end affiliate code -->
Then, in the Invoice Footer, place:
<script id="pap_xxxxxxxx" src="https://www.yourdomain.com/affiliate/scripts/sale.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
var TotalCost="&mvt:global:subtot;";
var OrderID="&mvt:order:id;";
papSale();
-->
</script>
Then, in the Invoice Order Contents part of the Invoice (INVC) Page template, insert code in a couple of places. The code to insert is in red:
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td align="left" valign="middle" bgcolor="&mvt:colors:lhdr_bg;">
<mvt:item name="fonts" param="lhdr_font">
<b>Code</b>
</mvt:item>
</td><td align="left" valign="middle" bgcolor="&mvt:colors:lhdr_bg;">
<mvt:item name="fonts" param="lhdr_font">
<b>Product</b>
</mvt:item>
</td><td align="left" valign="middle" bgcolor="&mvt:colors:lhdr_bg;">
<mvt:item name="fonts" param="lhdr_font">
<b>Quantity</b>
</mvt:item>
</td><td align="right" valign="middle" bgcolor="&mvt:colors:lhdr_bg;">
<mvt:item name="fonts" param="lhdr_font">
<b>Price/Ea.</b>
</mvt:item>
</td><td align="right" valign="middle" bgcolor="&mvt:colors:lhdr_bg;">
<mvt:item name="fonts" param="lhdr_font">
<b>Total</b>
</mvt:item>
</td></tr>
<mvt:item name="toolkit" param="sassign|subtot|0" />
<mvt:foreach iterator="item" array="order:items">
<tr><td align="left" valign="middle" nowrap>
<mvt:item name="fonts" param="body_font">
&mvt:item:code;
</mvt:item>
</td><td align="left" valign="middle" width="100%">
<mvt:item name="fonts" param="body_font">
&mvt:item:name;
<mvt:if expr="l.settings:item:upsold">
(Special Offer)
</mvt:if>
</mvt:item>
</td><td align="right" valign="middle" nowrap>
<mvt:item name="fonts" param="body_font">
&mvt:item:quantity;
</mvt:item>
</td><td align="right" valign="middle" nowrap>
<mvt:item name="fonts" param="body_font">
&mvt:item:formatted_price;
</mvt:item>
</td><td align="right" valign="middle" nowrap>
<mvt:item name="fonts" param="body_font">
&mvt:item:formatted_subtotal;
<mvt:if expr="l.settings:item:price GT 0">
<mvt:item name="toolkit" param="math_multiply|prodsub|l.all_settings:item:quantity|l.all_settings:item:price" />
<mvt:item name="toolkit" param="math_add|tottot|subtot|prodsub" />
<mvt:item name="toolkit" param="vassign|subtot|tottot" />
</mvt:if>
</mvt:item>
</td></tr>
<mvt:foreach iterator="option" array="item:options">
<tr><td align="left">
</td><td align="left">
<mvt:item name="fonts" param="body_font">
<mvt:if expr="l.settings:option:option_id">
&mvt:option:attr_code;: &mvt:option:opt_code;
<mvt:elseif expr="NOT ISNULL l.settings:option:data">
&mvt:option:attr_code;: &mvt:option:data;
<mvt:elseif expr="NOT ISNULL l.settings:option:data_logn">
&mvt:option:attr_code;: &mvt:option:data_logn;
<mvt:else>
&mvt:option:attr_code;
</mvt:if>
</mvt:item>
</td><td align="left">
</td><td align="right" nowrap>
<mvt:item name="fonts" param="body_font">
<mvt:if expr="l.settings:option:price">
&mvt:option:formatted_price;
<mvt:else>
</mvt:if>
</mvt:item>
</td><td align="right" nowrap>
<mvt:item name="fonts" param="body_font">
<mvt:if expr="l.settings:option:price">
&mvt:option:formatted_subtotal;
<mvt:else>
</mvt:if>
</mvt:item>
</td></tr>
</mvt:foreach>
</mvt:foreach>
<mvt:foreach iterator="charge" array="order:charges">
<tr><td align="right" valign="middle" colspan="3">
</td><td align="right" valign="middle" nowrap>
<mvt:item name="fonts" param="body_font">
<i>&mvt:charge:descrip;:</i>
</mvt:item>
</td><td align="right" valign="middle" nowrap>
<mvt:item name="fonts" param="body_font">
&mvt:charge:formatted_disp_amt;
</mvt:item>
</td></tr>
</mvt:foreach>
<tr><td align="right" valign="middle" colspan="3">
</td><td align="right" valign="middle" bgcolor="&mvt:colors:lhdr_bg;">
<mvt:item name="fonts" param="lhdr_font">
<b>Total:</b>
</mvt:item>
</td><td align="right" valign="middle" bgcolor="&mvt:colors:lhdr_bg;" nowrap>
<mvt:item name="fonts" param="lhdr_font">
<b>&mvt:order:formatted_total;</b>
</mvt:item>
</td><tr>
</table>
I'll repeat - be sure the toolkit Item is enabled within ALL Page Templates.
If you have any issues or need more details for this implementation, please let me know and I'll try to elaborate.