Allow affiliates to add sale manually from the affiliate panel

Sometimes, you may need to give your affiliates an option to add sales manually. You can achieve it by creating a custom page in their affiliate panel and in that page include a simple php script (file) of yours via iframe.

The steps to follow are:

  • create a new PHP file (in this example we call it affaddsale.php) and insert this code into the file:
<html>
<head>
<title> Add your sale here </title>
</head>
<body>
<?php
if (isset($_GET['referralid']) && isset($_POST['totalcost']) && isset($_POST['orderid'])){
    try{
        // download your PapApi.class.php from your merchant panel > Tools > Integration > API integration
        include_once('PapApi.class.php');
        //change URL to your own PAP location
        $saleTracker = new Pap_Api_SaleTracker('https://URL_to_PostAffiliatePro/scripts/server.php');
        $saleTracker->setAccountId('default1');
        $sale1 = $saleTracker->createSale();
        $sale1->setAffiliateID($_POST['referralid']);
        $sale1->setTotalCost($_POST['totalcost']);
        $sale1->setOrderID($_POST['orderid']);
        if (isset($_POST['productid'])){
            $sale1->setProductID($_POST['productid']);
        }
        $saleTracker->register();
        echo "A sale has been added.";
    } catch(Exception $e){
        echo $e->getMessage();
    }
}
?>
<form action="" method="POST">
<input type="hidden" name="referralid" value="<?php echo $_GET['referralid'];?>"> <br>
Total cost:<br> <input type="text" name="totalcost"> <br>
Order ID:<br> <input type="text" name="orderid"> <br>
Product ID:<br> <input type="text" name="productid"> <br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
 

DO NOT FORGET TO REPLACE URL_to_PostAffiliatePro with the real URL address leading to your installation of Post Affiliate Pro (Network).

  • save the file and upload it somewhere to your server so that it is available online via some URL address.
  • download the PapApi.class.php file from your Merchant panel at Tools > Integration > API integration > Download PAP API and upload it the same folder as your php file (affaddsale.php)
  • In your Merchant panel navigate to Configuration > Affiliate Panel > Menu & screens > Add new custom page > and create new page
  • edit the created page (click on pencil icon) and insert the following code into the template of the particular page (don't forget to replace Path_To_Your_Scrip with the real URL leading to your php file):
<iframe src="https://Path_To_Your_Script/affaddsale.php?referralid={$refid}" frameborder="0" width="100%" height="300px"></iframe>
  • save the changes and add this page to the affiliate panel menu by clicking the  “Add to menu” button next to the created custom page and Save the menu.

 

You are done! Your affiliates can add a sale manually via their affiliate panel. 

 

NOTE: You can add more variables into that script. For more information visit this link: https://support.qualityunit.com/938257-Pap_Api_SaleTracker
×