Miva HeLp! E-commerce for the rest of us.
E-commerce for the rest of us. 

one.gif (80 bytes)
Click Here for information on the East Coast Miva User Group meetings
one.gif (80 bytes)
one.gif (80 bytes)
Miva HeLp! HomeReady, Set, Go!TutorialsResourcesReviewsContact Us
one.gif (80 bytes)

Search Miva HeLp!

one.gif (80 bytes)
one.gif (80 bytes)

one.gif (80 bytes)

Quick Links

one.gif (80 bytes)

 

Step by Step Tutorial
Integrating Commission Junction Code in Merchant
 By Ahmed Saad, Technology Matrix Group - Copyright 2001

Click here for pointers on integrating ClixGalore and other affiliate network codes.

We use and recommend ClixGalore.   We believe it is one of the best and most affordable third party affiliate networks and it has an excellent user interface.  Click here for disclosures.

one.gif (80 bytes)
Before following the steps below, read "Modifying MMUI".  Also note that we have used <ENTER> to make the code not strech the screen and make you have to scroll horizonatally.  Make sure there are no enters in the code when you put it in and that it is one long line!

Step 1

You will need to edit MMUI.mv file. To do this you will need to download it to your hard drive via FTP.   Read Editing Your MMUI.mv File and follow the steps to locate and download the correct file.

Step 2

Next you will need to modify the Commssion Junction (CJ) code so that it can be inserted. You need to replace the <CID> with your CJ ID. This is the code you will need to use:

<img src="https://www.commission-junction.com/track/receive.dll?
AMOUNT=<AMOUNT>&CID=
<CID>&OID=<OID>&
TYPE=SALE&METHOD=IMG" height="1" width="1">

Step 3

The next step is to edit the file.  We recommend that you use PFE (Programmer's File Editor) ... it is a great tool.  William Weiland gave us this tip when we first started and we really appreciate it.

For the free download click here.

Step 4

Open the file using PFE and save a backup NOW! You may need it... In fact, if you're like us you WILL need it :-)

Step 5

Locate the Invoice function (this is where stuff related to the invoice screen goes).
  THIS IS WHERE ALL THE EDITING WILL TAKE PLACE.  It is located on about line 786 (of the mmui.mv code) in version 2.22  and line 1335 in version 3.  It will look like this:

<MvFUNCTION NAME = "UIModule_Invoice" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">

Once you have located it scroll down until you reach the line that ends the function; it will be a closing tag </MvFUNCTION> (it is around line 1491 in V2.22, and line 2074 in V3); a few lines above that there will be a closing table tag </table> and above that is <B><MvEVAL EXPR = "{ l.formattedprice }"></B>  You will need to insert your CJ code directly under that line.  This is the code you will need to insert:

<MvEVAL EXPR="<img
src='https://www.commission-junction.com/track/receive.dll?

amount=&[l.formattedprice];&oid=&[Orders.d.id];&CID=
<CID>&
TYPE=SALE&method=img' height='1'width='1'>">

Note how we included the code in an MvEVAL expression, and changed the double quotes around the CJ code (") to single quotes (').

Remember to change <CID> to YOUR CJ ID.

Note:  This will show the Grand Total of the sale...i.e. it includes the tax and the shipping.  If you want your affiliate to be paid for the total sale only without shipping or tax then there are a few more steps you will need to do, if not go directly to Step 9.

To get the total amount less the shipping and tax continue with the following steps:

Step 6

You will need to insert a line of code after <MvEVAL EXPR = "{ l.formattedprice }"> (around line 1375 in V2.22 and line 1952 in V3).  This is the l.formattedprice that comes (10 lines) before the first occurrence of
<MvLOCALIZED-TEXT LANGUAGE = "en-US">Shipping: %description%:</MvLOCALIZED-TEXT> it is still within the "UIModule_Invoice"

Add this line:
<MvASSIGN NAME = "cj1" VALUE = "{ OrderCharges.d.disp_amt }">

Step 7

You will need to insert another two lines of code after <MvEVAL EXPR = "{ l.formattedprice }"> (around line 1431 and line 2011 in V3).  This is the l.formattedprice that comes (10 lines) before the first occurrence of <MvLOCALIZED-TEXT LANGUAGE = "en-US">Sales Tax:</MvLOCALIZED-TEXT> it is also STILL within the "UIModule_Invoice".

Add the following lines:

<MvASSIGN NAME = "cj2" VALUE = "{ OrderCharges.d.disp_amt }">
<MvASSIGN NAME = "cj3" VALUE = "{ cj2 + cj1 }">


Step 8

Now scroll down until you reach the line that ends the function; it should show </MvFUNCTION> (it is around line 1491 and line 2059 in V3).  A few lines above the end function tag there will be a closing table tag </table> and above that will be <B><MvEVAL EXPR = "{ l.formattedprice }"></B>

Insert the following three lines directly under the one shown above:

<MvASSIGN NAME = "cj4" VALUE = "{ Orders.d.total }">
<MvASSIGN NAME = "cj5" VALUE = "{ cj4 - cj3 }">

<MvEVAL EXPR="<img
src='https://www.commission-junction.com/track/receive.dll?

amount=&[ctrade5];&oid=&[Orders.d.id];&CID=
<CID>&
TYPE=SALE&method=img' height='1'width='1'>">


Remember to change <CID> to YOUR CJ ID.

 
Step 9

Save, then FTP the file back to the same subdirectory and check that it works!

 

one.gif (80 bytes)

  If you have another affiliate code to integrate, its requirements are probably similar to the Commission Junction code requirements and will most definitely involve the order number and the sale total.  Click here to see our Clix Galore integration tutorial. Special thanks to James Williams from Ora Sweet for working with us to integrate the code in his store, for giving us the CJ virgin code, and the exact line numbers in Merchant version 3 where he inserted the code.

The order_id is a unique name in the mmui.mv and is global in nature.  Referencing it anywhere will always call the order number for the transaction.  We found the sales amount to be a little trickier since each of the formatted prices we found were localized {l.formattedprice}.  The first referenced the shipping value, the second was for the tax value, and the third was for the Grand Total (there were others pointing to upsale products and attributes).  We were unable to find a called value for the total without the shipping and tax. 

Since the formatted prices were all localized, we had to insert the CJ string at the point where the {l.formattedprice} of the Grand Total occurred.   We also had to assign non localized names to the Tax and Shipping {l.formattedprice} to be able to call them outside the localized function.   Again, note how we included the code in an MvEVAL expression, and changed the double quotes (") to single quotes (').  If you are replacing the CJ code with another third party commission tracking code you will need to replace the double quotes with single quotes.

one.gif (80 bytes)

If you have a better way to implement this integration, or have successfully coded other affiliates and would like to share it with the fellow Miva Merchant users, please e-mail us at feedback@mivahelp.com.

 

Quick Tips

one.gif (80 bytes)

one.gif (80 bytes)

one.gif (80 bytes)
one.gif (80 bytes)


Fotolia
    

Miva Merchant, and the Miva blades logo are registered trademarks of
Miva Corporation.

Miva HeLp! is not affiliated with Miva Corporation.

 

 

Please e-mail site related issues to webmaster@MivaHelp.com and content corrections to content@MivaHelp.com

Copyright 2001- 2008 Technology Matrix Group Ltd.

Site Design by: A Design Elf Site