Language switcher

#languages]

–Hidden comment

Use attributes in format region_from and region_to= to change the languages showing in language switcher.
Available regions are:
europe_from europe_to
asia_from asia_to
mideast_from mideast_to
america_from america_to

Example:
europe_from=0 europe_to=22 will put all languages (ordered in language switcher settings) from 1 to 21 to Europe region:
asia_from=22 asia_to=25 will put all languages from 23 to 24 (so only 2) into Asia region.

Integrations

Maximize the value of your existing affiliate marketing software and extend its possibilities with a wide range of integrations, plugins and apps. All built to improve the strong foundations of Post Affiliate Pro.

  • Integrations
  • Interspire Shopping Cart (especially for Google Checkout)

Interspire Shopping Cart (especially for Google Checkout)

A feature rich shopping cart software that includes everything you need to start, run, and promote your online store.

This integration method will help you to integrate Post Affiliate Pro with Interspire Shopping Cart 6.0+ in case when customers are not returned on the Interspire thank you page after payment with Google Checkout.

What is this script for?

This setup was created to track products ordered in InterspireShopping Cart and paid with Google Checkout. What this script does is that it posts each different product ordered as a separate sale to PAP4 or whole cart as a one sale. For sale tracking PAP API tracking is used.

Adding visitorId field into ProductAddToCart template

Edit file /templates/__master/Snippets/ProductAddToCart.html
(if you have changed it in own template it is in directory: /templates/[used template]/Snippets/)

Add this row into form:

<input value="" name="product-private-data" type="hidden" id="pap_dx8vc2s5">

after row:

<input type="hidden" name="currency_id" value="" />

and after end of form tag “</form>” add:

<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>

Code below shows whole ProductAddToCart.html file after changes:

%%GLOBAL_AddToCartButtonControlScript%%
<form method="post" action="%%GLOBAL_CartLink%%" onsubmit="return check_add_to_cart(this, %%GLOBAL_ProductOptionRequired%%)"  enctype="multipart/form-data">
	<input type="hidden" name="action" value="add" />
	<input type="hidden" name="product_id" value="%%GLOBAL_ProductId%%" />
	<input type="hidden" name="variation_id" class="CartVariationId" value="" />
	<input type="hidden" name="currency_id" value="" />
	<input value="" name="product-private-data" type="hidden" id="pap_dx8vc2s5">
	<div class="ProductDetailsGrid ProductAddToCart">
		%%SNIPPET_ProductFieldsList%%
		<div class="ProductOptionList">
			%%SNIPPET_VariationList%%
		</div>
		%%SNIPPET_EventDate%%
		<div class="DetailRow" style="display: %%GLOBAL_DisplayAdd%%">
			<div class="Label QuantityInput" style="display: %%GLOBAL_DisplayAddQty%%">%%LNG_QuantityFull%%:</div>
			<div class="Value AddCartButton">
				<span class="FloatLeft" style="display: %%GLOBAL_DisplayAddQty%%;">
					%%GLOBAL_AddToCartQty%%
				</span>
				<div class="BulkDiscount">
					%%GLOBAL_AddToCartButtonOptimizerScriptTag%%
						<input type="image" src="%%GLOBAL_IMG_PATH%%/%%GLOBAL_SiteColor%%/AddCartButton.gif" alt="Interspire Shopping Cart (especially for Google Checkout)"/>
					%%GLOBAL_AddToCartButtonOptimizerNoScriptTag%%
					<div class="BulkDiscountLink" style="display: %%GLOBAL_HideBulkDiscountLink%%;">
						<a href="#" onclick="$.iModal({data: $('#ProductDetailsBulkDiscountThickBox').html(), width: 600}); return false;">
							%%LNG_BulkDiscountLink%%
						</a>
					</div>
				</div>
			</div>
		</div>
	</div>
</form>

<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>

<div class="OutOfStockMessage">
	%%SNIPPET_SideAddItemSoldOut%%
</div>

%%GLOBAL_ProductBulkDiscountThickBox%%

<script type="text/javascript">
lang.OptionMessage = "%%GLOBAL_OptionMessage%%";
lang.VariationSoldOutMessage = "%%LNG_VariationSoldOutMessage%%";
lang.InvalidQuantity = "%%LNG_InvalidQuantity%%";
lang.EnterRequiredField = "%%LNG_EnterRequiredField%%";
lang.InvalidFileTypeJS = "%%LNG_InvalidFileTypeJS%%";
var ShowAddToCartQtyBox = "%%GLOBAL_ShowAddToCartQtyBox%%";
</script>
%%GLOBAL_EventDateJavascript%%

Edit all template files where is used add to cart link. Add attribute id=”affCookieLinkId” into tag <a> in <div class=”ProductActionAdd”>.

And into click tracking code add:

PostAffTracker.writeCookieToLink('affCookieLinkId', 'product-private-data');

after line:

PostAffTracker.track();

Code below shows that after changes:

<div class="ProductActionAdd" style="display:%%GLOBAL_HideActionAdd%%;">
		<a href="%%GLOBAL_ProductURL%%" id="affCookieLinkId">%%GLOBAL_ProductAddText%%</a>
</div>

List of files, which you need to edit in directory /templates/__master/Snippets/:

  • BrandProductsItem.html
  • CategoryProductsItem.html
  • HomeFeaturedProductsItem.html
  • HomeNewProductsItem.html
  • HomeSaleProductsItem.html
  • ProductVendorsOtherProductsItem.html
  • SearchResultProductGrid.html
  • SideCategoryNewProducts.html
  • SideCategoryPopularProducts.html
  • SideCategoryTopSellers.html
  • SideNewProducts.html
  • SideRecentlyViewedProducts.html
  • SideTopSellers.html
  • SideTopSellersFirst.html
  • TagProductsItem.html
  • VendorFeaturedItemsItem.html
  • VendorProductsItem.html

Edit file class.cart.api.php

Edit file /includes/classes/class.cart.api.php.

Find line:

public function AddItem

and add in the end of parameters new parameter $productPrivateData=null.

It will look like:

public function AddItem($productId, $quantity=1, $variationDetails=null, $configurableOptions=array(), $cartItemId=null, $options=array(), $parentId=null, $reorder=false, $productPrivateData=null)

Next find cartProduct array (line 1319):

    $cartProduct = array(
            'product_id' => $productId,
            'variation_id' => $variation,
            'options' => $variationOptions,
            'quantity' => $quantity,
            'product_name' => $product['prodname'],
            'product_code' => $productCode,
            'product_price' => $productPrice,
            'original_price' => $originalPrice,
            'default_currency' => $defaultCurrency['currencyid'],
            'customer_group' => $customerGroup,
        );

add there:

product_private_data' => $productPrivateData

it will look like:

$cartProduct = array(
            'product_id' => $productId,
            'variation_id' => $variation,
            'options' => $variationOptions,
            'quantity' => $quantity,
            'product_name' => $product['prodname'],
            'product_code' => $productCode,
            'product_price' => $productPrice,
            'original_price' => $originalPrice,
            'default_currency' => $defaultCurrency['currencyid'],
            'customer_group' => $customerGroup,
            'product_private_data' => $productPrivateData
        );

Edit file class.cart.php

Edit file /includes/classes/class.cart.php.

Find line:

$cartItemId = $this->api->AddItem($product_id, $qty, $variation, $configurableFields, null, $options, null, false);

change it like:

$cartItemId = $this->api->AddItem($product_id, $qty, $variation, $configurableFields, null, $options, null, false, $productPrivateData);

And add this before it:

  $productPrivateData = '';
            if(isset($_REQUEST['product-private-data'])) {
                $productPrivateData = $_REQUEST['product-private-data'];
            }

It will look after changes:

                        ...
                        ...
				$options['EventName'] = $eventName;
			}

			$productPrivateData = '';
			if(isset($_REQUEST['product-private-data'])) {
				$productPrivateData = $_REQUEST['product-private-data'];
			}

			// Actually add the product to the cart
			$cartItemId = $this->api->AddItem($product_id, $qty, $variation, $configurableFields, null, $options, null, false, $productPrivateData);
			$this->newCartItem = $cartItemId;

			if($cartItemId === false) {
                        ...
                        ...

Add sale tracking code into file class.handler.php in googlecheckout method

Edit file /modules/checkout/googlecheckout/class.handler.php.

Find this code around line 925:

	if (!$completed) {
			$GLOBALS['ISC_CLASS_LOG']->LogSystemError($this->logtype, sprintf(GetLang('GoogleCheckoutCantCompleteOrder'), isc_html_escape($pendingToken), isc_html_escape(var_export($completed, true))));
			return;
		}

add next code right below:

	include 'PapApi.class.php';
		$saleTracker = new Pap_Api_SaleTracker('URL_TO_PostAffiliatePro/scripts/sale.php');
		$prod_count = '1'; // Product Counter

		foreach($cartContent[$vendorId][0] as $cartItemId => $product) {
		    $productid = $product['data']['productid'];
		    $productPrivateData = $product['product_private_data'];

		    $price = $product['quantity'] * $product['product_price'];

		    if (strlen($productPrivateData) == 40) {
			  $accountId = substr($productPrivateData, 0, 8);
			  $visitorId = substr($productPrivateData, 8, 32);
		    } else {
			  $visitorId = $productPrivateData;
			  $accountId = 'default1';
		    }

		    $saleTracker->setAccountId($accountId);
		    $saleTracker->setCookieValue($visitorId);

		    $sale = $saleTracker->createSale();
		    $sale->setTotalCost($price);
		    $sale->setOrderID($order['orderid'] . "($prod_count)");
		    $sale->setProductID($productid);
		    $saleTracker->register();
		    $prod_count++;
		}

This tracking method is using PAP API. Therefore you need to have your actual PapApi.class.php file in directory /modules/checkout/googlecheckout/.

(You can download it from your merchant panel > start > tools > integration > api integration > Download PAP API).

Back to Integrations Create account for FREE

Our website uses cookies. By continuing we assume your permission to deploy cookies as detailed in our privacy and cookies policy.

×

Schedule a one-on-one call and discover how Post Affiliate Pro can benefit your business.

We’re available on multiple dates

Schedule a call