Version Notes
GM
Download this release
Release Info
Developer | Stephen Short |
Extension | AffiliateWindow |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/DigitalWindow/AwinTracking/Block/Awintracking.php +222 -0
- app/code/local/DigitalWindow/AwinTracking/Block/Cookie.php +40 -0
- app/code/local/DigitalWindow/AwinTracking/Block/Mastertag.php +20 -0
- app/code/local/DigitalWindow/AwinTracking/Helper/Data.php +3 -0
- app/code/local/DigitalWindow/AwinTracking/Model/Observer.php +78 -0
- app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/Cookie.php +17 -0
- app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/DefaultValue.php +14 -0
- app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/FeedName.php +15 -0
- app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/KeyParam.php +14 -0
- app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/MerchantId.php +14 -0
- app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Clock/Frequency.php +48 -0
- app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Store/Id.php +36 -0
- app/code/local/DigitalWindow/AwinTracking/etc/adminhtml.xml +25 -0
- app/code/local/DigitalWindow/AwinTracking/etc/config.xml +59 -0
- app/code/local/DigitalWindow/AwinTracking/etc/system.xml +209 -0
- app/design/frontend/base/default/layout/digitalwindow_awintracking.xml +59 -0
- app/design/frontend/base/default/template/digitalwindow/awintracking/awintracking.phtml +18 -0
- app/design/frontend/base/default/template/digitalwindow/awintracking/dwin1.phtml +1 -0
- app/etc/modules/DigitalWindow_AwinTracking.xml +14 -0
- package.xml +20 -0
app/code/local/DigitalWindow/AwinTracking/Block/Awintracking.php
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Block_Awintracking extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
public function getOrder() // Get order object
|
6 |
+
{
|
7 |
+
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
8 |
+
return $order;
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getAdvertiserId() // Get Advertiser Id
|
12 |
+
{
|
13 |
+
$merchantId = (int) Mage::getStoreConfig('AwinTracking_options/section_two/merchant_id');
|
14 |
+
return $merchantId;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getTestMode() // Get Config Test Mode Value
|
18 |
+
{
|
19 |
+
$testMode = (int) Mage::getStoreConfig('AwinTracking_options/section_one/test_mode');
|
20 |
+
return $testMode;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getCurrency() // Get Currency Code
|
24 |
+
{
|
25 |
+
$order = $this->getOrder();
|
26 |
+
$currency_code = $order->getOrderCurrency()->getCurrencyCode();
|
27 |
+
return $currency_code;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getCookieSource() // Get source parameter from cookie
|
31 |
+
{
|
32 |
+
$keyParam = Mage::getStoreConfig("AwinTracking_options/section_three/param_key");
|
33 |
+
if (isset($keyParam)) {
|
34 |
+
$channelParameter = filter_input(INPUT_COOKIE, $keyParam);
|
35 |
+
if (isset($channelParameter)) {
|
36 |
+
return $channelParameter;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getProducts() // Get all products from order object
|
42 |
+
{
|
43 |
+
$order = $this->getOrder();
|
44 |
+
$orderedProducts = $order->getAllVisibleItems();
|
45 |
+
return $orderedProducts;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getGrandTotal() // Get grand total amount
|
49 |
+
{
|
50 |
+
$order = $this->getOrder();
|
51 |
+
$grandTotal = $order->getGrandTotal();
|
52 |
+
return $grandTotal;
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getShipping() // Get shipping amount
|
56 |
+
{
|
57 |
+
$order = $this->getOrder();
|
58 |
+
$shippingAmount = $order->getShippingAmount();
|
59 |
+
return $shippingAmount;
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getSubTotal() // Get Subtotal (Subtotal = GrantTotal - Shipping - Tax)
|
63 |
+
{
|
64 |
+
$order = $this->getOrder();
|
65 |
+
$totalSubShipping = $order->getSubtotal();
|
66 |
+
return number_format($totalSubShipping, 2);
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getAwinAmount() // Get amount for awin tracking (dependant on VAT variable from backend config)
|
70 |
+
{
|
71 |
+
$order = $this->getOrder();
|
72 |
+
$includeVatInCalculation = Mage::getStoreConfig('AwinTracking_options/section_two/tax_inclusive');
|
73 |
+
$taxAmount = ($includeVatInCalculation == 0) ? $order->getTaxAmount() : 0;
|
74 |
+
$amount = ($this->getGrandTotal() - $this->getShipping()) - $taxAmount;
|
75 |
+
return number_format($amount, 2);
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getLastOrderId() // Get order Id
|
80 |
+
{
|
81 |
+
$order = $this->getOrder();
|
82 |
+
$lastOrderId = $order->getIncrementId();
|
83 |
+
return $lastOrderId;
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getVoucher() // Get voucher code
|
87 |
+
{
|
88 |
+
$order = $this->getOrder();
|
89 |
+
$voucherCode = $order->coupon_code;
|
90 |
+
return $voucherCode;
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getDiscount() // Get discount amount (whole number)
|
94 |
+
{
|
95 |
+
$order = $this->getOrder();
|
96 |
+
$discountAmount = abs($order->getDiscountAmount());
|
97 |
+
return $discountAmount;
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getDiscountPercent() // Get discount percent using discount amount
|
101 |
+
{
|
102 |
+
$order = $this->getOrder();
|
103 |
+
$discountAmount = $this->getDiscount($order);
|
104 |
+
$totalSubShipping = $this->getSubTotal($order);
|
105 |
+
$discountPercent = $discountAmount / $totalSubShipping;
|
106 |
+
return $discountPercent;
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getCouponRule() // Get coupon rule (used for determining the coupon type)
|
110 |
+
{
|
111 |
+
$order = $this->getOrder();
|
112 |
+
$sessionCoupon = $this->getVoucher($order);
|
113 |
+
$couponData = Mage::getModel('salesrule/coupon')->load($sessionCoupon, 'code');
|
114 |
+
$rule = Mage::getModel('salesrule/rule')->load($couponData->getRuleId());
|
115 |
+
return $rule;
|
116 |
+
}
|
117 |
+
|
118 |
+
public function getPLTString() // Return plt string to template
|
119 |
+
{
|
120 |
+
$productTracking = NULL;
|
121 |
+
$order = $this->getOrder();
|
122 |
+
if ((int) Mage::getStoreConfig('AwinTracking_options/section_one/plt') == 1) { // 1 = enabled PLT | 2 = disabled PLT
|
123 |
+
$productString = ''; // Initialize variables
|
124 |
+
$category = '';
|
125 |
+
$productPrice = 0;
|
126 |
+
$orderedProducts = $this->getProducts($order); // Get products, coupon rule and action from rule
|
127 |
+
$rule = $this->getCouponRule($order);
|
128 |
+
$action = $rule->getSimpleAction();
|
129 |
+
foreach ($orderedProducts as $product) { // Implement PLT logic per order
|
130 |
+
$productPrice = $product->getPrice();
|
131 |
+
$categoryIds = $product->getProduct()->getCategoryIds();
|
132 |
+
$categoryId = end($categoryIds); // Get last category id as product category id
|
133 |
+
$categoryName = Mage::getModel('catalog/category')->load($categoryId);
|
134 |
+
$category = $categoryName->getName(); // Get product category from Id
|
135 |
+
if (isset($action)) {
|
136 |
+
$productTracking .= $this->getProductCoupon($action, $product, $rule, $category); // If coupon action exists
|
137 |
+
} else { // If coupon action does not exist
|
138 |
+
$productString = $this->constructPLTString($this->getAdvertiserId(), $this->getLastOrderId($order), $product->getItemId(), $product->getName(), $productPrice, $product->getQtyOrdered(), $product->getSku(), $category);
|
139 |
+
$productTracking .= $productString . "\n \t";
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
return $productTracking;
|
144 |
+
}
|
145 |
+
|
146 |
+
public function getProductCoupon($action, $product, $rule, $category) // Return plt string depending on coupon
|
147 |
+
{
|
148 |
+
$productPrice = $product->getPrice();
|
149 |
+
switch ($action)
|
150 |
+
{
|
151 |
+
case "by_percent": // If coupon is a single product percentage coupon
|
152 |
+
$discountPercent = $this->getDiscountPercent($order);
|
153 |
+
$productPrice = $productPrice * (1 - $discountPercent);
|
154 |
+
return $this->constructPLTString($this->getAdvertiserId(), $this->getLastOrderId($this->getOrder()), $product->getItemId(), $product->getName(), $productPrice, round($product->getQtyOrdered()), $product->getSku(), $category);
|
155 |
+
case "by_fixed": // If coupon is a single product amount coupon
|
156 |
+
$discountAmount = $rule->getDiscountAmount(); // Get discount amount from coupon code
|
157 |
+
$productPrice = $productPrice - $discountAmount; // Calculate Product Price
|
158 |
+
return $this->constructPLTString($this->getAdvertiserId(), $this->getLastOrderId($this->getOrder()), $product->getItemId(), $product->getName(), $productPrice, round($product->getQtyOrdered()), $product->getSku(), $category);
|
159 |
+
case "cart_fixed": // If coupon is a cart amount coupon
|
160 |
+
$total = $this->getSubTotal($order); // Get subtotal value
|
161 |
+
$percentOfTotal = $productPrice / $total; // Calculate product percentage from total
|
162 |
+
$discountForProduct = $percentOfTotal * $this->getDiscount($order); // Find product discount proportion
|
163 |
+
$productPrice = $productPrice - $discountForProduct; // Subtract discount from product price
|
164 |
+
return $this->constructPLTString($this->getAdvertiserId(), $this->getLastOrderId($this->getOrder()), $product->getItemId(), $product->getName(), $productPrice, round($product->getQtyOrdered()), $product->getSku(), $category);
|
165 |
+
case "buy_x_get_y": // If coupon is buy x get y free coupon
|
166 |
+
$freeProductString = NULL; // Initialize productStrings
|
167 |
+
$paidProductString = NULL;
|
168 |
+
$quantity = $product->getQtyOrdered(); // Get product quantity
|
169 |
+
$productDiscountAmount = $product->getDiscountAmount(); // Get discount amount per product
|
170 |
+
$numberFreeProducts = $productDiscountAmount/$productPrice; // Calculate number of free products
|
171 |
+
$numberOfPaidProducts = $product->getQtyOrdered() - $numberOfFreeProducts; // Calculate number of paid products
|
172 |
+
if($numberOfFreeProducts != 0) // If number of free products is not 0 i.e > 0
|
173 |
+
{
|
174 |
+
$freeProductString = $this->constructPLTString($this->getAdvertiserId(), $this->getLastOrderId($this->getOrder()), $product->getItemId(), $product->getName(), 0, $numberOfFreeProducts, $product->getSku(), $category);
|
175 |
+
}
|
176 |
+
$paidProductString = $this->constructPLTString($this->getAdvertiserId(), $this->getLastOrderId($this->getOrder()), $product->getItemId(), $product->getName(), $productPrice, $numberOfPaidProducts, $product->getSku(), $category);
|
177 |
+
$productString = $paidProductString.$freeProductString;
|
178 |
+
return $productString;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
public function constructPLTString($advertiserId, $orderRef, $productId, $productName, $productPrice, $productQuantity, $productSku, $productCategory) // Build return literal PLT string
|
183 |
+
{
|
184 |
+
$productString = "AW:P|" . $advertiserId . "|" . $orderRef . "|" . $productId . "|" . $productName . "|" . number_format($productPrice, 2) . "|" . $productQuantity . "|" . $productSku. "|DEFAULT|" . $productCategory . "\n \t";
|
185 |
+
return $productString; // Return string constructed by parameters provided
|
186 |
+
}
|
187 |
+
|
188 |
+
public function getImagePixel() // Return image pixel to template
|
189 |
+
{
|
190 |
+
$imagePixel = NULL;
|
191 |
+
$order = $this->getOrder();
|
192 |
+
if ((int) Mage::getStoreConfig('AwinTracking_options/section_one/activate_tracking_code') == 1) {
|
193 |
+
$imagePixel = $imagePixel = '<img border="0" height="0" src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=' . $this->getAdvertiserId() . '&amount=' . $this->getAwinAmount($order) . '&ch=' . $this->getCookieSource() . '&cr=' . $this->getCurrency($order) . '&parts=DEFAULT:' . $this->getAwinAmount($order) . '&ref=' . $this->getLastOrderId($order) . '&testmode=' . $this->getTestMode() . '&p1=awinMagento&vc=' . $this->getVoucher($order) . '" style="display: none;" width="0">' . "\n";
|
194 |
+
return $imagePixel;
|
195 |
+
}
|
196 |
+
return $imagePixel;
|
197 |
+
}
|
198 |
+
|
199 |
+
public function getTracking() // Return javascript to template
|
200 |
+
{
|
201 |
+
$trackingCode = NULL;
|
202 |
+
$order = $this->getOrder();
|
203 |
+
if ((int) Mage::getStoreConfig('AwinTracking_options/section_one/activate_tracking_code') == 1) {
|
204 |
+
$trackingCode = '
|
205 |
+
var AWIN = {};
|
206 |
+
AWIN.Tracking = {};
|
207 |
+
AWIN.Tracking.Sale = {};
|
208 |
+
/*** Set your transaction parameters ***/
|
209 |
+
AWIN.Tracking.Sale.amount = "' . $this->getAwinAmount($order) . '";
|
210 |
+
AWIN.Tracking.Sale.channel = "' . $this->getCookieSource() . '";
|
211 |
+
AWIN.Tracking.Sale.orderRef = "' . $this->getLastOrderId($order) . '";
|
212 |
+
AWIN.Tracking.Sale.parts = "DEFAULT:' . $this->getAwinAmount($order) . '";
|
213 |
+
AWIN.Tracking.Sale.currency = "' . $this->getCurrency($order) . '";
|
214 |
+
AWIN.Tracking.Sale.test = "' . $this->getTestMode() . '";
|
215 |
+
AWIN.Tracking.Sale.voucher = "' . $this->getVoucher($order) . '";
|
216 |
+
AWIN.Tracking.Sale.custom = ["awinMagento"];' . "\n";
|
217 |
+
}
|
218 |
+
return $trackingCode;
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
|
app/code/local/DigitalWindow/AwinTracking/Block/Cookie.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Block_Cookie extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function setCookie()
|
5 |
+
{
|
6 |
+
$cookieDays = (int) Mage::getStoreConfig("AwinTracking_options/section_three/cookie_length");
|
7 |
+
if (!isset($cookieDays)){
|
8 |
+
$cookieDays = 30;
|
9 |
+
}
|
10 |
+
$keyParam = Mage::getStoreConfig("AwinTracking_options/section_three/param_key");
|
11 |
+
if (!isset($keyParam)){
|
12 |
+
$keyParam = 'source';
|
13 |
+
}
|
14 |
+
$defaultValue = Mage::getStoreConfig("AwinTracking_options/section_three/default_value");
|
15 |
+
if (!isset($defaultValue)){
|
16 |
+
$defaultValue = 'na';
|
17 |
+
}
|
18 |
+
$param = Mage::app()->getRequest()->getParam($keyParam);
|
19 |
+
|
20 |
+
if ((int) Mage::getStoreConfig("AwinTracking_options/section_three/enable_dedupe") == 0)
|
21 |
+
{
|
22 |
+
$date_of_expiry = time() + (24*60*60*30);
|
23 |
+
setcookie($keyParam, "aw", $date_of_expiry, "/" );
|
24 |
+
}
|
25 |
+
else
|
26 |
+
{
|
27 |
+
if (isset($param))
|
28 |
+
{
|
29 |
+
$date_of_expiry = time() + (24*60*60*$cookieDays);
|
30 |
+
setcookie($keyParam, $param, $date_of_expiry, "/" );
|
31 |
+
}
|
32 |
+
else
|
33 |
+
{
|
34 |
+
$date_of_expiry = time() + (24*60*60*$cookieDays);
|
35 |
+
setcookie($keyParam, $defaultValue, $date_of_expiry, "/" );
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Block/Mastertag.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Block_Mastertag extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function getMid(){
|
5 |
+
$merchantId = (int) Mage::getStoreConfig('AwinTracking_options/section_two/merchant_id');
|
6 |
+
return $merchantId;
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getJourneyTagConfig(){
|
10 |
+
$merchantId = $this->getMid();
|
11 |
+
if($merchantId != 0){
|
12 |
+
$script = "<script type=\"text/javascript\" src=\"http://dwin1.com/".$merchantId.".js\"> </script>"."\n";
|
13 |
+
return $script;
|
14 |
+
}
|
15 |
+
else{
|
16 |
+
return NULL;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Helper/Data.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Helper_Data extends Mage_Core_Helper_Data
|
3 |
+
{}
|
app/code/local/DigitalWindow/AwinTracking/Model/Observer.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class DigitalWindow_AwinTracking_Model_Observer {
|
4 |
+
public function fireTracking(Varien_Event_Observer $observer){
|
5 |
+
|
6 |
+
$feedName = Mage::getStoreConfig("AwinTracking_options/section_two/feed_name");
|
7 |
+
$scheduledTime = Mage::getStoreConfig("AwinTracking_options/section_two/my_date");
|
8 |
+
Mage::log(
|
9 |
+
"FiredTrack", null, 'sale-logs.log'
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function schedule()
|
14 |
+
{
|
15 |
+
$_product = array();
|
16 |
+
$product_data = array();
|
17 |
+
$arr = array();
|
18 |
+
$web_id = Mage::getStoreConfig('AwinTracking_Datafeed/section_one/store');
|
19 |
+
$fileName = Mage::getStoreConfig('AwinTracking_Datafeed/section_one/feed_name');
|
20 |
+
$fileName = $fileName.'.csv';
|
21 |
+
$collection = Mage::getModel('catalog/product')->getCollection()->addWebsiteFilter($web_id)->addAttributeToSelect('*');
|
22 |
+
$collection->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
23 |
+
foreach ($collection as $product)
|
24 |
+
{
|
25 |
+
$stock_item = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
26 |
+
$isInStock = $stock_item->getIsInStock();
|
27 |
+
$product_data["pid"]=$product->getId();
|
28 |
+
$product_data['qty'] = $stock_item->getQty();;
|
29 |
+
if ($product_data['qty'] > 0)
|
30 |
+
{
|
31 |
+
$product_data['stock_status']=1;
|
32 |
+
}else {
|
33 |
+
$product_data['stock_status']=0;
|
34 |
+
}
|
35 |
+
if ($product->isSalable() == 1)
|
36 |
+
{
|
37 |
+
$product_data['isforsale']=1;
|
38 |
+
}else {
|
39 |
+
$product_data['isforsale']=0;
|
40 |
+
}
|
41 |
+
$product_data["product_name"]=$product->getName();
|
42 |
+
$product_data['product_description']=$product->getDescription();
|
43 |
+
$product_data["price"]=$product->getPrice();
|
44 |
+
$product_data['store_price']=$product->getFinalPrice();
|
45 |
+
$categoryIds = $product->getCategoryIds();
|
46 |
+
if (count($categoryIds))
|
47 |
+
{
|
48 |
+
$firstCategoryId = $categoryIds[0];
|
49 |
+
$_category = Mage::getModel('catalog/category')->load($firstCategoryId);
|
50 |
+
$product_data['category'] = $_category->getName();
|
51 |
+
}else {
|
52 |
+
$product_data['category'] = "";
|
53 |
+
}
|
54 |
+
$product_data['image_url']= $product->getImageUrl();
|
55 |
+
$product_data['product_url']=str_replace('pr_magento_exporter.php/','',$product->getProductUrl());
|
56 |
+
array_push($arr, $product_data);
|
57 |
+
}
|
58 |
+
$headers['product_id'] = 'product_id';
|
59 |
+
$headers['quantity'] = 'quantity';
|
60 |
+
$headers['in_stock'] = 'in_stock';
|
61 |
+
$headers['isforsale'] = 'is_for_sale';
|
62 |
+
$headers['product_name'] = 'product_name';
|
63 |
+
$headers['description'] = 'description';
|
64 |
+
$headers['price'] = 'price';
|
65 |
+
$headers['store_price'] = 'store_price';
|
66 |
+
$headers['merchant_category'] = 'merchant_category';
|
67 |
+
$headers['image_url'] = 'image_url';
|
68 |
+
$headers['product_url'] = 'product_url';
|
69 |
+
$file = fopen($fileName, 'w');
|
70 |
+
fputcsv($file, $headers);
|
71 |
+
foreach ($arr as $line)
|
72 |
+
{
|
73 |
+
fputcsv($file, $line);
|
74 |
+
}
|
75 |
+
fclose($file);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/Cookie.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Model_System_Config_Backend_Cookie extends Mage_Core_Model_Config_Data
|
3 |
+
{
|
4 |
+
public function save()
|
5 |
+
{
|
6 |
+
$cookieLength = $this->getValue();
|
7 |
+
if($cookieLength <= 0 || !is_numeric($cookieLength) || is_float($cookieLength)){
|
8 |
+
Mage::throwException("Cookie length not saved, value should be positive numeric. Cookie length reverted.");
|
9 |
+
}elseif($cookieLength < 30){
|
10 |
+
Mage::getSingleton('core/session')->addNotice ('Cookie period under 30 days is not recommended.');
|
11 |
+
return parent::save();
|
12 |
+
}else{
|
13 |
+
return parent::save();
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/DefaultValue.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Model_System_Config_Backend_DefaultValue extends Mage_Core_Model_Config_Data
|
3 |
+
{
|
4 |
+
public function save()
|
5 |
+
{
|
6 |
+
$defaultValue = $this->getValue();
|
7 |
+
if(!ctype_alpha($defaultValue)){
|
8 |
+
Mage::throwException("Default value not saved, value should not be empty or contain numerics. Default value reverted.");
|
9 |
+
}else{
|
10 |
+
return parent::save();
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
14 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/FeedName.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Model_System_Config_Backend_FeedName extends Mage_Core_Model_Config_Data
|
3 |
+
{
|
4 |
+
public function save()
|
5 |
+
{
|
6 |
+
$feedName = trim($this->getValue());
|
7 |
+
if (preg_match("[\W+]", $feedName) || empty($feedName))
|
8 |
+
{
|
9 |
+
Mage::throwException("Feed name cannot be empty or contain special characters");
|
10 |
+
}else{
|
11 |
+
return parent::save();
|
12 |
+
}
|
13 |
+
}
|
14 |
+
}
|
15 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/KeyParam.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Model_System_Config_Backend_KeyParam extends Mage_Core_Model_Config_Data
|
3 |
+
{
|
4 |
+
public function save()
|
5 |
+
{
|
6 |
+
$keyParam = $this->getValue();
|
7 |
+
if(!ctype_alpha($keyParam)){
|
8 |
+
Mage::throwException("Key parameter not saved, value should not be empty or contain numerics. Key parameter reverted.");
|
9 |
+
}else{
|
10 |
+
return parent::save();
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
14 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Backend/MerchantId.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Model_System_Config_Backend_MerchantId extends Mage_Core_Model_Config_Data
|
3 |
+
{
|
4 |
+
public function save()
|
5 |
+
{
|
6 |
+
$merchantId = $this->getValue();
|
7 |
+
if($merchantId <= 0 || !is_numeric($merchantId) || is_float($merchantId)){
|
8 |
+
Mage::throwException("Merchant ID not saved, value should be numeric. Mastertag not set.");
|
9 |
+
}else{
|
10 |
+
return parent::save();
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
14 |
+
?>
|
app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Clock/Frequency.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Model_System_Config_Clock_Frequency
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Provide available options as a value/label array
|
6 |
+
*
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
/*
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
return array(
|
13 |
+
array('value'=>1, 'label'=>'One'),
|
14 |
+
array('value'=>2, 'label'=>'Two'),
|
15 |
+
array('value'=>3, 'label'=>'Three'),
|
16 |
+
array('value'=>4, 'label'=>'Four')
|
17 |
+
);
|
18 |
+
}*/
|
19 |
+
public function toOptionArray()
|
20 |
+
{
|
21 |
+
return array(
|
22 |
+
array('value'=> 0,'label'=> '0:00'),
|
23 |
+
array('value'=> 1,'label'=> '1:00'),
|
24 |
+
array('value'=> 2,'label'=> '2:00'),
|
25 |
+
array('value'=> 3,'label'=> '3:00'),
|
26 |
+
array('value'=> 4,'label'=> '4:00'),
|
27 |
+
array('value'=> 5,'label'=> '5:00'),
|
28 |
+
array('value'=> 6,'label'=> '6:00'),
|
29 |
+
array('value'=> 7,'label'=> '7:00'),
|
30 |
+
array('value'=> 8,'label'=> '8:00'),
|
31 |
+
array('value'=> 9,'label'=> '9:00'),
|
32 |
+
array('value'=> 10,'label'=> '10:00'),
|
33 |
+
array('value'=> 11,'label'=> '11:00'),
|
34 |
+
array('value'=> 12,'label'=> '12:00'),
|
35 |
+
array('value'=> 13,'label'=> '13:00'),
|
36 |
+
array('value'=> 14,'label'=> '14:00'),
|
37 |
+
array('value'=> 15,'label'=> '15:00'),
|
38 |
+
array('value'=> 16,'label'=> '16:00'),
|
39 |
+
array('value'=> 17,'label'=> '17:00'),
|
40 |
+
array('value'=> 18,'label'=> '18:00'),
|
41 |
+
array('value'=> 19,'label'=> '19:00'),
|
42 |
+
array('value'=> 20,'label'=> '20:00'),
|
43 |
+
array('value'=> 21,'label'=> '21:00'),
|
44 |
+
array('value'=> 22,'label'=> '22:00'),
|
45 |
+
array('value'=> 23,'label'=> '23:00')
|
46 |
+
);
|
47 |
+
}
|
48 |
+
}
|
app/code/local/DigitalWindow/AwinTracking/Model/System/Config/Store/Id.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class DigitalWindow_AwinTracking_Model_System_Config_Store_Id
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Provide available options as a value/label array
|
6 |
+
*
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
|
10 |
+
/*
|
11 |
+
public function toOptionArray()
|
12 |
+
{
|
13 |
+
return array(
|
14 |
+
array('value'=>1, 'label'=>'One'),
|
15 |
+
array('value'=>2, 'label'=>'Two'),
|
16 |
+
array('value'=>3, 'label'=>'Three'),
|
17 |
+
array('value'=>4, 'label'=>'Four')
|
18 |
+
);
|
19 |
+
}*/
|
20 |
+
public function toOptionArray()
|
21 |
+
{
|
22 |
+
$i = 0;
|
23 |
+
$webArray = array();
|
24 |
+
$websites = Mage::app()->getWebsites();
|
25 |
+
foreach ($websites as $websiteInfo)
|
26 |
+
{
|
27 |
+
|
28 |
+
$webCode = $websiteInfo->getCode();
|
29 |
+
$webName = $websiteInfo->getName();
|
30 |
+
$webId =$websiteInfo->getId();
|
31 |
+
$webArray[$i] = array("value"=>$webId, "label"=>$webName);
|
32 |
+
$i++;
|
33 |
+
}
|
34 |
+
return $webArray;
|
35 |
+
}
|
36 |
+
}
|
app/code/local/DigitalWindow/AwinTracking/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<AwinTracking_options>
|
12 |
+
<title>Custom AWIN Section</title>
|
13 |
+
</AwinTracking_options>
|
14 |
+
<AwinTracking_Datafeed>
|
15 |
+
<title>Custom AWIN Section</title>
|
16 |
+
</AwinTracking_Datafeed>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/local/DigitalWindow/AwinTracking/etc/config.xml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<DigitalWindow_AwinTracking>
|
6 |
+
<version>1.0.1</version>
|
7 |
+
</DigitalWindow_AwinTracking>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<DigitalWindow_AwinTracking>
|
12 |
+
<class>DigitalWindow_AwinTracking_Model</class>
|
13 |
+
</DigitalWindow_AwinTracking>
|
14 |
+
</models>
|
15 |
+
<helpers>
|
16 |
+
<AwinTracking>
|
17 |
+
<class>DigitalWindow_AwinTracking_Helper</class>
|
18 |
+
</AwinTracking>
|
19 |
+
</helpers>
|
20 |
+
<blocks>
|
21 |
+
<DigitalWindow_AwinTracking>
|
22 |
+
<class>DigitalWindow_AwinTracking_Block</class>
|
23 |
+
</DigitalWindow_AwinTracking>
|
24 |
+
</blocks>
|
25 |
+
<events>
|
26 |
+
<admin_system_config_changed_section_AwinTracking_Datafeed>
|
27 |
+
<observers>
|
28 |
+
<DigitalWindow_AwinTracking>
|
29 |
+
<type>singleton</type>
|
30 |
+
<class>DigitalWindow_AwinTracking_Model_Observer</class>
|
31 |
+
<method>schedule</method>
|
32 |
+
</DigitalWindow_AwinTracking>
|
33 |
+
</observers>
|
34 |
+
</admin_system_config_changed_section_AwinTracking_Datafeed>
|
35 |
+
</events>
|
36 |
+
</global>
|
37 |
+
<frontend>
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<DigitalWindow_AwinTracking>
|
41 |
+
<file>digitalwindow_awintracking.xml</file>
|
42 |
+
</DigitalWindow_AwinTracking>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
</frontend>
|
46 |
+
<default>
|
47 |
+
<AwinTracking_options>
|
48 |
+
<section_three>
|
49 |
+
<activate_tracking_code>Yes</activate_tracking_code>
|
50 |
+
<tax_inclusive>No</tax_inclusive>
|
51 |
+
<currency>Yes</currency>
|
52 |
+
<enable_dedupe>No</enable_dedupe>
|
53 |
+
<default_value>na</default_value>
|
54 |
+
<cookie_length>30</cookie_length>
|
55 |
+
<param_key>source</param_key>
|
56 |
+
</section_three>
|
57 |
+
</AwinTracking_options>
|
58 |
+
</default>
|
59 |
+
</config>
|
app/code/local/DigitalWindow/AwinTracking/etc/system.xml
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<AwinTracking translate="label" module="AwinTracking">
|
5 |
+
<label>Affiliate Window</label>
|
6 |
+
<sort_order>0</sort_order>
|
7 |
+
</AwinTracking>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<AwinTracking_options translate="label" module="AwinTracking">
|
11 |
+
<label>Tracking</label>
|
12 |
+
<tab>AwinTracking</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<section_one translate="label">
|
20 |
+
<label>General Settings</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>2</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<activate_tracking_code>
|
28 |
+
<label>Activate Tracking Code</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<sort_order>1</sort_order>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<comment>Enable conversion tag</comment>
|
36 |
+
<tooltip>Please enable to activate transaction tracking.</tooltip>
|
37 |
+
</activate_tracking_code>
|
38 |
+
<plt>
|
39 |
+
<label>Product Level Tracking</label>
|
40 |
+
<frontend_type>select</frontend_type>
|
41 |
+
<sort_order>3</sort_order>
|
42 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<comment>Enable product level tracking.</comment>
|
47 |
+
<tooltip>Activate advanced product analytics.</tooltip>
|
48 |
+
<depends>
|
49 |
+
<activate_tracking_code>1</activate_tracking_code>
|
50 |
+
</depends>
|
51 |
+
</plt>
|
52 |
+
<test_mode>
|
53 |
+
<label>In Test Mode</label>
|
54 |
+
<frontend_type>select</frontend_type>
|
55 |
+
<sort_order>2</sort_order>
|
56 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
<comment>Test enabled transactions cannot be validated.</comment>
|
61 |
+
<tooltip>Please set to 'No' to allow transaction processing.</tooltip>
|
62 |
+
<depends>
|
63 |
+
<activate_tracking_code>1</activate_tracking_code>
|
64 |
+
</depends>
|
65 |
+
</test_mode>
|
66 |
+
</fields>
|
67 |
+
</section_one>
|
68 |
+
<section_two translate="label">
|
69 |
+
<label>Program Specific</label>
|
70 |
+
<frontend_type>text</frontend_type>
|
71 |
+
<sort_order>1</sort_order>
|
72 |
+
<show_in_default>2</show_in_default>
|
73 |
+
<show_in_website>2</show_in_website>
|
74 |
+
<show_in_store>2</show_in_store>
|
75 |
+
<comment><![CDATA[<strong>For more information about this plug-in please visit the<a href="http://affiliatewindow.com" target="_blank">Wiki</a></strong>]]></comment>
|
76 |
+
<fields>
|
77 |
+
<merchant_id>
|
78 |
+
<backend_model>DigitalWindow_AwinTracking/System_Config_Backend_MerchantId</backend_model>
|
79 |
+
<label>Merchant ID</label>
|
80 |
+
<frontend_type>text</frontend_type>
|
81 |
+
<sort_order>1</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
<comment>Please enter your merchant ID.</comment>
|
86 |
+
<tooltip>Your Affiliate Window merchant ID</tooltip>
|
87 |
+
</merchant_id>
|
88 |
+
<tax_inclusive>
|
89 |
+
<label>Commission Includes VAT/Tax</label>
|
90 |
+
<frontend_type>select</frontend_type>
|
91 |
+
<sort_order>2</sort_order>
|
92 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
<comment>This setting is established during the integration period.</comment>
|
97 |
+
<tooltip>Pay commission inclusive of sale tax, please disucss with your account executive.</tooltip>
|
98 |
+
</tax_inclusive>
|
99 |
+
</fields>
|
100 |
+
</section_two>
|
101 |
+
<section_three translate="label">
|
102 |
+
<label>De-duplication</label>
|
103 |
+
<frontend_type>text</frontend_type>
|
104 |
+
<sort_order>3</sort_order>
|
105 |
+
<show_in_default>3</show_in_default>
|
106 |
+
<show_in_website>3</show_in_website>
|
107 |
+
<show_in_store>3</show_in_store>
|
108 |
+
<fields>
|
109 |
+
<enable_dedupe>
|
110 |
+
<label>Enable De-duplication</label>
|
111 |
+
<frontend_type>select</frontend_type>
|
112 |
+
<sort_order>1</sort_order>
|
113 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
114 |
+
<show_in_default>1</show_in_default>
|
115 |
+
<show_in_website>1</show_in_website>
|
116 |
+
<show_in_store>1</show_in_store>
|
117 |
+
<comment>Enable de-duplication logic.</comment>
|
118 |
+
<tooltip>Please consult with your account executive before enabling de-duplication logic.</tooltip>
|
119 |
+
</enable_dedupe>
|
120 |
+
<param_key>
|
121 |
+
<backend_model>DigitalWindow_AwinTracking/System_Config_Backend_KeyParam</backend_model>
|
122 |
+
<label>Key Parameter</label>
|
123 |
+
<frontend_type>text</frontend_type>
|
124 |
+
<sort_order>2</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>1</show_in_store>
|
128 |
+
<comment>The name of the parameter appended to clickthroughs to identify source.</comment>
|
129 |
+
<depends>
|
130 |
+
<enable_dedupe>1</enable_dedupe>
|
131 |
+
</depends>
|
132 |
+
<tooltip>The parameter identifying the traffic source.</tooltip>
|
133 |
+
</param_key>
|
134 |
+
<cookie_length>
|
135 |
+
<backend_model>DigitalWindow_AwinTracking/System_Config_Backend_Cookie</backend_model>
|
136 |
+
<label>Cookie Length</label>
|
137 |
+
<frontend_type>text</frontend_type>
|
138 |
+
<sort_order>5</sort_order>
|
139 |
+
<show_in_default>1</show_in_default>
|
140 |
+
<show_in_website>1</show_in_website>
|
141 |
+
<show_in_store>1</show_in_store>
|
142 |
+
<comment>The length to set the source cookie in days. 30 is highly recommended.</comment>
|
143 |
+
<depends>
|
144 |
+
<enable_dedupe>1</enable_dedupe>
|
145 |
+
</depends>
|
146 |
+
<tooltip>Please consult with your account executive before changing this value.</tooltip>
|
147 |
+
</cookie_length>
|
148 |
+
<default_value>
|
149 |
+
<backend_model>DigitalWindow_AwinTracking/System_Config_Backend_DefaultValue</backend_model>
|
150 |
+
<label>Default Value</label>
|
151 |
+
<frontend_type>text</frontend_type>
|
152 |
+
<sort_order>3</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>1</show_in_store>
|
156 |
+
<comment>The default value if no source parameter is provided at clickthrough.</comment>.
|
157 |
+
<depends>
|
158 |
+
<enable_dedupe>1</enable_dedupe>
|
159 |
+
</depends>
|
160 |
+
<tooltip>Please consult with your account executive before changing this value.</tooltip>
|
161 |
+
</default_value>
|
162 |
+
</fields>
|
163 |
+
</section_three>
|
164 |
+
</groups>
|
165 |
+
</AwinTracking_options>
|
166 |
+
<AwinTracking_Datafeed translate="label" module="AwinTracking">
|
167 |
+
<label>Product Feed</label>
|
168 |
+
<tab>AwinTracking</tab>
|
169 |
+
<frontend_type>text</frontend_type>
|
170 |
+
<sort_order>2</sort_order>
|
171 |
+
<show_in_default>2</show_in_default>
|
172 |
+
<show_in_website>2</show_in_website>
|
173 |
+
<show_in_store>2</show_in_store>
|
174 |
+
<groups>
|
175 |
+
<section_one translate="label">
|
176 |
+
<label>General Settings</label>
|
177 |
+
<frontend_type>text</frontend_type>
|
178 |
+
<sort_order>1</sort_order>
|
179 |
+
<show_in_default>1</show_in_default>
|
180 |
+
<show_in_website>1</show_in_website>
|
181 |
+
<show_in_store>1</show_in_store>
|
182 |
+
<fields>
|
183 |
+
<feed_name>
|
184 |
+
<backend_model>DigitalWindow_AwinTracking/System_Config_Backend_FeedName</backend_model>
|
185 |
+
<label>Feed Name</label>
|
186 |
+
<frontend_type>text</frontend_type>
|
187 |
+
<sort_order>1</sort_order>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
+
<show_in_store>1</show_in_store>
|
191 |
+
<comment>Please enter a feed name.</comment>
|
192 |
+
<tooltip>Recommended: use your merchant ID.</tooltip>
|
193 |
+
</feed_name>
|
194 |
+
<website>
|
195 |
+
<label>Website</label>
|
196 |
+
<frontend_type>select</frontend_type>
|
197 |
+
<source_model>DigitalWindow_AwinTracking/System_Config_Store_Id</source_model>
|
198 |
+
<sort_order>1</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>1</show_in_store>
|
202 |
+
<comment>Please select your Magento store from the above dropdown.</comment>
|
203 |
+
</website>
|
204 |
+
</fields>
|
205 |
+
</section_one>
|
206 |
+
</groups>
|
207 |
+
</AwinTracking_Datafeed>
|
208 |
+
</sections>
|
209 |
+
</config>
|
app/design/frontend/base/default/layout/digitalwindow_awintracking.xml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout>
|
3 |
+
|
4 |
+
<!--
|
5 |
+
<cms_index_index>
|
6 |
+
<reference name="after_body_start">
|
7 |
+
<block type="core/template" name="cookie" template="digitalwindow/awintracking/cookie.phtml"/>
|
8 |
+
</reference>
|
9 |
+
</cms_index_index>
|
10 |
+
|
11 |
+
<catalog_product_view>
|
12 |
+
<reference name="after_body_start">
|
13 |
+
<block type="core/template" name="cookiepp" template="digitalwindow/awintracking/cookie.phtml"/>
|
14 |
+
</reference>
|
15 |
+
</catalog_product_view>
|
16 |
+
-->
|
17 |
+
|
18 |
+
<!--<checkout_onepage_success>
|
19 |
+
<checkout_onepage_success>
|
20 |
+
<reference name="before_body_end">
|
21 |
+
<block type="core/template" name="awintracking" template="digitalwindow/awintracking/awintracking.phtml"/>
|
22 |
+
</reference>
|
23 |
+
</checkout_onepage_success>
|
24 |
+
|
25 |
+
<default>
|
26 |
+
<reference name="before_body_end">
|
27 |
+
<block type="core/template" name="mastertag" template="digitalwindow/awintracking/dwin1.phtml" after="awintracking"/>
|
28 |
+
</reference>
|
29 |
+
</default>
|
30 |
+
-->
|
31 |
+
|
32 |
+
<catalog_product_view>
|
33 |
+
<reference name="after_body_start">
|
34 |
+
<block type="DigitalWindow_AwinTracking/Cookie" name="cookieProductPage">
|
35 |
+
<action method="setCookie"></action>
|
36 |
+
</block>
|
37 |
+
</reference>
|
38 |
+
</catalog_product_view>
|
39 |
+
|
40 |
+
<cms_index_index>
|
41 |
+
<reference name="after_body_start">
|
42 |
+
<block type="DigitalWindow_AwinTracking/Cookie" name="cookieHome">
|
43 |
+
<action method="setCookie"></action>
|
44 |
+
</block>
|
45 |
+
</reference>
|
46 |
+
</cms_index_index>
|
47 |
+
|
48 |
+
<checkout_onepage_success>
|
49 |
+
<reference name="before_body_end">
|
50 |
+
<block type="DigitalWindow_AwinTracking/awintracking" name="Awintracking" template="digitalwindow/awintracking/awintracking.phtml"/>
|
51 |
+
</reference>
|
52 |
+
</checkout_onepage_success>
|
53 |
+
|
54 |
+
<default>
|
55 |
+
<reference name="before_body_end">
|
56 |
+
<block type="DigitalWindow_AwinTracking/Mastertag" name="mastertag" template="digitalwindow/awintracking/dwin1.phtml" after="Awintracking"/>
|
57 |
+
</reference>
|
58 |
+
</default>
|
59 |
+
</layout>
|
app/design/frontend/base/default/template/digitalwindow/awintracking/awintracking.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- Affiliate Window Magento Plug-in -->
|
2 |
+
|
3 |
+
<?php echo $this->getImagePixel(); ?>
|
4 |
+
|
5 |
+
<form style="display: none;" name="aw_basket_form">
|
6 |
+
<textarea wrap="physical" id="aw_basket">
|
7 |
+
<?php echo $this->getPLTString(); ?>
|
8 |
+
</textarea>
|
9 |
+
</form>
|
10 |
+
|
11 |
+
<!-- Test -->
|
12 |
+
<script type="text/javascript">
|
13 |
+
//<![CDATA[
|
14 |
+
/*** Do not change ***/
|
15 |
+
<?php echo $this->getTracking(); ?>
|
16 |
+
//]]>
|
17 |
+
</script>
|
18 |
+
|
app/design/frontend/base/default/template/digitalwindow/awintracking/dwin1.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $this->getJourneyTagConfig();?>
|
app/etc/modules/DigitalWindow_AwinTracking.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<DigitalWindow_AwinTracking>
|
5 |
+
|
6 |
+
<!-- Whether our module is active: true or false -->
|
7 |
+
<active>true</active>
|
8 |
+
|
9 |
+
<!-- Which code pool to use: core, community or local -->
|
10 |
+
<codePool>local</codePool>
|
11 |
+
<version>1.0.1</version>
|
12 |
+
</DigitalWindow_AwinTracking>
|
13 |
+
</modules>
|
14 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>AffiliateWindow</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GNU</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Affiliate Window's Official Magento Extension.
|
10 |
+
One click installation of Affiliate Window's bespoke tracking and datafeed platform.</summary>
|
11 |
+
<description>Affiliate Window's Official Magento Extension.
|
12 |
+
One click installation of Affiliate Window's bespoke tracking and datafeed platform.</description>
|
13 |
+
<notes>GM</notes>
|
14 |
+
<authors><author><name>Stephen Short</name><user>stephenshort</user><email>Stephen.Short@affiliatewindow.com</email></author><author><name>Vladimir Sofroniev</name><user>vladimirsofroniev</user><email>Vladimir.Sofroniev@affiliatewindow.com</email></author><author><name>Edgelson Lua</name><user>edgelsonlua</user><email>Edgelson.Lua@affiliatewindow.com</email></author><author><name>Oliver Smith</name><user>oliversmith</user><email>Oliver.Smith@affiliatewindow.com</email></author></authors>
|
15 |
+
<date>2016-02-02</date>
|
16 |
+
<time>09:01:59</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="DigitalWindow_AwinTracking.xml" hash="3739f607424fe88e27289a0ea5019aed"/></dir></target><target name="magelocal"><dir name="DigitalWindow"><dir name="AwinTracking"><dir><dir name="Block"><file name="Awintracking.php" hash="d3f463d249baa732d7ee75b38184fa0f"/><file name="Cookie.php" hash="66736b4cc636b72a9d00dc079efd02f7"/><file name="Mastertag.php" hash="92e6ef9a8c39aead8fa661e224e678e0"/></dir><dir name="Helper"><file name="Data.php" hash="c5a3c31d029ba2826605ce4f65f1d2db"/></dir><dir name="Model"><file name="Observer.php" hash="66506dc0d1c627afd118cf9fede24e40"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cookie.php" hash="50f06b4fcfca368033664d0eb5c9b7c9"/><file name="DefaultValue.php" hash="5d50db729cddc93cf4edac2369a1d395"/><file name="FeedName.php" hash="27c58e95203d12f93f5ec999367b51f6"/><file name="KeyParam.php" hash="39d3c69129f1e959d77b604e46f6f790"/><file name="MerchantId.php" hash="26428dec0c735ecb6c8f94fd4d2aa6a6"/></dir><dir name="Clock"><file name="Frequency.php" hash="6a13b43ef6004527a37f115a3243e52a"/></dir><dir name="Store"><file name="Id.php" hash="dc04605e1dd977956e8e1c7c474aeced"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="dc37b4397842f39ee0e2bd565f8f2083"/><file name="config.xml" hash="20e28c1e6f142657bf727b7d54add776"/><file name="system.xml" hash="ea626b675b41f82405e58960c96e1117"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="digitalwindow"><dir><dir name="awintracking"><file name="awintracking.phtml" hash="39ee017118d4da5c1f3ab23a8d3889d0"/><file name="dwin1.phtml" hash="9fb45f13061159776dcae4772c49dfd0"/></dir></dir></dir></dir><dir name="layout"><file name="digitalwindow_awintracking.xml" hash="fea2f002706ecedb9ea2d757412a2fbd"/></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|