PHP code example of xddesigners / shop-affiliate-marketing
1. Go to this page and download the library: Download xddesigners/shop-affiliate-marketing library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xddesigners / shop-affiliate-marketing example snippets
class HasOffersExtension extends Extension
{
public function onBeforePostBack(&$query, $order)
{
// if the order matches the case of the different offer or goal
if ($order->matchesDifferentCase()) {
$query['offer_id'] = 'my_offer_id';
}
}
}
class MyAffiliateProvider extends AffiliateProvider
{
/**
* Set the $transactionId = $request->getVar('transaction_id');
$affiliateId = $request->getVar('affiliate_id');
if ($transactionId && $affiliateId) {
$session = $request->getSession();
$session->set('MyAffiliateProvider.TransactionID', $transactionId);
$session->set('MyAffiliateProvider.AffiliateID', $affiliateId);
$session->save($request);
}
}
/**
* Handle the postback to the affiliate provider
*/
public function doPostBack(HTTPRequest $request, Order $order)
{
// send the postback to your affiliate partners server
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.