osCommerce integration
Ingyenes online shop program, amely rendelési előzményeket, bevásárlókosarakat, teljes keresési lehetőséget, termékismertetőket, biztonságos tranzakciókat, bestsellerlistákat és kapcsolódó cikkeket tartalmaz.
Az osCommerce-szel való integráció az értékesítés nyomkövetési szkriptjének a megerősítő oldalon történő elhelyezésével történik. Az OrderID és a TotalSale értékeinek megszerzéséhez a kódrészlet csatlakozik az osCommerce adatbázishoz, és onnan kéri le az értékeket.
Keresse meg a checkout_success.php fájlt
Keresse meg és nyissa meg a checkout_success.php fájlt az osCommerce forrásfájlokban.
Keresse meg a megfelelő helyet az integrációhoz
A fájlon belül keresse meg ezt a sort:
if ($global['global\_product\_notifications'] != '1') {...
valahol ez után a sor után kell lennie:
<! DOCTYPE ........>
Adjon hozzá az integrációs kódot
Szúrja be a következő kódot közvetlenül a sor fölé:
//--------------------------------------------------------------------------
// integration code
//--------------------------------------------------------------------------
// get order id
$sql = "select orders_id from ".TABLE_ORDERS.
" where customers_id='".(int)$customer_id.
"' order by date_purchased desc limit 1";
$pap_orders_query = tep_db_query($sql);
$pap_orders = tep_db_fetch_array($pap_orders_query);
$pap_order_id = $pap_orders['orders_id'];
// get total amount of order
$sql = "select value from ".TABLE_ORDERS_TOTAL.
" where orders_id='".(int)$pap_order_id.
"' and class='ot_subtotal'";
$pap_orders_total_query = tep_db_query($sql);
$pap_orders_total = tep_db_fetch_array($pap_orders_total_query);
$pap_total_value = $pap_orders_total['value'];
//get product ids
$sql = "select products_id from " .TABLE_ORDERS_PRODUCTS.
" where orders_id=".(int)$pap_order_id;
$pap_orders_products_query = tep_db_query($sql);
$pap_orders_products = '';
while ($row = tep_db_fetch_array($pap_orders_products_query)) {
$pap_orders_products .= $row['products_id'] . ',';
}
$pap_orders_products = substr($pap_orders_products, 0, -1);
// draw invisible image to register sale
if($pap_total_value != "" && $pap_order_id != "")
{
print '<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
'."<script type=\"text/javascript\">PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost('$pap_total_value');
sale.setOrderID('$pap_order_id');
sale.setProductID('$pap_orders_products');
PostAffTracker.register();
</script>";
}
//--------------------------------------------------------------------------
// END of integration code
//--------------------------------------------------------------------------
Az integráció befejeződött
Most már integrálva van. Minden alkalommal, amikor az ügyfél belép a rendelés visszaigazoló oldalára, a rendszer hívja a követőkódot, és értékesítést regisztrál a hivatkozó partner számára.
Másik integráció
Ha azt tervezi, hogy a termékeket több kampányra osztja fel, akkor valószínűleg egy másik integrációra lesz szüksége, amely a teljes értékesítést egyetlen termékértékesítésre osztja fel.
//--------------------------------------------------------------------------
// integration code
//--------------------------------------------------------------------------
// get order id
$sql = "select orders_id from ".TABLE_ORDERS.
" where customers_id='".(int)$customer_id.
"' order by date_purchased desc limit 1";
$pap_orders_query = tep_db_query($sql);
$pap_orders = tep_db_fetch_array($pap_orders_query);
$pap_order_id = $pap_orders['orders_id'];
//get variables for script
$sql = "select products_id,products_price,products_quantity from " .TABLE_ORDERS_PRODUCTS.
" where orders_id=".(int)$pap_order_id;
$pap_products_total_query = tep_db_query($sql);
$k = 0;
while ($row = tep_db_fetch_array($pap_products_total_query)) {
$pap_products_total[$k+1] = $row['products_price'] * $row['products_quantity'];
$pap_products[$k+1] = $row['products_id'];
$k++;
}
// draw invisible image to register sale
if($pap_order_id != "")
{
?>
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID'); <?php
for ($j=1; $j<=$k; $j++){
echo "var sale".$j." = PostAffTracker.createSale();\n".
"sale".$j.".setTotalCost('". $pap_products_total[$j]."');\n".
"sale".$j.".setOrderID('".$pap_order_id."');\n".
"sale".$j.".setProductID('".$pap_products[$j]."');\n\n";
}
?>
PostAffTracker.register();
</script>;
<?php
}
//--------------------------------------------------------------------------
// END of integration code
//--------------------------------------------------------------------------
Közvetlen PayPal integráció az osCommerce szolgáltatással
Ha a PayPal IPN-jére szeretne támaszkodni (mivel ez biztonságos és 100%-ban biztos abban, hogy a tranzakció rögzítésre kerül), közvetlenül szerkesztheti a PayPal gomb sablont az osCommerce-ben. Jelentkezzen be az FTP-re, navigáljon a catalog/includes/modules/payment/ oldalra, és szerkessze a paypal_standard.php fájlt.
Keresse meg a process_button függvényt, és görgessen le a végéig. Ezt a kódblokkot kell megtalálnia:
} else {
reset($parameters);
while (list($key, $value) = each($parameters)) {
$process_button_string .= tep_draw_hidden_field($key, $value);
}
}
return $process_button_string;
// --------------------------------------------
// change this whole block of code to this block:
} else {
reset($parameters);
while (list($key, $value) = each($parameters)) {
if ($key == "custom") {
$tofix = tep_draw_hidden_field($key, $value);
$process_button_string .= substr($tofix,0,-1) .' id="pap_ab78y5t4a" >';
}
else {
$process_button_string .= tep_draw_hidden_field($key, $value);
}
}
}
$process_button_string .= '<script type="text/javascript">';
$process_button_string .= 'document.write(unescape("%3Cscript id=%27pap_x2s6df8d%27 src=%27" + (("https:" == document.location.protocol) ? "https://" : "http://") + "URL_TO_PostAffiliatePro/scripts/trackjs.js%27 type=%27text/javascript%27%3E%3C/script%3E"));';
$process_button_string .= '</script><script type="text/javascript">PostAffTracker.setAccountId(\'default1\');';
$process_button_string .= 'PostAffTracker.setAppendValuesToField(\'||\');';
$process_button_string .= 'PostAffTracker.writeCookieToCustomField(\'pap_ab78y5t4a\');</script>';
return $process_button_string;
Ez a nyomkövetési szkriptet közvetlenül a Paypal gombhoz adja, és megfelelő értéket szúr be az egyéni paraméterbe.
Most újra el kell küldenie az IPN-t az osCommerce-től a PAP-ra is. Tekintse meg a következő lépést.
PayPal átirányítás a PAP-ra
Kiárusításkor a PayPal IPN-t küld az osCommerce-nek. A tranzakció mentéséhez újra el kell küldenie a PAP-nak. Keresse meg az FTP-n a catalog/ext/modules/payment/paypal/ mappát, és módosítsa a standard_ipn.php fájlt. Illessze be a következő kódot a fájl elejére:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_exec($ch);
Az utolsó lépés az egyéni mezőbe mentett ügyfélazonosító módosítása a PAP látogatóazonosító nélküli értékre. Sor keresése:
if ($result == 'VERIFIED') {
és adja hozzá a következő kódot a sor fölé:
$separator = '||';
if ($_POST['custom'] != '') {
$explodedCustomValue = explode($separator, $_POST['custom'], 2);
if (count($explodedCustomValue) == 2) {
$_REQUEST['custom'] = $_POST['custom'] = $explodedCustomValue[0];
$HTTP_POST_VARS['custom'] = $explodedCustomValue[0];
}
}
Ne felejtse el integrálni webhelyét a kattintáskövető kóddal.
Discover the power of the Lifetime Commissions plugin! Ensure lifetime referral tracking with unique customer identifiers, allowing affiliates to earn commissions on future sales without repeated clicks. Easily manage customer-affiliate relations and configure settings to suit your needs. Boost your affiliate program's efficiency with customizable options and ensure commissions for affiliates, even across different devices or channels. Explore seamless integration with eCommerce systems and enhance your marketing strategy today!
Discover the essentials of clicks (referrals) tracking with our comprehensive guide. Learn about the importance of click tracking code, explore various code examples including simple, asynchronous, and PHP versions, and dive into advanced tracking options. Optimize your affiliate marketing strategy with expert tips on setting account IDs, managing cookies, and customizing tracking parameters. Visit now to enhance your click tracking implementation!