Version Notes
Changelog for 1.2.0.0
Options to disable feeds
Feeds now set to run daily at 3:00am
Support for dynamic commissioning
Cookies increased to 365 days
Download this release
Release Info
Developer | Michael A. Smith |
Extension | eBay_Enterprise_Affiliate_Extension |
Version | 1.2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.2.0.0
- app/code/community/EbayEnterprise/Affiliate/Block/Beacon.php +321 -221
- app/code/community/EbayEnterprise/Affiliate/Block/Tracking.php +44 -44
- app/code/community/EbayEnterprise/Affiliate/Exception/Configuration.php +21 -21
- app/code/community/EbayEnterprise/Affiliate/Helper/Config.php +301 -217
- app/code/community/EbayEnterprise/Affiliate/Helper/Data.php +178 -135
- app/code/community/EbayEnterprise/Affiliate/Helper/Map.php +112 -112
- app/code/community/EbayEnterprise/Affiliate/Helper/Map/Order.php +172 -159
- app/code/community/EbayEnterprise/Affiliate/Helper/Map/Product.php +135 -135
- app/code/community/EbayEnterprise/Affiliate/Model/Feed/Abstract.php +337 -337
- app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Abstract.php +72 -72
- app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Basic.php +75 -75
- app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Dynamic.php +68 -0
- app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Itemized.php +81 -81
- app/code/community/EbayEnterprise/Affiliate/Model/Feed/Product.php +98 -98
- app/code/community/EbayEnterprise/Affiliate/Model/Observer.php +76 -67
- app/code/community/EbayEnterprise/Affiliate/Model/Product/Attribute/Source/CommissioningCategory.php +29 -0
- app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Attributes.php +75 -75
- app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Categories.php +37 -37
- app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Ordertypes.php +25 -0
- app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Stockquantity.php +37 -37
- app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Stockyesno.php +37 -37
- app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Transactiontype.php +30 -30
- app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Visibilityyesno.php +37 -37
- app/code/community/EbayEnterprise/Affiliate/Test/Block/BeaconTest.php +254 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Block/providers/testShowBeacon.yaml +99 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Helper/DataTest.php +54 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Helper/Map/ProductTest.php +174 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Helper/providers/testIsValidCookie.yaml +12 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/AbstractTest.php +293 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/Order/AbstractTest.php +60 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/Order/BasicTest.php +40 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/Order/ItemizedTest.php +40 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/ProductTest.php +169 -0
- app/code/community/EbayEnterprise/Affiliate/Test/Model/ObserverTest.php +62 -0
- app/code/community/EbayEnterprise/Affiliate/etc/adminhtml.xml +37 -37
- app/code/community/EbayEnterprise/Affiliate/etc/config.xml +1030 -979
- app/code/community/EbayEnterprise/Affiliate/etc/system.xml +931 -913
- app/code/community/EbayEnterprise/Affiliate/sql/eems_affiliate_setup/install-1.0.0.1.php +24 -24
- app/code/community/EbayEnterprise/Affiliate/sql/eems_affiliate_setup/mysql4-install-1.0.0.1.php +24 -24
- app/code/community/EbayEnterprise/Affiliate/sql/eems_affiliate_setup/mysql4-upgrade-1.0.0.1-1.2.0.0.php +36 -0
- app/design/frontend/base/default/layout/eems_affiliate.xml +35 -35
- app/design/frontend/base/default/template/eems_affiliate/beacon.phtml +35 -35
- app/design/frontend/base/default/template/eems_affiliate/tracking.phtml +97 -97
- app/etc/modules/EbayEnterprise_Affiliate.xml +23 -23
- package.xml +21 -6
app/code/community/EbayEnterprise/Affiliate/Block/Beacon.php
CHANGED
@@ -1,221 +1,321 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
class EbayEnterprise_Affiliate_Block_Beacon extends Mage_Core_Block_Template
|
19 |
-
{
|
20 |
-
/**
|
21 |
-
* The 'PID' beacon URL querystring key
|
22 |
-
*/
|
23 |
-
const KEY_PID = 'PID';
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
/**
|
41 |
-
* The '
|
42 |
-
*/
|
43 |
-
const
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
* @
|
80 |
-
*/
|
81 |
-
protected
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
*
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
$
|
213 |
-
$
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
class EbayEnterprise_Affiliate_Block_Beacon extends Mage_Core_Block_Template
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* The 'PID' beacon URL querystring key
|
22 |
+
*/
|
23 |
+
const KEY_PID = 'PID';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The 'OID' beacon URL querystring key
|
27 |
+
*/
|
28 |
+
const KEY_OID = 'OID';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* The 'AMOUNT' beacon URL querystring key
|
32 |
+
*/
|
33 |
+
const KEY_AMOUNT = 'AMOUNT';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The 'TYPE' beacon URL querystring key
|
37 |
+
*/
|
38 |
+
const KEY_TYPE = 'TYPE';
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The 'QTY' beacon URL querystring key
|
42 |
+
*/
|
43 |
+
const KEY_QTY = 'QTY';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* The 'TOTALAMOUNT' beacon URL querystring key
|
47 |
+
*/
|
48 |
+
const KEY_TOTALAMOUNT = 'TOTALAMOUNT';
|
49 |
+
|
50 |
+
/**
|
51 |
+
* The 'INT' beacon URL querystring key
|
52 |
+
*/
|
53 |
+
const KEY_INT = 'INT';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* The 'ITEM' beacon URL querystring key
|
57 |
+
*/
|
58 |
+
const KEY_ITEM = 'ITEM';
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The 'PROMOCODE' beacon URL querystring key
|
62 |
+
*/
|
63 |
+
const KEY_PROMOCODE = 'PROMOCODE';
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Dynamic query keys
|
67 |
+
*/
|
68 |
+
const KEY_DYNAMIC_PROGRAM_ID = 'PROGRAM_ID';
|
69 |
+
const KEY_DYNAMIC_ORDER_ID = 'ORDER_ID';
|
70 |
+
const KEY_DYNAMIC_ITEM_ID = 'ITEM_ID';
|
71 |
+
const KEY_DYNAMIC_ITEM_PRICE = 'ITEM_PRICE';
|
72 |
+
const KEY_DYNAMIC_QUANTITY = 'QUANTITY';
|
73 |
+
const KEY_DYNAMIC_CATEGORY = 'CATEGORY';
|
74 |
+
const KEY_DYNAMIC_NEW_TO_FILE = 'NEW_TO_FILE';
|
75 |
+
const KEY_DYNAMIC_COUPON = 'COUPON';
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @var Mage_Sales_Model_Order
|
79 |
+
* @see self::_getOrder
|
80 |
+
*/
|
81 |
+
protected $_order;
|
82 |
+
|
83 |
+
/** @var EbayEnterprise_Affiliate_Helper_Data */
|
84 |
+
protected $_helper = null;
|
85 |
+
|
86 |
+
/** @var EbayEnterprise_Affiliate_Helper_Config */
|
87 |
+
protected $_configHelper = null;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @return EbayEnterprise_Affiliate_Helper_Data
|
91 |
+
*/
|
92 |
+
protected function _getHelper()
|
93 |
+
{
|
94 |
+
if (!$this->_helper) {
|
95 |
+
$this->_helper = Mage::helper('eems_affiliate');
|
96 |
+
}
|
97 |
+
|
98 |
+
return $this->_helper;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @return EbayEnterprise_Affiliate_Helper_Config
|
103 |
+
*/
|
104 |
+
protected function _getConfigHelper()
|
105 |
+
{
|
106 |
+
if (!$this->_configHelper) {
|
107 |
+
$this->_configHelper = Mage::helper('eems_affiliate/config');
|
108 |
+
}
|
109 |
+
|
110 |
+
return $this->_configHelper;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Get the last order.
|
115 |
+
* @return Mage_Sales_Model_Order | null
|
116 |
+
*/
|
117 |
+
protected function _getOrder()
|
118 |
+
{
|
119 |
+
if (!($this->_order instanceof Mage_Sales_Model_Order)) {
|
120 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
121 |
+
if ($orderId) {
|
122 |
+
$this->_order = Mage::getModel('sales/order')->load($orderId);
|
123 |
+
}
|
124 |
+
}
|
125 |
+
return $this->_order;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Get the beacon URL.
|
130 |
+
* @return string | null
|
131 |
+
*/
|
132 |
+
public function getBeaconUrl()
|
133 |
+
{
|
134 |
+
$order = $this->_getOrder();
|
135 |
+
|
136 |
+
$url = null;
|
137 |
+
|
138 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
139 |
+
if (Mage::helper('eems_affiliate/config')->isItemizedOrders()) {
|
140 |
+
$params = $this->_buildItemizedParams($order);
|
141 |
+
} elseif (Mage::helper('eems_affiliate/config')->isDynamicOrders()) {
|
142 |
+
$params = $this->_buildDynamicParams($order);
|
143 |
+
} else {
|
144 |
+
$params = $this->_buildBasicParams($order);
|
145 |
+
}
|
146 |
+
|
147 |
+
$url = Mage::helper('eems_affiliate')->buildBeaconUrl($params);
|
148 |
+
}
|
149 |
+
return $url;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* build common params array
|
154 |
+
* @param Mage_Sales_Model_Order $order
|
155 |
+
* @return array
|
156 |
+
*/
|
157 |
+
protected function _buildCommonParams(Mage_Sales_Model_Order $order)
|
158 |
+
{
|
159 |
+
$params = array(
|
160 |
+
static::KEY_PID => Mage::helper('eems_affiliate/config')->getProgramId(),
|
161 |
+
static::KEY_OID => $order->getIncrementId(),
|
162 |
+
);
|
163 |
+
$couponCode = trim($order->getCouponCode());
|
164 |
+
return ($couponCode !== '')?
|
165 |
+
array_merge($params, array(static::KEY_PROMOCODE => $couponCode)) : $params;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* build basic params array for non itemized beacon URL
|
170 |
+
* @param Mage_Sales_Model_Order $order
|
171 |
+
* @return array
|
172 |
+
*/
|
173 |
+
protected function _buildBasicParams(Mage_Sales_Model_Order $order)
|
174 |
+
{
|
175 |
+
$params = $this->_buildCommonParams($order);
|
176 |
+
$params[static::KEY_AMOUNT] = number_format($order->getSubtotal() + $order->getDiscountAmount() + $order->getShippingDiscountAmount(), 2, '.', '');
|
177 |
+
$params[static::KEY_TYPE] = Mage::helper('eems_affiliate/config')->getTransactionType();
|
178 |
+
|
179 |
+
return $params;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* build itemized order params array for itemized beacon URL
|
184 |
+
* @param Mage_Sales_Model_Order $order
|
185 |
+
* @return array
|
186 |
+
*/
|
187 |
+
protected function _buildItemizedParams(Mage_Sales_Model_Order $order)
|
188 |
+
{
|
189 |
+
$params = $this->_buildCommonParams($order);
|
190 |
+
$params[static::KEY_INT] = Mage::helper('eems_affiliate/config')->getInt();
|
191 |
+
$increment = 1; // incrementer for the unique item keys
|
192 |
+
foreach ($order->getAllItems() as $item) {
|
193 |
+
// need to ignore the bundle parent as it will contain collected total
|
194 |
+
// for children but not discounts
|
195 |
+
$position = $this->_getDupePosition($params, $item);
|
196 |
+
// ignore the parent configurable quantity - quantity of config products
|
197 |
+
// will come from the simple used product with the same SKU
|
198 |
+
$quantity = $item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE ?
|
199 |
+
0 : (int) $item->getQtyOrdered();
|
200 |
+
// consider parent bundle products to be 0.00 total - total of the bundle
|
201 |
+
// is the sum of all child products which are also included in the beacon
|
202 |
+
// so including both totals would effectively double the price of the bundle
|
203 |
+
//
|
204 |
+
// Divide discount amount by quantity to get per item discount
|
205 |
+
$total = $item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ?
|
206 |
+
0.00 : $item->getPrice() - ($item->getDiscountAmount() / $item->getQtyOrdered());
|
207 |
+
if ($position) {
|
208 |
+
// we detected that the current item already exist in the params array
|
209 |
+
// and have the key increment position let's simply adjust
|
210 |
+
// the qty and total amount
|
211 |
+
$params[static::KEY_QTY . $position] += $quantity;
|
212 |
+
$amtKey = static::KEY_TOTALAMOUNT . $position;
|
213 |
+
$params[$amtKey] = number_format($params[$amtKey] + $total, 2, '.', '');
|
214 |
+
} else {
|
215 |
+
$params = array_merge($params, array(
|
216 |
+
static::KEY_ITEM . $increment => $item->getSku(),
|
217 |
+
static::KEY_QTY . $increment => $quantity,
|
218 |
+
static::KEY_AMOUNT . $increment => number_format($total, 2, '.', ''),
|
219 |
+
));
|
220 |
+
$increment++; // only get incremented when a unique key have been appended
|
221 |
+
}
|
222 |
+
}
|
223 |
+
return $params;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* build dynamic order params array for dynamic beacon URL
|
228 |
+
* @param Mage_Sales_Model_Order $order
|
229 |
+
* @return array
|
230 |
+
*/
|
231 |
+
protected function _buildDynamicParams(Mage_Sales_Model_Order $order)
|
232 |
+
{
|
233 |
+
$helper = Mage::helper('eems_affiliate');
|
234 |
+
|
235 |
+
$params = $this->_buildItemizedParams($order);
|
236 |
+
|
237 |
+
// Swap query key names for dynamic versions
|
238 |
+
$params[self::KEY_DYNAMIC_PROGRAM_ID] = $params[self::KEY_PID];
|
239 |
+
$params[self::KEY_DYNAMIC_ORDER_ID] = $params[self::KEY_OID];
|
240 |
+
unset($params[self::KEY_PID]);
|
241 |
+
unset($params[self::KEY_OID]);
|
242 |
+
if (isset($params[self::KEY_PROMOCODE])) {
|
243 |
+
$params[self::KEY_DYNAMIC_COUPON] = $params[self::KEY_PROMOCODE];
|
244 |
+
unset($params[self::KEY_PROMOCODE]);
|
245 |
+
}
|
246 |
+
|
247 |
+
// See if email has any history
|
248 |
+
$params[self::KEY_DYNAMIC_NEW_TO_FILE] = (int)$helper->isNewToFile($order);
|
249 |
+
|
250 |
+
$productIds = array();
|
251 |
+
foreach($order->getAllItems() as $item) {
|
252 |
+
$productIds[] = $item->getProduct()->getId();
|
253 |
+
}
|
254 |
+
|
255 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection()
|
256 |
+
->addAttributeToFilter('entity_id', array('in', $productIds))
|
257 |
+
->addCategoryIds();
|
258 |
+
|
259 |
+
// No need for increment, all items are in param already
|
260 |
+
foreach($order->getAllItems() as $item) {
|
261 |
+
// Every item should be found here
|
262 |
+
$position = $this->_getDupePosition($params, $item);
|
263 |
+
|
264 |
+
// Add category IDs
|
265 |
+
$product = $productCollection->getItemById($item->getProduct()->getId());
|
266 |
+
$item->getProduct()->setCategoryIds($product->getCategoryIds());
|
267 |
+
|
268 |
+
// Get item's category
|
269 |
+
$params[self::KEY_DYNAMIC_CATEGORY . $position] = $helper->getCommissioningCategory($item);
|
270 |
+
|
271 |
+
// Replace query string keys
|
272 |
+
$params[self::KEY_DYNAMIC_ITEM_ID . $position] = $params[self::KEY_ITEM . $position];
|
273 |
+
$params[self::KEY_DYNAMIC_ITEM_PRICE . $position] = $params[self::KEY_AMOUNT . $position];
|
274 |
+
$params[self::KEY_DYNAMIC_QUANTITY . $position] = $params[self::KEY_QTY . $position];
|
275 |
+
unset($params[self::KEY_ITEM . $position]);
|
276 |
+
unset($params[self::KEY_AMOUNT . $position]);
|
277 |
+
unset($params[self::KEY_QTY . $position]);
|
278 |
+
}
|
279 |
+
|
280 |
+
return $params;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* check if the current sku already exists in the params data if so return
|
285 |
+
* the position it is found in
|
286 |
+
* @param array $params the given array of keys needed to build the beacon URL querystring
|
287 |
+
* @param Mage_Sales_Model_Order_Item $item
|
288 |
+
* @return int the item position where dupe found otherwise zero
|
289 |
+
*/
|
290 |
+
protected function _getDupePosition(array $params, Mage_Sales_Model_Order_Item $item)
|
291 |
+
{
|
292 |
+
$key = array_search($item->getSku(), $params, true);
|
293 |
+
return ($key !== false)?
|
294 |
+
(int) str_replace(static::KEY_ITEM, '', $key) : 0;
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Whether or not to display the beacon.
|
299 |
+
*
|
300 |
+
* Show the pixel only if tracking is enabled and we have a valid order
|
301 |
+
* AND either conditional pixel logic is OFF or it is ON and we have
|
302 |
+
* a valid cookie.
|
303 |
+
*
|
304 |
+
* @return bool
|
305 |
+
*/
|
306 |
+
public function showBeacon()
|
307 |
+
{
|
308 |
+
$config = $this->_getConfigHelper();
|
309 |
+
|
310 |
+
return (
|
311 |
+
(
|
312 |
+
$config->isEnabled() &&
|
313 |
+
$this->_getOrder() instanceof Mage_Sales_Model_Order
|
314 |
+
) &&
|
315 |
+
(
|
316 |
+
$this->_getHelper()->isValidCookie() ||
|
317 |
+
!$config->isConditionalPixelEnabled()
|
318 |
+
)
|
319 |
+
);
|
320 |
+
}
|
321 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Block/Tracking.php
CHANGED
@@ -1,44 +1,44 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2013-2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.md.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
12 |
-
* @copyright Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
13 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
14 |
-
*/
|
15 |
-
|
16 |
-
|
17 |
-
class EbayEnterprise_Affiliate_Block_Tracking extends Mage_Core_Block_Template
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* @return string | null
|
21 |
-
*/
|
22 |
-
public function getCookieName()
|
23 |
-
{
|
24 |
-
return Mage::helper('eems_affiliate')->getSourceCookieName();
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @return string | null
|
29 |
-
*/
|
30 |
-
public function getQueryStringKeyName()
|
31 |
-
{
|
32 |
-
return Mage::helper('eems_affiliate/config')->getSourceKeyName();
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Whether or not to inject the javascript to set the tracking cookie
|
37 |
-
*
|
38 |
-
* @return bool
|
39 |
-
*/
|
40 |
-
public function injectJavaScript()
|
41 |
-
{
|
42 |
-
return (Mage::helper('eems_affiliate/config')->isConditionalPixelEnabled());
|
43 |
-
}
|
44 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2013-2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.md.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @copyright Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
13 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
14 |
+
*/
|
15 |
+
|
16 |
+
|
17 |
+
class EbayEnterprise_Affiliate_Block_Tracking extends Mage_Core_Block_Template
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* @return string | null
|
21 |
+
*/
|
22 |
+
public function getCookieName()
|
23 |
+
{
|
24 |
+
return Mage::helper('eems_affiliate')->getSourceCookieName();
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return string | null
|
29 |
+
*/
|
30 |
+
public function getQueryStringKeyName()
|
31 |
+
{
|
32 |
+
return Mage::helper('eems_affiliate/config')->getSourceKeyName();
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Whether or not to inject the javascript to set the tracking cookie
|
37 |
+
*
|
38 |
+
* @return bool
|
39 |
+
*/
|
40 |
+
public function injectJavaScript()
|
41 |
+
{
|
42 |
+
return (Mage::helper('eems_affiliate/config')->isConditionalPixelEnabled());
|
43 |
+
}
|
44 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Exception/Configuration.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Exception_Configuration extends Mage_Core_Exception
|
20 |
-
{
|
21 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Exception_Configuration extends Mage_Core_Exception
|
20 |
+
{
|
21 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Helper/Config.php
CHANGED
@@ -1,217 +1,301 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @codeCoverageIgnore
|
20 |
-
*/
|
21 |
-
class EbayEnterprise_Affiliate_Helper_Config
|
22 |
-
{
|
23 |
-
const BEACON_URL_PATH = 'marketing_solutions/eems_affiliate/beacon_url';
|
24 |
-
const ENABLED_PATH = 'marketing_solutions/eems_affiliate/active';
|
25 |
-
const
|
26 |
-
const
|
27 |
-
const
|
28 |
-
const
|
29 |
-
const
|
30 |
-
const
|
31 |
-
const
|
32 |
-
const
|
33 |
-
const ITEMIZED_ORDER_FEED_MAPPING_PATH = 'marketing_solutions/eems_affiliate/feeds/order_itemized/fields';
|
34 |
-
const BASIC_ORDER_FEED_MAPPING_PATH = 'marketing_solutions/eems_affiliate/feeds/order_basic/fields';
|
35 |
-
const
|
36 |
-
const
|
37 |
-
const
|
38 |
-
const
|
39 |
-
const
|
40 |
-
const
|
41 |
-
const
|
42 |
-
const
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
*
|
55 |
-
* @
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
/**
|
63 |
-
* retrieve the
|
64 |
-
* @param mixed $store
|
65 |
-
* @return
|
66 |
-
*/
|
67 |
-
public function
|
68 |
-
{
|
69 |
-
return Mage::
|
70 |
-
}
|
71 |
-
|
72 |
-
|
73 |
-
*
|
74 |
-
* @
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
*
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
*
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
*
|
145 |
-
* @
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
*
|
154 |
-
* @
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Get the configured
|
163 |
-
* @param mixed $store
|
164 |
-
* @return string
|
165 |
-
*/
|
166 |
-
public function
|
167 |
-
{
|
168 |
-
return Mage::getStoreConfig(static::
|
169 |
-
}
|
170 |
-
|
171 |
-
|
172 |
-
*
|
173 |
-
*
|
174 |
-
* @
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
*
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
*
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @codeCoverageIgnore
|
20 |
+
*/
|
21 |
+
class EbayEnterprise_Affiliate_Helper_Config
|
22 |
+
{
|
23 |
+
const BEACON_URL_PATH = 'marketing_solutions/eems_affiliate/beacon_url';
|
24 |
+
const ENABLED_PATH = 'marketing_solutions/eems_affiliate/active';
|
25 |
+
const ORDER_TYPE_PATH = 'marketing_solutions/eems_affiliate/order_type';
|
26 |
+
const PROGRAM_ID_PATH = 'marketing_solutions/eems_affiliate/program_id';
|
27 |
+
const TRANSACTION_TYPE_PATH = 'marketing_solutions/eems_affiliate/transaction_type';
|
28 |
+
const EXPORT_FILE_PATH_CONFIG_PATH = 'marketing_solutions/eems_affiliate/export_path';
|
29 |
+
const CALLBACK_MAPPINGS_PATH = 'marketing_solutions/eems_affiliate/feeds/callback_mappings';
|
30 |
+
const PRODUCT_FEED_MAPPING_PATH = 'marketing_solutions/eems_affiliate_product_attribute_map';
|
31 |
+
const PRODUCT_FEED_FILENAME_FORMAT_PATH = 'marketing_solutions/eems_affiliate/feeds/product/file_name_format';
|
32 |
+
const DYNAMIC_ORDER_FEED_MAPPING_PATH = 'marketing_solutions/eems_affiliate/feeds/order_dynamic/fields';
|
33 |
+
const ITEMIZED_ORDER_FEED_MAPPING_PATH = 'marketing_solutions/eems_affiliate/feeds/order_itemized/fields';
|
34 |
+
const BASIC_ORDER_FEED_MAPPING_PATH = 'marketing_solutions/eems_affiliate/feeds/order_basic/fields';
|
35 |
+
const DYNAMIC_ORDER_FEED_FILE_FORMAT_PATH = 'marketing_solutions/eems_affiliate/feeds/order_dynamic/file_name_format';
|
36 |
+
const ITEMIZED_ORDER_FEED_FILE_FORMAT_PATH = 'marketing_solutions/eems_affiliate/feeds/order_itemized/file_name_format';
|
37 |
+
const BASIC_ORDER_FEED_FILE_FORMAT_PATH = 'marketing_solutions/eems_affiliate/feeds/order_basic/file_name_format';
|
38 |
+
const ORDER_LAST_RUN_PATH = 'marketing_solutions/eems_affiliate/feed/last_run_time';
|
39 |
+
const JS_FILES = 'marketing_solutions/eems_affiliate/js_files';
|
40 |
+
const CONDITIONAL_PIXEL_ENABLED = 'marketing_solutions/eems_affiliate/conditional_pixel_enabled';
|
41 |
+
const SOURCE_KEY_NAME = 'marketing_solutions/eems_affiliate/source_key_name';
|
42 |
+
const PRODUCT_FEED_ENABLED = 'marketing_solutions/eems_affiliate/product_feed_enabled';
|
43 |
+
const ORDER_FEED_ENABLED = 'marketing_solutions/eems_affiliate/order_feed_enabled';
|
44 |
+
|
45 |
+
const TRANSACTION_TYPE_SALE = '1';
|
46 |
+
const TRANSACTION_TYPE_LEAD = '2';
|
47 |
+
|
48 |
+
const ORDER_TYPE_BASIC = 'basic';
|
49 |
+
const ORDER_TYPE_ITEMIZED = 'itemized';
|
50 |
+
const ORDER_TYPE_DYNAMIC = 'dynamic';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* retrieve the program id from store config
|
54 |
+
* @param mixed $store
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
public function getProgramId($store = null)
|
58 |
+
{
|
59 |
+
return Mage::getStoreConfig(static::PROGRAM_ID_PATH, $store);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* retrieve the transaction type from store config
|
64 |
+
* @param mixed $store
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function getTransactionType($store = null)
|
68 |
+
{
|
69 |
+
return Mage::getStoreConfig(static::TRANSACTION_TYPE_PATH, $store);
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* retrieve the order type from store config
|
74 |
+
* @param mixed $store
|
75 |
+
* @return string
|
76 |
+
*/
|
77 |
+
public function getOrderType($store = null)
|
78 |
+
{
|
79 |
+
return Mage::getStoreConfig(static::ORDER_TYPE_PATH, $store);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* determine if orders should be itemized
|
84 |
+
* @param mixed $store
|
85 |
+
* @return bool
|
86 |
+
*/
|
87 |
+
public function isItemizedOrders($store = null)
|
88 |
+
{
|
89 |
+
return $this->getOrderType() == static::ORDER_TYPE_ITEMIZED;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* determine if orders should be dynamic
|
94 |
+
* @param mixed $store
|
95 |
+
* @return bool
|
96 |
+
*/
|
97 |
+
public function isDynamicOrders($store = null)
|
98 |
+
{
|
99 |
+
return $this->getOrderType() == static::ORDER_TYPE_DYNAMIC;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* check if beacon pixel is enable in the store config
|
104 |
+
* @param mixed $store
|
105 |
+
* @return bool
|
106 |
+
*/
|
107 |
+
public function isEnabled($store = null)
|
108 |
+
{
|
109 |
+
return Mage::getStoreConfigFlag(static::ENABLED_PATH, $store);
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* retrieve the int from store config
|
114 |
+
* @param mixed $store
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
public function getInt($store = null)
|
118 |
+
{
|
119 |
+
return strtoupper(self::getOrderType());
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* retrieve the base url of the beacon from store config
|
124 |
+
* @param mixed $store
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public function getBeaconBaseUrl($store = null)
|
128 |
+
{
|
129 |
+
return Mage::getStoreConfig(static::BEACON_URL_PATH, $store);
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Get the configured export file path.
|
134 |
+
* @param mixed $store
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
public function getExportFilePath($store = null)
|
138 |
+
{
|
139 |
+
return Mage::getStoreConfig(static::EXPORT_FILE_PATH_CONFIG_PATH, $store);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get the callback mappings from the config
|
144 |
+
* @param mixed $store
|
145 |
+
* @return array
|
146 |
+
*/
|
147 |
+
public function getCallbackMappings($store = null)
|
148 |
+
{
|
149 |
+
return Mage::getStoreConfig(static::CALLBACK_MAPPINGS_PATH, $store);
|
150 |
+
}
|
151 |
+
/**
|
152 |
+
* Get the configured feed mapping for the product feed.
|
153 |
+
* @param mixed $store
|
154 |
+
* @return array
|
155 |
+
*/
|
156 |
+
public function getProductFeedFields($store = null)
|
157 |
+
{
|
158 |
+
return array_filter(Mage::getStoreConfig(static::PRODUCT_FEED_MAPPING_PATH, $store));
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Get the configured product feed file name format
|
163 |
+
* @param mixed $store
|
164 |
+
* @return string
|
165 |
+
*/
|
166 |
+
public function getProductFeedFilenameFormat($store = null)
|
167 |
+
{
|
168 |
+
return Mage::getStoreConfig(static::PRODUCT_FEED_FILENAME_FORMAT_PATH, $store);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get the configured feed mapping for the dynamic orders feed.
|
173 |
+
* @param mixed $store
|
174 |
+
* @return array
|
175 |
+
*/
|
176 |
+
public function getDynamicOrderFeedFields($store = null)
|
177 |
+
{
|
178 |
+
return Mage::getStoreConfig(static::DYNAMIC_ORDER_FEED_MAPPING_PATH, $store);
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Get the configured feed mapping for the itemized orders feed.
|
183 |
+
* @param mixed $store
|
184 |
+
* @return array
|
185 |
+
*/
|
186 |
+
public function getItemizedOrderFeedFields($store = null)
|
187 |
+
{
|
188 |
+
return Mage::getStoreConfig(static::ITEMIZED_ORDER_FEED_MAPPING_PATH, $store);
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Get the configured feed mapping for the basic orders feed.
|
193 |
+
* @param mixed $store
|
194 |
+
* @return array
|
195 |
+
*/
|
196 |
+
public function getBasicOrderFeedFields($store = null)
|
197 |
+
{
|
198 |
+
return Mage::getStoreConfig(static::BASIC_ORDER_FEED_MAPPING_PATH, $store);
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Get the configured dynamic order feed file format
|
203 |
+
* @param mixed $store
|
204 |
+
* @return string
|
205 |
+
*/
|
206 |
+
public function getDynamicOrderFeedFileFormat($store = null)
|
207 |
+
{
|
208 |
+
return Mage::getStoreConfig(static::DYNAMIC_ORDER_FEED_FILE_FORMAT_PATH, $store);
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Get the configured itemized order feed file format
|
213 |
+
* @param mixed $store
|
214 |
+
* @return string
|
215 |
+
*/
|
216 |
+
public function getItemizedOrderFeedFileFormat($store = null)
|
217 |
+
{
|
218 |
+
return Mage::getStoreConfig(static::ITEMIZED_ORDER_FEED_FILE_FORMAT_PATH, $store);
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Get the configured basic order feed file format
|
223 |
+
* @param mixed $store
|
224 |
+
* @return string
|
225 |
+
*/
|
226 |
+
public function getBasicOrderFeedFileFormat($store = null)
|
227 |
+
{
|
228 |
+
return Mage::getStoreConfig(static::BASIC_ORDER_FEED_FILE_FORMAT_PATH, $store);
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Update the last run time of the order create feed to the specified time,
|
233 |
+
* or the current time it no time is given. Always set globally so no need to
|
234 |
+
* ever be given a store context.
|
235 |
+
* @param string $time
|
236 |
+
* @return self
|
237 |
+
*/
|
238 |
+
public function updateOrderLastRunTime($time = null)
|
239 |
+
{
|
240 |
+
Mage::getConfig()->saveConfig(self::ORDER_LAST_RUN_PATH, $time ?: time());
|
241 |
+
Mage::app()->getStore()->resetConfig();
|
242 |
+
return $this;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Get the last time the order corrections feed was run. Returns the string
|
247 |
+
* value saved in config. Always set globally so no need for a store context.
|
248 |
+
* @return string
|
249 |
+
*/
|
250 |
+
public function getOrderLastRunTime()
|
251 |
+
{
|
252 |
+
return Mage::getStoreConfig(self::ORDER_LAST_RUN_PATH);
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Enable/disable conditional pixel logic
|
257 |
+
*
|
258 |
+
* @param null $store
|
259 |
+
* @return bool
|
260 |
+
*/
|
261 |
+
public function isConditionalPixelEnabled($store = null)
|
262 |
+
{
|
263 |
+
return Mage::getStoreConfig(self::CONDITIONAL_PIXEL_ENABLED, $store);
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Name of the affiliate source
|
268 |
+
*
|
269 |
+
* If conditional pixel logic is enabled then only display the pixel
|
270 |
+
* if the query string contains a key with this name
|
271 |
+
*
|
272 |
+
* @param null $store
|
273 |
+
* @return string
|
274 |
+
*/
|
275 |
+
public function getSourceKeyName($store = null)
|
276 |
+
{
|
277 |
+
return Mage::getStoreConfig(self::SOURCE_KEY_NAME, $store);
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Enable/disable product feed
|
282 |
+
*
|
283 |
+
* @param null $store
|
284 |
+
* @return boolean
|
285 |
+
*/
|
286 |
+
public function isProductFeedEnabled($store = null)
|
287 |
+
{
|
288 |
+
return Mage::getStoreConfig(self::PRODUCT_FEED_ENABLED, $store);
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Enable/disable order feed
|
293 |
+
*
|
294 |
+
* @param null $store
|
295 |
+
* @return boolean
|
296 |
+
*/
|
297 |
+
public function isOrderFeedEnabled($store = null)
|
298 |
+
{
|
299 |
+
return Mage::getStoreConfig(self::ORDER_FEED_ENABLED, $store);
|
300 |
+
}
|
301 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Helper/Data.php
CHANGED
@@ -1,135 +1,178 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Helper_Data extends Mage_Core_Helper_Abstract
|
20 |
-
{
|
21 |
-
/** value for the source cookie */
|
22 |
-
const SOURCE_KEY_VALUE = 'eean';
|
23 |
-
/** prefix added to the source key name set in the admin panel to create a unique cookie name */
|
24 |
-
const SOURCE_COOKIE_PREFIX = 'ebay_enterprise_affiliate_';
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Build the beacon url given an array keys
|
28 |
-
* @param array $params
|
29 |
-
* @return string
|
30 |
-
*/
|
31 |
-
public function buildBeaconUrl(array $params)
|
32 |
-
{
|
33 |
-
return Mage::helper('eems_affiliate/config')->getBeaconBaseUrl() . '?' .
|
34 |
-
http_build_query($params);
|
35 |
-
}
|
36 |
-
|
37 |
-
|
38 |
-
*
|
39 |
-
*
|
40 |
-
*
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
*
|
56 |
-
*
|
57 |
-
*
|
58 |
-
*
|
59 |
-
*
|
60 |
-
*
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
*
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
*
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Helper_Data extends Mage_Core_Helper_Abstract
|
20 |
+
{
|
21 |
+
/** value for the source cookie */
|
22 |
+
const SOURCE_KEY_VALUE = 'eean';
|
23 |
+
/** prefix added to the source key name set in the admin panel to create a unique cookie name */
|
24 |
+
const SOURCE_COOKIE_PREFIX = 'ebay_enterprise_affiliate_';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Build the beacon url given an array keys
|
28 |
+
* @param array $params
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public function buildBeaconUrl(array $params)
|
32 |
+
{
|
33 |
+
return Mage::helper('eems_affiliate/config')->getBeaconBaseUrl() . '?' .
|
34 |
+
http_build_query($params);
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get all unique configured program ids. Program ids may only be set at the
|
39 |
+
* website level, so only get the program id for the default store for
|
40 |
+
* each website.
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public function getAllProgramIds()
|
44 |
+
{
|
45 |
+
$config = Mage::helper('eems_affiliate/config');
|
46 |
+
return array_unique(array_filter(array_map(
|
47 |
+
function ($website) use ($config) {
|
48 |
+
return $config->getProgramId($website->getDefaultStore());
|
49 |
+
},
|
50 |
+
Mage::app()->getWebsites()
|
51 |
+
)));
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get a single store view for a program id. As program ids are configured
|
56 |
+
* only at the global or website level, the store view selecetd will be
|
57 |
+
* the default store view for the scope the configuration is set at. When
|
58 |
+
* set globally, the default store view for the Magento instance will be
|
59 |
+
* selected. When set at a website level, the default store view for that
|
60 |
+
* website will be used.
|
61 |
+
* @param string $programId
|
62 |
+
* @return Mage_Core_Model_Store|null
|
63 |
+
*/
|
64 |
+
public function getStoreForProgramId($programId)
|
65 |
+
{
|
66 |
+
$config = Mage::helper('eems_affiliate/config');
|
67 |
+
// Check for the default store view to be this program id first, will match
|
68 |
+
// when the program id is set at the global level.
|
69 |
+
$defaultStoreView = Mage::app()->getDefaultStoreView();
|
70 |
+
$defaultProgramId = $config->getProgramId($defaultStoreView);
|
71 |
+
if ($programId === $defaultProgramId) {
|
72 |
+
return $defaultStoreView;
|
73 |
+
}
|
74 |
+
// When set at the website level, use the first website encountered
|
75 |
+
// with a matching program id
|
76 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
77 |
+
$storeView = $website->getDefaultStore();
|
78 |
+
if ($config->getProgramId($storeView) === $programId) {
|
79 |
+
return $storeView;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return null;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get all store views that have a program id that matches the given
|
87 |
+
* program id
|
88 |
+
* @param string $programId
|
89 |
+
* @return Mage_Core_Model_Store[]
|
90 |
+
*/
|
91 |
+
public function getAllStoresForProgramId($programId)
|
92 |
+
{
|
93 |
+
$config = Mage::helper('eems_affiliate/config');
|
94 |
+
return array_filter(
|
95 |
+
Mage::app()->getStores(),
|
96 |
+
function ($store) use ($config, $programId) {
|
97 |
+
return $config->getProgramId($store) === $programId;
|
98 |
+
}
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* take a boolean value and return the string 'yes' or 'no' when the boolean
|
104 |
+
* value is true or false
|
105 |
+
* @param bool $value
|
106 |
+
* @return string
|
107 |
+
* @codeCoverageIgnore
|
108 |
+
*/
|
109 |
+
public function parseBoolToYesNo($value)
|
110 |
+
{
|
111 |
+
return $value?'yes':'no';
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* helper function to take the source key name set in the admin panel
|
116 |
+
* and prepend a string to create a unique name for the cookie
|
117 |
+
*
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
public function getSourceCookieName()
|
121 |
+
{
|
122 |
+
$key = Mage::helper('eems_affiliate/config')->getSourceKeyName();
|
123 |
+
|
124 |
+
return self::SOURCE_COOKIE_PREFIX.$key;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* True if the cookie exists and has a value of SOURCE_KEY_VALUE
|
129 |
+
* False otherwise
|
130 |
+
*
|
131 |
+
* @return bool
|
132 |
+
*/
|
133 |
+
public function isValidCookie()
|
134 |
+
{
|
135 |
+
$cookie = $this->getSourceCookieName();
|
136 |
+
$value = Mage::getModel('core/cookie')->get($cookie);
|
137 |
+
return ($value === self::SOURCE_KEY_VALUE);
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Check to see if any orders have been made by the customer before
|
142 |
+
* @param Mage_Sales_Model_Order $order
|
143 |
+
* @return boolean This is the first order by this customer (email address)
|
144 |
+
*/
|
145 |
+
public function isNewToFile(Mage_Sales_Model_Order $order)
|
146 |
+
{
|
147 |
+
// Customers are being identified by emails
|
148 |
+
$customerEmail = $order->getCustomerEmail();
|
149 |
+
|
150 |
+
// Look up any orders that use the same email
|
151 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
152 |
+
$orderCollection->addFieldToFilter('customer_email', $customerEmail);
|
153 |
+
|
154 |
+
// Current order should be only order if new
|
155 |
+
return $orderCollection->count() <= 1;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Get Commissioning Category assigned to the item or pick one of the assigned categories if one isn't set
|
160 |
+
* @param Mage_Sales_Model_Order_Item $item Order Item
|
161 |
+
* @return int Category ID
|
162 |
+
*/
|
163 |
+
public function getCommissioningCategory(Mage_Sales_Model_Order_Item $item)
|
164 |
+
{
|
165 |
+
$category = $item->getProduct()->getCommissioningCategory();
|
166 |
+
if ($category == '' || $category == null) {
|
167 |
+
|
168 |
+
$categoryIds = $item->getProduct()->getCategoryIds();
|
169 |
+
// if there are any categories, grab the first
|
170 |
+
if (count($categoryIds))
|
171 |
+
$category = $categoryIds[0];
|
172 |
+
else
|
173 |
+
$category = 0;
|
174 |
+
}
|
175 |
+
|
176 |
+
return $category;
|
177 |
+
}
|
178 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Helper/Map.php
CHANGED
@@ -1,112 +1,112 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* This class is composed of methods used as callbacks to the feed generation
|
20 |
-
* process. All methods accepting a generic `$params` argument are allowed to
|
21 |
-
* make the following assumptions about the contents of the array:
|
22 |
-
* 1. It will always include an "item" key with a value of the object
|
23 |
-
* being prcessed.
|
24 |
-
* 2. It will always include a "store" key with a value of the store context
|
25 |
-
* in which the feed is being processed.
|
26 |
-
* 3. Will contain additioanl key/value pairs set in the callback mappings
|
27 |
-
* in config.xml
|
28 |
-
*
|
29 |
-
* Additional key/value pairs may be included but may not be guaranteed.
|
30 |
-
* If the methods make any additional assumptions about the contents of the
|
31 |
-
* `$params` array, they must be stated with the method. This should include
|
32 |
-
* any additional key/value pairs expected to be set in the config.xml.
|
33 |
-
*
|
34 |
-
* All such mapping methods are expected to return a single value that can be
|
35 |
-
* inserted directly into the resulting feed file.
|
36 |
-
*/
|
37 |
-
class EbayEnterprise_Affiliate_Helper_Map
|
38 |
-
{
|
39 |
-
/**
|
40 |
-
* Get the program id using the store passed in params. Pass through to the
|
41 |
-
* config helper using the store included in the $params array as the store
|
42 |
-
* context to get the config value from.
|
43 |
-
* @param array $params
|
44 |
-
* @return string
|
45 |
-
*/
|
46 |
-
public function getProgramId($params)
|
47 |
-
{
|
48 |
-
return Mage::helper('eems_affiliate/config')->getProgramId($params['store']);
|
49 |
-
}
|
50 |
-
/**
|
51 |
-
* Get data for the key from the item. Expects "item" to be a Varien_Object,
|
52 |
-
* "key" must be set. Additionally, if "format" is also included, it must
|
53 |
-
* be a valid string format and will be used to format the data before it is
|
54 |
-
* returned from this method.
|
55 |
-
* @param array $params
|
56 |
-
* @return mixed
|
57 |
-
* @throws Mage_Core_Exception If the value of the `item` key is not a Varien_Object or the `key` key/value pair is not set.
|
58 |
-
*/
|
59 |
-
public function getDataValue($params)
|
60 |
-
{
|
61 |
-
if (!$params['item'] instanceof Varien_Object) {
|
62 |
-
throw new Mage_Core_Exception(
|
63 |
-
sprintf(
|
64 |
-
'Item of type %s not compatible with %s',
|
65 |
-
get_class($params['item']),
|
66 |
-
__METHOD__
|
67 |
-
)
|
68 |
-
);
|
69 |
-
}
|
70 |
-
if (!isset($params['key'])) {
|
71 |
-
throw new Mage_Core_Exception(
|
72 |
-
'The data "key" must be provided in the configured params for this callback.'
|
73 |
-
);
|
74 |
-
}
|
75 |
-
$helper = Mage::helper('core');
|
76 |
-
return sprintf(
|
77 |
-
isset($params['format']) ? $params['format'] : '%s',
|
78 |
-
preg_replace('/\s\s+/', ' ', $helper->stripTags($params['item']->getDataUsingMethod($params['key'])))
|
79 |
-
);
|
80 |
-
}
|
81 |
-
/**
|
82 |
-
* Simply return the "value" included in the params.
|
83 |
-
* @param array $params
|
84 |
-
* @return string
|
85 |
-
* @throws Mage_Core_Exception If the `value` key/value pair is not set.
|
86 |
-
*/
|
87 |
-
public function passStatic($params)
|
88 |
-
{
|
89 |
-
if (!isset($params['value'])) {
|
90 |
-
throw new Mage_Core_Exception(sprintf(
|
91 |
-
'No value provided to return from %s',
|
92 |
-
__METHOD__
|
93 |
-
));
|
94 |
-
}
|
95 |
-
return $params['value'];
|
96 |
-
}
|
97 |
-
/**
|
98 |
-
* check if an attribute has value then return 'yes' otherwise return
|
99 |
-
* 'no'
|
100 |
-
* @param array $params
|
101 |
-
* @return string
|
102 |
-
*/
|
103 |
-
public function getValueYesNo(array $params)
|
104 |
-
{
|
105 |
-
return sprintf(
|
106 |
-
isset($params['format']) ? $params['format'] : '%s',
|
107 |
-
Mage::helper('eems_affiliate')->parseBoolToYesNo(
|
108 |
-
$params['item']->getDataUsingMethod($params['key'])
|
109 |
-
)
|
110 |
-
);
|
111 |
-
}
|
112 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* This class is composed of methods used as callbacks to the feed generation
|
20 |
+
* process. All methods accepting a generic `$params` argument are allowed to
|
21 |
+
* make the following assumptions about the contents of the array:
|
22 |
+
* 1. It will always include an "item" key with a value of the object
|
23 |
+
* being prcessed.
|
24 |
+
* 2. It will always include a "store" key with a value of the store context
|
25 |
+
* in which the feed is being processed.
|
26 |
+
* 3. Will contain additioanl key/value pairs set in the callback mappings
|
27 |
+
* in config.xml
|
28 |
+
*
|
29 |
+
* Additional key/value pairs may be included but may not be guaranteed.
|
30 |
+
* If the methods make any additional assumptions about the contents of the
|
31 |
+
* `$params` array, they must be stated with the method. This should include
|
32 |
+
* any additional key/value pairs expected to be set in the config.xml.
|
33 |
+
*
|
34 |
+
* All such mapping methods are expected to return a single value that can be
|
35 |
+
* inserted directly into the resulting feed file.
|
36 |
+
*/
|
37 |
+
class EbayEnterprise_Affiliate_Helper_Map
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Get the program id using the store passed in params. Pass through to the
|
41 |
+
* config helper using the store included in the $params array as the store
|
42 |
+
* context to get the config value from.
|
43 |
+
* @param array $params
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function getProgramId($params)
|
47 |
+
{
|
48 |
+
return Mage::helper('eems_affiliate/config')->getProgramId($params['store']);
|
49 |
+
}
|
50 |
+
/**
|
51 |
+
* Get data for the key from the item. Expects "item" to be a Varien_Object,
|
52 |
+
* "key" must be set. Additionally, if "format" is also included, it must
|
53 |
+
* be a valid string format and will be used to format the data before it is
|
54 |
+
* returned from this method.
|
55 |
+
* @param array $params
|
56 |
+
* @return mixed
|
57 |
+
* @throws Mage_Core_Exception If the value of the `item` key is not a Varien_Object or the `key` key/value pair is not set.
|
58 |
+
*/
|
59 |
+
public function getDataValue($params)
|
60 |
+
{
|
61 |
+
if (!$params['item'] instanceof Varien_Object) {
|
62 |
+
throw new Mage_Core_Exception(
|
63 |
+
sprintf(
|
64 |
+
'Item of type %s not compatible with %s',
|
65 |
+
get_class($params['item']),
|
66 |
+
__METHOD__
|
67 |
+
)
|
68 |
+
);
|
69 |
+
}
|
70 |
+
if (!isset($params['key'])) {
|
71 |
+
throw new Mage_Core_Exception(
|
72 |
+
'The data "key" must be provided in the configured params for this callback.'
|
73 |
+
);
|
74 |
+
}
|
75 |
+
$helper = Mage::helper('core');
|
76 |
+
return sprintf(
|
77 |
+
isset($params['format']) ? $params['format'] : '%s',
|
78 |
+
preg_replace('/\s\s+/', ' ', $helper->stripTags($params['item']->getDataUsingMethod($params['key'])))
|
79 |
+
);
|
80 |
+
}
|
81 |
+
/**
|
82 |
+
* Simply return the "value" included in the params.
|
83 |
+
* @param array $params
|
84 |
+
* @return string
|
85 |
+
* @throws Mage_Core_Exception If the `value` key/value pair is not set.
|
86 |
+
*/
|
87 |
+
public function passStatic($params)
|
88 |
+
{
|
89 |
+
if (!isset($params['value'])) {
|
90 |
+
throw new Mage_Core_Exception(sprintf(
|
91 |
+
'No value provided to return from %s',
|
92 |
+
__METHOD__
|
93 |
+
));
|
94 |
+
}
|
95 |
+
return $params['value'];
|
96 |
+
}
|
97 |
+
/**
|
98 |
+
* check if an attribute has value then return 'yes' otherwise return
|
99 |
+
* 'no'
|
100 |
+
* @param array $params
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
+
public function getValueYesNo(array $params)
|
104 |
+
{
|
105 |
+
return sprintf(
|
106 |
+
isset($params['format']) ? $params['format'] : '%s',
|
107 |
+
Mage::helper('eems_affiliate')->parseBoolToYesNo(
|
108 |
+
$params['item']->getDataUsingMethod($params['key'])
|
109 |
+
)
|
110 |
+
);
|
111 |
+
}
|
112 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Helper/Map/Order.php
CHANGED
@@ -1,159 +1,172 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* The public methods of this class are all expected to be used as callbacks
|
20 |
-
* for building the Affiliate corrected orders feeds.
|
21 |
-
* @see EbayEnterprise_Affiliate_Helper_Map
|
22 |
-
*/
|
23 |
-
class EbayEnterprise_Affiliate_Helper_Map_Order
|
24 |
-
{
|
25 |
-
/**
|
26 |
-
* Get the order increment id from the order the item was created for. Expects
|
27 |
-
* the "item" to be a Mage_Sales_Model_Order_Item and the "format" to be a
|
28 |
-
* valid string format.
|
29 |
-
* @param array $params
|
30 |
-
* @return string
|
31 |
-
*/
|
32 |
-
public function getItemOrderId($params)
|
33 |
-
{
|
34 |
-
$item = $params['item'];
|
35 |
-
return sprintf(
|
36 |
-
$params['format'],
|
37 |
-
$item->getOriginalIncrementId() ?: $item->getIncrementId()
|
38 |
-
);
|
39 |
-
}
|
40 |
-
/**
|
41 |
-
* Get the updated item quantity - original quantity less any refunded
|
42 |
-
* or canceled. Expects the "item" to be a Mage_Sales_Model_Order_Item.
|
43 |
-
* @param array $params
|
44 |
-
* @return int
|
45 |
-
*/
|
46 |
-
public function getItemQuantity($params)
|
47 |
-
{
|
48 |
-
$item = $params['item'];
|
49 |
-
// field limit doesn't allow this to go above 99
|
50 |
-
return (int) ($item->getQtyOrdered() - $item->getQtyRefunded() - $item->getQtyCanceled());
|
51 |
-
}
|
52 |
-
/**
|
53 |
-
* Calculate a row total including discounts.
|
54 |
-
* @param array $params
|
55 |
-
* @return float
|
56 |
-
*/
|
57 |
-
private function
|
58 |
-
{
|
59 |
-
$item = $params['item'];
|
60 |
-
// tread bundle items as 0.00 total as their total will be represented by
|
61 |
-
// the total of their children products
|
62 |
-
if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
63 |
-
return 0.00;
|
64 |
-
}
|
65 |
-
// don't allow negative amounts - could happen if a discounted item was cancelled
|
66 |
-
return max(
|
67 |
-
0,
|
68 |
-
$item->getBasePrice()
|
69 |
-
);
|
70 |
-
}
|
71 |
-
/**
|
72 |
-
* Get the corrected total for the row - price * corrected qty. Expects the
|
73 |
-
* "item" to be a Mage_Sales_Model_Order_Item, "format" to be a valid
|
74 |
-
* format string and "store" to be a Mage_Core_Model_Store or otherwise viable
|
75 |
-
* store identifier.
|
76 |
-
* @param array $params
|
77 |
-
* @return string
|
78 |
-
*/
|
79 |
-
public function
|
80 |
-
{
|
81 |
-
$config = Mage::helper('eems_affiliate/config');
|
82 |
-
// transaction type of Lead should always just be "0"
|
83 |
-
if ($config->getTransactionType($params['store']) === $config::TRANSACTION_TYPE_LEAD) {
|
84 |
-
return 0;
|
85 |
-
}
|
86 |
-
return sprintf(
|
87 |
-
$params['format'],
|
88 |
-
$this->
|
89 |
-
);
|
90 |
-
}
|
91 |
-
/**
|
92 |
-
* Get the corrected amount of the order. Expects "item" to be a
|
93 |
-
* Mage_Sales_Model_Order, "store" to be a Mage_Core_Model_Store or otherwise
|
94 |
-
* valid store identifier, and "format" to be a valid format string.
|
95 |
-
* @param array $params
|
96 |
-
* @return string
|
97 |
-
*/
|
98 |
-
public function getOrderAmount($params)
|
99 |
-
{
|
100 |
-
$config = Mage::helper('eems_affiliate/config');
|
101 |
-
// transaction type of Lead should always just be "0"
|
102 |
-
if ($config->getTransactionType($params['store']) === $config::TRANSACTION_TYPE_LEAD) {
|
103 |
-
return 0;
|
104 |
-
}
|
105 |
-
$order = $params['item'];
|
106 |
-
return sprintf(
|
107 |
-
$params['format'],
|
108 |
-
// prevent sub-zero amounts for canceled orders with discounts
|
109 |
-
max(
|
110 |
-
0,
|
111 |
-
($order->getBaseSubtotal() + $order->getBaseDiscountAmount()) -
|
112 |
-
($order->getBaseSubtotalRefunded() + $order->getBaseDiscountRefunded()) -
|
113 |
-
($order->getBaseSubtotalCanceled() + $order->getBaseDiscountCanceled())
|
114 |
-
)
|
115 |
-
);
|
116 |
-
}
|
117 |
-
/**
|
118 |
-
* Get the transaction type configured for the store the order was received
|
119 |
-
* in. Expects "store" to be a Mage_Core_Model_Store or otherwise valid
|
120 |
-
* store identifier.
|
121 |
-
* @param array $params
|
122 |
-
* @return int
|
123 |
-
*/
|
124 |
-
public function getTransactionType($params)
|
125 |
-
{
|
126 |
-
return (int) Mage::helper('eems_affiliate/config')->getTransactionType($params['store']);
|
127 |
-
}
|
128 |
-
/**
|
129 |
-
* Get the order item increment id. For orders that are the result of an edit,
|
130 |
-
* get the increment id of the original order. Expects "item" to be a
|
131 |
-
* Mage_Sales_Model_Oorder and "format" to be a valid format string.
|
132 |
-
* @param array $params
|
133 |
-
* @return string
|
134 |
-
*/
|
135 |
-
public function getOrderId($params)
|
136 |
-
{
|
137 |
-
$order = $params['item'];
|
138 |
-
return sprintf(
|
139 |
-
$params['format'],
|
140 |
-
$order->getOriginalIncrementId() ?: $order->getIncrementId()
|
141 |
-
);
|
142 |
-
}
|
143 |
-
/**
|
144 |
-
* Get the SKU of the item with any prohibited characters in the SKU removed.
|
145 |
-
* Expects "format" to be a valid format string. As this method also passes
|
146 |
-
* through to EbayEnterprise_Affiliate_Helper_Map::getDataValue, `$params`
|
147 |
-
* must also adhere to the requirements of that method - "item" is a subclass
|
148 |
-
* of Varien_Object, have a "key" value set.
|
149 |
-
* @param array $params
|
150 |
-
* @return string
|
151 |
-
*/
|
152 |
-
public function getItemId($params)
|
153 |
-
{
|
154 |
-
return sprintf(
|
155 |
-
$params['format'],
|
156 |
-
preg_replace('/[^a-zA-Z0-9\-_]/', '', Mage::helper('eems_affiliate/map')->getDataValue($params))
|
157 |
-
);
|
158 |
-
}
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The public methods of this class are all expected to be used as callbacks
|
20 |
+
* for building the Affiliate corrected orders feeds.
|
21 |
+
* @see EbayEnterprise_Affiliate_Helper_Map
|
22 |
+
*/
|
23 |
+
class EbayEnterprise_Affiliate_Helper_Map_Order
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Get the order increment id from the order the item was created for. Expects
|
27 |
+
* the "item" to be a Mage_Sales_Model_Order_Item and the "format" to be a
|
28 |
+
* valid string format.
|
29 |
+
* @param array $params
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function getItemOrderId($params)
|
33 |
+
{
|
34 |
+
$item = $params['item'];
|
35 |
+
return sprintf(
|
36 |
+
$params['format'],
|
37 |
+
$item->getOriginalIncrementId() ?: $item->getIncrementId()
|
38 |
+
);
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
* Get the updated item quantity - original quantity less any refunded
|
42 |
+
* or canceled. Expects the "item" to be a Mage_Sales_Model_Order_Item.
|
43 |
+
* @param array $params
|
44 |
+
* @return int
|
45 |
+
*/
|
46 |
+
public function getItemQuantity($params)
|
47 |
+
{
|
48 |
+
$item = $params['item'];
|
49 |
+
// field limit doesn't allow this to go above 99
|
50 |
+
return (int) ($item->getQtyOrdered() - $item->getQtyRefunded() - $item->getQtyCanceled());
|
51 |
+
}
|
52 |
+
/**
|
53 |
+
* Calculate a row total including discounts.
|
54 |
+
* @param array $params
|
55 |
+
* @return float
|
56 |
+
*/
|
57 |
+
private function _calculateDiscountedItemPrice($params)
|
58 |
+
{
|
59 |
+
$item = $params['item'];
|
60 |
+
// tread bundle items as 0.00 total as their total will be represented by
|
61 |
+
// the total of their children products
|
62 |
+
if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
63 |
+
return 0.00;
|
64 |
+
}
|
65 |
+
// don't allow negative amounts - could happen if a discounted item was cancelled
|
66 |
+
return max(
|
67 |
+
0,
|
68 |
+
$item->getBasePrice() - (($item->getBaseDiscountAmount() - $item->getBaseDiscountRefunded()) / $this->getItemQuantity($params))
|
69 |
+
);
|
70 |
+
}
|
71 |
+
/**
|
72 |
+
* Get the corrected total for the row - price * corrected qty. Expects the
|
73 |
+
* "item" to be a Mage_Sales_Model_Order_Item, "format" to be a valid
|
74 |
+
* format string and "store" to be a Mage_Core_Model_Store or otherwise viable
|
75 |
+
* store identifier.
|
76 |
+
* @param array $params
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function getItemPrice($params)
|
80 |
+
{
|
81 |
+
$config = Mage::helper('eems_affiliate/config');
|
82 |
+
// transaction type of Lead should always just be "0"
|
83 |
+
if ($config->getTransactionType($params['store']) === $config::TRANSACTION_TYPE_LEAD) {
|
84 |
+
return 0;
|
85 |
+
}
|
86 |
+
return sprintf(
|
87 |
+
$params['format'],
|
88 |
+
$this->_calculateDiscountedItemPrice($params)
|
89 |
+
);
|
90 |
+
}
|
91 |
+
/**
|
92 |
+
* Get the corrected amount of the order. Expects "item" to be a
|
93 |
+
* Mage_Sales_Model_Order, "store" to be a Mage_Core_Model_Store or otherwise
|
94 |
+
* valid store identifier, and "format" to be a valid format string.
|
95 |
+
* @param array $params
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
public function getOrderAmount($params)
|
99 |
+
{
|
100 |
+
$config = Mage::helper('eems_affiliate/config');
|
101 |
+
// transaction type of Lead should always just be "0"
|
102 |
+
if ($config->getTransactionType($params['store']) === $config::TRANSACTION_TYPE_LEAD) {
|
103 |
+
return 0;
|
104 |
+
}
|
105 |
+
$order = $params['item'];
|
106 |
+
return sprintf(
|
107 |
+
$params['format'],
|
108 |
+
// prevent sub-zero amounts for canceled orders with discounts
|
109 |
+
max(
|
110 |
+
0,
|
111 |
+
($order->getBaseSubtotal() + $order->getBaseDiscountAmount()) -
|
112 |
+
($order->getBaseSubtotalRefunded() + $order->getBaseDiscountRefunded()) -
|
113 |
+
($order->getBaseSubtotalCanceled() + $order->getBaseDiscountCanceled())
|
114 |
+
)
|
115 |
+
);
|
116 |
+
}
|
117 |
+
/**
|
118 |
+
* Get the transaction type configured for the store the order was received
|
119 |
+
* in. Expects "store" to be a Mage_Core_Model_Store or otherwise valid
|
120 |
+
* store identifier.
|
121 |
+
* @param array $params
|
122 |
+
* @return int
|
123 |
+
*/
|
124 |
+
public function getTransactionType($params)
|
125 |
+
{
|
126 |
+
return (int) Mage::helper('eems_affiliate/config')->getTransactionType($params['store']);
|
127 |
+
}
|
128 |
+
/**
|
129 |
+
* Get the order item increment id. For orders that are the result of an edit,
|
130 |
+
* get the increment id of the original order. Expects "item" to be a
|
131 |
+
* Mage_Sales_Model_Oorder and "format" to be a valid format string.
|
132 |
+
* @param array $params
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
public function getOrderId($params)
|
136 |
+
{
|
137 |
+
$order = $params['item'];
|
138 |
+
return sprintf(
|
139 |
+
$params['format'],
|
140 |
+
$order->getOriginalIncrementId() ?: $order->getIncrementId()
|
141 |
+
);
|
142 |
+
}
|
143 |
+
/**
|
144 |
+
* Get the SKU of the item with any prohibited characters in the SKU removed.
|
145 |
+
* Expects "format" to be a valid format string. As this method also passes
|
146 |
+
* through to EbayEnterprise_Affiliate_Helper_Map::getDataValue, `$params`
|
147 |
+
* must also adhere to the requirements of that method - "item" is a subclass
|
148 |
+
* of Varien_Object, have a "key" value set.
|
149 |
+
* @param array $params
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
+
public function getItemId($params)
|
153 |
+
{
|
154 |
+
return sprintf(
|
155 |
+
$params['format'],
|
156 |
+
preg_replace('/[^a-zA-Z0-9\-_]/', '', Mage::helper('eems_affiliate/map')->getDataValue($params))
|
157 |
+
);
|
158 |
+
}
|
159 |
+
|
160 |
+
public function getCategory($params)
|
161 |
+
{
|
162 |
+
$item = $params['item'];
|
163 |
+
return Mage::helper('eems_affiliate')->getCommissioningCategory($item);
|
164 |
+
}
|
165 |
+
|
166 |
+
public function getNewToFile($params)
|
167 |
+
{
|
168 |
+
$order = $params['item']->getOrder();
|
169 |
+
|
170 |
+
return (int) Mage::helper('eems_affiliate')->isNewToFile($order);
|
171 |
+
}
|
172 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Helper/Map/Product.php
CHANGED
@@ -1,135 +1,135 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* The public methods of this class are all expected to be used as callbacks
|
20 |
-
* for building the Affiliate product feed.
|
21 |
-
* @see EbayEnterprise_Affiliate_Helper_Map
|
22 |
-
*/
|
23 |
-
class EbayEnterprise_Affiliate_Helper_Map_Product
|
24 |
-
{
|
25 |
-
const MEDIA_PATH = 'catalog/product';
|
26 |
-
const NO_SELECTION = 'no_selection';
|
27 |
-
/**
|
28 |
-
* Get a product first chained categories meaning that a product can be
|
29 |
-
* long to many chained of categories. Chained of categories here mean that
|
30 |
-
* a category root to it's inner most leaf child. Expects "item" to be a
|
31 |
-
* Mage_Catalog_Model_Product. If "format" is included in `$params`, it will
|
32 |
-
* must be a valid format string and will be used to format the data returned
|
33 |
-
* from this method.
|
34 |
-
* @param array $params
|
35 |
-
* @return string
|
36 |
-
*/
|
37 |
-
public function getCategory(array $params)
|
38 |
-
{
|
39 |
-
$categories = $params['item']->getCategoryCollection();
|
40 |
-
$category = $categories->getFirstItem();
|
41 |
-
$format = isset($params['format']) ? $params['format'] : '%s';
|
42 |
-
return !is_null($category) ?
|
43 |
-
sprintf($format, $this->_buildCategoryTree($category)) : null;
|
44 |
-
}
|
45 |
-
/**
|
46 |
-
* Take an array of category entity ids return a collection of categories
|
47 |
-
* in this array of category ids
|
48 |
-
* @param array $entityIds list of category ids
|
49 |
-
* @return Mage_Catalog_Model_Resource_Category_Collection
|
50 |
-
*/
|
51 |
-
protected function _getCategoriesByIds(array $entityIds)
|
52 |
-
{
|
53 |
-
return Mage::getResourceModel('catalog/category_collection')
|
54 |
-
->addAttributeToSelect(array('name', 'entity_id'))
|
55 |
-
->addAttributeToFilter(array(array('attribute' => 'entity_id', 'in' => $entityIds)))
|
56 |
-
->load();
|
57 |
-
}
|
58 |
-
/**
|
59 |
-
* Take a Mage_Catalog_Model_Category object and build a category tree from
|
60 |
-
* the child leaf to the root of the category (root > inner child > inner most child)
|
61 |
-
* @param Mage_Catalog_Model_Category $category the inner most child
|
62 |
-
* @return string
|
63 |
-
*/
|
64 |
-
protected function _buildCategoryTree(Mage_Catalog_Model_Category $category)
|
65 |
-
{
|
66 |
-
$collecton = $this->_getCategoriesByIds(explode('/', $category->getPath()));
|
67 |
-
$categories = array();
|
68 |
-
foreach ($collecton as $cat) {
|
69 |
-
$categories[] = $cat->getName();
|
70 |
-
}
|
71 |
-
return implode(' > ', array_filter($categories));
|
72 |
-
}
|
73 |
-
/**
|
74 |
-
* get a product image view URL
|
75 |
-
* Note: calling Mage_Catalog_Model_Product::getImageUrl, or getThumbnailUrl
|
76 |
-
* will return the wrong URL when running the feed via CRONJOB will return
|
77 |
-
* to something similar to this:
|
78 |
-
* (http://<host>/skin/frontend/default/default/images/catalog/product/placeholder/image.jpg)
|
79 |
-
* so this method will try to extrapolate as best it can the absolute path of
|
80 |
-
* the image by calling getImage or getThumbnail which will give the
|
81 |
-
* a relative path to the image in which we passed to a specialize method to try
|
82 |
-
* to build the absolute URL path to the image
|
83 |
-
* @param array $params
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
public function getImageUrl(array $params)
|
87 |
-
{
|
88 |
-
$item = $params['item'];
|
89 |
-
// calling the getThumbnail or getImage will return a relative path
|
90 |
-
// to where we think product image will live, see (self::MEDIA_PATH) constant
|
91 |
-
$image = trim($item->getDataUsingMethod($params['key']));
|
92 |
-
$format = isset($params['format']) ? $params['format'] : '%s';
|
93 |
-
return ($image !== '' && $image !== static::NO_SELECTION)?
|
94 |
-
sprintf($format, $this->_getAbsoluteImagePath($image)) : null;
|
95 |
-
}
|
96 |
-
/**
|
97 |
-
* get the absolute URL product media path
|
98 |
-
* @param string $image the relative image
|
99 |
-
* @return string
|
100 |
-
* @codeCoverageIgnore
|
101 |
-
*/
|
102 |
-
protected function _getAbsoluteImagePath($image)
|
103 |
-
{
|
104 |
-
// concatenating magento absolute path to the media folder, with a class
|
105 |
-
// constant base on observation of where we assume all product images stay
|
106 |
-
// and along with the passed in image relative path
|
107 |
-
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .
|
108 |
-
static::MEDIA_PATH . $image;
|
109 |
-
}
|
110 |
-
/**
|
111 |
-
* get a product manage stock quantity
|
112 |
-
* @param array $params
|
113 |
-
* @return string
|
114 |
-
*/
|
115 |
-
public function getInStockQty(array $params)
|
116 |
-
{
|
117 |
-
return (int) Mage::getModel('cataloginventory/stock_item')
|
118 |
-
->loadByProduct($params['item'])
|
119 |
-
->getQty();
|
120 |
-
}
|
121 |
-
/**
|
122 |
-
* check if a product is in stock and return 'yes' or 'no' in respect to
|
123 |
-
* the outcome
|
124 |
-
* @param array $params
|
125 |
-
* @return string
|
126 |
-
*/
|
127 |
-
public function getInStockYesNo(array $params)
|
128 |
-
{
|
129 |
-
return Mage::helper('eems_affiliate')->parseBoolToYesNo(
|
130 |
-
Mage::getModel('cataloginventory/stock_item')
|
131 |
-
->loadByProduct($params['item'])
|
132 |
-
->getIsInStock()
|
133 |
-
);
|
134 |
-
}
|
135 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* The public methods of this class are all expected to be used as callbacks
|
20 |
+
* for building the Affiliate product feed.
|
21 |
+
* @see EbayEnterprise_Affiliate_Helper_Map
|
22 |
+
*/
|
23 |
+
class EbayEnterprise_Affiliate_Helper_Map_Product
|
24 |
+
{
|
25 |
+
const MEDIA_PATH = 'catalog/product';
|
26 |
+
const NO_SELECTION = 'no_selection';
|
27 |
+
/**
|
28 |
+
* Get a product first chained categories meaning that a product can be
|
29 |
+
* long to many chained of categories. Chained of categories here mean that
|
30 |
+
* a category root to it's inner most leaf child. Expects "item" to be a
|
31 |
+
* Mage_Catalog_Model_Product. If "format" is included in `$params`, it will
|
32 |
+
* must be a valid format string and will be used to format the data returned
|
33 |
+
* from this method.
|
34 |
+
* @param array $params
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function getCategory(array $params)
|
38 |
+
{
|
39 |
+
$categories = $params['item']->getCategoryCollection();
|
40 |
+
$category = $categories->getFirstItem();
|
41 |
+
$format = isset($params['format']) ? $params['format'] : '%s';
|
42 |
+
return !is_null($category) ?
|
43 |
+
sprintf($format, $this->_buildCategoryTree($category)) : null;
|
44 |
+
}
|
45 |
+
/**
|
46 |
+
* Take an array of category entity ids return a collection of categories
|
47 |
+
* in this array of category ids
|
48 |
+
* @param array $entityIds list of category ids
|
49 |
+
* @return Mage_Catalog_Model_Resource_Category_Collection
|
50 |
+
*/
|
51 |
+
protected function _getCategoriesByIds(array $entityIds)
|
52 |
+
{
|
53 |
+
return Mage::getResourceModel('catalog/category_collection')
|
54 |
+
->addAttributeToSelect(array('name', 'entity_id'))
|
55 |
+
->addAttributeToFilter(array(array('attribute' => 'entity_id', 'in' => $entityIds)))
|
56 |
+
->load();
|
57 |
+
}
|
58 |
+
/**
|
59 |
+
* Take a Mage_Catalog_Model_Category object and build a category tree from
|
60 |
+
* the child leaf to the root of the category (root > inner child > inner most child)
|
61 |
+
* @param Mage_Catalog_Model_Category $category the inner most child
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
+
protected function _buildCategoryTree(Mage_Catalog_Model_Category $category)
|
65 |
+
{
|
66 |
+
$collecton = $this->_getCategoriesByIds(explode('/', $category->getPath()));
|
67 |
+
$categories = array();
|
68 |
+
foreach ($collecton as $cat) {
|
69 |
+
$categories[] = $cat->getName();
|
70 |
+
}
|
71 |
+
return implode(' > ', array_filter($categories));
|
72 |
+
}
|
73 |
+
/**
|
74 |
+
* get a product image view URL
|
75 |
+
* Note: calling Mage_Catalog_Model_Product::getImageUrl, or getThumbnailUrl
|
76 |
+
* will return the wrong URL when running the feed via CRONJOB will return
|
77 |
+
* to something similar to this:
|
78 |
+
* (http://<host>/skin/frontend/default/default/images/catalog/product/placeholder/image.jpg)
|
79 |
+
* so this method will try to extrapolate as best it can the absolute path of
|
80 |
+
* the image by calling getImage or getThumbnail which will give the
|
81 |
+
* a relative path to the image in which we passed to a specialize method to try
|
82 |
+
* to build the absolute URL path to the image
|
83 |
+
* @param array $params
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function getImageUrl(array $params)
|
87 |
+
{
|
88 |
+
$item = $params['item'];
|
89 |
+
// calling the getThumbnail or getImage will return a relative path
|
90 |
+
// to where we think product image will live, see (self::MEDIA_PATH) constant
|
91 |
+
$image = trim($item->getDataUsingMethod($params['key']));
|
92 |
+
$format = isset($params['format']) ? $params['format'] : '%s';
|
93 |
+
return ($image !== '' && $image !== static::NO_SELECTION)?
|
94 |
+
sprintf($format, $this->_getAbsoluteImagePath($image)) : null;
|
95 |
+
}
|
96 |
+
/**
|
97 |
+
* get the absolute URL product media path
|
98 |
+
* @param string $image the relative image
|
99 |
+
* @return string
|
100 |
+
* @codeCoverageIgnore
|
101 |
+
*/
|
102 |
+
protected function _getAbsoluteImagePath($image)
|
103 |
+
{
|
104 |
+
// concatenating magento absolute path to the media folder, with a class
|
105 |
+
// constant base on observation of where we assume all product images stay
|
106 |
+
// and along with the passed in image relative path
|
107 |
+
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .
|
108 |
+
static::MEDIA_PATH . $image;
|
109 |
+
}
|
110 |
+
/**
|
111 |
+
* get a product manage stock quantity
|
112 |
+
* @param array $params
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
public function getInStockQty(array $params)
|
116 |
+
{
|
117 |
+
return (int) Mage::getModel('cataloginventory/stock_item')
|
118 |
+
->loadByProduct($params['item'])
|
119 |
+
->getQty();
|
120 |
+
}
|
121 |
+
/**
|
122 |
+
* check if a product is in stock and return 'yes' or 'no' in respect to
|
123 |
+
* the outcome
|
124 |
+
* @param array $params
|
125 |
+
* @return string
|
126 |
+
*/
|
127 |
+
public function getInStockYesNo(array $params)
|
128 |
+
{
|
129 |
+
return Mage::helper('eems_affiliate')->parseBoolToYesNo(
|
130 |
+
Mage::getModel('cataloginventory/stock_item')
|
131 |
+
->loadByProduct($params['item'])
|
132 |
+
->getIsInStock()
|
133 |
+
);
|
134 |
+
}
|
135 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Feed/Abstract.php
CHANGED
@@ -1,337 +1,337 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
abstract class EbayEnterprise_Affiliate_Model_Feed_Abstract
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* The store context the feed is generated for. May be set to any viable store
|
23 |
-
* identified.
|
24 |
-
* @var Mage_Core_Model_Store
|
25 |
-
*/
|
26 |
-
protected $_store;
|
27 |
-
/**
|
28 |
-
* Get a collection of items to be included in the feed.
|
29 |
-
* @return Varien_Data_Collection
|
30 |
-
*/
|
31 |
-
abstract protected function _getItems();
|
32 |
-
/**
|
33 |
-
* Get fields to include in the feed. Fields are expected to map to existing
|
34 |
-
* callbacks defined in the config.xml.
|
35 |
-
* @see self::_invokeCallback
|
36 |
-
* @return array
|
37 |
-
*/
|
38 |
-
abstract protected function _getFeedFields();
|
39 |
-
/**
|
40 |
-
* Gets the filename format for the feed from config for this feed.
|
41 |
-
* @return string
|
42 |
-
*/
|
43 |
-
abstract protected function _getFileName();
|
44 |
-
/**
|
45 |
-
* Get the delimiter to use in the csv file
|
46 |
-
* @return string
|
47 |
-
* @codeCoverageIgnore
|
48 |
-
*/
|
49 |
-
protected function _getDelimiter()
|
50 |
-
{
|
51 |
-
return ',';
|
52 |
-
}
|
53 |
-
/**
|
54 |
-
* Get the encolsure to use in the csv file
|
55 |
-
* @return string
|
56 |
-
* @codeCoverageIgnore
|
57 |
-
*/
|
58 |
-
protected function _getEnclosure()
|
59 |
-
{
|
60 |
-
return '"';
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* Set up the store property.
|
64 |
-
*/
|
65 |
-
public function __construct($args = array())
|
66 |
-
{
|
67 |
-
// Set the store context to the given store or null which whill
|
68 |
-
// result in the "current" store.
|
69 |
-
$this->setStore(isset($args['store']) ? $args['store'] : null);
|
70 |
-
}
|
71 |
-
/**
|
72 |
-
* Set the store context for the feed, converting whatever viable store
|
73 |
-
* ID is passed in to an actual store instance.
|
74 |
-
* @see Mage_Core_Model_App::getStore for how various identifiers may be used to represent a store
|
75 |
-
* @param null|string|bool|int|Mage_Core_Model_Store
|
76 |
-
* @codeCoverageIgnore
|
77 |
-
*/
|
78 |
-
public function setStore($storeId)
|
79 |
-
{
|
80 |
-
$this->_store = Mage::app()->getStore($storeId);
|
81 |
-
return $this;
|
82 |
-
}
|
83 |
-
/**
|
84 |
-
* Get the store instance the feed is being executed within.
|
85 |
-
* @return Mage_Core_Model_Store
|
86 |
-
* @codeCoverageIgnore
|
87 |
-
*/
|
88 |
-
public function getStore()
|
89 |
-
{
|
90 |
-
return $this->_store;
|
91 |
-
}
|
92 |
-
/**
|
93 |
-
* Create the feed file and drop it in the configured export directory.
|
94 |
-
* @return self
|
95 |
-
*/
|
96 |
-
public function generateFeed()
|
97 |
-
{
|
98 |
-
$this->_generateFile($this->_buildFeedData());
|
99 |
-
return $this;
|
100 |
-
}
|
101 |
-
/**
|
102 |
-
* Create arrays of data that should be included in the feed file. Each array
|
103 |
-
* should included a value for every field that is expected to be in the feed.
|
104 |
-
* @return array
|
105 |
-
*/
|
106 |
-
protected function _buildFeedData()
|
107 |
-
{
|
108 |
-
$items = $this->_getItems();
|
109 |
-
Mage::log(sprintf('building feed for %d items', $items->count()));
|
110 |
-
// array_map must be on an array - $items is a collection so need to get the
|
111 |
-
// underlying array to pass to array_map
|
112 |
-
return array_map(array($this, '_applyMapping'), $items->getItems());
|
113 |
-
}
|
114 |
-
/**
|
115 |
-
* Use the callback mapping to create the data that represents the given item
|
116 |
-
* in the feed.
|
117 |
-
* @param mixed $item Likely a Varien_Object but could really be anything.
|
118 |
-
* @return array
|
119 |
-
*/
|
120 |
-
protected function _applyMapping($item)
|
121 |
-
{
|
122 |
-
$fields = array();
|
123 |
-
$mappings = Mage::helper('eems_affiliate/config')->getCallbackMappings();
|
124 |
-
foreach ($this->_getFeedFields() as $feedField) {
|
125 |
-
// If the mapping doesn't exist, supplying an empty array will eventually
|
126 |
-
// result in an exception for being an invalid config mapping.
|
127 |
-
// @see self::_validateCallbackConfig
|
128 |
-
$callback = isset($mappings[$feedField]) ? $mappings[$feedField] : array();
|
129 |
-
// exclude any mappings that have a type of "disabled"
|
130 |
-
if (!isset($callback['type']) || $callback['type'] !== 'disabled') {
|
131 |
-
$fields[] = $this->_invokeCallback($callback, $item);
|
132 |
-
}
|
133 |
-
}
|
134 |
-
return $fields;
|
135 |
-
}
|
136 |
-
/**
|
137 |
-
* Given a set of callback configuration and an item, invoke the configured
|
138 |
-
* callback and return the value. The callback configuration must meet the
|
139 |
-
* following requirements:
|
140 |
-
* - May contain a "type" key indicating the type of factory to use. May be
|
141 |
-
* one of:
|
142 |
-
* - "disabled" - will not be included in the feed
|
143 |
-
* - "helper" - will use the Mage::helper factory
|
144 |
-
* - "model" - will use the Mage::getModel factory
|
145 |
-
* - "singleton" - will use the Mage::getSingleton factory
|
146 |
-
* - If not included, will default to "singleton"
|
147 |
-
* - When type is "disabled" no other key/value pairs are required.
|
148 |
-
* - If type is not "disabled" the following must be included:
|
149 |
-
* - "class" must be a valid class alias for the configured factory type
|
150 |
-
* - "method" must be a valid method on the configured class
|
151 |
-
* - A "params" key may also be included. If included, its value must be
|
152 |
-
* an array of key/value pairs that will be included in the params array
|
153 |
-
* passed to the callback method.
|
154 |
-
* Every callback will be called with an array of params. The array will
|
155 |
-
* contain any key/value pairs added in the config as well as an "item" key
|
156 |
-
* which will have the item being mapped as the value and a "store" key which
|
157 |
-
* will have the store instance representing the store view context the feed
|
158 |
-
* is being generated for.
|
159 |
-
*
|
160 |
-
* Example configuration:
|
161 |
-
* <code>
|
162 |
-
* // This callback configuration array:
|
163 |
-
* $cfg = array(
|
164 |
-
* 'type' => 'helper',
|
165 |
-
* 'class' => 'eems_affiliate/map',
|
166 |
-
* 'column_name' => 'OID',
|
167 |
-
* 'params' => array(
|
168 |
-
* 'key' => 'increment_id',
|
169 |
-
* ),
|
170 |
-
* );
|
171 |
-
* // Will result in the following invocation:
|
172 |
-
* Mage::helper('eems_affiliate/map')->getDataValue(
|
173 |
-
* array('key' => 'increment_id', 'item' => $item)
|
174 |
-
* );
|
175 |
-
* </code>
|
176 |
-
*
|
177 |
-
* @see src/app/code/community/EbayEnterprise/Affiliate/etc/config.xml marketing_solutions/eems_affiliate/feeds contains mappings used for the affiliate feeds
|
178 |
-
* @param array $callbackConfig
|
179 |
-
* @param mixed $item
|
180 |
-
* @return mixed
|
181 |
-
*/
|
182 |
-
protected function _invokeCallback($callbackConfig, $item)
|
183 |
-
{
|
184 |
-
$obj = $this->_getCallbackInstance($callbackConfig);
|
185 |
-
$params = isset($callbackConfig['params']) ? $callbackConfig['params'] : array();
|
186 |
-
$item->setStoreId($this->getStore()->getId());
|
187 |
-
$params['item'] = $item;
|
188 |
-
$params['store'] = $this->getStore();
|
189 |
-
$method = $callbackConfig['method'];
|
190 |
-
if (method_exists($obj, $method)) {
|
191 |
-
return $obj->$method($params);
|
192 |
-
} else {
|
193 |
-
throw new EbayEnterprise_Affiliate_Exception_Configuration(
|
194 |
-
sprintf(
|
195 |
-
'Configured callback method %s::%s does not exist',
|
196 |
-
get_class($obj),
|
197 |
-
$method
|
198 |
-
)
|
199 |
-
);
|
200 |
-
}
|
201 |
-
}
|
202 |
-
/**
|
203 |
-
* Get an instance of the configured callback.
|
204 |
-
* @param array $callbackConfig
|
205 |
-
* @return mixed
|
206 |
-
*/
|
207 |
-
protected function _getCallbackInstance($callbackConfig)
|
208 |
-
{
|
209 |
-
$this->_validateCallbackConfig($callbackConfig);
|
210 |
-
switch ($callbackConfig['type']) {
|
211 |
-
// 'disabled' type callback mappings shouldn't pass through here under
|
212 |
-
// "normal" circumstances (filtered out in apply mapping) but if they do,
|
213 |
-
// do nothing and return null
|
214 |
-
case 'disabled':
|
215 |
-
return null;
|
216 |
-
case 'helper':
|
217 |
-
return Mage::helper($callbackConfig['class']);
|
218 |
-
case 'model':
|
219 |
-
return Mage::getModel($callbackConfig['class']);
|
220 |
-
case 'singleton':
|
221 |
-
default:
|
222 |
-
return Mage::getSingleton($callbackConfig['class']);
|
223 |
-
}
|
224 |
-
}
|
225 |
-
/**
|
226 |
-
* Make sure the callback configuration is valid. If it isn't throw an
|
227 |
-
* exception.
|
228 |
-
* @param array $callbackConfig
|
229 |
-
* @return self
|
230 |
-
* @throws EbayEnterprise_Affiliate_Exception_Configuration If callback configuration is not valid
|
231 |
-
*/
|
232 |
-
protected function _validateCallbackConfig($callbackConfig)
|
233 |
-
{
|
234 |
-
if (empty($callbackConfig)) {
|
235 |
-
throw new EbayEnterprise_Affiliate_Exception_Configuration('Callback configuration is empty or missing.');
|
236 |
-
}
|
237 |
-
// When the callback is "disabled" no other configuration is necessary.
|
238 |
-
if (isset($callbackConfig['type']) && $callbackConfig['type'] === 'disabled') {
|
239 |
-
return $this;
|
240 |
-
}
|
241 |
-
// If not disabled, must have a class and method - separate checks for
|
242 |
-
// more simply providing more useful error messages.
|
243 |
-
$missingFields = array_diff(array('class', 'method', 'column_name'), array_keys($callbackConfig));
|
244 |
-
if ($missingFields) {
|
245 |
-
throw new EbayEnterprise_Affiliate_Exception_Configuration(
|
246 |
-
sprintf('Callback missing %s configuration.', implode(', ', $missingFields))
|
247 |
-
);
|
248 |
-
}
|
249 |
-
return $this;
|
250 |
-
}
|
251 |
-
/**
|
252 |
-
* Create the file and drop it in the configured export directory.
|
253 |
-
* @param array $feedData
|
254 |
-
* @return self
|
255 |
-
*/
|
256 |
-
protected function _generateFile($feedData)
|
257 |
-
{
|
258 |
-
if (empty($feedData)) {
|
259 |
-
return $this;
|
260 |
-
}
|
261 |
-
$delimiter = $this->_getDelimiter();
|
262 |
-
$enclosure = $this->_getEnclosure();
|
263 |
-
|
264 |
-
$tmpFile = fopen('php://temp', 'r+');
|
265 |
-
fputcsv($tmpFile, $this->_getHeaders(), $delimiter, $enclosure);
|
266 |
-
foreach ($feedData as $row) {
|
267 |
-
fputcsv($tmpFile, $row, $delimiter, $enclosure);
|
268 |
-
}
|
269 |
-
rewind($tmpFile);
|
270 |
-
|
271 |
-
$targetPath = $this->_generateFilePath();
|
272 |
-
$this->_checkAndCreateFolder(dirname($targetPath));
|
273 |
-
|
274 |
-
// send the contents of the temp stream to the actual file
|
275 |
-
file_put_contents(
|
276 |
-
$targetPath,
|
277 |
-
stream_get_contents($tmpFile)
|
278 |
-
);
|
279 |
-
return $this;
|
280 |
-
}
|
281 |
-
/**
|
282 |
-
* Generate the full path to the location where the file should be created.
|
283 |
-
* @return string
|
284 |
-
*/
|
285 |
-
protected function _generateFilePath()
|
286 |
-
{
|
287 |
-
return self::normalPaths(
|
288 |
-
Mage::getBaseDir(),
|
289 |
-
Mage::helper('eems_affiliate/config', $this->getStore())->getExportFilePath(),
|
290 |
-
$this->_getFileName()
|
291 |
-
);
|
292 |
-
}
|
293 |
-
/**
|
294 |
-
* The CSV file headers should be the keys used in the configured mappings.
|
295 |
-
* @return array
|
296 |
-
*/
|
297 |
-
protected function _getHeaders()
|
298 |
-
{
|
299 |
-
$mappings = Mage::helper('eems_affiliate/config')->getCallbackMappings();
|
300 |
-
$headers = array();
|
301 |
-
foreach ($this->_getFeedFields() as $field) {
|
302 |
-
$callbackMapping = isset($mappings[$field]) ? $mappings[$field] : array();
|
303 |
-
if (!isset($callbackMapping['type']) || $callbackMapping['type'] !== 'disabled') {
|
304 |
-
$this->_validateCallbackConfig($callbackMapping);
|
305 |
-
$headers[] = $callbackMapping['column_name'];
|
306 |
-
}
|
307 |
-
}
|
308 |
-
return $headers;
|
309 |
-
}
|
310 |
-
/**
|
311 |
-
* Make sure that all necessary directories in the given path exist. Create
|
312 |
-
* any that do not.
|
313 |
-
* @param string $dirPath
|
314 |
-
* @return self
|
315 |
-
*/
|
316 |
-
protected function _checkAndCreateFolder($dirPath)
|
317 |
-
{
|
318 |
-
// Use the model factory to allow for DI via the factory
|
319 |
-
$fileIo = Mage::getModel('Varien_Io_File');
|
320 |
-
$fileIo->open(array('path' => Mage::getBaseDir()));
|
321 |
-
$fileIo->checkAndCreateFolder($dirPath);
|
322 |
-
return $this;
|
323 |
-
}
|
324 |
-
/**
|
325 |
-
* Given an arbitrary array of arguments, join them to make a valid path.
|
326 |
-
* @param string $_,... Parts of the path to be joined
|
327 |
-
* @return string
|
328 |
-
*/
|
329 |
-
public static function normalPaths()
|
330 |
-
{
|
331 |
-
$paths = implode(DS, func_get_args());
|
332 |
-
// Retain a single leading slash; otherwise remove all leading, trailing
|
333 |
-
// and duplicate slashes.
|
334 |
-
return ((substr($paths, 0, 1) === DS) ? DS : '') .
|
335 |
-
implode(DS, array_filter(explode(DS, $paths)));
|
336 |
-
}
|
337 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
abstract class EbayEnterprise_Affiliate_Model_Feed_Abstract
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* The store context the feed is generated for. May be set to any viable store
|
23 |
+
* identified.
|
24 |
+
* @var Mage_Core_Model_Store
|
25 |
+
*/
|
26 |
+
protected $_store;
|
27 |
+
/**
|
28 |
+
* Get a collection of items to be included in the feed.
|
29 |
+
* @return Varien_Data_Collection
|
30 |
+
*/
|
31 |
+
abstract protected function _getItems();
|
32 |
+
/**
|
33 |
+
* Get fields to include in the feed. Fields are expected to map to existing
|
34 |
+
* callbacks defined in the config.xml.
|
35 |
+
* @see self::_invokeCallback
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
abstract protected function _getFeedFields();
|
39 |
+
/**
|
40 |
+
* Gets the filename format for the feed from config for this feed.
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
abstract protected function _getFileName();
|
44 |
+
/**
|
45 |
+
* Get the delimiter to use in the csv file
|
46 |
+
* @return string
|
47 |
+
* @codeCoverageIgnore
|
48 |
+
*/
|
49 |
+
protected function _getDelimiter()
|
50 |
+
{
|
51 |
+
return ',';
|
52 |
+
}
|
53 |
+
/**
|
54 |
+
* Get the encolsure to use in the csv file
|
55 |
+
* @return string
|
56 |
+
* @codeCoverageIgnore
|
57 |
+
*/
|
58 |
+
protected function _getEnclosure()
|
59 |
+
{
|
60 |
+
return '"';
|
61 |
+
}
|
62 |
+
/**
|
63 |
+
* Set up the store property.
|
64 |
+
*/
|
65 |
+
public function __construct($args = array())
|
66 |
+
{
|
67 |
+
// Set the store context to the given store or null which whill
|
68 |
+
// result in the "current" store.
|
69 |
+
$this->setStore(isset($args['store']) ? $args['store'] : null);
|
70 |
+
}
|
71 |
+
/**
|
72 |
+
* Set the store context for the feed, converting whatever viable store
|
73 |
+
* ID is passed in to an actual store instance.
|
74 |
+
* @see Mage_Core_Model_App::getStore for how various identifiers may be used to represent a store
|
75 |
+
* @param null|string|bool|int|Mage_Core_Model_Store
|
76 |
+
* @codeCoverageIgnore
|
77 |
+
*/
|
78 |
+
public function setStore($storeId)
|
79 |
+
{
|
80 |
+
$this->_store = Mage::app()->getStore($storeId);
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
/**
|
84 |
+
* Get the store instance the feed is being executed within.
|
85 |
+
* @return Mage_Core_Model_Store
|
86 |
+
* @codeCoverageIgnore
|
87 |
+
*/
|
88 |
+
public function getStore()
|
89 |
+
{
|
90 |
+
return $this->_store;
|
91 |
+
}
|
92 |
+
/**
|
93 |
+
* Create the feed file and drop it in the configured export directory.
|
94 |
+
* @return self
|
95 |
+
*/
|
96 |
+
public function generateFeed()
|
97 |
+
{
|
98 |
+
$this->_generateFile($this->_buildFeedData());
|
99 |
+
return $this;
|
100 |
+
}
|
101 |
+
/**
|
102 |
+
* Create arrays of data that should be included in the feed file. Each array
|
103 |
+
* should included a value for every field that is expected to be in the feed.
|
104 |
+
* @return array
|
105 |
+
*/
|
106 |
+
protected function _buildFeedData()
|
107 |
+
{
|
108 |
+
$items = $this->_getItems();
|
109 |
+
Mage::log(sprintf('building feed for %d items', $items->count()));
|
110 |
+
// array_map must be on an array - $items is a collection so need to get the
|
111 |
+
// underlying array to pass to array_map
|
112 |
+
return array_map(array($this, '_applyMapping'), $items->getItems());
|
113 |
+
}
|
114 |
+
/**
|
115 |
+
* Use the callback mapping to create the data that represents the given item
|
116 |
+
* in the feed.
|
117 |
+
* @param mixed $item Likely a Varien_Object but could really be anything.
|
118 |
+
* @return array
|
119 |
+
*/
|
120 |
+
protected function _applyMapping($item)
|
121 |
+
{
|
122 |
+
$fields = array();
|
123 |
+
$mappings = Mage::helper('eems_affiliate/config')->getCallbackMappings();
|
124 |
+
foreach ($this->_getFeedFields() as $feedField) {
|
125 |
+
// If the mapping doesn't exist, supplying an empty array will eventually
|
126 |
+
// result in an exception for being an invalid config mapping.
|
127 |
+
// @see self::_validateCallbackConfig
|
128 |
+
$callback = isset($mappings[$feedField]) ? $mappings[$feedField] : array();
|
129 |
+
// exclude any mappings that have a type of "disabled"
|
130 |
+
if (!isset($callback['type']) || $callback['type'] !== 'disabled') {
|
131 |
+
$fields[] = $this->_invokeCallback($callback, $item);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
return $fields;
|
135 |
+
}
|
136 |
+
/**
|
137 |
+
* Given a set of callback configuration and an item, invoke the configured
|
138 |
+
* callback and return the value. The callback configuration must meet the
|
139 |
+
* following requirements:
|
140 |
+
* - May contain a "type" key indicating the type of factory to use. May be
|
141 |
+
* one of:
|
142 |
+
* - "disabled" - will not be included in the feed
|
143 |
+
* - "helper" - will use the Mage::helper factory
|
144 |
+
* - "model" - will use the Mage::getModel factory
|
145 |
+
* - "singleton" - will use the Mage::getSingleton factory
|
146 |
+
* - If not included, will default to "singleton"
|
147 |
+
* - When type is "disabled" no other key/value pairs are required.
|
148 |
+
* - If type is not "disabled" the following must be included:
|
149 |
+
* - "class" must be a valid class alias for the configured factory type
|
150 |
+
* - "method" must be a valid method on the configured class
|
151 |
+
* - A "params" key may also be included. If included, its value must be
|
152 |
+
* an array of key/value pairs that will be included in the params array
|
153 |
+
* passed to the callback method.
|
154 |
+
* Every callback will be called with an array of params. The array will
|
155 |
+
* contain any key/value pairs added in the config as well as an "item" key
|
156 |
+
* which will have the item being mapped as the value and a "store" key which
|
157 |
+
* will have the store instance representing the store view context the feed
|
158 |
+
* is being generated for.
|
159 |
+
*
|
160 |
+
* Example configuration:
|
161 |
+
* <code>
|
162 |
+
* // This callback configuration array:
|
163 |
+
* $cfg = array(
|
164 |
+
* 'type' => 'helper',
|
165 |
+
* 'class' => 'eems_affiliate/map',
|
166 |
+
* 'column_name' => 'OID',
|
167 |
+
* 'params' => array(
|
168 |
+
* 'key' => 'increment_id',
|
169 |
+
* ),
|
170 |
+
* );
|
171 |
+
* // Will result in the following invocation:
|
172 |
+
* Mage::helper('eems_affiliate/map')->getDataValue(
|
173 |
+
* array('key' => 'increment_id', 'item' => $item)
|
174 |
+
* );
|
175 |
+
* </code>
|
176 |
+
*
|
177 |
+
* @see src/app/code/community/EbayEnterprise/Affiliate/etc/config.xml marketing_solutions/eems_affiliate/feeds contains mappings used for the affiliate feeds
|
178 |
+
* @param array $callbackConfig
|
179 |
+
* @param mixed $item
|
180 |
+
* @return mixed
|
181 |
+
*/
|
182 |
+
protected function _invokeCallback($callbackConfig, $item)
|
183 |
+
{
|
184 |
+
$obj = $this->_getCallbackInstance($callbackConfig);
|
185 |
+
$params = isset($callbackConfig['params']) ? $callbackConfig['params'] : array();
|
186 |
+
$item->setStoreId($this->getStore()->getId());
|
187 |
+
$params['item'] = $item;
|
188 |
+
$params['store'] = $this->getStore();
|
189 |
+
$method = $callbackConfig['method'];
|
190 |
+
if (method_exists($obj, $method)) {
|
191 |
+
return $obj->$method($params);
|
192 |
+
} else {
|
193 |
+
throw new EbayEnterprise_Affiliate_Exception_Configuration(
|
194 |
+
sprintf(
|
195 |
+
'Configured callback method %s::%s does not exist',
|
196 |
+
get_class($obj),
|
197 |
+
$method
|
198 |
+
)
|
199 |
+
);
|
200 |
+
}
|
201 |
+
}
|
202 |
+
/**
|
203 |
+
* Get an instance of the configured callback.
|
204 |
+
* @param array $callbackConfig
|
205 |
+
* @return mixed
|
206 |
+
*/
|
207 |
+
protected function _getCallbackInstance($callbackConfig)
|
208 |
+
{
|
209 |
+
$this->_validateCallbackConfig($callbackConfig);
|
210 |
+
switch ($callbackConfig['type']) {
|
211 |
+
// 'disabled' type callback mappings shouldn't pass through here under
|
212 |
+
// "normal" circumstances (filtered out in apply mapping) but if they do,
|
213 |
+
// do nothing and return null
|
214 |
+
case 'disabled':
|
215 |
+
return null;
|
216 |
+
case 'helper':
|
217 |
+
return Mage::helper($callbackConfig['class']);
|
218 |
+
case 'model':
|
219 |
+
return Mage::getModel($callbackConfig['class']);
|
220 |
+
case 'singleton':
|
221 |
+
default:
|
222 |
+
return Mage::getSingleton($callbackConfig['class']);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
/**
|
226 |
+
* Make sure the callback configuration is valid. If it isn't throw an
|
227 |
+
* exception.
|
228 |
+
* @param array $callbackConfig
|
229 |
+
* @return self
|
230 |
+
* @throws EbayEnterprise_Affiliate_Exception_Configuration If callback configuration is not valid
|
231 |
+
*/
|
232 |
+
protected function _validateCallbackConfig($callbackConfig)
|
233 |
+
{
|
234 |
+
if (empty($callbackConfig)) {
|
235 |
+
throw new EbayEnterprise_Affiliate_Exception_Configuration('Callback configuration is empty or missing.');
|
236 |
+
}
|
237 |
+
// When the callback is "disabled" no other configuration is necessary.
|
238 |
+
if (isset($callbackConfig['type']) && $callbackConfig['type'] === 'disabled') {
|
239 |
+
return $this;
|
240 |
+
}
|
241 |
+
// If not disabled, must have a class and method - separate checks for
|
242 |
+
// more simply providing more useful error messages.
|
243 |
+
$missingFields = array_diff(array('class', 'method', 'column_name'), array_keys($callbackConfig));
|
244 |
+
if ($missingFields) {
|
245 |
+
throw new EbayEnterprise_Affiliate_Exception_Configuration(
|
246 |
+
sprintf('Callback missing %s configuration.', implode(', ', $missingFields))
|
247 |
+
);
|
248 |
+
}
|
249 |
+
return $this;
|
250 |
+
}
|
251 |
+
/**
|
252 |
+
* Create the file and drop it in the configured export directory.
|
253 |
+
* @param array $feedData
|
254 |
+
* @return self
|
255 |
+
*/
|
256 |
+
protected function _generateFile($feedData)
|
257 |
+
{
|
258 |
+
if (empty($feedData)) {
|
259 |
+
return $this;
|
260 |
+
}
|
261 |
+
$delimiter = $this->_getDelimiter();
|
262 |
+
$enclosure = $this->_getEnclosure();
|
263 |
+
|
264 |
+
$tmpFile = fopen('php://temp', 'r+');
|
265 |
+
fputcsv($tmpFile, $this->_getHeaders(), $delimiter, $enclosure);
|
266 |
+
foreach ($feedData as $row) {
|
267 |
+
fputcsv($tmpFile, $row, $delimiter, $enclosure);
|
268 |
+
}
|
269 |
+
rewind($tmpFile);
|
270 |
+
|
271 |
+
$targetPath = $this->_generateFilePath();
|
272 |
+
$this->_checkAndCreateFolder(dirname($targetPath));
|
273 |
+
|
274 |
+
// send the contents of the temp stream to the actual file
|
275 |
+
file_put_contents(
|
276 |
+
$targetPath,
|
277 |
+
stream_get_contents($tmpFile)
|
278 |
+
);
|
279 |
+
return $this;
|
280 |
+
}
|
281 |
+
/**
|
282 |
+
* Generate the full path to the location where the file should be created.
|
283 |
+
* @return string
|
284 |
+
*/
|
285 |
+
protected function _generateFilePath()
|
286 |
+
{
|
287 |
+
return self::normalPaths(
|
288 |
+
Mage::getBaseDir(),
|
289 |
+
Mage::helper('eems_affiliate/config', $this->getStore())->getExportFilePath(),
|
290 |
+
$this->_getFileName()
|
291 |
+
);
|
292 |
+
}
|
293 |
+
/**
|
294 |
+
* The CSV file headers should be the keys used in the configured mappings.
|
295 |
+
* @return array
|
296 |
+
*/
|
297 |
+
protected function _getHeaders()
|
298 |
+
{
|
299 |
+
$mappings = Mage::helper('eems_affiliate/config')->getCallbackMappings();
|
300 |
+
$headers = array();
|
301 |
+
foreach ($this->_getFeedFields() as $field) {
|
302 |
+
$callbackMapping = isset($mappings[$field]) ? $mappings[$field] : array();
|
303 |
+
if (!isset($callbackMapping['type']) || $callbackMapping['type'] !== 'disabled') {
|
304 |
+
$this->_validateCallbackConfig($callbackMapping);
|
305 |
+
$headers[] = $callbackMapping['column_name'];
|
306 |
+
}
|
307 |
+
}
|
308 |
+
return $headers;
|
309 |
+
}
|
310 |
+
/**
|
311 |
+
* Make sure that all necessary directories in the given path exist. Create
|
312 |
+
* any that do not.
|
313 |
+
* @param string $dirPath
|
314 |
+
* @return self
|
315 |
+
*/
|
316 |
+
protected function _checkAndCreateFolder($dirPath)
|
317 |
+
{
|
318 |
+
// Use the model factory to allow for DI via the factory
|
319 |
+
$fileIo = Mage::getModel('Varien_Io_File');
|
320 |
+
$fileIo->open(array('path' => Mage::getBaseDir()));
|
321 |
+
$fileIo->checkAndCreateFolder($dirPath);
|
322 |
+
return $this;
|
323 |
+
}
|
324 |
+
/**
|
325 |
+
* Given an arbitrary array of arguments, join them to make a valid path.
|
326 |
+
* @param string $_,... Parts of the path to be joined
|
327 |
+
* @return string
|
328 |
+
*/
|
329 |
+
public static function normalPaths()
|
330 |
+
{
|
331 |
+
$paths = implode(DS, func_get_args());
|
332 |
+
// Retain a single leading slash; otherwise remove all leading, trailing
|
333 |
+
// and duplicate slashes.
|
334 |
+
return ((substr($paths, 0, 1) === DS) ? DS : '') .
|
335 |
+
implode(DS, array_filter(explode(DS, $paths)));
|
336 |
+
}
|
337 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Abstract.php
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
abstract class EbayEnterprise_Affiliate_Model_Feed_Order_Abstract extends EbayEnterprise_Affiliate_Model_Feed_Abstract
|
20 |
-
{
|
21 |
-
// Time format to use for the SQL statements
|
22 |
-
const SELECT_TIME_FORMAT = 'Y-m-d H:i:s';
|
23 |
-
const FILENAME_TIME_FORMAT = 'YmdHis';
|
24 |
-
/**
|
25 |
-
* Time stamp considered to be the time at which the feed runs - used for
|
26 |
-
* generating the file name and the cutoff time for capturing order changes.
|
27 |
-
* @var int
|
28 |
-
*/
|
29 |
-
protected $_startTime;
|
30 |
-
/**
|
31 |
-
* Allow for the "start" time of the feed to be passed in the constructor
|
32 |
-
* $args array. If given, this should be the time at which the feed is run.
|
33 |
-
* @param array $args
|
34 |
-
*/
|
35 |
-
public function __construct($args = array())
|
36 |
-
{
|
37 |
-
parent::__construct($args);
|
38 |
-
$this->_startTime = isset($args['start_time']) ? $args['start_time'] : time();
|
39 |
-
}
|
40 |
-
/**
|
41 |
-
* Get the ids of all stores that should be included in the feed. Only orders
|
42 |
-
* placed for these stores will be included in the corrected feed.
|
43 |
-
* @return array
|
44 |
-
*/
|
45 |
-
protected function _getStoreIdsToInclude()
|
46 |
-
{
|
47 |
-
return array_map(
|
48 |
-
function ($store) {
|
49 |
-
return $store->getId();
|
50 |
-
},
|
51 |
-
Mage::helper('eems_affiliate')->getAllStoresForProgramId(
|
52 |
-
Mage::helper('eems_affiliate/config')->getProgramId($this->_store)
|
53 |
-
)
|
54 |
-
);
|
55 |
-
}
|
56 |
-
/**
|
57 |
-
* @see parent::_getFileName
|
58 |
-
*/
|
59 |
-
protected function _getFileName()
|
60 |
-
{
|
61 |
-
return sprintf(
|
62 |
-
$this->_getFileNameFormat(),
|
63 |
-
Mage::helper('eems_affiliate/config')->getProgramId($this->getStore()),
|
64 |
-
date(static::FILENAME_TIME_FORMAT, $this->_startTime)
|
65 |
-
);
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Get the format string used to build the feed file name.
|
69 |
-
* @return string
|
70 |
-
*/
|
71 |
-
abstract protected function _getFileNameFormat();
|
72 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
abstract class EbayEnterprise_Affiliate_Model_Feed_Order_Abstract extends EbayEnterprise_Affiliate_Model_Feed_Abstract
|
20 |
+
{
|
21 |
+
// Time format to use for the SQL statements
|
22 |
+
const SELECT_TIME_FORMAT = 'Y-m-d H:i:s';
|
23 |
+
const FILENAME_TIME_FORMAT = 'YmdHis';
|
24 |
+
/**
|
25 |
+
* Time stamp considered to be the time at which the feed runs - used for
|
26 |
+
* generating the file name and the cutoff time for capturing order changes.
|
27 |
+
* @var int
|
28 |
+
*/
|
29 |
+
protected $_startTime;
|
30 |
+
/**
|
31 |
+
* Allow for the "start" time of the feed to be passed in the constructor
|
32 |
+
* $args array. If given, this should be the time at which the feed is run.
|
33 |
+
* @param array $args
|
34 |
+
*/
|
35 |
+
public function __construct($args = array())
|
36 |
+
{
|
37 |
+
parent::__construct($args);
|
38 |
+
$this->_startTime = isset($args['start_time']) ? $args['start_time'] : time();
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
* Get the ids of all stores that should be included in the feed. Only orders
|
42 |
+
* placed for these stores will be included in the corrected feed.
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
protected function _getStoreIdsToInclude()
|
46 |
+
{
|
47 |
+
return array_map(
|
48 |
+
function ($store) {
|
49 |
+
return $store->getId();
|
50 |
+
},
|
51 |
+
Mage::helper('eems_affiliate')->getAllStoresForProgramId(
|
52 |
+
Mage::helper('eems_affiliate/config')->getProgramId($this->_store)
|
53 |
+
)
|
54 |
+
);
|
55 |
+
}
|
56 |
+
/**
|
57 |
+
* @see parent::_getFileName
|
58 |
+
*/
|
59 |
+
protected function _getFileName()
|
60 |
+
{
|
61 |
+
return sprintf(
|
62 |
+
$this->_getFileNameFormat(),
|
63 |
+
Mage::helper('eems_affiliate/config')->getProgramId($this->getStore()),
|
64 |
+
date(static::FILENAME_TIME_FORMAT, $this->_startTime)
|
65 |
+
);
|
66 |
+
}
|
67 |
+
/**
|
68 |
+
* Get the format string used to build the feed file name.
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
+
abstract protected function _getFileNameFormat();
|
72 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Basic.php
CHANGED
@@ -1,75 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_Feed_Order_Basic extends EbayEnterprise_Affiliate_Model_Feed_Order_Abstract
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* @see parent::_getItems
|
23 |
-
*/
|
24 |
-
protected function _getItems()
|
25 |
-
{
|
26 |
-
$lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('eems_affiliate/config')->getOrderLastRunTime() ?: 0);
|
27 |
-
$startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
|
28 |
-
$storeIds = $this->_getStoreIdsToInclude();
|
29 |
-
|
30 |
-
$collection = Mage::getResourceModel('sales/order_collection');
|
31 |
-
$select = $collection->getSelect();
|
32 |
-
$select
|
33 |
-
->joinLeft(
|
34 |
-
array('cmo' => $collection->getTable('sales/creditmemo')),
|
35 |
-
'main_table.entity_id = cmo.order_id',
|
36 |
-
array()
|
37 |
-
)
|
38 |
-
// this is far more pure SQL than should be here but I don't see a way to
|
39 |
-
// get the proper groupings of where clauses without doing this
|
40 |
-
->where(
|
41 |
-
'main_table.store_id IN (?)',
|
42 |
-
$storeIds
|
43 |
-
)
|
44 |
-
->where(
|
45 |
-
"(main_table.original_increment_id IS NOT NULL AND main_table.created_at >= :lastRunTime AND main_table.created_at < :startTime) OR" .
|
46 |
-
"(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR" .
|
47 |
-
"(main_table.state = 'canceled' AND main_table.updated_at >= :lastRunTime AND main_table.updated_at < :startTime AND main_table.relation_child_id IS NULL)"
|
48 |
-
);
|
49 |
-
|
50 |
-
$collection->addBindParam(':lastRunTime', $lastRunTime)
|
51 |
-
->addBindParam(':startTime', $startTime);
|
52 |
-
|
53 |
-
return $collection;
|
54 |
-
}
|
55 |
-
/**
|
56 |
-
* Get an array of callback mappings for the feed. Should result in an array
|
57 |
-
* with keys for the field in the CSV and a value of an array used to
|
58 |
-
* represent a mapping callback.
|
59 |
-
* @see parent::_invokeCallback
|
60 |
-
*/
|
61 |
-
protected function _getFeedFields()
|
62 |
-
{
|
63 |
-
return explode(',', Mage::helper('eems_affiliate/config')->getBasicOrderFeedFields());
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* Get the file name format from config. Doesn't pass store context as the
|
67 |
-
* file name format should only ever exist at the global level.
|
68 |
-
* @see parent::_getFileNameFormat
|
69 |
-
* @codeCoverageIgnore
|
70 |
-
*/
|
71 |
-
protected function _getFileNameFormat()
|
72 |
-
{
|
73 |
-
return Mage::helper('eems_affiliate/config')->getBasicOrderFeedFileFormat();
|
74 |
-
}
|
75 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_Feed_Order_Basic extends EbayEnterprise_Affiliate_Model_Feed_Order_Abstract
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* @see parent::_getItems
|
23 |
+
*/
|
24 |
+
protected function _getItems()
|
25 |
+
{
|
26 |
+
$lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('eems_affiliate/config')->getOrderLastRunTime() ?: 0);
|
27 |
+
$startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
|
28 |
+
$storeIds = $this->_getStoreIdsToInclude();
|
29 |
+
|
30 |
+
$collection = Mage::getResourceModel('sales/order_collection');
|
31 |
+
$select = $collection->getSelect();
|
32 |
+
$select
|
33 |
+
->joinLeft(
|
34 |
+
array('cmo' => $collection->getTable('sales/creditmemo')),
|
35 |
+
'main_table.entity_id = cmo.order_id',
|
36 |
+
array()
|
37 |
+
)
|
38 |
+
// this is far more pure SQL than should be here but I don't see a way to
|
39 |
+
// get the proper groupings of where clauses without doing this
|
40 |
+
->where(
|
41 |
+
'main_table.store_id IN (?)',
|
42 |
+
$storeIds
|
43 |
+
)
|
44 |
+
->where(
|
45 |
+
"(main_table.original_increment_id IS NOT NULL AND main_table.created_at >= :lastRunTime AND main_table.created_at < :startTime) OR" .
|
46 |
+
"(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR" .
|
47 |
+
"(main_table.state = 'canceled' AND main_table.updated_at >= :lastRunTime AND main_table.updated_at < :startTime AND main_table.relation_child_id IS NULL)"
|
48 |
+
);
|
49 |
+
|
50 |
+
$collection->addBindParam(':lastRunTime', $lastRunTime)
|
51 |
+
->addBindParam(':startTime', $startTime);
|
52 |
+
|
53 |
+
return $collection;
|
54 |
+
}
|
55 |
+
/**
|
56 |
+
* Get an array of callback mappings for the feed. Should result in an array
|
57 |
+
* with keys for the field in the CSV and a value of an array used to
|
58 |
+
* represent a mapping callback.
|
59 |
+
* @see parent::_invokeCallback
|
60 |
+
*/
|
61 |
+
protected function _getFeedFields()
|
62 |
+
{
|
63 |
+
return explode(',', Mage::helper('eems_affiliate/config')->getBasicOrderFeedFields());
|
64 |
+
}
|
65 |
+
/**
|
66 |
+
* Get the file name format from config. Doesn't pass store context as the
|
67 |
+
* file name format should only ever exist at the global level.
|
68 |
+
* @see parent::_getFileNameFormat
|
69 |
+
* @codeCoverageIgnore
|
70 |
+
*/
|
71 |
+
protected function _getFileNameFormat()
|
72 |
+
{
|
73 |
+
return Mage::helper('eems_affiliate/config')->getBasicOrderFeedFileFormat();
|
74 |
+
}
|
75 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Dynamic.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EbayEnterprise_Affiliate_Model_Feed_Order_Dynamic extends EbayEnterprise_Affiliate_Model_Feed_Order_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @see parent::_getItems
|
7 |
+
*/
|
8 |
+
protected function _getItems()
|
9 |
+
{
|
10 |
+
$lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('eems_affiliate/config')->getOrderLastRunTime() ?: 0);
|
11 |
+
$startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
|
12 |
+
$storeIds = $this->_getStoreIdsToInclude();
|
13 |
+
|
14 |
+
$collection = Mage::getResourceModel('sales/order_item_collection');
|
15 |
+
$select = $collection->getSelect();
|
16 |
+
$select
|
17 |
+
->joinLeft(
|
18 |
+
array('o' => $collection->getTable('sales/order')),
|
19 |
+
'main_table.order_id = o.entity_id',
|
20 |
+
array('o.increment_id', 'o.original_increment_id')
|
21 |
+
)
|
22 |
+
->joinLeft(
|
23 |
+
array('cmo' => $collection->getTable('sales/creditmemo')),
|
24 |
+
'main_table.order_id = cmo.order_id',
|
25 |
+
array()
|
26 |
+
)
|
27 |
+
// this is far more pure SQL than should be here but I don't see a way to
|
28 |
+
// get the proper groupings of where clauses without doing this
|
29 |
+
->where(
|
30 |
+
// get only items within the correct store scope and filter out any
|
31 |
+
// configurable used simple products
|
32 |
+
'main_table.store_id IN (?) AND NOT (main_table.product_type="simple" AND main_table.parent_item_id IS NOT NULL AND main_table.row_total=0)',
|
33 |
+
$storeIds
|
34 |
+
)
|
35 |
+
->where(
|
36 |
+
"(o.original_increment_id IS NOT NULL AND o.created_at >= :lastRunTime AND o.created_at < :startTime) OR " .
|
37 |
+
"(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR " .
|
38 |
+
"(o.state = 'canceled' AND o.updated_at >= :lastRunTime AND o.updated_at < :startTime AND o.relation_child_id IS NULL)"
|
39 |
+
)
|
40 |
+
// The left joins can leave duplicate item rows
|
41 |
+
// But the selected items will be identical, so we don't need them.
|
42 |
+
->distinct();
|
43 |
+
|
44 |
+
$collection->addBindParam(':lastRunTime', $lastRunTime)
|
45 |
+
->addBindParam(':startTime', $startTime);
|
46 |
+
|
47 |
+
return $collection;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @see parent::_getFeedFields
|
52 |
+
*/
|
53 |
+
protected function _getFeedFields()
|
54 |
+
{
|
55 |
+
return explode(',', Mage::helper('eems_affiliate/config')->getDynamicOrderFeedFields());
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Get the file name format from config. Doesn't pass store context as the
|
60 |
+
* file name format should only ever exist at the global level.
|
61 |
+
* @see parent::_getFileNameFormat
|
62 |
+
* @codeCoverageIgnore
|
63 |
+
*/
|
64 |
+
protected function _getFileNameFormat()
|
65 |
+
{
|
66 |
+
return Mage::helper('eems_affiliate/config')->getDynamicOrderFeedFileFormat();
|
67 |
+
}
|
68 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Feed/Order/Itemized.php
CHANGED
@@ -1,81 +1,81 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
class EbayEnterprise_Affiliate_Model_Feed_Order_Itemized extends EbayEnterprise_Affiliate_Model_Feed_Order_Abstract
|
19 |
-
{
|
20 |
-
/**
|
21 |
-
* @see parent::_getItems
|
22 |
-
*/
|
23 |
-
protected function _getItems()
|
24 |
-
{
|
25 |
-
$lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('eems_affiliate/config')->getOrderLastRunTime() ?: 0);
|
26 |
-
$startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
|
27 |
-
$storeIds = $this->_getStoreIdsToInclude();
|
28 |
-
|
29 |
-
$collection = Mage::getResourceModel('sales/order_item_collection');
|
30 |
-
$select = $collection->getSelect();
|
31 |
-
$select
|
32 |
-
->joinLeft(
|
33 |
-
array('o' => $collection->getTable('sales/order')),
|
34 |
-
'main_table.order_id = o.entity_id',
|
35 |
-
array('o.increment_id', 'o.original_increment_id')
|
36 |
-
)
|
37 |
-
->joinLeft(
|
38 |
-
array('cmo' => $collection->getTable('sales/creditmemo')),
|
39 |
-
'main_table.order_id = cmo.order_id',
|
40 |
-
array()
|
41 |
-
)
|
42 |
-
// this is far more pure SQL than should be here but I don't see a way to
|
43 |
-
// get the proper groupings of where clauses without doing this
|
44 |
-
->where(
|
45 |
-
// get only items within the correct store scope and filter out any
|
46 |
-
// configurable used simple products
|
47 |
-
'main_table.store_id IN (?) AND NOT (main_table.product_type="simple" AND main_table.parent_item_id IS NOT NULL AND main_table.row_total=0)',
|
48 |
-
$storeIds
|
49 |
-
)
|
50 |
-
->where(
|
51 |
-
"(o.original_increment_id IS NOT NULL AND o.created_at >= :lastRunTime AND o.created_at < :startTime) OR " .
|
52 |
-
"(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR " .
|
53 |
-
"(o.state = 'canceled' AND o.updated_at >= :lastRunTime AND o.updated_at < :startTime AND o.relation_child_id IS NULL)"
|
54 |
-
)
|
55 |
-
// The left joins can leave duplicate item rows
|
56 |
-
// But the selected items will be identical, so we don't need them.
|
57 |
-
->distinct();
|
58 |
-
|
59 |
-
$collection->addBindParam(':lastRunTime', $lastRunTime)
|
60 |
-
->addBindParam(':startTime', $startTime);
|
61 |
-
|
62 |
-
return $collection;
|
63 |
-
}
|
64 |
-
/**
|
65 |
-
* @see parent::_getFeedFields
|
66 |
-
*/
|
67 |
-
protected function _getFeedFields()
|
68 |
-
{
|
69 |
-
return explode(',', Mage::helper('eems_affiliate/config')->getItemizedOrderFeedFields());
|
70 |
-
}
|
71 |
-
/**
|
72 |
-
* Get the file name format from config. Doesn't pass store context as the
|
73 |
-
* file name format should only ever exist at the global level.
|
74 |
-
* @see parent::_getFileNameFormat
|
75 |
-
* @codeCoverageIgnore
|
76 |
-
*/
|
77 |
-
protected function _getFileNameFormat()
|
78 |
-
{
|
79 |
-
return Mage::helper('eems_affiliate/config')->getItemizedOrderFeedFileFormat();
|
80 |
-
}
|
81 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
class EbayEnterprise_Affiliate_Model_Feed_Order_Itemized extends EbayEnterprise_Affiliate_Model_Feed_Order_Abstract
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* @see parent::_getItems
|
22 |
+
*/
|
23 |
+
protected function _getItems()
|
24 |
+
{
|
25 |
+
$lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('eems_affiliate/config')->getOrderLastRunTime() ?: 0);
|
26 |
+
$startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
|
27 |
+
$storeIds = $this->_getStoreIdsToInclude();
|
28 |
+
|
29 |
+
$collection = Mage::getResourceModel('sales/order_item_collection');
|
30 |
+
$select = $collection->getSelect();
|
31 |
+
$select
|
32 |
+
->joinLeft(
|
33 |
+
array('o' => $collection->getTable('sales/order')),
|
34 |
+
'main_table.order_id = o.entity_id',
|
35 |
+
array('o.increment_id', 'o.original_increment_id')
|
36 |
+
)
|
37 |
+
->joinLeft(
|
38 |
+
array('cmo' => $collection->getTable('sales/creditmemo')),
|
39 |
+
'main_table.order_id = cmo.order_id',
|
40 |
+
array()
|
41 |
+
)
|
42 |
+
// this is far more pure SQL than should be here but I don't see a way to
|
43 |
+
// get the proper groupings of where clauses without doing this
|
44 |
+
->where(
|
45 |
+
// get only items within the correct store scope and filter out any
|
46 |
+
// configurable used simple products
|
47 |
+
'main_table.store_id IN (?) AND NOT (main_table.product_type="simple" AND main_table.parent_item_id IS NOT NULL AND main_table.row_total=0)',
|
48 |
+
$storeIds
|
49 |
+
)
|
50 |
+
->where(
|
51 |
+
"(o.original_increment_id IS NOT NULL AND o.created_at >= :lastRunTime AND o.created_at < :startTime) OR " .
|
52 |
+
"(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR " .
|
53 |
+
"(o.state = 'canceled' AND o.updated_at >= :lastRunTime AND o.updated_at < :startTime AND o.relation_child_id IS NULL)"
|
54 |
+
)
|
55 |
+
// The left joins can leave duplicate item rows
|
56 |
+
// But the selected items will be identical, so we don't need them.
|
57 |
+
->distinct();
|
58 |
+
|
59 |
+
$collection->addBindParam(':lastRunTime', $lastRunTime)
|
60 |
+
->addBindParam(':startTime', $startTime);
|
61 |
+
|
62 |
+
return $collection;
|
63 |
+
}
|
64 |
+
/**
|
65 |
+
* @see parent::_getFeedFields
|
66 |
+
*/
|
67 |
+
protected function _getFeedFields()
|
68 |
+
{
|
69 |
+
return explode(',', Mage::helper('eems_affiliate/config')->getItemizedOrderFeedFields());
|
70 |
+
}
|
71 |
+
/**
|
72 |
+
* Get the file name format from config. Doesn't pass store context as the
|
73 |
+
* file name format should only ever exist at the global level.
|
74 |
+
* @see parent::_getFileNameFormat
|
75 |
+
* @codeCoverageIgnore
|
76 |
+
*/
|
77 |
+
protected function _getFileNameFormat()
|
78 |
+
{
|
79 |
+
return Mage::helper('eems_affiliate/config')->getItemizedOrderFeedFileFormat();
|
80 |
+
}
|
81 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Feed/Product.php
CHANGED
@@ -1,98 +1,98 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_Feed_Product extends EbayEnterprise_Affiliate_Model_Feed_Abstract
|
20 |
-
{
|
21 |
-
const DELIMITER = "\t";
|
22 |
-
/**
|
23 |
-
* @see parent::_getItems
|
24 |
-
*/
|
25 |
-
protected function _getItems()
|
26 |
-
{
|
27 |
-
return Mage::getResourceModel('catalog/product_collection')
|
28 |
-
->setStore($this->getStore())
|
29 |
-
->addAttributeToSelect(array('*'))
|
30 |
-
->addStoreFilter($this->getStore())
|
31 |
-
->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
32 |
-
}
|
33 |
-
/**
|
34 |
-
* Get an array of callback mappings for the feed. Should result in an array
|
35 |
-
* with keys for the field in the CSV and a value of an array used to
|
36 |
-
* represent a mapping callback.
|
37 |
-
* @see parent::_invokeCallback
|
38 |
-
*/
|
39 |
-
protected function _getFeedFields()
|
40 |
-
{
|
41 |
-
$store = $this->getStore();
|
42 |
-
$callbackMap = Mage::helper('eems_affiliate/config')->getCallbackMappings($store);
|
43 |
-
return array_filter(array_map(
|
44 |
-
function ($key) use ($callbackMap) {
|
45 |
-
return isset($callbackMap[$key])? $callbackMap[$key]['column_name'] : null;
|
46 |
-
},
|
47 |
-
array_keys(Mage::helper('eems_affiliate/config')->getProductFeedFields($store))
|
48 |
-
));
|
49 |
-
}
|
50 |
-
/**
|
51 |
-
* @see parent::_applyMapping
|
52 |
-
* @param mixed $item Likely a Varien_Object but could really be anything.
|
53 |
-
* @return array
|
54 |
-
*/
|
55 |
-
protected function _applyMapping($item)
|
56 |
-
{
|
57 |
-
$fields = array();
|
58 |
-
$helper = Mage::helper('eems_affiliate/config');
|
59 |
-
$store = $this->getStore();
|
60 |
-
$mappings = $helper->getCallbackMappings($store);
|
61 |
-
$columns = $helper->getProductFeedFields($store);
|
62 |
-
foreach ($this->_getFeedFields() as $feedField) {
|
63 |
-
// If the mapping doesn't exist, supplying an empty array will eventually
|
64 |
-
// result in an exception for being an invalid config mapping.
|
65 |
-
// @see self::_validateCallbackConfig
|
66 |
-
$callback = isset($mappings[$feedField]) ? $mappings[$feedField] : array();
|
67 |
-
if ($columns[$feedField]) {
|
68 |
-
$callback['params']['key'] = $columns[$feedField];
|
69 |
-
}
|
70 |
-
// exclude any mappings that have a type of "disabled"
|
71 |
-
if (!isset($callback['type']) || $callback['type'] !== 'disabled') {
|
72 |
-
$fields[] = $this->_invokeCallback($callback, $item);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
return $fields;
|
76 |
-
}
|
77 |
-
/**
|
78 |
-
* @see parent::_getFileName
|
79 |
-
*/
|
80 |
-
protected function _getFileName()
|
81 |
-
{
|
82 |
-
$config = Mage::helper('eems_affiliate/config');
|
83 |
-
$store = $this->getStore();
|
84 |
-
return sprintf(
|
85 |
-
$config->getProductFeedFilenameFormat($store),
|
86 |
-
$config->getProgramId($this->getStore($store))
|
87 |
-
);
|
88 |
-
}
|
89 |
-
/**
|
90 |
-
* @see EbayEnterprise_Affiliate_Model_Feed_Abstract::_getDelimiter
|
91 |
-
* @return string
|
92 |
-
* @codeCoverageIgnore
|
93 |
-
*/
|
94 |
-
protected function _getDelimiter()
|
95 |
-
{
|
96 |
-
return static::DELIMITER;
|
97 |
-
}
|
98 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_Feed_Product extends EbayEnterprise_Affiliate_Model_Feed_Abstract
|
20 |
+
{
|
21 |
+
const DELIMITER = "\t";
|
22 |
+
/**
|
23 |
+
* @see parent::_getItems
|
24 |
+
*/
|
25 |
+
protected function _getItems()
|
26 |
+
{
|
27 |
+
return Mage::getResourceModel('catalog/product_collection')
|
28 |
+
->setStore($this->getStore())
|
29 |
+
->addAttributeToSelect(array('*'))
|
30 |
+
->addStoreFilter($this->getStore())
|
31 |
+
->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
32 |
+
}
|
33 |
+
/**
|
34 |
+
* Get an array of callback mappings for the feed. Should result in an array
|
35 |
+
* with keys for the field in the CSV and a value of an array used to
|
36 |
+
* represent a mapping callback.
|
37 |
+
* @see parent::_invokeCallback
|
38 |
+
*/
|
39 |
+
protected function _getFeedFields()
|
40 |
+
{
|
41 |
+
$store = $this->getStore();
|
42 |
+
$callbackMap = Mage::helper('eems_affiliate/config')->getCallbackMappings($store);
|
43 |
+
return array_filter(array_map(
|
44 |
+
function ($key) use ($callbackMap) {
|
45 |
+
return isset($callbackMap[$key])? $callbackMap[$key]['column_name'] : null;
|
46 |
+
},
|
47 |
+
array_keys(Mage::helper('eems_affiliate/config')->getProductFeedFields($store))
|
48 |
+
));
|
49 |
+
}
|
50 |
+
/**
|
51 |
+
* @see parent::_applyMapping
|
52 |
+
* @param mixed $item Likely a Varien_Object but could really be anything.
|
53 |
+
* @return array
|
54 |
+
*/
|
55 |
+
protected function _applyMapping($item)
|
56 |
+
{
|
57 |
+
$fields = array();
|
58 |
+
$helper = Mage::helper('eems_affiliate/config');
|
59 |
+
$store = $this->getStore();
|
60 |
+
$mappings = $helper->getCallbackMappings($store);
|
61 |
+
$columns = $helper->getProductFeedFields($store);
|
62 |
+
foreach ($this->_getFeedFields() as $feedField) {
|
63 |
+
// If the mapping doesn't exist, supplying an empty array will eventually
|
64 |
+
// result in an exception for being an invalid config mapping.
|
65 |
+
// @see self::_validateCallbackConfig
|
66 |
+
$callback = isset($mappings[$feedField]) ? $mappings[$feedField] : array();
|
67 |
+
if ($columns[$feedField]) {
|
68 |
+
$callback['params']['key'] = $columns[$feedField];
|
69 |
+
}
|
70 |
+
// exclude any mappings that have a type of "disabled"
|
71 |
+
if (!isset($callback['type']) || $callback['type'] !== 'disabled') {
|
72 |
+
$fields[] = $this->_invokeCallback($callback, $item);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
return $fields;
|
76 |
+
}
|
77 |
+
/**
|
78 |
+
* @see parent::_getFileName
|
79 |
+
*/
|
80 |
+
protected function _getFileName()
|
81 |
+
{
|
82 |
+
$config = Mage::helper('eems_affiliate/config');
|
83 |
+
$store = $this->getStore();
|
84 |
+
return sprintf(
|
85 |
+
$config->getProductFeedFilenameFormat($store),
|
86 |
+
$config->getProgramId($this->getStore($store))
|
87 |
+
);
|
88 |
+
}
|
89 |
+
/**
|
90 |
+
* @see EbayEnterprise_Affiliate_Model_Feed_Abstract::_getDelimiter
|
91 |
+
* @return string
|
92 |
+
* @codeCoverageIgnore
|
93 |
+
*/
|
94 |
+
protected function _getDelimiter()
|
95 |
+
{
|
96 |
+
return static::DELIMITER;
|
97 |
+
}
|
98 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Observer.php
CHANGED
@@ -1,67 +1,76 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_Observer
|
20 |
-
{
|
21 |
-
const PRODUCT_LOG_MESSAGE = 'Generating Product feed: program id %s, default store view: %s';
|
22 |
-
/**
|
23 |
-
* This observer method is the entry point to generating product feed when
|
24 |
-
* the CRONJOB 'eems_affiliate_generate_product_feed' run.
|
25 |
-
* @return void
|
26 |
-
*/
|
27 |
-
public function createProductFeed()
|
28 |
-
{
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
Mage::
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
Mage::
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_Observer
|
20 |
+
{
|
21 |
+
const PRODUCT_LOG_MESSAGE = 'Generating Product feed: program id %s, default store view: %s';
|
22 |
+
/**
|
23 |
+
* This observer method is the entry point to generating product feed when
|
24 |
+
* the CRONJOB 'eems_affiliate_generate_product_feed' run.
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
public function createProductFeed()
|
28 |
+
{
|
29 |
+
if (!Mage::getStoreConfig('marketing_solutions/eems_affiliate/product_feed_enabled')) {
|
30 |
+
Mage::log(Mage::helper('eems_affiliate')->__('Product feed disabled'), Zend_Log::NOTICE);
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
+
$helper = Mage::helper('eems_affiliate');
|
35 |
+
foreach ($helper->getAllProgramIds() as $programId) {
|
36 |
+
$store = $helper->getStoreForProgramId($programId);
|
37 |
+
Mage::log(
|
38 |
+
sprintf(static::PRODUCT_LOG_MESSAGE, $programId, $store->getName()),
|
39 |
+
Zend_Log::INFO
|
40 |
+
);
|
41 |
+
|
42 |
+
Mage::getModel('eems_affiliate/feed_product', array(
|
43 |
+
'store' => $store
|
44 |
+
))->generateFeed();
|
45 |
+
}
|
46 |
+
}
|
47 |
+
/**
|
48 |
+
* Generate the order corrected feed.
|
49 |
+
* @return self
|
50 |
+
*/
|
51 |
+
public function createCorrectedOrdersFeed()
|
52 |
+
{
|
53 |
+
if (!Mage::getStoreConfig('marketing_solutions/eems_affiliate/order_feed_enabled')) {
|
54 |
+
Mage::log(Mage::helper('eems_affiliate')->__('Corrected order feed disabled'), Zend_Log::NOTICE);
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
|
58 |
+
$startTime = time();
|
59 |
+
|
60 |
+
$feedAlias = 'feed_order_'.Mage::helper('eems_affiliate/config')->getOrderType();
|
61 |
+
|
62 |
+
Mage::log(sprintf('[%s] Generating %s feed', __CLASS__, $feedAlias), Zend_Log::INFO);
|
63 |
+
|
64 |
+
$helper = Mage::helper('eems_affiliate');
|
65 |
+
foreach ($helper->getAllProgramIds() as $programId) {
|
66 |
+
Mage::getModel(
|
67 |
+
"eems_affiliate/{$feedAlias}",
|
68 |
+
array('store' => $helper->getStoreForProgramId($programId), 'start_time' => $startTime)
|
69 |
+
)->generateFeed();
|
70 |
+
}
|
71 |
+
|
72 |
+
Mage::helper('eems_affiliate/config')->updateOrderLastRunTime($startTime);
|
73 |
+
|
74 |
+
return $this;
|
75 |
+
}
|
76 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/Product/Attribute/Source/CommissioningCategory.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EbayEnterprise_Affiliate_Model_Product_Attribute_Source_CommissioningCategory extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
|
4 |
+
{
|
5 |
+
public function getAllOptions()
|
6 |
+
{
|
7 |
+
$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
|
8 |
+
$rootCategories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('name')->addFieldToFilter('parent_id', $rootCategoryId);
|
9 |
+
|
10 |
+
$categoryOptions = array(array('value' => '', 'label' => ''));
|
11 |
+
|
12 |
+
$this->_addChildren($categoryOptions, $rootCategories->getFirstItem()->getChildrenCategories(), 0);
|
13 |
+
|
14 |
+
return $categoryOptions;
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function _addChildren(&$options, $categories, $level)
|
18 |
+
{
|
19 |
+
if (!$categories->count())
|
20 |
+
return;
|
21 |
+
|
22 |
+
foreach($categories as $category) {
|
23 |
+
$options[] = array('value' => $category->getId(), 'label' => str_repeat('-', $level) . $category->getName());
|
24 |
+
|
25 |
+
$subcategories = $category->getChildrenCategories();
|
26 |
+
$this->_addChildren($options, $subcategories, $level+1);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Attributes.php
CHANGED
@@ -1,75 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_System_Config_Source_Attributes
|
20 |
-
{
|
21 |
-
const PRODUCT_URL_VALUE = 'product_url';
|
22 |
-
const PRODUCT_URL_LABEL = 'Product Url';
|
23 |
-
/**
|
24 |
-
* Get product attributes
|
25 |
-
* @return array
|
26 |
-
*/
|
27 |
-
public function toOptionArray()
|
28 |
-
{
|
29 |
-
$helper = Mage::helper('catalog');
|
30 |
-
$collection = Mage::getSingleton('eav/config')
|
31 |
-
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
|
32 |
-
->getAttributeCollection();
|
33 |
-
$attributes = array(array('value' => '', 'label' => ''));
|
34 |
-
foreach ($collection as $attribute) {
|
35 |
-
$attributes[] = array(
|
36 |
-
'value' => $attribute->getAttributeCode(),
|
37 |
-
'label' => $helper->__($attribute->getFrontendLabel() ?
|
38 |
-
$attribute->getFrontendLabel() :
|
39 |
-
$this->_convertToTitleCase($attribute->getAttributeCode()))
|
40 |
-
);
|
41 |
-
}
|
42 |
-
$attributes[] = array(
|
43 |
-
'value' => static::PRODUCT_URL_VALUE,
|
44 |
-
'label' => $helper->__(static::PRODUCT_URL_LABEL)
|
45 |
-
);
|
46 |
-
// sort the attribute options by label
|
47 |
-
usort($attributes, array($this, '_compareLabels'));
|
48 |
-
return $attributes;
|
49 |
-
}
|
50 |
-
/**
|
51 |
-
* Convert the attribute code to title case. Replace '_'s with spaces
|
52 |
-
* and capitalize each word.
|
53 |
-
* @param string $attributeCode
|
54 |
-
* @return string
|
55 |
-
*/
|
56 |
-
protected function _convertToTitleCase($attributeCode)
|
57 |
-
{
|
58 |
-
return ucwords(str_replace('_', ' ', $attributeCode));
|
59 |
-
}
|
60 |
-
/**
|
61 |
-
* Comparison method for sorting options by "label" key.
|
62 |
-
* @param array $a
|
63 |
-
* @param array $b
|
64 |
-
* @return int
|
65 |
-
*/
|
66 |
-
protected function _compareLabels($a, $b)
|
67 |
-
{
|
68 |
-
$aLabel = strtolower($a['label']);
|
69 |
-
$bLabel = strtolower($b['label']);
|
70 |
-
if ($aLabel === $bLabel) {
|
71 |
-
return 0;
|
72 |
-
}
|
73 |
-
return $aLabel < $bLabel ? -1 : 1;
|
74 |
-
}
|
75 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_System_Config_Source_Attributes
|
20 |
+
{
|
21 |
+
const PRODUCT_URL_VALUE = 'product_url';
|
22 |
+
const PRODUCT_URL_LABEL = 'Product Url';
|
23 |
+
/**
|
24 |
+
* Get product attributes
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function toOptionArray()
|
28 |
+
{
|
29 |
+
$helper = Mage::helper('catalog');
|
30 |
+
$collection = Mage::getSingleton('eav/config')
|
31 |
+
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
|
32 |
+
->getAttributeCollection();
|
33 |
+
$attributes = array(array('value' => '', 'label' => ''));
|
34 |
+
foreach ($collection as $attribute) {
|
35 |
+
$attributes[] = array(
|
36 |
+
'value' => $attribute->getAttributeCode(),
|
37 |
+
'label' => $helper->__($attribute->getFrontendLabel() ?
|
38 |
+
$attribute->getFrontendLabel() :
|
39 |
+
$this->_convertToTitleCase($attribute->getAttributeCode()))
|
40 |
+
);
|
41 |
+
}
|
42 |
+
$attributes[] = array(
|
43 |
+
'value' => static::PRODUCT_URL_VALUE,
|
44 |
+
'label' => $helper->__(static::PRODUCT_URL_LABEL)
|
45 |
+
);
|
46 |
+
// sort the attribute options by label
|
47 |
+
usort($attributes, array($this, '_compareLabels'));
|
48 |
+
return $attributes;
|
49 |
+
}
|
50 |
+
/**
|
51 |
+
* Convert the attribute code to title case. Replace '_'s with spaces
|
52 |
+
* and capitalize each word.
|
53 |
+
* @param string $attributeCode
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
protected function _convertToTitleCase($attributeCode)
|
57 |
+
{
|
58 |
+
return ucwords(str_replace('_', ' ', $attributeCode));
|
59 |
+
}
|
60 |
+
/**
|
61 |
+
* Comparison method for sorting options by "label" key.
|
62 |
+
* @param array $a
|
63 |
+
* @param array $b
|
64 |
+
* @return int
|
65 |
+
*/
|
66 |
+
protected function _compareLabels($a, $b)
|
67 |
+
{
|
68 |
+
$aLabel = strtolower($a['label']);
|
69 |
+
$bLabel = strtolower($b['label']);
|
70 |
+
if ($aLabel === $bLabel) {
|
71 |
+
return 0;
|
72 |
+
}
|
73 |
+
return $aLabel < $bLabel ? -1 : 1;
|
74 |
+
}
|
75 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Categories.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_System_Config_Source_Categories
|
20 |
-
{
|
21 |
-
const CATEGORY_VALUE = 'category';
|
22 |
-
const CATEGORY_LABEL = 'Product Categories';
|
23 |
-
/**
|
24 |
-
* Get category attributes
|
25 |
-
* @return array
|
26 |
-
*/
|
27 |
-
public function toOptionArray()
|
28 |
-
{
|
29 |
-
return array(
|
30 |
-
array('value' => '', 'label' => ''),
|
31 |
-
array(
|
32 |
-
'value' => static::CATEGORY_VALUE,
|
33 |
-
'label' => Mage::helper('catalog')->__(static::CATEGORY_LABEL)
|
34 |
-
)
|
35 |
-
);
|
36 |
-
}
|
37 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_System_Config_Source_Categories
|
20 |
+
{
|
21 |
+
const CATEGORY_VALUE = 'category';
|
22 |
+
const CATEGORY_LABEL = 'Product Categories';
|
23 |
+
/**
|
24 |
+
* Get category attributes
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function toOptionArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
array('value' => '', 'label' => ''),
|
31 |
+
array(
|
32 |
+
'value' => static::CATEGORY_VALUE,
|
33 |
+
'label' => Mage::helper('catalog')->__(static::CATEGORY_LABEL)
|
34 |
+
)
|
35 |
+
);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Ordertypes.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class EbayEnterprise_Affiliate_Model_System_Config_Source_Ordertypes
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$helper = Mage::helper('eems_affiliate');
|
8 |
+
$config = Mage::helper('eems_affiliate/config');
|
9 |
+
|
10 |
+
return array(
|
11 |
+
array(
|
12 |
+
'value' => $config::ORDER_TYPE_BASIC,
|
13 |
+
'label' => $helper->__('Basic'),
|
14 |
+
),
|
15 |
+
array(
|
16 |
+
'value' => $config::ORDER_TYPE_ITEMIZED,
|
17 |
+
'label' => $helper->__('Itemized'),
|
18 |
+
),
|
19 |
+
array(
|
20 |
+
'value' => $config::ORDER_TYPE_DYNAMIC,
|
21 |
+
'label' => $helper->__('Dynamic'),
|
22 |
+
),
|
23 |
+
);
|
24 |
+
}
|
25 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Stockquantity.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_System_Config_Source_Stockquantity
|
20 |
-
{
|
21 |
-
const STOCK_QTY_VALUE = 'qty';
|
22 |
-
const STOCK_QTY_LABEL = 'Quantity';
|
23 |
-
/**
|
24 |
-
* Get quantity in stock list
|
25 |
-
* @return array
|
26 |
-
*/
|
27 |
-
public function toOptionArray()
|
28 |
-
{
|
29 |
-
return array(
|
30 |
-
array('value' => '', 'label' => ''),
|
31 |
-
array(
|
32 |
-
'value' => static::STOCK_QTY_VALUE,
|
33 |
-
'label' => Mage::helper('catalog')->__(static::STOCK_QTY_LABEL)
|
34 |
-
)
|
35 |
-
);
|
36 |
-
}
|
37 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_System_Config_Source_Stockquantity
|
20 |
+
{
|
21 |
+
const STOCK_QTY_VALUE = 'qty';
|
22 |
+
const STOCK_QTY_LABEL = 'Quantity';
|
23 |
+
/**
|
24 |
+
* Get quantity in stock list
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function toOptionArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
array('value' => '', 'label' => ''),
|
31 |
+
array(
|
32 |
+
'value' => static::STOCK_QTY_VALUE,
|
33 |
+
'label' => Mage::helper('catalog')->__(static::STOCK_QTY_LABEL)
|
34 |
+
)
|
35 |
+
);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Stockyesno.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_System_Config_Source_Stockyesno
|
20 |
-
{
|
21 |
-
const IN_STOCK_VALUE = 'in_stock';
|
22 |
-
const IN_STOCK_LABEL = 'Inventory Stock Availability';
|
23 |
-
/**
|
24 |
-
* Get in stock list
|
25 |
-
* @return array
|
26 |
-
*/
|
27 |
-
public function toOptionArray()
|
28 |
-
{
|
29 |
-
return array(
|
30 |
-
array('value' => '', 'label' => ''),
|
31 |
-
array(
|
32 |
-
'value' => static::IN_STOCK_VALUE,
|
33 |
-
'label' => Mage::helper('catalog')->__(static::IN_STOCK_LABEL)
|
34 |
-
)
|
35 |
-
);
|
36 |
-
}
|
37 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_System_Config_Source_Stockyesno
|
20 |
+
{
|
21 |
+
const IN_STOCK_VALUE = 'in_stock';
|
22 |
+
const IN_STOCK_LABEL = 'Inventory Stock Availability';
|
23 |
+
/**
|
24 |
+
* Get in stock list
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function toOptionArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
array('value' => '', 'label' => ''),
|
31 |
+
array(
|
32 |
+
'value' => static::IN_STOCK_VALUE,
|
33 |
+
'label' => Mage::helper('catalog')->__(static::IN_STOCK_LABEL)
|
34 |
+
)
|
35 |
+
);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Transactiontype.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_System_Config_Source_Transactiontype
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* Get available Transaction Type options
|
23 |
-
* @return array
|
24 |
-
*/
|
25 |
-
public function toOptionArray()
|
26 |
-
{
|
27 |
-
$helper = Mage::helper('eems_affiliate');
|
28 |
-
return array('1' => $helper->__('Sale'), '2' => $helper->__('Lead'));
|
29 |
-
}
|
30 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_System_Config_Source_Transactiontype
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Get available Transaction Type options
|
23 |
+
* @return array
|
24 |
+
*/
|
25 |
+
public function toOptionArray()
|
26 |
+
{
|
27 |
+
$helper = Mage::helper('eems_affiliate');
|
28 |
+
return array('1' => $helper->__('Sale'), '2' => $helper->__('Lead'));
|
29 |
+
}
|
30 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Model/System/Config/Source/Visibilityyesno.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
|
19 |
-
class EbayEnterprise_Affiliate_Model_System_Config_Source_Visibilityyesno
|
20 |
-
{
|
21 |
-
const VISIBILITY_VALUE = 'visibility';
|
22 |
-
const VISIBILITY_LABEL = 'Visibility';
|
23 |
-
/**
|
24 |
-
* Get product visibility list
|
25 |
-
* @return array
|
26 |
-
*/
|
27 |
-
public function toOptionArray()
|
28 |
-
{
|
29 |
-
return array(
|
30 |
-
array('value' => '', 'label' => ''),
|
31 |
-
array(
|
32 |
-
'value' => static::VISIBILITY_VALUE,
|
33 |
-
'label' => Mage::helper('catalog')->__(static::VISIBILITY_LABEL)
|
34 |
-
)
|
35 |
-
);
|
36 |
-
}
|
37 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Model_System_Config_Source_Visibilityyesno
|
20 |
+
{
|
21 |
+
const VISIBILITY_VALUE = 'visibility';
|
22 |
+
const VISIBILITY_LABEL = 'Visibility';
|
23 |
+
/**
|
24 |
+
* Get product visibility list
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function toOptionArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
array('value' => '', 'label' => ''),
|
31 |
+
array(
|
32 |
+
'value' => static::VISIBILITY_VALUE,
|
33 |
+
'label' => Mage::helper('catalog')->__(static::VISIBILITY_LABEL)
|
34 |
+
)
|
35 |
+
);
|
36 |
+
}
|
37 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Block/BeaconTest.php
ADDED
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
class EbayEnterprise_Affiliate_Test_Block_BeaconTest extends EcomDev_PHPUnit_Test_Case
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Get a mock of the config helper to return expected system configurations.
|
22 |
+
* @param string $programId
|
23 |
+
* @param string $transactionType
|
24 |
+
* @param string $itemizeOrders
|
25 |
+
* @return Mock_EbayEnterprise_Affiliate_Helper_Config
|
26 |
+
*/
|
27 |
+
protected function _getConfigHelper($programId, $transactionType, $itemizeOrders)
|
28 |
+
{
|
29 |
+
$helper = $this->getHelperMock('eems_affiliate/config', array(
|
30 |
+
'getProgramId', 'getTransactionType', 'isItemizedOrders', 'isDynamicOrders',
|
31 |
+
));
|
32 |
+
$helper->expects($this->any())
|
33 |
+
->method('getProgramId')
|
34 |
+
->will($this->returnValue($programId));
|
35 |
+
$helper->expects($this->any())
|
36 |
+
->method('getTransactionType')
|
37 |
+
->will($this->returnValue($transactionType));
|
38 |
+
$helper->expects($this->any())
|
39 |
+
->method('isItemizedOrders')
|
40 |
+
->will($this->returnValue($itemizeOrders));
|
41 |
+
$helper->expects($this->any())
|
42 |
+
->method('isDynamicOrders')
|
43 |
+
->will($this->returnValue($itemizeOrders));
|
44 |
+
return $helper;
|
45 |
+
}
|
46 |
+
/**
|
47 |
+
* Test building the basic beacon url. Should only include order level
|
48 |
+
* information about the order in the url params.
|
49 |
+
*/
|
50 |
+
public function testGetBeaconUrlBasic()
|
51 |
+
{
|
52 |
+
$orderId = '000012';
|
53 |
+
$subtotal = '10.99';
|
54 |
+
$discount = '-5.00';
|
55 |
+
$couponCode = 'COUPON';
|
56 |
+
$programId = 'PROGRAM ID';
|
57 |
+
$transactionType = 'TRANS TYPE';
|
58 |
+
$itemizeOrders = false;
|
59 |
+
$params = array(
|
60 |
+
'PID' => $programId,
|
61 |
+
'OID' => $orderId,
|
62 |
+
'PROMOCODE' => $couponCode,
|
63 |
+
'AMOUNT' => '5.99',
|
64 |
+
'TYPE' => $transactionType
|
65 |
+
);
|
66 |
+
$beaconUrl = 'https://example.com/track';
|
67 |
+
$order = Mage::getModel('sales/order', array(
|
68 |
+
'increment_id' => $orderId,
|
69 |
+
'subtotal' => $subtotal,
|
70 |
+
'coupon_code' => $couponCode,
|
71 |
+
'discount_amount' => $discount,
|
72 |
+
));
|
73 |
+
// mock out the config helper to setup expected system configurations
|
74 |
+
$this->replaceByMock(
|
75 |
+
'helper',
|
76 |
+
'eems_affiliate/config',
|
77 |
+
$this->_getConfigHelper($programId, $transactionType, $itemizeOrders)
|
78 |
+
);
|
79 |
+
$helper = $this->getHelperMock('eems_affiliate/data', array('buildBeaconUrl'));
|
80 |
+
$helper->expects($this->once())
|
81 |
+
->method('buildBeaconUrl')
|
82 |
+
->with($this->identicalTo($params))
|
83 |
+
->will($this->returnValue($beaconUrl));
|
84 |
+
$this->replaceByMock('helper', 'eems_affiliate', $helper);
|
85 |
+
|
86 |
+
$block = $this->getBlockMock('eems_affiliate/beacon', array('_getOrder'));
|
87 |
+
$block->expects($this->any())
|
88 |
+
->method('_getOrder')
|
89 |
+
->will($this->returnValue($order));
|
90 |
+
|
91 |
+
$this->assertSame($beaconUrl, $block->getBeaconUrl());
|
92 |
+
}
|
93 |
+
/**
|
94 |
+
* Test building the itemized beacon url. Should include item level details
|
95 |
+
* in the url params for each item in the order.
|
96 |
+
*/
|
97 |
+
public function testGetBeaconUrlItemized()
|
98 |
+
{
|
99 |
+
$programId = 'PROGRAM ID';
|
100 |
+
// should use itemized beacon when itemize orders is true
|
101 |
+
$itemizeOrders = true;
|
102 |
+
$orderId = '000012';
|
103 |
+
$couponCode = 'COUPON';
|
104 |
+
$itemSku = 'sku-12345';
|
105 |
+
$altSku = 'sku-54321';
|
106 |
+
$itemQty = 2;
|
107 |
+
$altQty = 3;
|
108 |
+
$itemAmt = '12.34';
|
109 |
+
$altAmt = '10.67';
|
110 |
+
$discountAmt = '5.00';
|
111 |
+
$bundleSku = 'bundle-sku-made-up-of-child-skus';
|
112 |
+
$bundleQty = 1;
|
113 |
+
// This is the expected final output from the method - gets returned from
|
114 |
+
// the eems_affiliate/data helper when called with the right params.
|
115 |
+
$beaconUrl = 'https://example.com/track?PARAM=Value';
|
116 |
+
// These are the "correct" params the helper method should be called with.
|
117 |
+
// Order of the array is significant - both to the test and the
|
118 |
+
// actual implementation.
|
119 |
+
$beaconParams = array(
|
120 |
+
'PID' => $programId,
|
121 |
+
'OID' => $orderId,
|
122 |
+
'PROMOCODE' => $couponCode,
|
123 |
+
'INT' => 'ITEMIZED',
|
124 |
+
'ITEM1' => $itemSku,
|
125 |
+
'QTY1' => $itemQty * 2,
|
126 |
+
'TOTALAMOUNT1' => number_format(($itemAmt - $discountAmt) * 2, 2),
|
127 |
+
'ITEM2' => $altSku,
|
128 |
+
'QTY2' => $altQty,
|
129 |
+
'TOTALAMOUNT2' => $altAmt,
|
130 |
+
'ITEM3' => $bundleSku,
|
131 |
+
'QTY3' => $bundleQty,
|
132 |
+
'TOTALAMOUNT3' => '0.00',
|
133 |
+
);
|
134 |
+
|
135 |
+
$item = Mage::getModel('sales/order_item', array(
|
136 |
+
'sku' => $itemSku, 'qty_ordered' => $itemQty, 'row_total' => $itemAmt,
|
137 |
+
'parent_item_id' => null, 'discount_amount' => $discountAmt,
|
138 |
+
'product_type' => 'simple',
|
139 |
+
));
|
140 |
+
$itemDupe = Mage::getModel('sales/order_item', array(
|
141 |
+
'sku' => $itemSku, 'qty_ordered' => $itemQty, 'row_total' => $itemAmt,
|
142 |
+
'parent_item_id' => null, 'discount_amount' => $discountAmt,
|
143 |
+
'product_type' => 'simple',
|
144 |
+
));
|
145 |
+
$parentItem = Mage::getModel('sales/order_item', array(
|
146 |
+
'sku' => $altSku, 'qty_ordered' => $altQty, 'row_total' => $altAmt,
|
147 |
+
'parent_item_id' => null, 'discount_amount' => 0.00,
|
148 |
+
'product_type' => 'configurable',
|
149 |
+
));
|
150 |
+
$altItem = Mage::getModel('sales/order_item', array(
|
151 |
+
'sku' => $altSku, 'qty_ordered' => $altQty, 'row_total' => 0.00,
|
152 |
+
'parent_item_id' => '2', 'discount_amount' => 0.00,
|
153 |
+
'product_type' => 'simple',
|
154 |
+
));
|
155 |
+
$bundleItem = Mage::getModel('sales/order_item', array(
|
156 |
+
'sku' => $bundleSku, 'qty_ordered' => $bundleQty, 'row_total' => '500.00',
|
157 |
+
'parent_item_id' => null, 'discount_amount' => 0.00,
|
158 |
+
'product_type' => 'bundle',
|
159 |
+
));
|
160 |
+
$order = Mage::getModel('sales/order', array(
|
161 |
+
'increment_id' => $orderId, 'coupon_code' => $couponCode,
|
162 |
+
));
|
163 |
+
$order->addItem($item);
|
164 |
+
$order->addItem($itemDupe);
|
165 |
+
$order->addItem($parentItem);
|
166 |
+
$order->addItem($altItem);
|
167 |
+
$order->addItem($bundleItem);
|
168 |
+
|
169 |
+
// mock out the config helper to setup expected system configurations
|
170 |
+
$this->replaceByMock(
|
171 |
+
'helper',
|
172 |
+
'eems_affiliate/config',
|
173 |
+
$this->_getConfigHelper($programId, null, $itemizeOrders)
|
174 |
+
);
|
175 |
+
|
176 |
+
$helper = $this->getHelperMock('eems_affiliate/data', array('buildBeaconUrl'));
|
177 |
+
$helper->expects($this->once())
|
178 |
+
->method('buildBeaconUrl')
|
179 |
+
->with($this->identicalTo($beaconParams))
|
180 |
+
->will($this->returnValue($beaconUrl));
|
181 |
+
$this->replaceByMock('helper', 'eems_affiliate', $helper);
|
182 |
+
|
183 |
+
$block = $this->getBlockMock('eems_affiliate/beacon', array('_getOrder'));
|
184 |
+
$block->expects($this->any())
|
185 |
+
->method('_getOrder')
|
186 |
+
->will($this->returnValue($order));
|
187 |
+
|
188 |
+
$this->assertSame($beaconUrl, $block->getBeaconUrl());
|
189 |
+
}
|
190 |
+
/**
|
191 |
+
* Test that EbayEnterprise_Affiliate_Block_Beacon::_getOrder will be invoked
|
192 |
+
* by this test and expect it to return Mage_Sales_Model_Order object
|
193 |
+
*/
|
194 |
+
public function testGetOrder()
|
195 |
+
{
|
196 |
+
$orderId = '00000084848';
|
197 |
+
$session = $this->getModelMockBuilder('checkout/session')
|
198 |
+
->disableOriginalConstructor()
|
199 |
+
->setMethods(null)
|
200 |
+
->getMock();
|
201 |
+
$session->setLastOrderId($orderId);
|
202 |
+
$this->replaceByMock('singleton', 'checkout/session', $session);
|
203 |
+
|
204 |
+
$order = $this->getModelMock('sales/order', array('load'));
|
205 |
+
$order->expects($this->once())
|
206 |
+
->method('load')
|
207 |
+
->with($this->identicalTo($orderId))
|
208 |
+
->will($this->returnSelf());
|
209 |
+
$this->replaceByMock('model', 'sales/order', $order);
|
210 |
+
|
211 |
+
$beacon = $this->getBlockMock('eems_affiliate/beacon', array());
|
212 |
+
EcomDev_Utils_Reflection::setRestrictedPropertyValue($beacon, '_order', null);
|
213 |
+
|
214 |
+
$this->assertSame($order, EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
215 |
+
$beacon,
|
216 |
+
'_getOrder',
|
217 |
+
array()
|
218 |
+
));
|
219 |
+
}
|
220 |
+
/**
|
221 |
+
* Test that EbayEnterprise_Affiliate_Block_Beacon::showBeacon will return true
|
222 |
+
* only if tracking is enabled and we have a valid order
|
223 |
+
* AND either conditional pixel logic is OFF or it is ON and we have
|
224 |
+
* a valid cookie.
|
225 |
+
*
|
226 |
+
* @dataProvider dataProvider
|
227 |
+
*/
|
228 |
+
public function testShowBeacon($isEnabled, $isOrder, $isPixelLogicEnabled, $isValidCookie, $expectedResult)
|
229 |
+
{
|
230 |
+
$configHelper = $this->getHelperMock('eems_affiliate/config', array('isEnabled', 'isConditionalPixelEnabled'));
|
231 |
+
$configHelper->expects($this->any())
|
232 |
+
->method('isEnabled')
|
233 |
+
->will($this->returnValue($isEnabled));
|
234 |
+
|
235 |
+
$configHelper->expects($this->any())
|
236 |
+
->method('isConditionalPixelEnabled')
|
237 |
+
->will($this->returnValue($isPixelLogicEnabled));
|
238 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $configHelper);
|
239 |
+
|
240 |
+
$dataHelper = $this->getHelperMock('eems_affiliate', array('isValidCookie'));
|
241 |
+
$dataHelper->expects(($this->any()))
|
242 |
+
->method('isValidCookie')
|
243 |
+
->will($this->returnValue($isValidCookie));
|
244 |
+
$this->replaceByMock('helper', 'eems_affiliate', $dataHelper);
|
245 |
+
|
246 |
+
$order = (bool)$isOrder ? Mage::getModel('sales/order') : null;
|
247 |
+
$beacon = $this->getBlockMock('eems_affiliate/beacon', array('_getOrder'));
|
248 |
+
$beacon->expects($this->any())
|
249 |
+
->method('_getOrder')
|
250 |
+
->will($this->returnValue($order));
|
251 |
+
|
252 |
+
$this->assertEquals((bool)$expectedResult, $beacon->showBeacon());
|
253 |
+
}
|
254 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Block/providers/testShowBeacon.yaml
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-
|
2 |
+
- 1 # tracking enabled
|
3 |
+
- 1 # order is instanceof Mage_Sales_Model_Order
|
4 |
+
- 1 # conditional logic enabled
|
5 |
+
- 1 # valid cookie
|
6 |
+
- 1 # show beacon
|
7 |
+
-
|
8 |
+
- 1
|
9 |
+
- 1
|
10 |
+
- 1
|
11 |
+
- 0
|
12 |
+
- 0
|
13 |
+
-
|
14 |
+
- 1
|
15 |
+
- 1
|
16 |
+
- 0
|
17 |
+
- 0
|
18 |
+
- 1
|
19 |
+
-
|
20 |
+
- 1
|
21 |
+
- 1
|
22 |
+
- 0
|
23 |
+
- 1
|
24 |
+
- 1
|
25 |
+
#
|
26 |
+
-
|
27 |
+
- 1
|
28 |
+
- 0
|
29 |
+
- 0
|
30 |
+
- 0
|
31 |
+
- 0
|
32 |
+
-
|
33 |
+
- 1
|
34 |
+
- 0
|
35 |
+
- 0
|
36 |
+
- 1
|
37 |
+
- 0
|
38 |
+
-
|
39 |
+
- 1
|
40 |
+
- 0
|
41 |
+
- 1
|
42 |
+
- 0
|
43 |
+
- 0
|
44 |
+
-
|
45 |
+
- 1
|
46 |
+
- 0
|
47 |
+
- 1
|
48 |
+
- 1
|
49 |
+
- 0
|
50 |
+
#
|
51 |
+
-
|
52 |
+
- 0
|
53 |
+
- 0
|
54 |
+
- 0
|
55 |
+
- 0
|
56 |
+
- 0
|
57 |
+
-
|
58 |
+
- 0
|
59 |
+
- 0
|
60 |
+
- 0
|
61 |
+
- 1
|
62 |
+
- 0
|
63 |
+
-
|
64 |
+
- 0
|
65 |
+
- 0
|
66 |
+
- 1
|
67 |
+
- 0
|
68 |
+
- 0
|
69 |
+
-
|
70 |
+
- 0
|
71 |
+
- 0
|
72 |
+
- 1
|
73 |
+
- 1
|
74 |
+
- 0
|
75 |
+
#
|
76 |
+
-
|
77 |
+
- 0
|
78 |
+
- 1
|
79 |
+
- 0
|
80 |
+
- 0
|
81 |
+
- 0
|
82 |
+
-
|
83 |
+
- 0
|
84 |
+
- 1
|
85 |
+
- 0
|
86 |
+
- 1
|
87 |
+
- 0
|
88 |
+
-
|
89 |
+
- 0
|
90 |
+
- 1
|
91 |
+
- 1
|
92 |
+
- 0
|
93 |
+
- 0
|
94 |
+
-
|
95 |
+
- 0
|
96 |
+
- 1
|
97 |
+
- 1
|
98 |
+
- 1
|
99 |
+
- 0
|
app/code/community/EbayEnterprise/Affiliate/Test/Helper/DataTest.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
class EbayEnterprise_Affiliate_Test_Helper_DataTest extends EcomDev_PHPUnit_Test_Case
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Test that EbayEnterprise_Affiliate_Helper_Data::buildBeaconUrl yields the
|
22 |
+
* expected, escaped url with query string when passed an array of params to append.
|
23 |
+
*/
|
24 |
+
public function testBuildBeaconUrl()
|
25 |
+
{
|
26 |
+
$beaconUrl = 'https://example.com/track';
|
27 |
+
$params = array('KEY1' => 'K1', 'KEY2' => 'K2');
|
28 |
+
$result = $beaconUrl . '?' . http_build_query($params);
|
29 |
+
|
30 |
+
$cfgHelper = $this->getHelperMock('eems_affiliate/config', array('getBeaconBaseUrl'));
|
31 |
+
$cfgHelper->expects($this->once())
|
32 |
+
->method('getBeaconBaseUrl')
|
33 |
+
->will($this->returnValue($beaconUrl));
|
34 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $cfgHelper);
|
35 |
+
|
36 |
+
$this->assertSame($result, Mage::helper('eems_affiliate/data')->buildBeaconUrl($params));
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @dataProvider dataProvider
|
41 |
+
*/
|
42 |
+
public function testIsValidCookie($cookie, $value, $expectedResult)
|
43 |
+
{
|
44 |
+
$dataHelper = $this->getHelperMock('eems_affiliate', array('getSourceCookieName'));
|
45 |
+
$dataHelper->expects(($this->any()))
|
46 |
+
->method('getSourceCookieName')
|
47 |
+
->will($this->returnValue('ebay_enterprise_affiliate_source'));
|
48 |
+
$this->replaceByMock('helper', 'eems_affiliate', $dataHelper);
|
49 |
+
|
50 |
+
$_COOKIE[$cookie] = $value;
|
51 |
+
|
52 |
+
$this->assertEquals((bool)$expectedResult, $dataHelper->isValidCookie());
|
53 |
+
}
|
54 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Helper/Map/ProductTest.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
class EbayEnterprise_Affiliate_Test_Helper_Map_ProductTest extends EcomDev_PHPUnit_Test_Case
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Test that EbayEnterprise_Affiliate_Helper_Map_Product::getCategory will
|
22 |
+
* return a string of root category separated with the symbol '>' with inner
|
23 |
+
* category to the the inner most category.
|
24 |
+
*/
|
25 |
+
public function testGetCategory()
|
26 |
+
{
|
27 |
+
|
28 |
+
$categoryIds = array('1','2','3');
|
29 |
+
$path = implode('/', $categoryIds);
|
30 |
+
$categories = array('cat one', 'cat two', 'cat three');
|
31 |
+
$collection = Mage::getResourceModel('catalog/category_collection');
|
32 |
+
|
33 |
+
$categoryObjects = array();
|
34 |
+
foreach ($categories as $index => $name) {
|
35 |
+
$category = Mage::getModel('catalog/category', array(
|
36 |
+
'name' => $name, 'entity_id' => $index + 9999, 'path' => $path
|
37 |
+
));
|
38 |
+
$categoryObjects[] = $category;
|
39 |
+
$collection->addItem($category);
|
40 |
+
}
|
41 |
+
|
42 |
+
$productCategoryColl = Mage::getResourceModel('catalog/category_collection');
|
43 |
+
;
|
44 |
+
$productCategoryColl->addItem($categoryObjects[2]);
|
45 |
+
$product = $this->getModelMock('catalog/product', array('getCategoryCollection'));
|
46 |
+
$product->expects($this->once())
|
47 |
+
->method('getCategoryCollection')
|
48 |
+
->will($this->returnValue($productCategoryColl));
|
49 |
+
|
50 |
+
$params = array('item' => $product);
|
51 |
+
|
52 |
+
$result = implode(' > ', $categories);
|
53 |
+
|
54 |
+
$mapProduct = $this->getHelperMock('eems_affiliate/map_product', array('_getCategoriesByIds'));
|
55 |
+
$mapProduct->expects($this->once())
|
56 |
+
->method('_getCategoriesByIds')
|
57 |
+
->with($this->identicalTo($categoryIds))
|
58 |
+
->will($this->returnValue($collection));
|
59 |
+
|
60 |
+
$this->assertSame($result, $mapProduct->getCategory($params));
|
61 |
+
}
|
62 |
+
/**
|
63 |
+
* Test that EbayEnterprise_Affiliate_Helper_Map_Product::getImageUrl will
|
64 |
+
* return an absolute URL to an image view.
|
65 |
+
*/
|
66 |
+
public function testGetImageUrl()
|
67 |
+
{
|
68 |
+
$key = 'image';
|
69 |
+
$image = '/k/o/some-product-image.jpg';
|
70 |
+
$mediaUrl = 'http://www.example.com/' .
|
71 |
+
EbayEnterprise_Affiliate_Helper_Map_Product::MEDIA_PATH . $image;
|
72 |
+
|
73 |
+
$product = $this->getModelMockBuilder('catalog/product')
|
74 |
+
->disableOriginalConstructor()
|
75 |
+
->setMethods(array('getDataUsingMethod'))
|
76 |
+
->getMock();
|
77 |
+
$product->expects($this->once())
|
78 |
+
->method('getDataUsingMethod')
|
79 |
+
->with($this->identicalTo($key))
|
80 |
+
->will($this->returnValue($image));
|
81 |
+
|
82 |
+
$params = array('item' => $product, 'key' => $key);
|
83 |
+
|
84 |
+
$helperProduct = $this->getHelperMock('eems_affiliate/map_product', array(
|
85 |
+
'_getAbsoluteImagePath'
|
86 |
+
));
|
87 |
+
|
88 |
+
$helperProduct->expects($this->once())
|
89 |
+
->method('_getAbsoluteImagePath')
|
90 |
+
->with($this->identicalTo($image))
|
91 |
+
->will($this->returnValue($mediaUrl));
|
92 |
+
|
93 |
+
$this->assertSame($mediaUrl, $helperProduct->getImageUrl($params));
|
94 |
+
}
|
95 |
+
/**
|
96 |
+
* Test that EbayEnterprise_Affiliate_Helper_Map_Product::getInStockQty will
|
97 |
+
* return an integer value representing the manage stock qty of a product.
|
98 |
+
*/
|
99 |
+
public function testGetInStockQty()
|
100 |
+
{
|
101 |
+
$qty = 999;
|
102 |
+
$product = Mage::getModel('catalog/product');
|
103 |
+
$params = array('item' => $product);
|
104 |
+
|
105 |
+
$stockItem = $this->getModelMockBuilder('cataloginventory/stock_item')
|
106 |
+
->disableOriginalConstructor()
|
107 |
+
->setMethods(array('loadByProduct', 'getQty'))
|
108 |
+
->getMock();
|
109 |
+
$stockItem->expects($this->once())
|
110 |
+
->method('loadByProduct')
|
111 |
+
->with($this->identicalTo($product))
|
112 |
+
->will($this->returnSelf());
|
113 |
+
$stockItem->expects($this->once())
|
114 |
+
->method('getQty')
|
115 |
+
->will($this->returnValue($qty));
|
116 |
+
$this->replaceByMock('model', 'cataloginventory/stock_item', $stockItem);
|
117 |
+
|
118 |
+
$this->assertSame($qty, Mage::helper('eems_affiliate/map_product')->getInStockQty($params));
|
119 |
+
}
|
120 |
+
/**
|
121 |
+
* Test that EbayEnterprise_Affiliate_Helper_Map_Product::_getCategoriesByIds
|
122 |
+
* will be invoked by this test passing an array of category entity ids
|
123 |
+
* and will return a Mage_Catalog_Model_Resource_Category_Collection
|
124 |
+
*/
|
125 |
+
public function testGetCategoriesByIds()
|
126 |
+
{
|
127 |
+
$entityIds = array(1,2,3);
|
128 |
+
$collection = $this->getResourceModelMockBuilder('catalog/category_collection')
|
129 |
+
->disableOriginalConstructor()
|
130 |
+
->setMethods(array('addAttributeToSelect', 'addAttributeToFilter', 'load'))
|
131 |
+
->getMock();
|
132 |
+
$collection->expects($this->once())
|
133 |
+
->method('addAttributeToSelect')
|
134 |
+
->with($this->identicalTo(array('name', 'entity_id')))
|
135 |
+
->will($this->returnSelf());
|
136 |
+
$collection->expects($this->once())
|
137 |
+
->method('addAttributeToFilter')
|
138 |
+
->with($this->identicalTo(array(array('attribute' => 'entity_id', 'in' => $entityIds))))
|
139 |
+
->will($this->returnSelf());
|
140 |
+
$collection->expects($this->once())
|
141 |
+
->method('load')
|
142 |
+
->will($this->returnSelf());
|
143 |
+
$this->replaceByMock('resource_model', 'catalog/category_collection', $collection);
|
144 |
+
|
145 |
+
$mapProduct = $this->getHelperMock('eems_affiliate/map_product', array());
|
146 |
+
|
147 |
+
$this->assertSame($collection, EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
148 |
+
$mapProduct,
|
149 |
+
'_getCategoriesByIds',
|
150 |
+
array($entityIds)
|
151 |
+
));
|
152 |
+
}
|
153 |
+
/**
|
154 |
+
* Test that EbayEnterprise_Affiliate_Helper_Map_Product::getInStockYesNo will
|
155 |
+
* be called by this test passing an array with key item map to a
|
156 |
+
* Mage_Catalog_Model_Product object and expects it to return the string value 'yes'.
|
157 |
+
*/
|
158 |
+
public function testGetInStockYesNo()
|
159 |
+
{
|
160 |
+
$result = 'yes';
|
161 |
+
$isInStock = '1';
|
162 |
+
$params = array('item' => Mage::getModel('catalog/product'));
|
163 |
+
|
164 |
+
$stockItem = $this->getModelMock('cataloginventory/stock_item', array('loadByProduct'));
|
165 |
+
$stockItem->expects($this->once())
|
166 |
+
->method('loadByProduct')
|
167 |
+
->with($this->identicalTo($params['item']))
|
168 |
+
->will($this->returnSelf());
|
169 |
+
$stockItem->setIsInstock($isInStock);
|
170 |
+
$this->replaceByMock('model', 'cataloginventory/stock_item', $stockItem);
|
171 |
+
|
172 |
+
$this->assertSame($result, Mage::helper('eems_affiliate/map_product')->getInStockYesNo($params));
|
173 |
+
}
|
174 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Helper/providers/testIsValidCookie.yaml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
-
|
2 |
+
- ebay_enterprise_affiliate_source
|
3 |
+
- eean
|
4 |
+
- 1
|
5 |
+
-
|
6 |
+
- ebay_enterprise_affiliate_source
|
7 |
+
- invalid_value
|
8 |
+
- 0
|
9 |
+
-
|
10 |
+
- invalid_cookie_name
|
11 |
+
- eean
|
12 |
+
- 0
|
app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/AbstractTest.php
ADDED
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Test_Model_Feed_AbstractTest extends EcomDev_PHPUnit_Test_Case
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Test generating a feed file
|
23 |
+
*/
|
24 |
+
public function testGenerateFeed()
|
25 |
+
{
|
26 |
+
$feedData = array(array('one', 'two', 'three'));
|
27 |
+
$feed = $this->getModelMock(
|
28 |
+
'eems_affiliate/feed_abstract',
|
29 |
+
array('_buildFeedData', '_generateFile'),
|
30 |
+
true
|
31 |
+
);
|
32 |
+
$feed->expects($this->once())
|
33 |
+
->method('_buildFeedData')
|
34 |
+
->will($this->returnValue($feedData));
|
35 |
+
$feed->expects($this->once())
|
36 |
+
->method('_generateFile')
|
37 |
+
->with($this->identicalTo($feedData))
|
38 |
+
->will($this->returnSelf());
|
39 |
+
$this->assertSame($feed, $feed->generateFeed());
|
40 |
+
}
|
41 |
+
/**
|
42 |
+
* Test generating array of data to place into feed
|
43 |
+
*/
|
44 |
+
public function testBuildFeedData()
|
45 |
+
{
|
46 |
+
$itemOneMappedData = array('item', 'one', 'data');
|
47 |
+
$itemTwoMappedData = array('item', 'two', 'data');
|
48 |
+
$feedData = array($itemOneMappedData, $itemTwoMappedData);
|
49 |
+
|
50 |
+
$itemCollection = new Varien_Data_Collection();
|
51 |
+
$itemOne = Mage::getModel('sales/order');
|
52 |
+
$itemTwo = Mage::getModel('sales/order');
|
53 |
+
$itemCollection->addItem($itemOne)->addItem($itemTwo);
|
54 |
+
|
55 |
+
$feed = $this->getModelMock(
|
56 |
+
'eems_affiliate/feed_abstract',
|
57 |
+
array('_getItems', '_applyMapping'),
|
58 |
+
true
|
59 |
+
);
|
60 |
+
// get items will vary per feed type - itemized order, basic order or product
|
61 |
+
$feed->expects($this->once())
|
62 |
+
->method('_getItems')
|
63 |
+
->will($this->returnValue($itemCollection));
|
64 |
+
// should get called once for each item, returning the array of item data for the feed
|
65 |
+
$feed->expects($this->exactly(2))
|
66 |
+
->method('_applyMapping')
|
67 |
+
->will($this->returnValueMap(array(
|
68 |
+
array($itemOne, $itemOneMappedData),
|
69 |
+
array($itemTwo, $itemTwoMappedData),
|
70 |
+
)));
|
71 |
+
|
72 |
+
$this->assertSame(
|
73 |
+
$feedData,
|
74 |
+
EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_buildFeedData')
|
75 |
+
);
|
76 |
+
}
|
77 |
+
/**
|
78 |
+
* Test applying the configured mapping to the item to get back an array of
|
79 |
+
* data for each field in the feed.
|
80 |
+
*/
|
81 |
+
public function testApplyMapping()
|
82 |
+
{
|
83 |
+
$orderAmt = 23.23;
|
84 |
+
$store = Mage::app()->getStore();
|
85 |
+
$fields = array('fieldA', 'fieldB');
|
86 |
+
// callback mapping to use
|
87 |
+
$mappings = array(
|
88 |
+
'fieldA' => array(
|
89 |
+
'class' => 'eems_affiliate/map_order', 'type' => 'helper',
|
90 |
+
'method' => 'getOrderAmount', 'params' => array('key' => 'value'),
|
91 |
+
'column_name' => 'OID'
|
92 |
+
),
|
93 |
+
'fieldB' => array('type' => 'disabled'),
|
94 |
+
);
|
95 |
+
$itemData = array($orderAmt);
|
96 |
+
// The type of this object will vary depending on feed type but will likely
|
97 |
+
// be a descendent of Varien_Object. It shouldn't matter much to the test
|
98 |
+
// as it should just get passed through to the callbacks.
|
99 |
+
$item = new Varien_Object();
|
100 |
+
|
101 |
+
// All callbacks setup to use this helper
|
102 |
+
$feedHelper = $this->getHelperMock(
|
103 |
+
'eems_affiliate/map_order',
|
104 |
+
array('getOrderAmount')
|
105 |
+
);
|
106 |
+
$feedHelper->expects($this->once())
|
107 |
+
->method('getOrderAmount')
|
108 |
+
->with($this->identicalTo(array('key' => 'value', 'item' => $item, 'store' => $store)))
|
109 |
+
->will($this->returnValue($orderAmt));
|
110 |
+
$this->replaceByMock('helper', 'eems_affiliate/map_order', $feedHelper);
|
111 |
+
|
112 |
+
$config = $this->getHelperMock('eems_affiliate/config', array('getCallbackMappings'));
|
113 |
+
$config->expects($this->any())
|
114 |
+
->method('getCallbackMappings')
|
115 |
+
->will($this->returnValue($mappings));
|
116 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $config);
|
117 |
+
|
118 |
+
$feed = $this->getModelMock(
|
119 |
+
'eems_affiliate/feed_abstract',
|
120 |
+
array('_getFeedFields'),
|
121 |
+
true,
|
122 |
+
array(array('store' => $store))
|
123 |
+
);
|
124 |
+
// The _getFeedFields method will be defined for each type of feed and should
|
125 |
+
// return array of mapped fields to include.
|
126 |
+
$feed->expects($this->any())
|
127 |
+
->method('_getFeedFields')
|
128 |
+
->will($this->returnValue($fields));
|
129 |
+
|
130 |
+
$this->assertSame(
|
131 |
+
$itemData,
|
132 |
+
EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_applyMapping', array($item))
|
133 |
+
);
|
134 |
+
}
|
135 |
+
/**
|
136 |
+
* Test that when a configured method does not exist on the specified class,
|
137 |
+
* an exception is thrown.
|
138 |
+
*/
|
139 |
+
public function testInvokeCallbackFailures()
|
140 |
+
{
|
141 |
+
$callbackConfig = array('class' => 'eems_affiliate', 'type' => 'helper', 'method' => 'getSomething');
|
142 |
+
$feed = $this->getModelMock(
|
143 |
+
'eems_affiliate/feed_abstract',
|
144 |
+
array('_getCallbackInstance'),
|
145 |
+
true
|
146 |
+
);
|
147 |
+
// Sub an object that will certainly not have the configured method on it.
|
148 |
+
$feed->expects($this->once())
|
149 |
+
->method('_getCallbackInstance')
|
150 |
+
->with($this->identicalTo($callbackConfig))
|
151 |
+
->will($this->returnValue(new StdClass));
|
152 |
+
|
153 |
+
$this->setExpectedException('EbayEnterprise_Affiliate_Exception_Configuration');
|
154 |
+
EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
155 |
+
$feed,
|
156 |
+
'_invokeCallback',
|
157 |
+
array($callbackConfig, new Varien_Object())
|
158 |
+
);
|
159 |
+
}
|
160 |
+
/**
|
161 |
+
* Provide a sample callback configuration and whether the callback is
|
162 |
+
* expected to be deemed valid.
|
163 |
+
* @return array
|
164 |
+
*/
|
165 |
+
public function provideCallbacksToValidate()
|
166 |
+
{
|
167 |
+
return array(
|
168 |
+
array(
|
169 |
+
array(),
|
170 |
+
false
|
171 |
+
),
|
172 |
+
array(
|
173 |
+
array('type' => 'disabled'),
|
174 |
+
true
|
175 |
+
),
|
176 |
+
array(
|
177 |
+
array('type' => 'disabled', 'class' => 'eems_affiliate'),
|
178 |
+
true
|
179 |
+
),
|
180 |
+
array(
|
181 |
+
array('type' => 'model'),
|
182 |
+
false
|
183 |
+
),
|
184 |
+
array(
|
185 |
+
array('type' => 'singleton', 'class' => 'eems_affiliate/feed_abstract'),
|
186 |
+
false
|
187 |
+
),
|
188 |
+
array(
|
189 |
+
array('type' => 'helper', 'class' => 'eems_affiliate/map', 'method' => 'getOrderId'),
|
190 |
+
false
|
191 |
+
),
|
192 |
+
array(
|
193 |
+
array('type' => 'helper', 'class' => 'eems_affiliate/map', 'method' => 'getOrderId', 'column_name' => 'OID'),
|
194 |
+
true
|
195 |
+
),
|
196 |
+
);
|
197 |
+
}
|
198 |
+
/**
|
199 |
+
* Test checking for a callback configuration to be valid. When the is valid
|
200 |
+
* param indicates the configuration is invalid, an exception should be
|
201 |
+
* thrown. Otherwise, the method should simply reurun self.
|
202 |
+
* @param array $config Array of config data to validate
|
203 |
+
* @param boolean $isValid Is the config data valid
|
204 |
+
* @dataProvider provideCallbacksToValidate
|
205 |
+
*/
|
206 |
+
public function testValidateCallbackConfig($config, $isValid)
|
207 |
+
{
|
208 |
+
$feed = $this->getModelMock(
|
209 |
+
'eems_affiliate/feed_abstract',
|
210 |
+
array(),
|
211 |
+
true
|
212 |
+
);
|
213 |
+
|
214 |
+
if (!$isValid) {
|
215 |
+
$this->setExpectedException('EbayEnterprise_Affiliate_Exception_Configuration');
|
216 |
+
}
|
217 |
+
|
218 |
+
$result = EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
219 |
+
$feed,
|
220 |
+
'_validateCallbackConfig',
|
221 |
+
array($config)
|
222 |
+
);
|
223 |
+
if ($isValid) {
|
224 |
+
$this->assertSame($result, $feed);
|
225 |
+
}
|
226 |
+
}
|
227 |
+
/**
|
228 |
+
* Test getting column headers based on the configured mappings for the feed.
|
229 |
+
*/
|
230 |
+
public function testGetHeaders()
|
231 |
+
{
|
232 |
+
$fields = array('program_id', 'order_id');
|
233 |
+
$mapping = array(
|
234 |
+
'program_id' => array('class' => 'some/class', 'method' => 'getProgramId', 'column_name' => 'PID'),
|
235 |
+
'order_id' => array('class' => 'some/class', 'method' => 'getOrderId', 'column_name' => 'OID'),
|
236 |
+
);
|
237 |
+
|
238 |
+
$config = $this->getHelperMock('eems_affiliate/config', array('getCallbackMappings'));
|
239 |
+
$config->expects($this->any())
|
240 |
+
->method('getCallbackMappings')
|
241 |
+
->will($this->returnValue($mapping));
|
242 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $config);
|
243 |
+
|
244 |
+
$feed = $this->getModelMock(
|
245 |
+
'eems_affiliate/feed_abstract',
|
246 |
+
array('_getFeedFields'),
|
247 |
+
true
|
248 |
+
);
|
249 |
+
$feed->expects($this->once())
|
250 |
+
->method('_getFeedFields')
|
251 |
+
->will($this->returnValue($fields));
|
252 |
+
|
253 |
+
$this->assertSame(
|
254 |
+
// keys don't matter, so make sure to compare just values to values
|
255 |
+
array('PID', 'OID'),
|
256 |
+
array_values(EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getHeaders'))
|
257 |
+
);
|
258 |
+
}
|
259 |
+
/**
|
260 |
+
* Test generating the full path to the file. Should consist of Magento's
|
261 |
+
* base dir, the configured export feed path, and the name of the file.
|
262 |
+
*/
|
263 |
+
public function testGenerateFilePath()
|
264 |
+
{
|
265 |
+
$format = 'file_name.csv';
|
266 |
+
$configuredPath = 'var/feed/export';
|
267 |
+
$configHelper = $this->getHelperMock(
|
268 |
+
'eems_affiliate/config',
|
269 |
+
array('getExportFilePath', 'getProgramId')
|
270 |
+
);
|
271 |
+
$configHelper->expects($this->any())
|
272 |
+
->method('getExportFilePath')
|
273 |
+
->will($this->returnValue($configuredPath));
|
274 |
+
$configHelper->expects($this->any())
|
275 |
+
->method('getProgramId')
|
276 |
+
->will($this->returnValue('PROGRAM_ID'));
|
277 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $configHelper);
|
278 |
+
|
279 |
+
$feed = $this->getModelMock(
|
280 |
+
'eems_affiliate/feed_abstract',
|
281 |
+
array('_getFileName'),
|
282 |
+
true
|
283 |
+
);
|
284 |
+
$feed->expects($this->any())
|
285 |
+
->method('_getFileName')
|
286 |
+
->will($this->returnValue($format));
|
287 |
+
|
288 |
+
$this->assertSame(
|
289 |
+
Mage::getBaseDir() . DS . 'var/feed/export' . DS . $format,
|
290 |
+
EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_generateFilePath')
|
291 |
+
);
|
292 |
+
}
|
293 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/Order/AbstractTest.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Test_Model_Feed_Order_AbstractTest extends EcomDev_PHPUnit_Test_Case
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Test generating the file name using the
|
23 |
+
*/
|
24 |
+
public function testGetFileName()
|
25 |
+
{
|
26 |
+
$format = '%s_corrected_orders_%s.csv';
|
27 |
+
$programId = 'PROGRAM_ID';
|
28 |
+
$time = 1397829577;
|
29 |
+
$formattedTime = date('YmdHis', $time);
|
30 |
+
$fileName = "{$programId}_corrected_orders_{$formattedTime}.csv";
|
31 |
+
|
32 |
+
// get the default store to be used as context for config getting
|
33 |
+
$store = Mage::app()->getStore();
|
34 |
+
// get the order feed instance with the expected store and start time injected
|
35 |
+
$feed = $this->getModelMock(
|
36 |
+
'eems_affiliate/feed_order_itemized',
|
37 |
+
array('_getFileNameFormat'),
|
38 |
+
true,
|
39 |
+
array(array('store' => $store, 'start_time' => $time))
|
40 |
+
);
|
41 |
+
$feed->expects($this->any())
|
42 |
+
->method('_getFileNameFormat')
|
43 |
+
->will($this->returnValue($format));
|
44 |
+
|
45 |
+
$config = $this->getHelperMock('eems_affiliate/config', array('getProgramId'));
|
46 |
+
// Will have different program ids per feed so store context definitely
|
47 |
+
// matters when getting this value.
|
48 |
+
$config->expects($this->any())
|
49 |
+
->method('getProgramId')
|
50 |
+
->with($this->identicalTo($store))
|
51 |
+
->will($this->returnValue($programId));
|
52 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $config);
|
53 |
+
|
54 |
+
$generated = EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getFileName');
|
55 |
+
$this->assertSame(
|
56 |
+
$fileName,
|
57 |
+
$generated
|
58 |
+
);
|
59 |
+
}
|
60 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/Order/BasicTest.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Test_Model_Feed_Order_BasicTest extends EcomDev_PHPUnit_Test_Case
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Test getting the fields to include in the feed. Should be pulling the
|
23 |
+
* comma-separated list of fields from config.xml and splitting it to produce
|
24 |
+
* an array of fields.
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function testFeedFields()
|
28 |
+
{
|
29 |
+
$config = $this->getHelperMock('eems_affiliate/config', array('getBasicOrderFeedFields'));
|
30 |
+
$config->expects($this->any())
|
31 |
+
->method('getBasicOrderFeedFields')
|
32 |
+
->will($this->returnValue('one,two,three'));
|
33 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $config);
|
34 |
+
$feed = Mage::getModel('eems_affiliate/feed_order_basic');
|
35 |
+
$this->assertSame(
|
36 |
+
array('one', 'two', 'three'),
|
37 |
+
EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getFeedFields')
|
38 |
+
);
|
39 |
+
}
|
40 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/Order/ItemizedTest.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Test_Model_Feed_Order_ItemizedTest extends EcomDev_PHPUnit_Test_Case
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Test getting the fields to include in the feed. Should be pulling the
|
23 |
+
* comma-separated list of fields from config.xml and splitting it to produce
|
24 |
+
* an array of fields.
|
25 |
+
* @return array
|
26 |
+
*/
|
27 |
+
public function testFeedFields()
|
28 |
+
{
|
29 |
+
$config = $this->getHelperMock('eems_affiliate/config', array('getItemizedOrderFeedFields'));
|
30 |
+
$config->expects($this->any())
|
31 |
+
->method('getItemizedOrderFeedFields')
|
32 |
+
->will($this->returnValue('one,two,three'));
|
33 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $config);
|
34 |
+
$feed = Mage::getModel('eems_affiliate/feed_order_itemized');
|
35 |
+
$this->assertSame(
|
36 |
+
array('one', 'two', 'three'),
|
37 |
+
EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getFeedFields')
|
38 |
+
);
|
39 |
+
}
|
40 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Model/Feed/ProductTest.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
|
19 |
+
class EbayEnterprise_Affiliate_Test_Model_Feed_ProductTest extends EcomDev_PHPUnit_Test_Case
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Test that EbayEnterprise_Affiliate_Model_Feed_Product::_getItems will return
|
23 |
+
* a Mage_Catalog_Model_Resource_Product_Collection
|
24 |
+
*/
|
25 |
+
public function testGetItems()
|
26 |
+
{
|
27 |
+
$store = Mage::getModel('core/store');
|
28 |
+
$collection = $this->getResourceModelMockBuilder('catalog/product_collection')
|
29 |
+
->disableOriginalConstructor()
|
30 |
+
->setMethods(array('setStore', 'addAttributeToSelect', 'addStoreFilter', 'addFieldToFilter'))
|
31 |
+
->getMock();
|
32 |
+
$collection->expects($this->once())
|
33 |
+
->method('setStore')
|
34 |
+
->with($this->identicalTo($store))
|
35 |
+
->will($this->returnSelf());
|
36 |
+
$collection->expects($this->once())
|
37 |
+
->method('addAttributeToSelect')
|
38 |
+
->with($this->identicalTo(array('*')))
|
39 |
+
->will($this->returnSelf());
|
40 |
+
$collection->expects($this->once())
|
41 |
+
->method('addStoreFilter')
|
42 |
+
->with($this->identicalTo($store))
|
43 |
+
->will($this->returnSelf());
|
44 |
+
$collection->expects($this->once())
|
45 |
+
->method('addFieldToFilter')
|
46 |
+
->with($this->identicalTo('status'), $this->identicalTo(Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
|
47 |
+
->will($this->returnSelf());
|
48 |
+
$this->replaceByMock('resource_model', 'catalog/product_collection', $collection);
|
49 |
+
|
50 |
+
$feedProduct = Mage::getModel('eems_affiliate/feed_product', array('store' => $store));
|
51 |
+
|
52 |
+
$this->assertSame($collection, EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
53 |
+
$feedProduct,
|
54 |
+
'_getItems',
|
55 |
+
array()
|
56 |
+
));
|
57 |
+
}
|
58 |
+
/**
|
59 |
+
* Test that EbayEnterprise_Affiliate_Model_Feed_Product::_getFeedFields will
|
60 |
+
* retrieve a list of field from the configuration and explode it into an array
|
61 |
+
* of fields
|
62 |
+
*/
|
63 |
+
public function testGetFeedFields()
|
64 |
+
{
|
65 |
+
$maps = array(
|
66 |
+
'field_1' => array('column_name' => 'field_1'),
|
67 |
+
'field_2' => array('column_name' => 'field_2'),
|
68 |
+
'field_3' => array('column_name' => 'field_3')
|
69 |
+
);
|
70 |
+
$fields = array('field_1' => 'key 1', 'field_2' => 'key 2', 'field_3' => 'key 3');
|
71 |
+
$configHelper = $this->getHelperMock('eems_affiliate/config', array(
|
72 |
+
'getProductFeedFields', 'getCallbackMappings'
|
73 |
+
));
|
74 |
+
$result = array_keys($fields);
|
75 |
+
|
76 |
+
$configHelper->expects($this->once())
|
77 |
+
->method('getProductFeedFields')
|
78 |
+
->will($this->returnValue($fields));
|
79 |
+
$configHelper->expects($this->once())
|
80 |
+
->method('getCallbackMappings')
|
81 |
+
->will($this->returnValue($maps));
|
82 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $configHelper);
|
83 |
+
|
84 |
+
$feedProduct = Mage::getModel('eems_affiliate/feed_product');
|
85 |
+
|
86 |
+
$this->assertSame($result, EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
87 |
+
$feedProduct,
|
88 |
+
'_getFeedFields',
|
89 |
+
array()
|
90 |
+
));
|
91 |
+
}
|
92 |
+
/**
|
93 |
+
* Test that EbayEnterprise_Affiliate_Model_Feed_Product::_getFileName will return
|
94 |
+
* a string representing a feed file name
|
95 |
+
*/
|
96 |
+
public function testFileName()
|
97 |
+
{
|
98 |
+
$filenameFormat = '%s_Some_Feed.csv';
|
99 |
+
$programId = 'P12';
|
100 |
+
$result = sprintf($filenameFormat, $programId);
|
101 |
+
|
102 |
+
$store = Mage::getModel('core/store');
|
103 |
+
$configHelper = $this->getHelperMock('eems_affiliate/config', array(
|
104 |
+
'getProductFeedFilenameFormat', 'getProgramId'
|
105 |
+
));
|
106 |
+
$configHelper->expects($this->once())
|
107 |
+
->method('getProductFeedFilenameFormat')
|
108 |
+
->will($this->returnValue($filenameFormat));
|
109 |
+
$configHelper->expects($this->once())
|
110 |
+
->method('getProgramId')
|
111 |
+
->with($this->identicalTo($store))
|
112 |
+
->will($this->returnValue($programId));
|
113 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $configHelper);
|
114 |
+
|
115 |
+
$feedProduct = Mage::getModel('eems_affiliate/feed_product', array('store' => $store));
|
116 |
+
|
117 |
+
$this->assertSame($result, EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
118 |
+
$feedProduct,
|
119 |
+
'_getFileName',
|
120 |
+
array()
|
121 |
+
));
|
122 |
+
}
|
123 |
+
/**
|
124 |
+
* Test that EbayEnterprise_Affiliate_Model_Feed_Product::_applyMapping will
|
125 |
+
* be invoked with a Mage_Catalog_Model_Product object passed as its parameter
|
126 |
+
* and it will generate an array of callback result from configuration
|
127 |
+
*/
|
128 |
+
public function testApplyMapping()
|
129 |
+
{
|
130 |
+
$result = 'some value';
|
131 |
+
$fields = array('field_1' => 'code_1');
|
132 |
+
$mappings = array(
|
133 |
+
'field_1' => array(
|
134 |
+
'params' => array(),
|
135 |
+
'column_name' => 'field_1',
|
136 |
+
'type' => 'helper'
|
137 |
+
),
|
138 |
+
);
|
139 |
+
$callback = $mappings['field_1'];
|
140 |
+
$callback['params']['key'] = $fields['field_1'];
|
141 |
+
|
142 |
+
$item = Mage::getModel('catalog/product');
|
143 |
+
|
144 |
+
$callbackResult = array($result);
|
145 |
+
|
146 |
+
$configHelper = $this->getHelperMock('eems_affiliate/config', array(
|
147 |
+
'getCallbackMappings', 'getProductFeedFields'
|
148 |
+
));
|
149 |
+
$configHelper->expects($this->any())
|
150 |
+
->method('getCallbackMappings')
|
151 |
+
->will($this->returnValue($mappings));
|
152 |
+
$configHelper->expects($this->any())
|
153 |
+
->method('getProductFeedFields')
|
154 |
+
->will($this->returnValue($fields));
|
155 |
+
$this->replaceByMock('helper', 'eems_affiliate/config', $configHelper);
|
156 |
+
|
157 |
+
$feedProduct = $this->getModelMock('eems_affiliate/feed_product', array('_invokeCallBack'));
|
158 |
+
$feedProduct->expects($this->once())
|
159 |
+
->method('_invokeCallBack')
|
160 |
+
->with($this->identicalTo($callback), $this->identicalTo($item))
|
161 |
+
->will($this->returnValue($result));
|
162 |
+
|
163 |
+
$this->assertSame($callbackResult, EcomDev_Utils_Reflection::invokeRestrictedMethod(
|
164 |
+
$feedProduct,
|
165 |
+
'_applyMapping',
|
166 |
+
array($item)
|
167 |
+
));
|
168 |
+
}
|
169 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/Test/Model/ObserverTest.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
class EbayEnterprise_Affiliate_Test_Model_ObserverTest extends EcomDev_PHPUnit_Test_Case
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Test that EbayEnterprise_Affiliate_Model_Observer::createProductFeed
|
22 |
+
* will be invoked and expected the method
|
23 |
+
* EbayEnterprise_Affiliate_Model_Observer::getWebsitesDefaultStoreviews
|
24 |
+
* to be called and returned a known array of program keys map to default
|
25 |
+
* website store views, then expects the method
|
26 |
+
* EbayEnterprise_Affiliate_Model_Product::generateFeed to be invoked per
|
27 |
+
* default program id and store views
|
28 |
+
*/
|
29 |
+
public function testCreateProductFeed()
|
30 |
+
{
|
31 |
+
$websitesDefaultStoreViews = array(
|
32 |
+
'P1' => Mage::getModel('core/store', array('name' => 'store view 1')),
|
33 |
+
'P2' => Mage::getModel('core/store', array('name' => 'store view 2'))
|
34 |
+
);
|
35 |
+
$programIds = array_keys($websitesDefaultStoreViews);
|
36 |
+
|
37 |
+
$helper = $this->getHelperMock('eems_affiliate/data', array(
|
38 |
+
'getAllProgramIds', 'getStoreForProgramId'
|
39 |
+
));
|
40 |
+
$helper->expects($this->once())
|
41 |
+
->method('getAllProgramIds')
|
42 |
+
->will($this->returnValue($programIds));
|
43 |
+
$helper->expects($this->exactly(2))
|
44 |
+
->method('getStoreForProgramId')
|
45 |
+
->will($this->returnValueMap(array(
|
46 |
+
array($programIds[0], $websitesDefaultStoreViews[$programIds[0]]),
|
47 |
+
array($programIds[1], $websitesDefaultStoreViews[$programIds[1]])
|
48 |
+
)));
|
49 |
+
$this->replaceByMock('helper', 'eems_affiliate', $helper);
|
50 |
+
|
51 |
+
$productFeed = $this->getModelMockBuilder('eems_affiliate/feed_product')
|
52 |
+
->disableOriginalConstructor()
|
53 |
+
->setMethods(array('generateFeed'))
|
54 |
+
->getMock();
|
55 |
+
$productFeed->expects($this->exactly(2))
|
56 |
+
->method('generateFeed')
|
57 |
+
->will($this->returnSelf());
|
58 |
+
$this->replaceByMock('model', 'eems_affiliate/feed_product', $productFeed);
|
59 |
+
|
60 |
+
Mage::getModel('eems_affiliate/observer')->createProductFeed();
|
61 |
+
}
|
62 |
+
}
|
app/code/community/EbayEnterprise/Affiliate/etc/adminhtml.xml
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!--
|
3 |
-
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
|
5 |
-
NOTICE OF LICENSE
|
6 |
-
|
7 |
-
This source file is subject to the eBay Enterprise
|
8 |
-
Magento Extensions End User License Agreement
|
9 |
-
that is bundled with this package in the file LICENSE.md.
|
10 |
-
It is also available through the world-wide-web at this URL:
|
11 |
-
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
|
13 |
-
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
-->
|
16 |
-
<config>
|
17 |
-
<acl>
|
18 |
-
<resources>
|
19 |
-
<admin>
|
20 |
-
<children>
|
21 |
-
<system>
|
22 |
-
<children>
|
23 |
-
<config>
|
24 |
-
<children>
|
25 |
-
<marketing_solutions translate="title">
|
26 |
-
<title>Marketing Solutions</title>
|
27 |
-
<sort_order>20</sort_order>
|
28 |
-
</marketing_solutions>
|
29 |
-
</children>
|
30 |
-
</config>
|
31 |
-
</children>
|
32 |
-
</system>
|
33 |
-
</children>
|
34 |
-
</admin>
|
35 |
-
</resources>
|
36 |
-
</acl>
|
37 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!--
|
3 |
+
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
|
5 |
+
NOTICE OF LICENSE
|
6 |
+
|
7 |
+
This source file is subject to the eBay Enterprise
|
8 |
+
Magento Extensions End User License Agreement
|
9 |
+
that is bundled with this package in the file LICENSE.md.
|
10 |
+
It is also available through the world-wide-web at this URL:
|
11 |
+
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
|
13 |
+
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
-->
|
16 |
+
<config>
|
17 |
+
<acl>
|
18 |
+
<resources>
|
19 |
+
<admin>
|
20 |
+
<children>
|
21 |
+
<system>
|
22 |
+
<children>
|
23 |
+
<config>
|
24 |
+
<children>
|
25 |
+
<marketing_solutions translate="title">
|
26 |
+
<title>Marketing Solutions</title>
|
27 |
+
<sort_order>20</sort_order>
|
28 |
+
</marketing_solutions>
|
29 |
+
</children>
|
30 |
+
</config>
|
31 |
+
</children>
|
32 |
+
</system>
|
33 |
+
</children>
|
34 |
+
</admin>
|
35 |
+
</resources>
|
36 |
+
</acl>
|
37 |
+
</config>
|
app/code/community/EbayEnterprise/Affiliate/etc/config.xml
CHANGED
@@ -1,979 +1,1030 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!--
|
3 |
-
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
|
5 |
-
NOTICE OF LICENSE
|
6 |
-
|
7 |
-
This source file is subject to the eBay Enterprise
|
8 |
-
Magento Extensions End User License Agreement
|
9 |
-
that is bundled with this package in the file LICENSE.md.
|
10 |
-
It is also available through the world-wide-web at this URL:
|
11 |
-
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
|
13 |
-
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
-->
|
16 |
-
<config>
|
17 |
-
<modules>
|
18 |
-
<EbayEnterprise_Affiliate>
|
19 |
-
<version>1.0.0
|
20 |
-
</EbayEnterprise_Affiliate>
|
21 |
-
</modules>
|
22 |
-
<global>
|
23 |
-
<models>
|
24 |
-
<eems_affiliate>
|
25 |
-
<class>EbayEnterprise_Affiliate_Model</class>
|
26 |
-
</eems_affiliate>
|
27 |
-
</models>
|
28 |
-
<helpers>
|
29 |
-
<eems_affiliate>
|
30 |
-
<class>EbayEnterprise_Affiliate_Helper</class>
|
31 |
-
</eems_affiliate>
|
32 |
-
</helpers>
|
33 |
-
<blocks>
|
34 |
-
<eems_affiliate>
|
35 |
-
<class>EbayEnterprise_Affiliate_Block</class>
|
36 |
-
</eems_affiliate>
|
37 |
-
</blocks>
|
38 |
-
<resources>
|
39 |
-
<eems_affiliate_setup>
|
40 |
-
<setup>
|
41 |
-
<module>EbayEnterprise_Affiliate</module>
|
42 |
-
<class>Mage_Core_Model_Resource_Setup</class>
|
43 |
-
</setup>
|
44 |
-
</eems_affiliate_setup>
|
45 |
-
</resources>
|
46 |
-
</global>
|
47 |
-
<crontab>
|
48 |
-
<jobs>
|
49 |
-
<eems_affiliate_generate_product_feed>
|
50 |
-
<schedule>
|
51 |
-
<cron_expr>0
|
52 |
-
</schedule>
|
53 |
-
<run>
|
54 |
-
<model>eems_affiliate/observer::createProductFeed</model>
|
55 |
-
</run>
|
56 |
-
</eems_affiliate_generate_product_feed>
|
57 |
-
<eems_affiliate_generate_corrected_order_feed>
|
58 |
-
<schedule>
|
59 |
-
<cron_expr>0
|
60 |
-
</schedule>
|
61 |
-
<run>
|
62 |
-
<model>eems_affiliate/observer::createCorrectedOrdersFeed</model>
|
63 |
-
</run>
|
64 |
-
</eems_affiliate_generate_corrected_order_feed>
|
65 |
-
</jobs>
|
66 |
-
</crontab>
|
67 |
-
<default>
|
68 |
-
<marketing_solutions>
|
69 |
-
<eems_affiliate>
|
70 |
-
<active>0</active>
|
71 |
-
<js_files>eems_affiliate/cookie.js</js_files>
|
72 |
-
<!-- use comma to add more js files-->
|
73 |
-
<beacon_url>https://t.pepperjamnetwork.com/track</beacon_url>
|
74 |
-
<export_path>var/export/eems_affiliate/</export_path>
|
75 |
-
<
|
76 |
-
<
|
77 |
-
<
|
78 |
-
<
|
79 |
-
<
|
80 |
-
<
|
81 |
-
<
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
<
|
86 |
-
<
|
87 |
-
<
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
<
|
92 |
-
<
|
93 |
-
<
|
94 |
-
<
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
<
|
101 |
-
<
|
102 |
-
<
|
103 |
-
<
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
<
|
110 |
-
<
|
111 |
-
<
|
112 |
-
<
|
113 |
-
|
114 |
-
<
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
<
|
120 |
-
<
|
121 |
-
<
|
122 |
-
<
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
<
|
129 |
-
<
|
130 |
-
<
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
<
|
135 |
-
<
|
136 |
-
<
|
137 |
-
<
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
<
|
143 |
-
<
|
144 |
-
<
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
<
|
152 |
-
<
|
153 |
-
<
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
<
|
160 |
-
<
|
161 |
-
<
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
<
|
169 |
-
<
|
170 |
-
<
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
<
|
176 |
-
<
|
177 |
-
<
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
</
|
182 |
-
|
183 |
-
|
184 |
-
<
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
</
|
191 |
-
|
192 |
-
|
193 |
-
<
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
</
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
<
|
205 |
-
<
|
206 |
-
<
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
<
|
214 |
-
<
|
215 |
-
<
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
<
|
223 |
-
<
|
224 |
-
<
|
225 |
-
<
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
<
|
232 |
-
<
|
233 |
-
<
|
234 |
-
<
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
<
|
241 |
-
<
|
242 |
-
<
|
243 |
-
<
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
<
|
250 |
-
<
|
251 |
-
<
|
252 |
-
<
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
<
|
259 |
-
<
|
260 |
-
<
|
261 |
-
<
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
<
|
269 |
-
<
|
270 |
-
<
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
<
|
278 |
-
<
|
279 |
-
<
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
<
|
287 |
-
<
|
288 |
-
<
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
<
|
296 |
-
<
|
297 |
-
<
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
<
|
305 |
-
<
|
306 |
-
<
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
<
|
314 |
-
<
|
315 |
-
<
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
<
|
323 |
-
<
|
324 |
-
<
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
<
|
332 |
-
<
|
333 |
-
<
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
<
|
341 |
-
<
|
342 |
-
<
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
<
|
350 |
-
<
|
351 |
-
<
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
<
|
359 |
-
<
|
360 |
-
<
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
<
|
368 |
-
<
|
369 |
-
<
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
<
|
377 |
-
<
|
378 |
-
<
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
<
|
386 |
-
<
|
387 |
-
<
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
<
|
395 |
-
<
|
396 |
-
<
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
<
|
404 |
-
<
|
405 |
-
<
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
<
|
413 |
-
<
|
414 |
-
<
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
<
|
422 |
-
<
|
423 |
-
<
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
<
|
431 |
-
<
|
432 |
-
<
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
<
|
440 |
-
<
|
441 |
-
<
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
<
|
449 |
-
<
|
450 |
-
<
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
<
|
458 |
-
<
|
459 |
-
<
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
<
|
467 |
-
<
|
468 |
-
<
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
<
|
476 |
-
<
|
477 |
-
<
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
<
|
485 |
-
<
|
486 |
-
<
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
<
|
494 |
-
<
|
495 |
-
<
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
<
|
503 |
-
<
|
504 |
-
<
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
<
|
512 |
-
<
|
513 |
-
<
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
<
|
521 |
-
<
|
522 |
-
<
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
<
|
530 |
-
<
|
531 |
-
<
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
<
|
539 |
-
<
|
540 |
-
<
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
<
|
548 |
-
<
|
549 |
-
<
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
<
|
557 |
-
<
|
558 |
-
<
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
<
|
566 |
-
<
|
567 |
-
<
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
<
|
575 |
-
<
|
576 |
-
<
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
<
|
584 |
-
<
|
585 |
-
<
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
<
|
593 |
-
<
|
594 |
-
<
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
<
|
602 |
-
<
|
603 |
-
<
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
<
|
611 |
-
<
|
612 |
-
<
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
<
|
620 |
-
<
|
621 |
-
<
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
<
|
629 |
-
<
|
630 |
-
<
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
<
|
638 |
-
<
|
639 |
-
<
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
<
|
647 |
-
<
|
648 |
-
<
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
<
|
656 |
-
<
|
657 |
-
<
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
<
|
665 |
-
<
|
666 |
-
<
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
<
|
674 |
-
<
|
675 |
-
<
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
<
|
683 |
-
<
|
684 |
-
<
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
<
|
692 |
-
<
|
693 |
-
<
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
<
|
701 |
-
<
|
702 |
-
<
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
<
|
710 |
-
<
|
711 |
-
<
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
<
|
719 |
-
<
|
720 |
-
<
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
<
|
728 |
-
<
|
729 |
-
<
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
<
|
737 |
-
<
|
738 |
-
<
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
<
|
746 |
-
<
|
747 |
-
<
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
<
|
755 |
-
<
|
756 |
-
<
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
<
|
764 |
-
<
|
765 |
-
<
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
<
|
773 |
-
<
|
774 |
-
<
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
<
|
782 |
-
<
|
783 |
-
<
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
<
|
791 |
-
<
|
792 |
-
<
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
<
|
800 |
-
<
|
801 |
-
<
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
<
|
809 |
-
<
|
810 |
-
<
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
<
|
818 |
-
<
|
819 |
-
<
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
<
|
827 |
-
<
|
828 |
-
<
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
<
|
836 |
-
<
|
837 |
-
<
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
<
|
845 |
-
<
|
846 |
-
<
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
<
|
854 |
-
<
|
855 |
-
<
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
<
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
<
|
934 |
-
<
|
935 |
-
<
|
936 |
-
<
|
937 |
-
<
|
938 |
-
<
|
939 |
-
<
|
940 |
-
<
|
941 |
-
<
|
942 |
-
<
|
943 |
-
<
|
944 |
-
<
|
945 |
-
<
|
946 |
-
<
|
947 |
-
<
|
948 |
-
<
|
949 |
-
<
|
950 |
-
<
|
951 |
-
<
|
952 |
-
<
|
953 |
-
<
|
954 |
-
<
|
955 |
-
<
|
956 |
-
<
|
957 |
-
<
|
958 |
-
<
|
959 |
-
<
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
<
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
<
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!--
|
3 |
+
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
|
5 |
+
NOTICE OF LICENSE
|
6 |
+
|
7 |
+
This source file is subject to the eBay Enterprise
|
8 |
+
Magento Extensions End User License Agreement
|
9 |
+
that is bundled with this package in the file LICENSE.md.
|
10 |
+
It is also available through the world-wide-web at this URL:
|
11 |
+
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
|
13 |
+
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
-->
|
16 |
+
<config>
|
17 |
+
<modules>
|
18 |
+
<EbayEnterprise_Affiliate>
|
19 |
+
<version>1.2.0.0</version>
|
20 |
+
</EbayEnterprise_Affiliate>
|
21 |
+
</modules>
|
22 |
+
<global>
|
23 |
+
<models>
|
24 |
+
<eems_affiliate>
|
25 |
+
<class>EbayEnterprise_Affiliate_Model</class>
|
26 |
+
</eems_affiliate>
|
27 |
+
</models>
|
28 |
+
<helpers>
|
29 |
+
<eems_affiliate>
|
30 |
+
<class>EbayEnterprise_Affiliate_Helper</class>
|
31 |
+
</eems_affiliate>
|
32 |
+
</helpers>
|
33 |
+
<blocks>
|
34 |
+
<eems_affiliate>
|
35 |
+
<class>EbayEnterprise_Affiliate_Block</class>
|
36 |
+
</eems_affiliate>
|
37 |
+
</blocks>
|
38 |
+
<resources>
|
39 |
+
<eems_affiliate_setup>
|
40 |
+
<setup>
|
41 |
+
<module>EbayEnterprise_Affiliate</module>
|
42 |
+
<class>Mage_Core_Model_Resource_Setup</class>
|
43 |
+
</setup>
|
44 |
+
</eems_affiliate_setup>
|
45 |
+
</resources>
|
46 |
+
</global>
|
47 |
+
<crontab>
|
48 |
+
<jobs>
|
49 |
+
<eems_affiliate_generate_product_feed>
|
50 |
+
<schedule>
|
51 |
+
<cron_expr>0 0 3 * *</cron_expr>
|
52 |
+
</schedule>
|
53 |
+
<run>
|
54 |
+
<model>eems_affiliate/observer::createProductFeed</model>
|
55 |
+
</run>
|
56 |
+
</eems_affiliate_generate_product_feed>
|
57 |
+
<eems_affiliate_generate_corrected_order_feed>
|
58 |
+
<schedule>
|
59 |
+
<cron_expr>0 0 3 * *</cron_expr>
|
60 |
+
</schedule>
|
61 |
+
<run>
|
62 |
+
<model>eems_affiliate/observer::createCorrectedOrdersFeed</model>
|
63 |
+
</run>
|
64 |
+
</eems_affiliate_generate_corrected_order_feed>
|
65 |
+
</jobs>
|
66 |
+
</crontab>
|
67 |
+
<default>
|
68 |
+
<marketing_solutions>
|
69 |
+
<eems_affiliate>
|
70 |
+
<active>0</active>
|
71 |
+
<js_files>eems_affiliate/cookie.js</js_files>
|
72 |
+
<!-- use comma to add more js files-->
|
73 |
+
<beacon_url>https://t.pepperjamnetwork.com/track</beacon_url>
|
74 |
+
<export_path>var/export/eems_affiliate/</export_path>
|
75 |
+
<order_type>itemized</order_type>
|
76 |
+
<program_id/>
|
77 |
+
<transaction_type>1</transaction_type>
|
78 |
+
<conditional_pixel_enabled>0</conditional_pixel_enabled>
|
79 |
+
<source_key_name>eean</source_key_name>
|
80 |
+
<product_feed_enabled>1</product_feed_enabled>
|
81 |
+
<order_feed_enabled>1</order_feed_enabled>
|
82 |
+
<feeds>
|
83 |
+
<callback_mappings>
|
84 |
+
<program_id>
|
85 |
+
<class>eems_affiliate/map</class>
|
86 |
+
<method>getProgramId</method>
|
87 |
+
<type>helper</type>
|
88 |
+
<column_name>PID</column_name>
|
89 |
+
</program_id>
|
90 |
+
<order_id>
|
91 |
+
<class>eems_affiliate/map_order</class>
|
92 |
+
<method>getOrderId</method>
|
93 |
+
<type>helper</type>
|
94 |
+
<column_name>OID</column_name>
|
95 |
+
<params>
|
96 |
+
<format>%.50s</format>
|
97 |
+
</params>
|
98 |
+
</order_id>
|
99 |
+
<item_order_id>
|
100 |
+
<class>eems_affiliate/map_order</class>
|
101 |
+
<method>getItemOrderId</method>
|
102 |
+
<type>helper</type>
|
103 |
+
<column_name>OID</column_name>
|
104 |
+
<params>
|
105 |
+
<format>%.50s</format>
|
106 |
+
</params>
|
107 |
+
</item_order_id>
|
108 |
+
<item_id>
|
109 |
+
<class>eems_affiliate/map_order</class>
|
110 |
+
<method>getItemId</method>
|
111 |
+
<type>helper</type>
|
112 |
+
<column_name>ITEMID</column_name>
|
113 |
+
<params>
|
114 |
+
<format>%.50s</format>
|
115 |
+
<key>sku</key>
|
116 |
+
</params>
|
117 |
+
</item_id>
|
118 |
+
<item_price>
|
119 |
+
<class>eems_affiliate/map_order</class>
|
120 |
+
<method>getItemPrice</method>
|
121 |
+
<type>helper</type>
|
122 |
+
<column_name>AMOUNT</column_name>
|
123 |
+
<params>
|
124 |
+
<format>%.2f</format>
|
125 |
+
</params>
|
126 |
+
</item_price>
|
127 |
+
<item_quantity>
|
128 |
+
<class>eems_affiliate/map_order</class>
|
129 |
+
<method>getItemQuantity</method>
|
130 |
+
<type>helper</type>
|
131 |
+
<column_name>QUANTITY</column_name>
|
132 |
+
</item_quantity>
|
133 |
+
<dynamic_program_id>
|
134 |
+
<class>eems_affiliate/map</class>
|
135 |
+
<method>getProgramId</method>
|
136 |
+
<type>helper</type>
|
137 |
+
<column_name>PROGRAM_ID</column_name>
|
138 |
+
</dynamic_program_id>
|
139 |
+
<dynamic_item_order_id>
|
140 |
+
<class>eems_affiliate/map_order</class>
|
141 |
+
<method>getItemOrderId</method>
|
142 |
+
<type>helper</type>
|
143 |
+
<column_name>ORDER_ID</column_name>
|
144 |
+
<params>
|
145 |
+
<format>%.50s</format>
|
146 |
+
</params>
|
147 |
+
</dynamic_item_order_id>
|
148 |
+
<dynamic_item_id>
|
149 |
+
<class>eems_affiliate/map_order</class>
|
150 |
+
<method>getItemId</method>
|
151 |
+
<type>helper</type>
|
152 |
+
<column_name>ITEM_ID</column_name>
|
153 |
+
<params>
|
154 |
+
<format>%.50s</format>
|
155 |
+
<key>sku</key>
|
156 |
+
</params>
|
157 |
+
</dynamic_item_id>
|
158 |
+
<dynamic_item_price>
|
159 |
+
<class>eems_affiliate/map_order</class>
|
160 |
+
<method>getItemPrice</method>
|
161 |
+
<type>helper</type>
|
162 |
+
<column_name>ITEM_PRICE</column_name>
|
163 |
+
<params>
|
164 |
+
<format>%.2f</format>
|
165 |
+
</params>
|
166 |
+
</dynamic_item_price>
|
167 |
+
<category>
|
168 |
+
<class>eems_affiliate/map_order</class>
|
169 |
+
<method>getCategory</method>
|
170 |
+
<type>helper</type>
|
171 |
+
<column_name>CATEGORY</column_name>
|
172 |
+
</category>
|
173 |
+
<new_to_file>
|
174 |
+
<class>eems_affiliate/map_order</class>
|
175 |
+
<method>getNewToFile</method>
|
176 |
+
<type>helper</type>
|
177 |
+
<column_name>NEW_TO_FILE</column_name>
|
178 |
+
</new_to_file>
|
179 |
+
<order_amount>
|
180 |
+
<class>eems_affiliate/map_order</class>
|
181 |
+
<method>getOrderAmount</method>
|
182 |
+
<type>helper</type>
|
183 |
+
<column_name>AMOUNT</column_name>
|
184 |
+
<params>
|
185 |
+
<format>%.2f</format>
|
186 |
+
</params>
|
187 |
+
</order_amount>
|
188 |
+
<reason>
|
189 |
+
<class>eems_affiliate/map</class>
|
190 |
+
<method>passStatic</method>
|
191 |
+
<type>helper</type>
|
192 |
+
<column_name>REASON</column_name>
|
193 |
+
<params>
|
194 |
+
<value>8</value>
|
195 |
+
</params>
|
196 |
+
</reason>
|
197 |
+
<transaction_type>
|
198 |
+
<class>eems_affiliate/map_order</class>
|
199 |
+
<method>getTransactionType</method>
|
200 |
+
<type>helper</type>
|
201 |
+
<column_name>TYPE</column_name>
|
202 |
+
</transaction_type>
|
203 |
+
<age_range>
|
204 |
+
<class>eems_affiliate/map</class>
|
205 |
+
<method>getDataValue</method>
|
206 |
+
<type>helper</type>
|
207 |
+
<column_name>age_range</column_name>
|
208 |
+
<params>
|
209 |
+
<format>%.32s</format>
|
210 |
+
</params>
|
211 |
+
</age_range>
|
212 |
+
<artist>
|
213 |
+
<class>eems_affiliate/map</class>
|
214 |
+
<method>getDataValue</method>
|
215 |
+
<type>helper</type>
|
216 |
+
<column_name>artist</column_name>
|
217 |
+
<params>
|
218 |
+
<format>%.128s</format>
|
219 |
+
</params>
|
220 |
+
</artist>
|
221 |
+
<aspect_ratio>
|
222 |
+
<class>eems_affiliate/map</class>
|
223 |
+
<method>getDataValue</method>
|
224 |
+
<type>helper</type>
|
225 |
+
<column_name>aspect_ratio</column_name>
|
226 |
+
<params>
|
227 |
+
<format>%.16s</format>
|
228 |
+
</params>
|
229 |
+
</aspect_ratio>
|
230 |
+
<author>
|
231 |
+
<class>eems_affiliate/map</class>
|
232 |
+
<method>getDataValue</method>
|
233 |
+
<type>helper</type>
|
234 |
+
<column_name>author</column_name>
|
235 |
+
<params>
|
236 |
+
<format>%.128s</format>
|
237 |
+
</params>
|
238 |
+
</author>
|
239 |
+
<battery_life>
|
240 |
+
<class>eems_affiliate/map</class>
|
241 |
+
<method>getDataValue</method>
|
242 |
+
<type>helper</type>
|
243 |
+
<column_name>battery_life</column_name>
|
244 |
+
<params>
|
245 |
+
<format>%.32s</format>
|
246 |
+
</params>
|
247 |
+
</battery_life>
|
248 |
+
<binding>
|
249 |
+
<class>eems_affiliate/map</class>
|
250 |
+
<method>getDataValue</method>
|
251 |
+
<type>helper</type>
|
252 |
+
<column_name>binding</column_name>
|
253 |
+
<params>
|
254 |
+
<format>%.32s</format>
|
255 |
+
</params>
|
256 |
+
</binding>
|
257 |
+
<buy_url>
|
258 |
+
<class>eems_affiliate/map</class>
|
259 |
+
<method>getDataValue</method>
|
260 |
+
<type>helper</type>
|
261 |
+
<column_name>buy_url</column_name>
|
262 |
+
<params>
|
263 |
+
<key>product_url</key>
|
264 |
+
<format>%.2000s</format>
|
265 |
+
</params>
|
266 |
+
</buy_url>
|
267 |
+
<category_network>
|
268 |
+
<class>eems_affiliate/map_product</class>
|
269 |
+
<method>getCategory</method>
|
270 |
+
<type>helper</type>
|
271 |
+
<column_name>category_network</column_name>
|
272 |
+
<params>
|
273 |
+
<format>%.256s</format>
|
274 |
+
</params>
|
275 |
+
</category_network>
|
276 |
+
<category_program>
|
277 |
+
<class>eems_affiliate/map_product</class>
|
278 |
+
<method>getCategory</method>
|
279 |
+
<type>helper</type>
|
280 |
+
<column_name>category_program</column_name>
|
281 |
+
<params>
|
282 |
+
<format>%.256s</format>
|
283 |
+
</params>
|
284 |
+
</category_program>
|
285 |
+
<color>
|
286 |
+
<class>eems_affiliate/map</class>
|
287 |
+
<method>getDataValue</method>
|
288 |
+
<type>helper</type>
|
289 |
+
<column_name>color</column_name>
|
290 |
+
<params>
|
291 |
+
<format>%.32s</format>
|
292 |
+
</params>
|
293 |
+
</color>
|
294 |
+
<color_output>
|
295 |
+
<class>eems_affiliate/map</class>
|
296 |
+
<method>getValueYesNo</method>
|
297 |
+
<type>helper</type>
|
298 |
+
<column_name>color_output</column_name>
|
299 |
+
<params>
|
300 |
+
<format>%s</format>
|
301 |
+
</params>
|
302 |
+
</color_output>
|
303 |
+
<condition>
|
304 |
+
<class>eems_affiliate/map</class>
|
305 |
+
<method>getDataValue</method>
|
306 |
+
<type>helper</type>
|
307 |
+
<column_name>condition</column_name>
|
308 |
+
<params>
|
309 |
+
<format>%.64s</format>
|
310 |
+
</params>
|
311 |
+
</condition>
|
312 |
+
<description_long>
|
313 |
+
<class>eems_affiliate/map</class>
|
314 |
+
<method>getDataValue</method>
|
315 |
+
<type>helper</type>
|
316 |
+
<column_name>description_long</column_name>
|
317 |
+
<params>
|
318 |
+
<format>%.2000s</format>
|
319 |
+
</params>
|
320 |
+
</description_long>
|
321 |
+
<description_short>
|
322 |
+
<class>eems_affiliate/map</class>
|
323 |
+
<method>getDataValue</method>
|
324 |
+
<type>helper</type>
|
325 |
+
<column_name>description_short</column_name>
|
326 |
+
<params>
|
327 |
+
<format>%.512s</format>
|
328 |
+
</params>
|
329 |
+
</description_short>
|
330 |
+
<director>
|
331 |
+
<class>eems_affiliate/map</class>
|
332 |
+
<method>getDataValue</method>
|
333 |
+
<type>helper</type>
|
334 |
+
<column_name>director</column_name>
|
335 |
+
<params>
|
336 |
+
<format>%.128s</format>
|
337 |
+
</params>
|
338 |
+
</director>
|
339 |
+
<discontinued>
|
340 |
+
<class>eems_affiliate/map</class>
|
341 |
+
<method>getValueYesNo</method>
|
342 |
+
<type>helper</type>
|
343 |
+
<column_name>discontinued</column_name>
|
344 |
+
<params>
|
345 |
+
<format>%s</format>
|
346 |
+
</params>
|
347 |
+
</discontinued>
|
348 |
+
<display_type>
|
349 |
+
<class>eems_affiliate/map</class>
|
350 |
+
<method>getDataValue</method>
|
351 |
+
<type>helper</type>
|
352 |
+
<column_name>display_type</column_name>
|
353 |
+
<params>
|
354 |
+
<format>%.32s</format>
|
355 |
+
</params>
|
356 |
+
</display_type>
|
357 |
+
<edition>
|
358 |
+
<class>eems_affiliate/map</class>
|
359 |
+
<method>getDataValue</method>
|
360 |
+
<type>helper</type>
|
361 |
+
<column_name>edition</column_name>
|
362 |
+
<params>
|
363 |
+
<format>%.32s</format>
|
364 |
+
</params>
|
365 |
+
</edition>
|
366 |
+
<expiration_date>
|
367 |
+
<class>eems_affiliate/map</class>
|
368 |
+
<method>getDateValue</method>
|
369 |
+
<type>helper</type>
|
370 |
+
<column_name>expiration_date</column_name>
|
371 |
+
<params>
|
372 |
+
<format>Y-m-d</format>
|
373 |
+
</params>
|
374 |
+
</expiration_date>
|
375 |
+
<features>
|
376 |
+
<class>eems_affiliate/map</class>
|
377 |
+
<method>getDataValue</method>
|
378 |
+
<type>helper</type>
|
379 |
+
<column_name>features</column_name>
|
380 |
+
<params>
|
381 |
+
<format>%.128s</format>
|
382 |
+
</params>
|
383 |
+
</features>
|
384 |
+
<focus_type>
|
385 |
+
<class>eems_affiliate/map</class>
|
386 |
+
<method>getDataValue</method>
|
387 |
+
<type>helper</type>
|
388 |
+
<column_name>focus_type</column_name>
|
389 |
+
<params>
|
390 |
+
<format>%.128s</format>
|
391 |
+
</params>
|
392 |
+
</focus_type>
|
393 |
+
<format>
|
394 |
+
<class>eems_affiliate/map</class>
|
395 |
+
<method>getDataValue</method>
|
396 |
+
<type>helper</type>
|
397 |
+
<column_name>format</column_name>
|
398 |
+
<params>
|
399 |
+
<format>%.64s</format>
|
400 |
+
</params>
|
401 |
+
</format>
|
402 |
+
<functions>
|
403 |
+
<class>eems_affiliate/map</class>
|
404 |
+
<method>getDataValue</method>
|
405 |
+
<type>helper</type>
|
406 |
+
<column_name>functions</column_name>
|
407 |
+
<params>
|
408 |
+
<format>%.64s</format>
|
409 |
+
</params>
|
410 |
+
</functions>
|
411 |
+
<genre>
|
412 |
+
<class>eems_affiliate/map</class>
|
413 |
+
<method>getDataValue</method>
|
414 |
+
<type>helper</type>
|
415 |
+
<column_name>genre</column_name>
|
416 |
+
<params>
|
417 |
+
<format>%.64s</format>
|
418 |
+
</params>
|
419 |
+
</genre>
|
420 |
+
<heel_height>
|
421 |
+
<class>eems_affiliate/map</class>
|
422 |
+
<method>getDataValue</method>
|
423 |
+
<type>helper</type>
|
424 |
+
<column_name>heel_height</column_name>
|
425 |
+
<params>
|
426 |
+
<format>%.32s</format>
|
427 |
+
</params>
|
428 |
+
</heel_height>
|
429 |
+
<height>
|
430 |
+
<class>eems_affiliate/map</class>
|
431 |
+
<method>getDataValue</method>
|
432 |
+
<type>helper</type>
|
433 |
+
<column_name>height</column_name>
|
434 |
+
<params>
|
435 |
+
<format>%.32s</format>
|
436 |
+
</params>
|
437 |
+
</height>
|
438 |
+
<image_thumb_url>
|
439 |
+
<class>eems_affiliate/map_product</class>
|
440 |
+
<method>getImageUrl</method>
|
441 |
+
<type>helper</type>
|
442 |
+
<column_name>image_thumb_url</column_name>
|
443 |
+
<params>
|
444 |
+
<format>%.2000s</format>
|
445 |
+
</params>
|
446 |
+
</image_thumb_url>
|
447 |
+
<image_url>
|
448 |
+
<class>eems_affiliate/map_product</class>
|
449 |
+
<method>getImageUrl</method>
|
450 |
+
<type>helper</type>
|
451 |
+
<column_name>image_url</column_name>
|
452 |
+
<params>
|
453 |
+
<format>%.2000s</format>
|
454 |
+
</params>
|
455 |
+
</image_url>
|
456 |
+
<installation>
|
457 |
+
<class>eems_affiliate/map</class>
|
458 |
+
<method>getDataValue</method>
|
459 |
+
<type>helper</type>
|
460 |
+
<column_name>installation</column_name>
|
461 |
+
<params>
|
462 |
+
<format>%.64s</format>
|
463 |
+
</params>
|
464 |
+
</installation>
|
465 |
+
<in_stock>
|
466 |
+
<class>eems_affiliate/map_product</class>
|
467 |
+
<method>getInStockYesNo</method>
|
468 |
+
<type>helper</type>
|
469 |
+
<column_name>in_stock</column_name>
|
470 |
+
<params>
|
471 |
+
<format>%s</format>
|
472 |
+
</params>
|
473 |
+
</in_stock>
|
474 |
+
<isbn>
|
475 |
+
<class>eems_affiliate/map</class>
|
476 |
+
<method>getDataValue</method>
|
477 |
+
<type>helper</type>
|
478 |
+
<column_name>isbn</column_name>
|
479 |
+
<params>
|
480 |
+
<format>%.64s</format>
|
481 |
+
</params>
|
482 |
+
</isbn>
|
483 |
+
<keywords>
|
484 |
+
<class>eems_affiliate/map</class>
|
485 |
+
<method>getDataValue</method>
|
486 |
+
<type>helper</type>
|
487 |
+
<column_name>keywords</column_name>
|
488 |
+
<params>
|
489 |
+
<format>%.256s</format>
|
490 |
+
</params>
|
491 |
+
</keywords>
|
492 |
+
<length>
|
493 |
+
<class>eems_affiliate/map</class>
|
494 |
+
<method>getDataValue</method>
|
495 |
+
<type>helper</type>
|
496 |
+
<column_name>length</column_name>
|
497 |
+
<params>
|
498 |
+
<format>%.32s</format>
|
499 |
+
</params>
|
500 |
+
</length>
|
501 |
+
<load_type>
|
502 |
+
<class>eems_affiliate/map</class>
|
503 |
+
<method>getDataValue</method>
|
504 |
+
<type>helper</type>
|
505 |
+
<column_name>load_type</column_name>
|
506 |
+
<params>
|
507 |
+
<format>%.32s</format>
|
508 |
+
</params>
|
509 |
+
</load_type>
|
510 |
+
<location>
|
511 |
+
<class>eems_affiliate/map</class>
|
512 |
+
<method>getDataValue</method>
|
513 |
+
<type>helper</type>
|
514 |
+
<column_name>location</column_name>
|
515 |
+
<params>
|
516 |
+
<format>%.64s</format>
|
517 |
+
</params>
|
518 |
+
</location>
|
519 |
+
<made_in>
|
520 |
+
<class>eems_affiliate/map</class>
|
521 |
+
<method>getDataValue</method>
|
522 |
+
<type>helper</type>
|
523 |
+
<column_name>made_in</column_name>
|
524 |
+
<params>
|
525 |
+
<format>%.64s</format>
|
526 |
+
</params>
|
527 |
+
</made_in>
|
528 |
+
<manufacturer>
|
529 |
+
<class>eems_affiliate/map</class>
|
530 |
+
<method>getDataValue</method>
|
531 |
+
<type>helper</type>
|
532 |
+
<column_name>manufacturer</column_name>
|
533 |
+
<params>
|
534 |
+
<format>%.128s</format>
|
535 |
+
</params>
|
536 |
+
</manufacturer>
|
537 |
+
<material>
|
538 |
+
<class>eems_affiliate/map</class>
|
539 |
+
<method>getDataValue</method>
|
540 |
+
<type>helper</type>
|
541 |
+
<column_name>material</column_name>
|
542 |
+
<params>
|
543 |
+
<format>%.128s</format>
|
544 |
+
</params>
|
545 |
+
</material>
|
546 |
+
<megapixels>
|
547 |
+
<class>eems_affiliate/map</class>
|
548 |
+
<method>getDataValue</method>
|
549 |
+
<type>helper</type>
|
550 |
+
<column_name>megapixels</column_name>
|
551 |
+
<params>
|
552 |
+
<format>%01.2f</format>
|
553 |
+
</params>
|
554 |
+
</megapixels>
|
555 |
+
<memory_capacity>
|
556 |
+
<class>eems_affiliate/map</class>
|
557 |
+
<method>getDataValue</method>
|
558 |
+
<type>helper</type>
|
559 |
+
<column_name>memory_capacity</column_name>
|
560 |
+
<params>
|
561 |
+
<format>%.64s</format>
|
562 |
+
</params>
|
563 |
+
</memory_capacity>
|
564 |
+
<memory_card_slot>
|
565 |
+
<class>eems_affiliate/map</class>
|
566 |
+
<method>getDataValue</method>
|
567 |
+
<type>helper</type>
|
568 |
+
<column_name>memory_card_slot</column_name>
|
569 |
+
<params>
|
570 |
+
<format>%.32s</format>
|
571 |
+
</params>
|
572 |
+
</memory_card_slot>
|
573 |
+
<memory_type>
|
574 |
+
<class>eems_affiliate/map</class>
|
575 |
+
<method>getDataValue</method>
|
576 |
+
<type>helper</type>
|
577 |
+
<column_name>memory_type</column_name>
|
578 |
+
<params>
|
579 |
+
<format>%.64s</format>
|
580 |
+
</params>
|
581 |
+
</memory_type>
|
582 |
+
<model_number>
|
583 |
+
<class>eems_affiliate/map</class>
|
584 |
+
<method>getDataValue</method>
|
585 |
+
<type>helper</type>
|
586 |
+
<column_name>model_number</column_name>
|
587 |
+
<params>
|
588 |
+
<format>%.128s</format>
|
589 |
+
</params>
|
590 |
+
</model_number>
|
591 |
+
<mpn>
|
592 |
+
<class>eems_affiliate/map</class>
|
593 |
+
<method>getDataValue</method>
|
594 |
+
<type>helper</type>
|
595 |
+
<column_name>mpn</column_name>
|
596 |
+
<params>
|
597 |
+
<format>%.128s</format>
|
598 |
+
</params>
|
599 |
+
</mpn>
|
600 |
+
<name>
|
601 |
+
<class>eems_affiliate/map</class>
|
602 |
+
<method>getDataValue</method>
|
603 |
+
<type>helper</type>
|
604 |
+
<column_name>name</column_name>
|
605 |
+
<params>
|
606 |
+
<format>%.128s</format>
|
607 |
+
</params>
|
608 |
+
</name>
|
609 |
+
<occasion>
|
610 |
+
<class>eems_affiliate/map</class>
|
611 |
+
<method>getDataValue</method>
|
612 |
+
<type>helper</type>
|
613 |
+
<column_name>occasion</column_name>
|
614 |
+
<params>
|
615 |
+
<format>%.128s</format>
|
616 |
+
</params>
|
617 |
+
</occasion>
|
618 |
+
<operating_system>
|
619 |
+
<class>eems_affiliate/map</class>
|
620 |
+
<method>getDataValue</method>
|
621 |
+
<type>helper</type>
|
622 |
+
<column_name>operating_system</column_name>
|
623 |
+
<params>
|
624 |
+
<format>%.128s</format>
|
625 |
+
</params>
|
626 |
+
</operating_system>
|
627 |
+
<optical_drive>
|
628 |
+
<class>eems_affiliate/map</class>
|
629 |
+
<method>getDataValue</method>
|
630 |
+
<type>helper</type>
|
631 |
+
<column_name>optical_drive</column_name>
|
632 |
+
<params>
|
633 |
+
<format>%.64s</format>
|
634 |
+
</params>
|
635 |
+
</optical_drive>
|
636 |
+
<pages>
|
637 |
+
<class>eems_affiliate/map</class>
|
638 |
+
<method>getDataValue</method>
|
639 |
+
<type>helper</type>
|
640 |
+
<column_name>pages</column_name>
|
641 |
+
<params>
|
642 |
+
<format>%.11d</format>
|
643 |
+
</params>
|
644 |
+
</pages>
|
645 |
+
<payment_accepted>
|
646 |
+
<class>eems_affiliate/map</class>
|
647 |
+
<method>getDataValue</method>
|
648 |
+
<type>helper</type>
|
649 |
+
<column_name>payment_accepted</column_name>
|
650 |
+
<params>
|
651 |
+
<format>%.128s</format>
|
652 |
+
</params>
|
653 |
+
</payment_accepted>
|
654 |
+
<payment_notes>
|
655 |
+
<class>eems_affiliate/map</class>
|
656 |
+
<method>getDataValue</method>
|
657 |
+
<type>helper</type>
|
658 |
+
<column_name>payment_notes</column_name>
|
659 |
+
<params>
|
660 |
+
<format>%.256s</format>
|
661 |
+
</params>
|
662 |
+
</payment_notes>
|
663 |
+
<platform>
|
664 |
+
<class>eems_affiliate/map</class>
|
665 |
+
<method>getDataValue</method>
|
666 |
+
<type>helper</type>
|
667 |
+
<column_name>platform</column_name>
|
668 |
+
<params>
|
669 |
+
<format>%.64s</format>
|
670 |
+
</params>
|
671 |
+
</platform>
|
672 |
+
<price>
|
673 |
+
<class>eems_affiliate/map</class>
|
674 |
+
<method>getDataValue</method>
|
675 |
+
<type>helper</type>
|
676 |
+
<column_name>price</column_name>
|
677 |
+
<params>
|
678 |
+
<format>%01.2f</format>
|
679 |
+
</params>
|
680 |
+
</price>
|
681 |
+
<price_retail>
|
682 |
+
<class>eems_affiliate/map</class>
|
683 |
+
<method>getDataValue</method>
|
684 |
+
<type>helper</type>
|
685 |
+
<column_name>price_retail</column_name>
|
686 |
+
<params>
|
687 |
+
<format>%01.2f</format>
|
688 |
+
</params>
|
689 |
+
</price_retail>
|
690 |
+
<price_sale>
|
691 |
+
<class>eems_affiliate/map</class>
|
692 |
+
<method>getDataValue</method>
|
693 |
+
<type>helper</type>
|
694 |
+
<column_name>price_sale</column_name>
|
695 |
+
<params>
|
696 |
+
<format>%01.2f</format>
|
697 |
+
</params>
|
698 |
+
</price_sale>
|
699 |
+
<price_shipping>
|
700 |
+
<class>eems_affiliate/map</class>
|
701 |
+
<method>getDataValue</method>
|
702 |
+
<type>helper</type>
|
703 |
+
<column_name>price_shipping</column_name>
|
704 |
+
<params>
|
705 |
+
<format>%01.2f</format>
|
706 |
+
</params>
|
707 |
+
</price_shipping>
|
708 |
+
<processor>
|
709 |
+
<class>eems_affiliate/map</class>
|
710 |
+
<method>getDataValue</method>
|
711 |
+
<type>helper</type>
|
712 |
+
<column_name>processor</column_name>
|
713 |
+
<params>
|
714 |
+
<format>%.64s</format>
|
715 |
+
</params>
|
716 |
+
</processor>
|
717 |
+
<publisher>
|
718 |
+
<class>eems_affiliate/map</class>
|
719 |
+
<method>getDataValue</method>
|
720 |
+
<type>helper</type>
|
721 |
+
<column_name>publisher</column_name>
|
722 |
+
<params>
|
723 |
+
<format>%.128s</format>
|
724 |
+
</params>
|
725 |
+
</publisher>
|
726 |
+
<quantity_in_stock>
|
727 |
+
<class>eems_affiliate/map_product</class>
|
728 |
+
<method>getInStockQty</method>
|
729 |
+
<type>helper</type>
|
730 |
+
<column_name>quantity_in_stock</column_name>
|
731 |
+
<params>
|
732 |
+
<format>%.11d</format>
|
733 |
+
</params>
|
734 |
+
</quantity_in_stock>
|
735 |
+
<rating>
|
736 |
+
<class>eems_affiliate/map</class>
|
737 |
+
<method>getDataValue</method>
|
738 |
+
<type>helper</type>
|
739 |
+
<column_name>rating</column_name>
|
740 |
+
<params>
|
741 |
+
<format>%.32s</format>
|
742 |
+
</params>
|
743 |
+
</rating>
|
744 |
+
<recommended_usage>
|
745 |
+
<class>eems_affiliate/map</class>
|
746 |
+
<method>getDataValue</method>
|
747 |
+
<type>helper</type>
|
748 |
+
<column_name>recommended_usage</column_name>
|
749 |
+
<params>
|
750 |
+
<format>%.128s</format>
|
751 |
+
</params>
|
752 |
+
</recommended_usage>
|
753 |
+
<resolution>
|
754 |
+
<class>eems_affiliate/map</class>
|
755 |
+
<method>getDataValue</method>
|
756 |
+
<type>helper</type>
|
757 |
+
<column_name>resolution</column_name>
|
758 |
+
<params>
|
759 |
+
<format>%.64s</format>
|
760 |
+
</params>
|
761 |
+
</resolution>
|
762 |
+
<screen_size>
|
763 |
+
<class>eems_affiliate/map</class>
|
764 |
+
<method>getDataValue</method>
|
765 |
+
<type>helper</type>
|
766 |
+
<column_name>screen_size</column_name>
|
767 |
+
<params>
|
768 |
+
<format>%.32s</format>
|
769 |
+
</params>
|
770 |
+
</screen_size>
|
771 |
+
<shipping_method>
|
772 |
+
<class>eems_affiliate/map</class>
|
773 |
+
<method>getDataValue</method>
|
774 |
+
<type>helper</type>
|
775 |
+
<column_name>shipping_method</column_name>
|
776 |
+
<params>
|
777 |
+
<format>%.64s</format>
|
778 |
+
</params>
|
779 |
+
</shipping_method>
|
780 |
+
<shoe_size>
|
781 |
+
<class>eems_affiliate/map</class>
|
782 |
+
<method>getDataValue</method>
|
783 |
+
<type>helper</type>
|
784 |
+
<column_name>shoe_size</column_name>
|
785 |
+
<params>
|
786 |
+
<format>%.32s</format>
|
787 |
+
</params>
|
788 |
+
</shoe_size>
|
789 |
+
<shoe_width>
|
790 |
+
<class>eems_affiliate/map</class>
|
791 |
+
<method>getDataValue</method>
|
792 |
+
<type>helper</type>
|
793 |
+
<column_name>shoe_width</column_name>
|
794 |
+
<params>
|
795 |
+
<format>%.32s</format>
|
796 |
+
</params>
|
797 |
+
</shoe_width>
|
798 |
+
<size>
|
799 |
+
<class>eems_affiliate/map</class>
|
800 |
+
<method>getDataValue</method>
|
801 |
+
<type>helper</type>
|
802 |
+
<column_name>size</column_name>
|
803 |
+
<params>
|
804 |
+
<format>%.32s</format>
|
805 |
+
</params>
|
806 |
+
</size>
|
807 |
+
<sku>
|
808 |
+
<class>eems_affiliate/map</class>
|
809 |
+
<method>getDataValue</method>
|
810 |
+
<type>helper</type>
|
811 |
+
<column_name>sku</column_name>
|
812 |
+
<params>
|
813 |
+
<format>%.128s</format>
|
814 |
+
</params>
|
815 |
+
</sku>
|
816 |
+
<staring>
|
817 |
+
<class>eems_affiliate/map</class>
|
818 |
+
<method>getDataValue</method>
|
819 |
+
<type>helper</type>
|
820 |
+
<column_name>staring</column_name>
|
821 |
+
<params>
|
822 |
+
<format>%.128s</format>
|
823 |
+
</params>
|
824 |
+
</staring>
|
825 |
+
<style>
|
826 |
+
<class>eems_affiliate/map</class>
|
827 |
+
<method>getDataValue</method>
|
828 |
+
<type>helper</type>
|
829 |
+
<column_name>style</column_name>
|
830 |
+
<params>
|
831 |
+
<format>%.64s</format>
|
832 |
+
</params>
|
833 |
+
</style>
|
834 |
+
<tech_spec_url>
|
835 |
+
<class>eems_affiliate/map</class>
|
836 |
+
<method>getDataValue</method>
|
837 |
+
<type>helper</type>
|
838 |
+
<column_name>tech_spec_url</column_name>
|
839 |
+
<params>
|
840 |
+
<format>%.2000s</format>
|
841 |
+
</params>
|
842 |
+
</tech_spec_url>
|
843 |
+
<tracks>
|
844 |
+
<class>eems_affiliate/map</class>
|
845 |
+
<method>getDataValue</method>
|
846 |
+
<type>helper</type>
|
847 |
+
<column_name>tracks</column_name>
|
848 |
+
<params>
|
849 |
+
<format>%.11d</format>
|
850 |
+
</params>
|
851 |
+
</tracks>
|
852 |
+
<upc>
|
853 |
+
<class>eems_affiliate/map</class>
|
854 |
+
<method>getDataValue</method>
|
855 |
+
<type>helper</type>
|
856 |
+
<column_name>upc</column_name>
|
857 |
+
<params>
|
858 |
+
<format>%.128s</format>
|
859 |
+
</params>
|
860 |
+
</upc>
|
861 |
+
<weight>
|
862 |
+
<class>eems_affiliate/map</class>
|
863 |
+
<method>getDataValue</method>
|
864 |
+
<type>helper</type>
|
865 |
+
<column_name>weight</column_name>
|
866 |
+
<params>
|
867 |
+
<format>%.32s</format>
|
868 |
+
</params>
|
869 |
+
</weight>
|
870 |
+
<width>
|
871 |
+
<class>eems_affiliate/map</class>
|
872 |
+
<method>getDataValue</method>
|
873 |
+
<type>helper</type>
|
874 |
+
<column_name>width</column_name>
|
875 |
+
<params>
|
876 |
+
<format>%.32s</format>
|
877 |
+
</params>
|
878 |
+
</width>
|
879 |
+
<wireless_interface>
|
880 |
+
<class>eems_affiliate/map</class>
|
881 |
+
<method>getDataValue</method>
|
882 |
+
<type>helper</type>
|
883 |
+
<column_name>wireless_interface</column_name>
|
884 |
+
<params>
|
885 |
+
<format>%.32s</format>
|
886 |
+
</params>
|
887 |
+
</wireless_interface>
|
888 |
+
<year>
|
889 |
+
<class>eems_affiliate/map</class>
|
890 |
+
<method>getYearValue</method>
|
891 |
+
<type>helper</type>
|
892 |
+
<column_name>year</column_name>
|
893 |
+
<params>
|
894 |
+
<format>%.dd</format>
|
895 |
+
</params>
|
896 |
+
</year>
|
897 |
+
<zoom>
|
898 |
+
<class>eems_affiliate/map</class>
|
899 |
+
<method>getDataValue</method>
|
900 |
+
<type>helper</type>
|
901 |
+
<column_name>zoom</column_name>
|
902 |
+
<params>
|
903 |
+
<format>%.32s</format>
|
904 |
+
</params>
|
905 |
+
</zoom>
|
906 |
+
</callback_mappings>
|
907 |
+
<order_dynamic>
|
908 |
+
<fields>dynamic_program_id,dynamic_item_order_id,dynamic_item_id,dynamic_item_price,item_quantity,category,new_to_file</fields>
|
909 |
+
<file_name_format>%s_transactions_corrected_%s.csv</file_name_format>
|
910 |
+
</order_dynamic>
|
911 |
+
<order_itemized>
|
912 |
+
<fields>program_id,item_order_id,item_id,item_price,item_quantity,reason</fields>
|
913 |
+
<file_name_format>%s_transactions_corrected_%s.csv</file_name_format>
|
914 |
+
</order_itemized>
|
915 |
+
<order_basic>
|
916 |
+
<fields>program_id,order_amount,order_id,reason,transaction_type</fields>
|
917 |
+
<file_name_format>%s_transactions_corrected_%s.csv</file_name_format>
|
918 |
+
</order_basic>
|
919 |
+
<product>
|
920 |
+
<file_name_format>%s_product_feed.csv</file_name_format>
|
921 |
+
</product>
|
922 |
+
</feeds>
|
923 |
+
</eems_affiliate>
|
924 |
+
<eems_affiliate_product_attribute_map>
|
925 |
+
<!--
|
926 |
+
The purpose of this mapping is enabled the coexistence of both
|
927 |
+
pre-configured product attributes mapping and configured attributes
|
928 |
+
mapping for the affiliate product feed. This means that when this
|
929 |
+
module is installed and no other attribute is configured for the
|
930 |
+
product feed the required pre-mapped attributes will be sufficient
|
931 |
+
enough to generate a valid product feed.
|
932 |
+
-->
|
933 |
+
<age_range/>
|
934 |
+
<artist/>
|
935 |
+
<aspect_ratio/>
|
936 |
+
<author/>
|
937 |
+
<battery_life/>
|
938 |
+
<binding/>
|
939 |
+
<buy_url>product_url</buy_url>
|
940 |
+
<category_network/>
|
941 |
+
<category_program>category</category_program>
|
942 |
+
<color/>
|
943 |
+
<color_output/>
|
944 |
+
<condition/>
|
945 |
+
<description_long>description</description_long>
|
946 |
+
<description_short>short_description</description_short>
|
947 |
+
<director/>
|
948 |
+
<discontinued/>
|
949 |
+
<display_type/>
|
950 |
+
<edition/>
|
951 |
+
<expiration_date/>
|
952 |
+
<features/>
|
953 |
+
<focus_type/>
|
954 |
+
<format/>
|
955 |
+
<functions/>
|
956 |
+
<genre/>
|
957 |
+
<heel_height/>
|
958 |
+
<height/>
|
959 |
+
<image_thumb_url>thumbnail</image_thumb_url>
|
960 |
+
<image_url>image</image_url>
|
961 |
+
<installation/>
|
962 |
+
<in_stock/>
|
963 |
+
<isbn/>
|
964 |
+
<keywords>meta_keyword</keywords>
|
965 |
+
<length/>
|
966 |
+
<load_type/>
|
967 |
+
<location/>
|
968 |
+
<made_in/>
|
969 |
+
<manufacturer>manufacturer</manufacturer>
|
970 |
+
<material/>
|
971 |
+
<megapixels/>
|
972 |
+
<memory_capacity/>
|
973 |
+
<memory_card_slot/>
|
974 |
+
<memory_type/>
|
975 |
+
<model_number/>
|
976 |
+
<mpn/>
|
977 |
+
<name>name</name>
|
978 |
+
<occasion/>
|
979 |
+
<operating_system/>
|
980 |
+
<optical_drive/>
|
981 |
+
<pages/>
|
982 |
+
<payment_accepted/>
|
983 |
+
<payment_notes/>
|
984 |
+
<platform/>
|
985 |
+
<price>price</price>
|
986 |
+
<price_retail>msrp</price_retail>
|
987 |
+
<price_sale>special_price</price_sale>
|
988 |
+
<price_shipping/>
|
989 |
+
<processor/>
|
990 |
+
<publisher/>
|
991 |
+
<quantity_in_stock>qty</quantity_in_stock>
|
992 |
+
<rating/>
|
993 |
+
<recommended_usage/>
|
994 |
+
<resolution/>
|
995 |
+
<screen_size/>
|
996 |
+
<shipping_method/>
|
997 |
+
<shoe_size/>
|
998 |
+
<shoe_width/>
|
999 |
+
<size/>
|
1000 |
+
<sku>sku</sku>
|
1001 |
+
<staring/>
|
1002 |
+
<style/>
|
1003 |
+
<tech_spec_url/>
|
1004 |
+
<tracks/>
|
1005 |
+
<upc/>
|
1006 |
+
<weight/>
|
1007 |
+
<width/>
|
1008 |
+
<wireless_interface/>
|
1009 |
+
<year/>
|
1010 |
+
<zoom/>
|
1011 |
+
</eems_affiliate_product_attribute_map>
|
1012 |
+
</marketing_solutions>
|
1013 |
+
</default>
|
1014 |
+
<frontend>
|
1015 |
+
<layout>
|
1016 |
+
<updates>
|
1017 |
+
<eems_affiliate>
|
1018 |
+
<file>eems_affiliate.xml</file>
|
1019 |
+
</eems_affiliate>
|
1020 |
+
</updates>
|
1021 |
+
</layout>
|
1022 |
+
</frontend>
|
1023 |
+
<phpunit>
|
1024 |
+
<suite>
|
1025 |
+
<modules>
|
1026 |
+
<EbayEnterprise_Affiliate/>
|
1027 |
+
</modules>
|
1028 |
+
</suite>
|
1029 |
+
</phpunit>
|
1030 |
+
</config>
|
app/code/community/EbayEnterprise/Affiliate/etc/system.xml
CHANGED
@@ -1,913 +1,931 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!--
|
3 |
-
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
|
5 |
-
NOTICE OF LICENSE
|
6 |
-
|
7 |
-
This source file is subject to the eBay Enterprise
|
8 |
-
Magento Extensions End User License Agreement
|
9 |
-
that is bundled with this package in the file LICENSE.md.
|
10 |
-
It is also available through the world-wide-web at this URL:
|
11 |
-
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
|
13 |
-
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
-->
|
16 |
-
<config>
|
17 |
-
<tabs>
|
18 |
-
<ebayenterprise translate="label" module="eems_affiliate">
|
19 |
-
<label>eBay Enterprise</label>
|
20 |
-
<sort_order>550</sort_order>
|
21 |
-
</ebayenterprise>
|
22 |
-
</tabs>
|
23 |
-
<sections>
|
24 |
-
<marketing_solutions translate="label" module="eems_affiliate">
|
25 |
-
<class>separator-top</class>
|
26 |
-
<label>Marketing Solutions</label>
|
27 |
-
<tab>ebayenterprise</tab>
|
28 |
-
<frontend_type>text</frontend_type>
|
29 |
-
<sort_order>550</sort_order>
|
30 |
-
<show_in_default>1</show_in_default>
|
31 |
-
<show_in_website>1</show_in_website>
|
32 |
-
<show_in_store>1</show_in_store>
|
33 |
-
<groups>
|
34 |
-
<eems_affiliate translate="label comment">
|
35 |
-
<label>Affiliate</label>
|
36 |
-
<comment><![CDATA[Your program ID and other information can be found within your EEAN advertiser account. Don’t have an account yet? <a href='https://www.pepperjamnetwork.com/register/basic' target='_pjregister'>Register</a> for one today!]]></comment>
|
37 |
-
<frontend_type>text</frontend_type>
|
38 |
-
<sort_order>100</sort_order>
|
39 |
-
<show_in_default>1</show_in_default>
|
40 |
-
<show_in_website>1</show_in_website>
|
41 |
-
<show_in_store>1</show_in_store>
|
42 |
-
<fields>
|
43 |
-
<active translate="label">
|
44 |
-
<label>Enable Affiliate Tracking</label>
|
45 |
-
<frontend_type>select</frontend_type>
|
46 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
47 |
-
<sort_order>1</sort_order>
|
48 |
-
<show_in_default>1</show_in_default>
|
49 |
-
<show_in_website>0</show_in_website>
|
50 |
-
<show_in_store>0</show_in_store>
|
51 |
-
</active>
|
52 |
-
<program_id translate="label comment">
|
53 |
-
<label>Program Id</label>
|
54 |
-
<comment>Your Program Id will be provided to you by eBay Enterprise Affiliate</comment>
|
55 |
-
<frontend_type>text</frontend_type>
|
56 |
-
<sort_order>10</sort_order>
|
57 |
-
<show_in_default>1</show_in_default>
|
58 |
-
<show_in_website>1</show_in_website>
|
59 |
-
<show_in_store>0</show_in_store>
|
60 |
-
</program_id>
|
61 |
-
<
|
62 |
-
<label>
|
63 |
-
<frontend_type>select</frontend_type>
|
64 |
-
<source_model>
|
65 |
-
<sort_order>20</sort_order>
|
66 |
-
<show_in_default>1</show_in_default>
|
67 |
-
<show_in_website>0</show_in_website>
|
68 |
-
<show_in_store>0</show_in_store>
|
69 |
-
</
|
70 |
-
<transaction_type translate="label comment">
|
71 |
-
<label>Transaction Type</label>
|
72 |
-
<comment>Sale transactions pay publishers a percentage of the sale, lead transactions pay publishes a flat amount for an action.</comment>
|
73 |
-
<frontend_type>select</frontend_type>
|
74 |
-
<source_model>eems_affiliate/system_config_source_transactiontype</source_model>
|
75 |
-
<depends>
|
76 |
-
<
|
77 |
-
</depends>
|
78 |
-
<sort_order>30</sort_order>
|
79 |
-
<show_in_default>1</show_in_default>
|
80 |
-
<show_in_website>0</show_in_website>
|
81 |
-
<show_in_store>0</show_in_store>
|
82 |
-
</transaction_type>
|
83 |
-
<export_path translate="label comment">
|
84 |
-
<label>Export Path</label>
|
85 |
-
<comment>Default local path to export feeds to. These feeds will need to be made available to eBay Enterprise Affiliate via FTP.</comment>
|
86 |
-
<frontend_type>text</frontend_type>
|
87 |
-
<sort_order>50</sort_order>
|
88 |
-
<show_in_default>1</show_in_default>
|
89 |
-
<show_in_website>0</show_in_website>
|
90 |
-
<show_in_store>0</show_in_store>
|
91 |
-
</export_path>
|
92 |
-
<conditional_pixel_enabled translate="label">
|
93 |
-
<label>Conditional Pixel</label>
|
94 |
-
<frontend_type>select</frontend_type>
|
95 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
96 |
-
<sort_order>60</sort_order>
|
97 |
-
<show_in_default>1</show_in_default>
|
98 |
-
<show_in_website>0</show_in_website>
|
99 |
-
<show_in_store>0</show_in_store>
|
100 |
-
</conditional_pixel_enabled>
|
101 |
-
<source_key_name translate="label comment">
|
102 |
-
<label>Query String Key Name</label>
|
103 |
-
<comment>Only apply the pixel if the query string includes this key.</comment>
|
104 |
-
<frontend_type>text</frontend_type>
|
105 |
-
<depends>
|
106 |
-
<conditional_pixel_enabled>1</conditional_pixel_enabled>
|
107 |
-
</depends>
|
108 |
-
<sort_order>70</sort_order>
|
109 |
-
<show_in_default>1</show_in_default>
|
110 |
-
<show_in_website>0</show_in_website>
|
111 |
-
<show_in_store>0</show_in_store>
|
112 |
-
</source_key_name>
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
<
|
125 |
-
<
|
126 |
-
<
|
127 |
-
<
|
128 |
-
<
|
129 |
-
<
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
<
|
145 |
-
<
|
146 |
-
<
|
147 |
-
<
|
148 |
-
<
|
149 |
-
<
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
<
|
155 |
-
<
|
156 |
-
<
|
157 |
-
<
|
158 |
-
<
|
159 |
-
<
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
<
|
165 |
-
<
|
166 |
-
<
|
167 |
-
<
|
168 |
-
<
|
169 |
-
<
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
<
|
175 |
-
<
|
176 |
-
<
|
177 |
-
<
|
178 |
-
<
|
179 |
-
<
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
<
|
185 |
-
<
|
186 |
-
<
|
187 |
-
<
|
188 |
-
<
|
189 |
-
<
|
190 |
-
|
191 |
-
|
192 |
-
<
|
193 |
-
|
194 |
-
|
195 |
-
<
|
196 |
-
<
|
197 |
-
<
|
198 |
-
<
|
199 |
-
<
|
200 |
-
|
201 |
-
|
202 |
-
<
|
203 |
-
|
204 |
-
|
205 |
-
<
|
206 |
-
<
|
207 |
-
<
|
208 |
-
<
|
209 |
-
<
|
210 |
-
<
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
<
|
216 |
-
<
|
217 |
-
<
|
218 |
-
<
|
219 |
-
<
|
220 |
-
<
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
<
|
226 |
-
<
|
227 |
-
<
|
228 |
-
<
|
229 |
-
<
|
230 |
-
<
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
<
|
236 |
-
<
|
237 |
-
<
|
238 |
-
<
|
239 |
-
<
|
240 |
-
<
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
<
|
246 |
-
<
|
247 |
-
<
|
248 |
-
<
|
249 |
-
<
|
250 |
-
<
|
251 |
-
|
252 |
-
|
253 |
-
<
|
254 |
-
|
255 |
-
|
256 |
-
<
|
257 |
-
<
|
258 |
-
<
|
259 |
-
<
|
260 |
-
<
|
261 |
-
|
262 |
-
|
263 |
-
<
|
264 |
-
|
265 |
-
|
266 |
-
<
|
267 |
-
<
|
268 |
-
<
|
269 |
-
<
|
270 |
-
<
|
271 |
-
<
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
<
|
277 |
-
<
|
278 |
-
<
|
279 |
-
<
|
280 |
-
<
|
281 |
-
<
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
<
|
287 |
-
<
|
288 |
-
<
|
289 |
-
<
|
290 |
-
<
|
291 |
-
<
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
<
|
297 |
-
<
|
298 |
-
<
|
299 |
-
<
|
300 |
-
<
|
301 |
-
<
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
<
|
307 |
-
<
|
308 |
-
<
|
309 |
-
<
|
310 |
-
<
|
311 |
-
<
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
<
|
317 |
-
<
|
318 |
-
<
|
319 |
-
<
|
320 |
-
<
|
321 |
-
<
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
<
|
327 |
-
<
|
328 |
-
<
|
329 |
-
<
|
330 |
-
<
|
331 |
-
<
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
<
|
337 |
-
<
|
338 |
-
<
|
339 |
-
<
|
340 |
-
<
|
341 |
-
<
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
<
|
347 |
-
<
|
348 |
-
<
|
349 |
-
<
|
350 |
-
<
|
351 |
-
<
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
<
|
357 |
-
<
|
358 |
-
<
|
359 |
-
<
|
360 |
-
<
|
361 |
-
<
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
<
|
367 |
-
<
|
368 |
-
<
|
369 |
-
<
|
370 |
-
<
|
371 |
-
<
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
<
|
377 |
-
<
|
378 |
-
<
|
379 |
-
<
|
380 |
-
<
|
381 |
-
<
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
<
|
387 |
-
<
|
388 |
-
<
|
389 |
-
<
|
390 |
-
<
|
391 |
-
<
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
<
|
397 |
-
<
|
398 |
-
<
|
399 |
-
<
|
400 |
-
<
|
401 |
-
<
|
402 |
-
|
403 |
-
|
404 |
-
<
|
405 |
-
|
406 |
-
|
407 |
-
<
|
408 |
-
<
|
409 |
-
<
|
410 |
-
<
|
411 |
-
<
|
412 |
-
|
413 |
-
|
414 |
-
<
|
415 |
-
|
416 |
-
|
417 |
-
<
|
418 |
-
<
|
419 |
-
<
|
420 |
-
<
|
421 |
-
<
|
422 |
-
<
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
<
|
428 |
-
<
|
429 |
-
<
|
430 |
-
<
|
431 |
-
<
|
432 |
-
<
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
<
|
438 |
-
<
|
439 |
-
<
|
440 |
-
<
|
441 |
-
<
|
442 |
-
<
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
<
|
448 |
-
<
|
449 |
-
<
|
450 |
-
<
|
451 |
-
<
|
452 |
-
<
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
<
|
458 |
-
<
|
459 |
-
<
|
460 |
-
<
|
461 |
-
<
|
462 |
-
<
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
<
|
468 |
-
<
|
469 |
-
<
|
470 |
-
<
|
471 |
-
<
|
472 |
-
<
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
<
|
478 |
-
<
|
479 |
-
<
|
480 |
-
<
|
481 |
-
<
|
482 |
-
<
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
<
|
488 |
-
<
|
489 |
-
<
|
490 |
-
<
|
491 |
-
<
|
492 |
-
<
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
<
|
498 |
-
<
|
499 |
-
<
|
500 |
-
<
|
501 |
-
<
|
502 |
-
<
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
<
|
508 |
-
<
|
509 |
-
<
|
510 |
-
<
|
511 |
-
<
|
512 |
-
<
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
<
|
518 |
-
<
|
519 |
-
<
|
520 |
-
<
|
521 |
-
<
|
522 |
-
<
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
<
|
528 |
-
<
|
529 |
-
<
|
530 |
-
<
|
531 |
-
<
|
532 |
-
<
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
<
|
538 |
-
<
|
539 |
-
<
|
540 |
-
<
|
541 |
-
<
|
542 |
-
<
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
<
|
548 |
-
<
|
549 |
-
<
|
550 |
-
<
|
551 |
-
<
|
552 |
-
<
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
<
|
558 |
-
<
|
559 |
-
<
|
560 |
-
<
|
561 |
-
<
|
562 |
-
<
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
<
|
568 |
-
<
|
569 |
-
<
|
570 |
-
<
|
571 |
-
<
|
572 |
-
<
|
573 |
-
|
574 |
-
|
575 |
-
<
|
576 |
-
|
577 |
-
|
578 |
-
<
|
579 |
-
<
|
580 |
-
<
|
581 |
-
<
|
582 |
-
<
|
583 |
-
|
584 |
-
|
585 |
-
<
|
586 |
-
|
587 |
-
|
588 |
-
<
|
589 |
-
<
|
590 |
-
<
|
591 |
-
<
|
592 |
-
<
|
593 |
-
<
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
<
|
599 |
-
<
|
600 |
-
<
|
601 |
-
<
|
602 |
-
<
|
603 |
-
<
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
<
|
609 |
-
<
|
610 |
-
<
|
611 |
-
<
|
612 |
-
<
|
613 |
-
<
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
<
|
619 |
-
<
|
620 |
-
<
|
621 |
-
<
|
622 |
-
<
|
623 |
-
<
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
<
|
629 |
-
<
|
630 |
-
<
|
631 |
-
<
|
632 |
-
<
|
633 |
-
<
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
<
|
639 |
-
<
|
640 |
-
<
|
641 |
-
<
|
642 |
-
<
|
643 |
-
<
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
<
|
649 |
-
<
|
650 |
-
<
|
651 |
-
<
|
652 |
-
<
|
653 |
-
<
|
654 |
-
|
655 |
-
|
656 |
-
<
|
657 |
-
|
658 |
-
|
659 |
-
<
|
660 |
-
<
|
661 |
-
<
|
662 |
-
<
|
663 |
-
<
|
664 |
-
|
665 |
-
|
666 |
-
<
|
667 |
-
|
668 |
-
|
669 |
-
<
|
670 |
-
<
|
671 |
-
<
|
672 |
-
<
|
673 |
-
<
|
674 |
-
<
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
<
|
680 |
-
<
|
681 |
-
<
|
682 |
-
<
|
683 |
-
<
|
684 |
-
<
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
<
|
690 |
-
<
|
691 |
-
<
|
692 |
-
<
|
693 |
-
<
|
694 |
-
<
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
<
|
700 |
-
<
|
701 |
-
<
|
702 |
-
<
|
703 |
-
<
|
704 |
-
<
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
<
|
710 |
-
<
|
711 |
-
<
|
712 |
-
<
|
713 |
-
<
|
714 |
-
<
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
<
|
720 |
-
<
|
721 |
-
<
|
722 |
-
<
|
723 |
-
<
|
724 |
-
<
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
<
|
730 |
-
<
|
731 |
-
<
|
732 |
-
<
|
733 |
-
<
|
734 |
-
<
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
<
|
740 |
-
<
|
741 |
-
<
|
742 |
-
<
|
743 |
-
<
|
744 |
-
<
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
<
|
750 |
-
<
|
751 |
-
<
|
752 |
-
<
|
753 |
-
<
|
754 |
-
<
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
<
|
760 |
-
<
|
761 |
-
<
|
762 |
-
<
|
763 |
-
<
|
764 |
-
<
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
<
|
770 |
-
<
|
771 |
-
<
|
772 |
-
<
|
773 |
-
<
|
774 |
-
<
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
<
|
780 |
-
<
|
781 |
-
<
|
782 |
-
<
|
783 |
-
<
|
784 |
-
<
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
<
|
790 |
-
<
|
791 |
-
<
|
792 |
-
<
|
793 |
-
<
|
794 |
-
<
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
<
|
800 |
-
<
|
801 |
-
<
|
802 |
-
<
|
803 |
-
<
|
804 |
-
<
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
<
|
810 |
-
<
|
811 |
-
<
|
812 |
-
<
|
813 |
-
<
|
814 |
-
<
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
<
|
820 |
-
<
|
821 |
-
<
|
822 |
-
<
|
823 |
-
<
|
824 |
-
<
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
<
|
830 |
-
<
|
831 |
-
<
|
832 |
-
<
|
833 |
-
<
|
834 |
-
<
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
<
|
840 |
-
<
|
841 |
-
<
|
842 |
-
<
|
843 |
-
<
|
844 |
-
<
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
<
|
850 |
-
<
|
851 |
-
<
|
852 |
-
<
|
853 |
-
<
|
854 |
-
<
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
<
|
860 |
-
<
|
861 |
-
<
|
862 |
-
<
|
863 |
-
<
|
864 |
-
<
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
<
|
870 |
-
<
|
871 |
-
<
|
872 |
-
<
|
873 |
-
<
|
874 |
-
<
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
<
|
880 |
-
<
|
881 |
-
<
|
882 |
-
<
|
883 |
-
<
|
884 |
-
<
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
<
|
890 |
-
<
|
891 |
-
<
|
892 |
-
<
|
893 |
-
<
|
894 |
-
<
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
<
|
900 |
-
<
|
901 |
-
<
|
902 |
-
<
|
903 |
-
<
|
904 |
-
<
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!--
|
3 |
+
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
|
5 |
+
NOTICE OF LICENSE
|
6 |
+
|
7 |
+
This source file is subject to the eBay Enterprise
|
8 |
+
Magento Extensions End User License Agreement
|
9 |
+
that is bundled with this package in the file LICENSE.md.
|
10 |
+
It is also available through the world-wide-web at this URL:
|
11 |
+
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
|
13 |
+
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
-->
|
16 |
+
<config>
|
17 |
+
<tabs>
|
18 |
+
<ebayenterprise translate="label" module="eems_affiliate">
|
19 |
+
<label>eBay Enterprise</label>
|
20 |
+
<sort_order>550</sort_order>
|
21 |
+
</ebayenterprise>
|
22 |
+
</tabs>
|
23 |
+
<sections>
|
24 |
+
<marketing_solutions translate="label" module="eems_affiliate">
|
25 |
+
<class>separator-top</class>
|
26 |
+
<label>Marketing Solutions</label>
|
27 |
+
<tab>ebayenterprise</tab>
|
28 |
+
<frontend_type>text</frontend_type>
|
29 |
+
<sort_order>550</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
<groups>
|
34 |
+
<eems_affiliate translate="label comment">
|
35 |
+
<label>Affiliate</label>
|
36 |
+
<comment><![CDATA[Your program ID and other information can be found within your EEAN advertiser account. Don’t have an account yet? <a href='https://www.pepperjamnetwork.com/register/basic' target='_pjregister'>Register</a> for one today!]]></comment>
|
37 |
+
<frontend_type>text</frontend_type>
|
38 |
+
<sort_order>100</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
<fields>
|
43 |
+
<active translate="label">
|
44 |
+
<label>Enable Affiliate Tracking</label>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
47 |
+
<sort_order>1</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>0</show_in_website>
|
50 |
+
<show_in_store>0</show_in_store>
|
51 |
+
</active>
|
52 |
+
<program_id translate="label comment">
|
53 |
+
<label>Program Id</label>
|
54 |
+
<comment>Your Program Id will be provided to you by eBay Enterprise Affiliate</comment>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>10</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>0</show_in_store>
|
60 |
+
</program_id>
|
61 |
+
<order_type>
|
62 |
+
<label>Program Tracking Type</label>
|
63 |
+
<frontend_type>select</frontend_type>
|
64 |
+
<source_model>eems_affiliate/system_config_source_ordertypes</source_model>
|
65 |
+
<sort_order>20</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>0</show_in_website>
|
68 |
+
<show_in_store>0</show_in_store>
|
69 |
+
</order_type>
|
70 |
+
<transaction_type translate="label comment">
|
71 |
+
<label>Transaction Type</label>
|
72 |
+
<comment>Sale transactions pay publishers a percentage of the sale, lead transactions pay publishes a flat amount for an action.</comment>
|
73 |
+
<frontend_type>select</frontend_type>
|
74 |
+
<source_model>eems_affiliate/system_config_source_transactiontype</source_model>
|
75 |
+
<depends>
|
76 |
+
<order_type>basic</order_type>
|
77 |
+
</depends>
|
78 |
+
<sort_order>30</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>0</show_in_website>
|
81 |
+
<show_in_store>0</show_in_store>
|
82 |
+
</transaction_type>
|
83 |
+
<export_path translate="label comment">
|
84 |
+
<label>Export Path</label>
|
85 |
+
<comment>Default local path to export feeds to. These feeds will need to be made available to eBay Enterprise Affiliate via FTP.</comment>
|
86 |
+
<frontend_type>text</frontend_type>
|
87 |
+
<sort_order>50</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>0</show_in_website>
|
90 |
+
<show_in_store>0</show_in_store>
|
91 |
+
</export_path>
|
92 |
+
<conditional_pixel_enabled translate="label">
|
93 |
+
<label>Conditional Pixel</label>
|
94 |
+
<frontend_type>select</frontend_type>
|
95 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
96 |
+
<sort_order>60</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>0</show_in_website>
|
99 |
+
<show_in_store>0</show_in_store>
|
100 |
+
</conditional_pixel_enabled>
|
101 |
+
<source_key_name translate="label comment">
|
102 |
+
<label>Query String Key Name</label>
|
103 |
+
<comment>Only apply the pixel if the query string includes this key.</comment>
|
104 |
+
<frontend_type>text</frontend_type>
|
105 |
+
<depends>
|
106 |
+
<conditional_pixel_enabled>1</conditional_pixel_enabled>
|
107 |
+
</depends>
|
108 |
+
<sort_order>70</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>0</show_in_website>
|
111 |
+
<show_in_store>0</show_in_store>
|
112 |
+
</source_key_name>
|
113 |
+
<product_feed_enabled translate="label">
|
114 |
+
<label>Product Feed Enabled</label>
|
115 |
+
<frontend_type>select</frontend_type>
|
116 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
117 |
+
<sort_order>80</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>0</show_in_website>
|
120 |
+
<show_in_store>0</show_in_store>
|
121 |
+
</product_feed_enabled>
|
122 |
+
<order_feed_enabled translate="label">
|
123 |
+
<label>Order Correction Feed Enabled</label>
|
124 |
+
<frontend_type>select</frontend_type>
|
125 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
126 |
+
<sort_order>90</sort_order>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>0</show_in_website>
|
129 |
+
<show_in_store>0</show_in_store>
|
130 |
+
</order_feed_enabled>
|
131 |
+
</fields>
|
132 |
+
</eems_affiliate>
|
133 |
+
<eems_affiliate_product_attribute_map translate="label comment">
|
134 |
+
<label>Affiliate Product Feed Map</label>
|
135 |
+
<frontend_type>text</frontend_type>
|
136 |
+
<sort_order>101</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>0</show_in_store>
|
140 |
+
<fields>
|
141 |
+
<age_range translate="label">
|
142 |
+
<label>age_range</label>
|
143 |
+
<comment>Suggested age range</comment>
|
144 |
+
<frontend_type>select</frontend_type>
|
145 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
146 |
+
<sort_order>1</sort_order>
|
147 |
+
<show_in_default>1</show_in_default>
|
148 |
+
<show_in_website>0</show_in_website>
|
149 |
+
<show_in_store>0</show_in_store>
|
150 |
+
</age_range>
|
151 |
+
<artist translate="label">
|
152 |
+
<label>artist</label>
|
153 |
+
<comment>Media artist</comment>
|
154 |
+
<frontend_type>select</frontend_type>
|
155 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
156 |
+
<sort_order>2</sort_order>
|
157 |
+
<show_in_default>1</show_in_default>
|
158 |
+
<show_in_website>0</show_in_website>
|
159 |
+
<show_in_store>0</show_in_store>
|
160 |
+
</artist>
|
161 |
+
<aspect_ratio translate="label">
|
162 |
+
<label>aspect_ratio</label>
|
163 |
+
<comment>Screen aspect ratio</comment>
|
164 |
+
<frontend_type>select</frontend_type>
|
165 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
166 |
+
<sort_order>3</sort_order>
|
167 |
+
<show_in_default>1</show_in_default>
|
168 |
+
<show_in_website>0</show_in_website>
|
169 |
+
<show_in_store>0</show_in_store>
|
170 |
+
</aspect_ratio>
|
171 |
+
<author translate="label">
|
172 |
+
<label>author</label>
|
173 |
+
<comment>Media author</comment>
|
174 |
+
<frontend_type>select</frontend_type>
|
175 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
176 |
+
<sort_order>4</sort_order>
|
177 |
+
<show_in_default>1</show_in_default>
|
178 |
+
<show_in_website>0</show_in_website>
|
179 |
+
<show_in_store>0</show_in_store>
|
180 |
+
</author>
|
181 |
+
<battery_life translate="label">
|
182 |
+
<label>battery_life</label>
|
183 |
+
<comment>Battery life</comment>
|
184 |
+
<frontend_type>select</frontend_type>
|
185 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
186 |
+
<sort_order>5</sort_order>
|
187 |
+
<show_in_default>1</show_in_default>
|
188 |
+
<show_in_website>0</show_in_website>
|
189 |
+
<show_in_store>0</show_in_store>
|
190 |
+
</battery_life>
|
191 |
+
<binding translate="label">
|
192 |
+
<label>binding</label>
|
193 |
+
<comment>Book binding</comment>
|
194 |
+
<frontend_type>select</frontend_type>
|
195 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
196 |
+
<sort_order>6</sort_order>
|
197 |
+
<show_in_default>1</show_in_default>
|
198 |
+
<show_in_website>0</show_in_website>
|
199 |
+
<show_in_store>0</show_in_store>
|
200 |
+
</binding>
|
201 |
+
<buy_url translate="label">
|
202 |
+
<label>buy_url</label>
|
203 |
+
<comment>Destination URL (Required)</comment>
|
204 |
+
<frontend_type>select</frontend_type>
|
205 |
+
<validate>required-entry</validate>
|
206 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
207 |
+
<sort_order>7</sort_order>
|
208 |
+
<show_in_default>1</show_in_default>
|
209 |
+
<show_in_website>0</show_in_website>
|
210 |
+
<show_in_store>0</show_in_store>
|
211 |
+
</buy_url>
|
212 |
+
<category_network translate="label">
|
213 |
+
<label>category_network</label>
|
214 |
+
<comment>eBay Enterprise Affiliate Network specific category (sub categories optionally delimited by '>')</comment>
|
215 |
+
<frontend_type>select</frontend_type>
|
216 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
217 |
+
<sort_order>8</sort_order>
|
218 |
+
<show_in_default>1</show_in_default>
|
219 |
+
<show_in_website>0</show_in_website>
|
220 |
+
<show_in_store>0</show_in_store>
|
221 |
+
</category_network>
|
222 |
+
<category_program translate="label">
|
223 |
+
<label>category_program</label>
|
224 |
+
<comment>Merchant specific category (sub categories optionally delimited by '>') (Recommended)</comment>
|
225 |
+
<frontend_type>select</frontend_type>
|
226 |
+
<source_model>eems_affiliate/system_config_source_categories</source_model>
|
227 |
+
<sort_order>9</sort_order>
|
228 |
+
<show_in_default>1</show_in_default>
|
229 |
+
<show_in_website>0</show_in_website>
|
230 |
+
<show_in_store>0</show_in_store>
|
231 |
+
</category_program>
|
232 |
+
<color translate="label">
|
233 |
+
<label>color</label>
|
234 |
+
<comment>Color of item</comment>
|
235 |
+
<frontend_type>select</frontend_type>
|
236 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
237 |
+
<sort_order>10</sort_order>
|
238 |
+
<show_in_default>1</show_in_default>
|
239 |
+
<show_in_website>0</show_in_website>
|
240 |
+
<show_in_store>0</show_in_store>
|
241 |
+
</color>
|
242 |
+
<color_output translate="label">
|
243 |
+
<label>color_output</label>
|
244 |
+
<comment>Whether output is color or not</comment>
|
245 |
+
<frontend_type>select</frontend_type>
|
246 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
247 |
+
<sort_order>11</sort_order>
|
248 |
+
<show_in_default>1</show_in_default>
|
249 |
+
<show_in_website>0</show_in_website>
|
250 |
+
<show_in_store>0</show_in_store>
|
251 |
+
</color_output>
|
252 |
+
<condition translate="label">
|
253 |
+
<label>condition</label>
|
254 |
+
<comment>Condition (Recommended)</comment>
|
255 |
+
<frontend_type>select</frontend_type>
|
256 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
257 |
+
<sort_order>12</sort_order>
|
258 |
+
<show_in_default>1</show_in_default>
|
259 |
+
<show_in_website>0</show_in_website>
|
260 |
+
<show_in_store>0</show_in_store>
|
261 |
+
</condition>
|
262 |
+
<description_long translate="label">
|
263 |
+
<label>description_long</label>
|
264 |
+
<comment>Long description (Required)</comment>
|
265 |
+
<frontend_type>select</frontend_type>
|
266 |
+
<validate>required-entry</validate>
|
267 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
268 |
+
<sort_order>13</sort_order>
|
269 |
+
<show_in_default>1</show_in_default>
|
270 |
+
<show_in_website>0</show_in_website>
|
271 |
+
<show_in_store>0</show_in_store>
|
272 |
+
</description_long>
|
273 |
+
<description_short translate="label">
|
274 |
+
<label>description_short</label>
|
275 |
+
<comment>Short description</comment>
|
276 |
+
<frontend_type>select</frontend_type>
|
277 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
278 |
+
<sort_order>14</sort_order>
|
279 |
+
<show_in_default>1</show_in_default>
|
280 |
+
<show_in_website>0</show_in_website>
|
281 |
+
<show_in_store>0</show_in_store>
|
282 |
+
</description_short>
|
283 |
+
<director translate="label">
|
284 |
+
<label>director</label>
|
285 |
+
<comment>Movie director</comment>
|
286 |
+
<frontend_type>select</frontend_type>
|
287 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
288 |
+
<sort_order>15</sort_order>
|
289 |
+
<show_in_default>1</show_in_default>
|
290 |
+
<show_in_website>0</show_in_website>
|
291 |
+
<show_in_store>0</show_in_store>
|
292 |
+
</director>
|
293 |
+
<discontinued translate="label">
|
294 |
+
<label>discontinued</label>
|
295 |
+
<comment>Whether product is discontinued or not</comment>
|
296 |
+
<frontend_type>select</frontend_type>
|
297 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
298 |
+
<sort_order>16</sort_order>
|
299 |
+
<show_in_default>1</show_in_default>
|
300 |
+
<show_in_website>0</show_in_website>
|
301 |
+
<show_in_store>0</show_in_store>
|
302 |
+
</discontinued>
|
303 |
+
<display_type translate="label">
|
304 |
+
<label>display_type</label>
|
305 |
+
<comment>Display type</comment>
|
306 |
+
<frontend_type>select</frontend_type>
|
307 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
308 |
+
<sort_order>17</sort_order>
|
309 |
+
<show_in_default>1</show_in_default>
|
310 |
+
<show_in_website>0</show_in_website>
|
311 |
+
<show_in_store>0</show_in_store>
|
312 |
+
</display_type>
|
313 |
+
<edition translate="label">
|
314 |
+
<label>edition</label>
|
315 |
+
<comment>Media edition</comment>
|
316 |
+
<frontend_type>select</frontend_type>
|
317 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
318 |
+
<sort_order>18</sort_order>
|
319 |
+
<show_in_default>1</show_in_default>
|
320 |
+
<show_in_website>0</show_in_website>
|
321 |
+
<show_in_store>0</show_in_store>
|
322 |
+
</edition>
|
323 |
+
<expiration_date translate="label">
|
324 |
+
<label>expiration_date</label>
|
325 |
+
<comment>Expiration date</comment>
|
326 |
+
<frontend_type>select</frontend_type>
|
327 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
328 |
+
<sort_order>19</sort_order>
|
329 |
+
<show_in_default>1</show_in_default>
|
330 |
+
<show_in_website>0</show_in_website>
|
331 |
+
<show_in_store>0</show_in_store>
|
332 |
+
</expiration_date>
|
333 |
+
<features translate="label">
|
334 |
+
<label>features</label>
|
335 |
+
<comment>Special features</comment>
|
336 |
+
<frontend_type>select</frontend_type>
|
337 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
338 |
+
<sort_order>20</sort_order>
|
339 |
+
<show_in_default>1</show_in_default>
|
340 |
+
<show_in_website>0</show_in_website>
|
341 |
+
<show_in_store>0</show_in_store>
|
342 |
+
</features>
|
343 |
+
<focus_type translate="label">
|
344 |
+
<label>focus_type</label>
|
345 |
+
<comment>Focus type</comment>
|
346 |
+
<frontend_type>select</frontend_type>
|
347 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
348 |
+
<sort_order>21</sort_order>
|
349 |
+
<show_in_default>1</show_in_default>
|
350 |
+
<show_in_website>0</show_in_website>
|
351 |
+
<show_in_store>0</show_in_store>
|
352 |
+
</focus_type>
|
353 |
+
<format translate="label">
|
354 |
+
<label>format</label>
|
355 |
+
<comment>Format</comment>
|
356 |
+
<frontend_type>select</frontend_type>
|
357 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
358 |
+
<sort_order>22</sort_order>
|
359 |
+
<show_in_default>1</show_in_default>
|
360 |
+
<show_in_website>0</show_in_website>
|
361 |
+
<show_in_store>0</show_in_store>
|
362 |
+
</format>
|
363 |
+
<functions translate="label">
|
364 |
+
<label>functions</label>
|
365 |
+
<comment>Functions</comment>
|
366 |
+
<frontend_type>select</frontend_type>
|
367 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
368 |
+
<sort_order>23</sort_order>
|
369 |
+
<show_in_default>1</show_in_default>
|
370 |
+
<show_in_website>0</show_in_website>
|
371 |
+
<show_in_store>0</show_in_store>
|
372 |
+
</functions>
|
373 |
+
<genre translate="label">
|
374 |
+
<label>genre</label>
|
375 |
+
<comment>Genre</comment>
|
376 |
+
<frontend_type>select</frontend_type>
|
377 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
378 |
+
<sort_order>24</sort_order>
|
379 |
+
<show_in_default>1</show_in_default>
|
380 |
+
<show_in_website>0</show_in_website>
|
381 |
+
<show_in_store>0</show_in_store>
|
382 |
+
</genre>
|
383 |
+
<heel_height translate="label">
|
384 |
+
<label>heel_height</label>
|
385 |
+
<comment>Heel height</comment>
|
386 |
+
<frontend_type>select</frontend_type>
|
387 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
388 |
+
<sort_order>25</sort_order>
|
389 |
+
<show_in_default>1</show_in_default>
|
390 |
+
<show_in_website>0</show_in_website>
|
391 |
+
<show_in_store>0</show_in_store>
|
392 |
+
</heel_height>
|
393 |
+
<height translate="label">
|
394 |
+
<label>height</label>
|
395 |
+
<comment>Height</comment>
|
396 |
+
<frontend_type>select</frontend_type>
|
397 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
398 |
+
<sort_order>26</sort_order>
|
399 |
+
<show_in_default>1</show_in_default>
|
400 |
+
<show_in_website>0</show_in_website>
|
401 |
+
<show_in_store>0</show_in_store>
|
402 |
+
</height>
|
403 |
+
<image_thumb_url translate="label">
|
404 |
+
<label>image_thumb_url</label>
|
405 |
+
<comment>Thumbnail image URL (Recommended)</comment>
|
406 |
+
<frontend_type>select</frontend_type>
|
407 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
408 |
+
<sort_order>27</sort_order>
|
409 |
+
<show_in_default>1</show_in_default>
|
410 |
+
<show_in_website>0</show_in_website>
|
411 |
+
<show_in_store>0</show_in_store>
|
412 |
+
</image_thumb_url>
|
413 |
+
<image_url translate="label">
|
414 |
+
<label>image_url</label>
|
415 |
+
<comment>Standard image URL (Required)</comment>
|
416 |
+
<frontend_type>select</frontend_type>
|
417 |
+
<validate>required-entry</validate>
|
418 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
419 |
+
<sort_order>28</sort_order>
|
420 |
+
<show_in_default>1</show_in_default>
|
421 |
+
<show_in_website>0</show_in_website>
|
422 |
+
<show_in_store>0</show_in_store>
|
423 |
+
</image_url>
|
424 |
+
<installation translate="label">
|
425 |
+
<label>installation</label>
|
426 |
+
<comment>Installation type</comment>
|
427 |
+
<frontend_type>select</frontend_type>
|
428 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
429 |
+
<sort_order>29</sort_order>
|
430 |
+
<show_in_default>1</show_in_default>
|
431 |
+
<show_in_website>0</show_in_website>
|
432 |
+
<show_in_store>0</show_in_store>
|
433 |
+
</installation>
|
434 |
+
<in_stock translate="label">
|
435 |
+
<label>in_stock</label>
|
436 |
+
<comment>Whether product is in stock or not</comment>
|
437 |
+
<frontend_type>select</frontend_type>
|
438 |
+
<source_model>eems_affiliate/system_config_source_stockyesno</source_model>
|
439 |
+
<sort_order>30</sort_order>
|
440 |
+
<show_in_default>1</show_in_default>
|
441 |
+
<show_in_website>0</show_in_website>
|
442 |
+
<show_in_store>0</show_in_store>
|
443 |
+
</in_stock>
|
444 |
+
<isbn translate="label">
|
445 |
+
<label>isbn</label>
|
446 |
+
<comment>Book ISBN</comment>
|
447 |
+
<frontend_type>select</frontend_type>
|
448 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
449 |
+
<sort_order>31</sort_order>
|
450 |
+
<show_in_default>1</show_in_default>
|
451 |
+
<show_in_website>0</show_in_website>
|
452 |
+
<show_in_store>0</show_in_store>
|
453 |
+
</isbn>
|
454 |
+
<keywords translate="label">
|
455 |
+
<label>keywords</label>
|
456 |
+
<comment>Space separated list of keywords (Recommended)</comment>
|
457 |
+
<frontend_type>select</frontend_type>
|
458 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
459 |
+
<sort_order>32</sort_order>
|
460 |
+
<show_in_default>1</show_in_default>
|
461 |
+
<show_in_website>0</show_in_website>
|
462 |
+
<show_in_store>0</show_in_store>
|
463 |
+
</keywords>
|
464 |
+
<length translate="label">
|
465 |
+
<label>length</label>
|
466 |
+
<comment>Length</comment>
|
467 |
+
<frontend_type>select</frontend_type>
|
468 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
469 |
+
<sort_order>33</sort_order>
|
470 |
+
<show_in_default>1</show_in_default>
|
471 |
+
<show_in_website>0</show_in_website>
|
472 |
+
<show_in_store>0</show_in_store>
|
473 |
+
</length>
|
474 |
+
<load_type translate="label">
|
475 |
+
<label>load_type</label>
|
476 |
+
<comment>Load type</comment>
|
477 |
+
<frontend_type>select</frontend_type>
|
478 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
479 |
+
<sort_order>34</sort_order>
|
480 |
+
<show_in_default>1</show_in_default>
|
481 |
+
<show_in_website>0</show_in_website>
|
482 |
+
<show_in_store>0</show_in_store>
|
483 |
+
</load_type>
|
484 |
+
<location translate="label">
|
485 |
+
<label>location</label>
|
486 |
+
<comment>Shipping location</comment>
|
487 |
+
<frontend_type>select</frontend_type>
|
488 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
489 |
+
<sort_order>35</sort_order>
|
490 |
+
<show_in_default>1</show_in_default>
|
491 |
+
<show_in_website>0</show_in_website>
|
492 |
+
<show_in_store>0</show_in_store>
|
493 |
+
</location>
|
494 |
+
<made_in translate="label">
|
495 |
+
<label>made_in</label>
|
496 |
+
<comment>Manufacturing country</comment>
|
497 |
+
<frontend_type>select</frontend_type>
|
498 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
499 |
+
<sort_order>36</sort_order>
|
500 |
+
<show_in_default>1</show_in_default>
|
501 |
+
<show_in_website>0</show_in_website>
|
502 |
+
<show_in_store>0</show_in_store>
|
503 |
+
</made_in>
|
504 |
+
<manufacturer translate="label">
|
505 |
+
<label>manufacturer</label>
|
506 |
+
<comment>Manufacturer or brand (Recommended)</comment>
|
507 |
+
<frontend_type>select</frontend_type>
|
508 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
509 |
+
<sort_order>37</sort_order>
|
510 |
+
<show_in_default>1</show_in_default>
|
511 |
+
<show_in_website>0</show_in_website>
|
512 |
+
<show_in_store>0</show_in_store>
|
513 |
+
</manufacturer>
|
514 |
+
<material translate="label">
|
515 |
+
<label>material</label>
|
516 |
+
<comment>Construction material</comment>
|
517 |
+
<frontend_type>select</frontend_type>
|
518 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
519 |
+
<sort_order>38</sort_order>
|
520 |
+
<show_in_default>1</show_in_default>
|
521 |
+
<show_in_website>0</show_in_website>
|
522 |
+
<show_in_store>0</show_in_store>
|
523 |
+
</material>
|
524 |
+
<megapixels translate="label">
|
525 |
+
<label>megapixels</label>
|
526 |
+
<comment>Megapixels</comment>
|
527 |
+
<frontend_type>select</frontend_type>
|
528 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
529 |
+
<sort_order>39</sort_order>
|
530 |
+
<show_in_default>1</show_in_default>
|
531 |
+
<show_in_website>0</show_in_website>
|
532 |
+
<show_in_store>0</show_in_store>
|
533 |
+
</megapixels>
|
534 |
+
<memory_capacity translate="label">
|
535 |
+
<label>memory_capacity</label>
|
536 |
+
<comment>Memory capacity</comment>
|
537 |
+
<frontend_type>select</frontend_type>
|
538 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
539 |
+
<sort_order>40</sort_order>
|
540 |
+
<show_in_default>1</show_in_default>
|
541 |
+
<show_in_website>0</show_in_website>
|
542 |
+
<show_in_store>0</show_in_store>
|
543 |
+
</memory_capacity>
|
544 |
+
<memory_card_slot translate="label">
|
545 |
+
<label>memory_card_slot</label>
|
546 |
+
<comment>Memory card slot type</comment>
|
547 |
+
<frontend_type>select</frontend_type>
|
548 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
549 |
+
<sort_order>41</sort_order>
|
550 |
+
<show_in_default>1</show_in_default>
|
551 |
+
<show_in_website>0</show_in_website>
|
552 |
+
<show_in_store>0</show_in_store>
|
553 |
+
</memory_card_slot>
|
554 |
+
<memory_type translate="label">
|
555 |
+
<label>memory_type</label>
|
556 |
+
<comment>Memory type</comment>
|
557 |
+
<frontend_type>select</frontend_type>
|
558 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
559 |
+
<sort_order>42</sort_order>
|
560 |
+
<show_in_default>1</show_in_default>
|
561 |
+
<show_in_website>0</show_in_website>
|
562 |
+
<show_in_store>0</show_in_store>
|
563 |
+
</memory_type>
|
564 |
+
<model_number translate="label">
|
565 |
+
<label>model_number</label>
|
566 |
+
<comment>Model number</comment>
|
567 |
+
<frontend_type>select</frontend_type>
|
568 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
569 |
+
<sort_order>43</sort_order>
|
570 |
+
<show_in_default>1</show_in_default>
|
571 |
+
<show_in_website>0</show_in_website>
|
572 |
+
<show_in_store>0</show_in_store>
|
573 |
+
</model_number>
|
574 |
+
<mpn translate="label">
|
575 |
+
<label>mpn</label>
|
576 |
+
<comment>Manufacturer part number</comment>
|
577 |
+
<frontend_type>select</frontend_type>
|
578 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
579 |
+
<sort_order>44</sort_order>
|
580 |
+
<show_in_default>1</show_in_default>
|
581 |
+
<show_in_website>0</show_in_website>
|
582 |
+
<show_in_store>0</show_in_store>
|
583 |
+
</mpn>
|
584 |
+
<name translate="label">
|
585 |
+
<label>name</label>
|
586 |
+
<comment>Name or title (Required)</comment>
|
587 |
+
<frontend_type>select</frontend_type>
|
588 |
+
<validate>required-entry</validate>
|
589 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
590 |
+
<sort_order>45</sort_order>
|
591 |
+
<show_in_default>1</show_in_default>
|
592 |
+
<show_in_website>0</show_in_website>
|
593 |
+
<show_in_store>0</show_in_store>
|
594 |
+
</name>
|
595 |
+
<occasion translate="label">
|
596 |
+
<label>occasion</label>
|
597 |
+
<comment>Recommended usage occasion</comment>
|
598 |
+
<frontend_type>select</frontend_type>
|
599 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
600 |
+
<sort_order>46</sort_order>
|
601 |
+
<show_in_default>1</show_in_default>
|
602 |
+
<show_in_website>0</show_in_website>
|
603 |
+
<show_in_store>0</show_in_store>
|
604 |
+
</occasion>
|
605 |
+
<operating_system translate="label">
|
606 |
+
<label>operating_system</label>
|
607 |
+
<comment>Operating system</comment>
|
608 |
+
<frontend_type>select</frontend_type>
|
609 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
610 |
+
<sort_order>47</sort_order>
|
611 |
+
<show_in_default>1</show_in_default>
|
612 |
+
<show_in_website>0</show_in_website>
|
613 |
+
<show_in_store>0</show_in_store>
|
614 |
+
</operating_system>
|
615 |
+
<optical_drive translate="label">
|
616 |
+
<label>optical_drive</label>
|
617 |
+
<comment>Optical drive type</comment>
|
618 |
+
<frontend_type>select</frontend_type>
|
619 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
620 |
+
<sort_order>48</sort_order>
|
621 |
+
<show_in_default>1</show_in_default>
|
622 |
+
<show_in_website>0</show_in_website>
|
623 |
+
<show_in_store>0</show_in_store>
|
624 |
+
</optical_drive>
|
625 |
+
<pages translate="label">
|
626 |
+
<label>pages</label>
|
627 |
+
<comment>Number of pages</comment>
|
628 |
+
<frontend_type>select</frontend_type>
|
629 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
630 |
+
<sort_order>49</sort_order>
|
631 |
+
<show_in_default>1</show_in_default>
|
632 |
+
<show_in_website>0</show_in_website>
|
633 |
+
<show_in_store>0</show_in_store>
|
634 |
+
</pages>
|
635 |
+
<payment_accepted translate="label">
|
636 |
+
<label>payment_accepted</label>
|
637 |
+
<comment>Accepted payment methods</comment>
|
638 |
+
<frontend_type>select</frontend_type>
|
639 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
640 |
+
<sort_order>50</sort_order>
|
641 |
+
<show_in_default>1</show_in_default>
|
642 |
+
<show_in_website>0</show_in_website>
|
643 |
+
<show_in_store>0</show_in_store>
|
644 |
+
</payment_accepted>
|
645 |
+
<payment_notes translate="label">
|
646 |
+
<label>payment_notes</label>
|
647 |
+
<comment>Additional payment notes</comment>
|
648 |
+
<frontend_type>select</frontend_type>
|
649 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
650 |
+
<sort_order>51</sort_order>
|
651 |
+
<show_in_default>1</show_in_default>
|
652 |
+
<show_in_website>0</show_in_website>
|
653 |
+
<show_in_store>0</show_in_store>
|
654 |
+
</payment_notes>
|
655 |
+
<platform translate="label">
|
656 |
+
<label>platform</label>
|
657 |
+
<comment>Platform</comment>
|
658 |
+
<frontend_type>select</frontend_type>
|
659 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
660 |
+
<sort_order>52</sort_order>
|
661 |
+
<show_in_default>1</show_in_default>
|
662 |
+
<show_in_website>0</show_in_website>
|
663 |
+
<show_in_store>0</show_in_store>
|
664 |
+
</platform>
|
665 |
+
<price translate="label">
|
666 |
+
<label>price</label>
|
667 |
+
<comment>Selling price (Required)</comment>
|
668 |
+
<frontend_type>select</frontend_type>
|
669 |
+
<validate>required-entry</validate>
|
670 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
671 |
+
<sort_order>53</sort_order>
|
672 |
+
<show_in_default>1</show_in_default>
|
673 |
+
<show_in_website>0</show_in_website>
|
674 |
+
<show_in_store>0</show_in_store>
|
675 |
+
</price>
|
676 |
+
<price_retail translate="label">
|
677 |
+
<label>price_retail</label>
|
678 |
+
<comment>Manufacturer suggested retail price</comment>
|
679 |
+
<frontend_type>select</frontend_type>
|
680 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
681 |
+
<sort_order>54</sort_order>
|
682 |
+
<show_in_default>1</show_in_default>
|
683 |
+
<show_in_website>0</show_in_website>
|
684 |
+
<show_in_store>0</show_in_store>
|
685 |
+
</price_retail>
|
686 |
+
<price_sale translate="label">
|
687 |
+
<label>price_sale</label>
|
688 |
+
<comment>Discount price</comment>
|
689 |
+
<frontend_type>select</frontend_type>
|
690 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
691 |
+
<sort_order>55</sort_order>
|
692 |
+
<show_in_default>1</show_in_default>
|
693 |
+
<show_in_website>0</show_in_website>
|
694 |
+
<show_in_store>0</show_in_store>
|
695 |
+
</price_sale>
|
696 |
+
<price_shipping translate="label">
|
697 |
+
<label>price_shipping</label>
|
698 |
+
<comment>Shipping price</comment>
|
699 |
+
<frontend_type>select</frontend_type>
|
700 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
701 |
+
<sort_order>56</sort_order>
|
702 |
+
<show_in_default>1</show_in_default>
|
703 |
+
<show_in_website>0</show_in_website>
|
704 |
+
<show_in_store>0</show_in_store>
|
705 |
+
</price_shipping>
|
706 |
+
<processor translate="label">
|
707 |
+
<label>processor</label>
|
708 |
+
<comment>Processor type</comment>
|
709 |
+
<frontend_type>select</frontend_type>
|
710 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
711 |
+
<sort_order>57</sort_order>
|
712 |
+
<show_in_default>1</show_in_default>
|
713 |
+
<show_in_website>0</show_in_website>
|
714 |
+
<show_in_store>0</show_in_store>
|
715 |
+
</processor>
|
716 |
+
<publisher translate="label">
|
717 |
+
<label>publisher</label>
|
718 |
+
<comment>Publisher</comment>
|
719 |
+
<frontend_type>select</frontend_type>
|
720 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
721 |
+
<sort_order>58</sort_order>
|
722 |
+
<show_in_default>1</show_in_default>
|
723 |
+
<show_in_website>0</show_in_website>
|
724 |
+
<show_in_store>0</show_in_store>
|
725 |
+
</publisher>
|
726 |
+
<quantity_in_stock translate="label">
|
727 |
+
<label>quantity_in_stock</label>
|
728 |
+
<comment>Number of items in stock</comment>
|
729 |
+
<frontend_type>select</frontend_type>
|
730 |
+
<source_model>eems_affiliate/system_config_source_stockquantity</source_model>
|
731 |
+
<sort_order>59</sort_order>
|
732 |
+
<show_in_default>1</show_in_default>
|
733 |
+
<show_in_website>0</show_in_website>
|
734 |
+
<show_in_store>0</show_in_store>
|
735 |
+
</quantity_in_stock>
|
736 |
+
<rating translate="label">
|
737 |
+
<label>rating</label>
|
738 |
+
<comment>Rating</comment>
|
739 |
+
<frontend_type>select</frontend_type>
|
740 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
741 |
+
<sort_order>60</sort_order>
|
742 |
+
<show_in_default>1</show_in_default>
|
743 |
+
<show_in_website>0</show_in_website>
|
744 |
+
<show_in_store>0</show_in_store>
|
745 |
+
</rating>
|
746 |
+
<recommended_usage translate="label">
|
747 |
+
<label>recommended_usage</label>
|
748 |
+
<comment>Recommended usage</comment>
|
749 |
+
<frontend_type>select</frontend_type>
|
750 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
751 |
+
<sort_order>61</sort_order>
|
752 |
+
<show_in_default>1</show_in_default>
|
753 |
+
<show_in_website>0</show_in_website>
|
754 |
+
<show_in_store>0</show_in_store>
|
755 |
+
</recommended_usage>
|
756 |
+
<resolution translate="label">
|
757 |
+
<label>resolution</label>
|
758 |
+
<comment>Screen resolution</comment>
|
759 |
+
<frontend_type>select</frontend_type>
|
760 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
761 |
+
<sort_order>62</sort_order>
|
762 |
+
<show_in_default>1</show_in_default>
|
763 |
+
<show_in_website>0</show_in_website>
|
764 |
+
<show_in_store>0</show_in_store>
|
765 |
+
</resolution>
|
766 |
+
<screen_size translate="label">
|
767 |
+
<label>screen_size</label>
|
768 |
+
<comment>Screen size</comment>
|
769 |
+
<frontend_type>select</frontend_type>
|
770 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
771 |
+
<sort_order>63</sort_order>
|
772 |
+
<show_in_default>1</show_in_default>
|
773 |
+
<show_in_website>0</show_in_website>
|
774 |
+
<show_in_store>0</show_in_store>
|
775 |
+
</screen_size>
|
776 |
+
<shipping_method translate="label">
|
777 |
+
<label>shipping_method</label>
|
778 |
+
<comment>Shipping methods</comment>
|
779 |
+
<frontend_type>select</frontend_type>
|
780 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
781 |
+
<sort_order>64</sort_order>
|
782 |
+
<show_in_default>1</show_in_default>
|
783 |
+
<show_in_website>0</show_in_website>
|
784 |
+
<show_in_store>0</show_in_store>
|
785 |
+
</shipping_method>
|
786 |
+
<shoe_size translate="label">
|
787 |
+
<label>shoe_size</label>
|
788 |
+
<comment>Shoe size</comment>
|
789 |
+
<frontend_type>select</frontend_type>
|
790 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
791 |
+
<sort_order>65</sort_order>
|
792 |
+
<show_in_default>1</show_in_default>
|
793 |
+
<show_in_website>0</show_in_website>
|
794 |
+
<show_in_store>0</show_in_store>
|
795 |
+
</shoe_size>
|
796 |
+
<shoe_width translate="label">
|
797 |
+
<label>shoe_width</label>
|
798 |
+
<comment>Shoe width</comment>
|
799 |
+
<frontend_type>select</frontend_type>
|
800 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
801 |
+
<sort_order>66</sort_order>
|
802 |
+
<show_in_default>1</show_in_default>
|
803 |
+
<show_in_website>0</show_in_website>
|
804 |
+
<show_in_store>0</show_in_store>
|
805 |
+
</shoe_width>
|
806 |
+
<size translate="label">
|
807 |
+
<label>size</label>
|
808 |
+
<comment>Size</comment>
|
809 |
+
<frontend_type>select</frontend_type>
|
810 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
811 |
+
<sort_order>67</sort_order>
|
812 |
+
<show_in_default>1</show_in_default>
|
813 |
+
<show_in_website>0</show_in_website>
|
814 |
+
<show_in_store>0</show_in_store>
|
815 |
+
</size>
|
816 |
+
<sku translate="label">
|
817 |
+
<label>sku</label>
|
818 |
+
<comment>Stock keeping unit (Recommended)</comment>
|
819 |
+
<frontend_type>select</frontend_type>
|
820 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
821 |
+
<sort_order>68</sort_order>
|
822 |
+
<show_in_default>1</show_in_default>
|
823 |
+
<show_in_website>0</show_in_website>
|
824 |
+
<show_in_store>0</show_in_store>
|
825 |
+
</sku>
|
826 |
+
<staring translate="label">
|
827 |
+
<label>staring</label>
|
828 |
+
<comment>Staring actors</comment>
|
829 |
+
<frontend_type>select</frontend_type>
|
830 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
831 |
+
<sort_order>69</sort_order>
|
832 |
+
<show_in_default>1</show_in_default>
|
833 |
+
<show_in_website>0</show_in_website>
|
834 |
+
<show_in_store>0</show_in_store>
|
835 |
+
</staring>
|
836 |
+
<style translate="label">
|
837 |
+
<label>style</label>
|
838 |
+
<comment>Style</comment>
|
839 |
+
<frontend_type>select</frontend_type>
|
840 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
841 |
+
<sort_order>70</sort_order>
|
842 |
+
<show_in_default>1</show_in_default>
|
843 |
+
<show_in_website>0</show_in_website>
|
844 |
+
<show_in_store>0</show_in_store>
|
845 |
+
</style>
|
846 |
+
<tech_spec_url translate="label">
|
847 |
+
<label>tech_spec_url</label>
|
848 |
+
<comment>Technical specifications URL</comment>
|
849 |
+
<frontend_type>select</frontend_type>
|
850 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
851 |
+
<sort_order>71</sort_order>
|
852 |
+
<show_in_default>1</show_in_default>
|
853 |
+
<show_in_website>0</show_in_website>
|
854 |
+
<show_in_store>0</show_in_store>
|
855 |
+
</tech_spec_url>
|
856 |
+
<tracks translate="label">
|
857 |
+
<label>tracks</label>
|
858 |
+
<comment>Total number of tracks</comment>
|
859 |
+
<frontend_type>select</frontend_type>
|
860 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
861 |
+
<sort_order>72</sort_order>
|
862 |
+
<show_in_default>1</show_in_default>
|
863 |
+
<show_in_website>0</show_in_website>
|
864 |
+
<show_in_store>0</show_in_store>
|
865 |
+
</tracks>
|
866 |
+
<upc translate="label">
|
867 |
+
<label>upc</label>
|
868 |
+
<comment>Universal product code (Recommended)</comment>
|
869 |
+
<frontend_type>select</frontend_type>
|
870 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
871 |
+
<sort_order>73</sort_order>
|
872 |
+
<show_in_default>1</show_in_default>
|
873 |
+
<show_in_website>0</show_in_website>
|
874 |
+
<show_in_store>0</show_in_store>
|
875 |
+
</upc>
|
876 |
+
<weight translate="label">
|
877 |
+
<label>weight</label>
|
878 |
+
<comment>Weight</comment>
|
879 |
+
<frontend_type>select</frontend_type>
|
880 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
881 |
+
<sort_order>74</sort_order>
|
882 |
+
<show_in_default>1</show_in_default>
|
883 |
+
<show_in_website>0</show_in_website>
|
884 |
+
<show_in_store>0</show_in_store>
|
885 |
+
</weight>
|
886 |
+
<width translate="label">
|
887 |
+
<label>width</label>
|
888 |
+
<comment>Width</comment>
|
889 |
+
<frontend_type>select</frontend_type>
|
890 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
891 |
+
<sort_order>75</sort_order>
|
892 |
+
<show_in_default>1</show_in_default>
|
893 |
+
<show_in_website>0</show_in_website>
|
894 |
+
<show_in_store>0</show_in_store>
|
895 |
+
</width>
|
896 |
+
<wireless_interface translate="label">
|
897 |
+
<label>wireless_interface</label>
|
898 |
+
<comment>Wireless interface</comment>
|
899 |
+
<frontend_type>select</frontend_type>
|
900 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
901 |
+
<sort_order>76</sort_order>
|
902 |
+
<show_in_default>1</show_in_default>
|
903 |
+
<show_in_website>0</show_in_website>
|
904 |
+
<show_in_store>0</show_in_store>
|
905 |
+
</wireless_interface>
|
906 |
+
<year translate="label">
|
907 |
+
<label>year</label>
|
908 |
+
<comment>Year of manufacture - YYYY</comment>
|
909 |
+
<frontend_type>select</frontend_type>
|
910 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
911 |
+
<sort_order>77</sort_order>
|
912 |
+
<show_in_default>1</show_in_default>
|
913 |
+
<show_in_website>0</show_in_website>
|
914 |
+
<show_in_store>0</show_in_store>
|
915 |
+
</year>
|
916 |
+
<zoom translate="label">
|
917 |
+
<label>zoom</label>
|
918 |
+
<comment>Maximum zoom</comment>
|
919 |
+
<frontend_type>select</frontend_type>
|
920 |
+
<source_model>eems_affiliate/system_config_source_attributes</source_model>
|
921 |
+
<sort_order>78</sort_order>
|
922 |
+
<show_in_default>1</show_in_default>
|
923 |
+
<show_in_website>0</show_in_website>
|
924 |
+
<show_in_store>0</show_in_store>
|
925 |
+
</zoom>
|
926 |
+
</fields>
|
927 |
+
</eems_affiliate_product_attribute_map>
|
928 |
+
</groups>
|
929 |
+
</marketing_solutions>
|
930 |
+
</sections>
|
931 |
+
</config>
|
app/code/community/EbayEnterprise/Affiliate/sql/eems_affiliate_setup/install-1.0.0.1.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
/** @var $installer Mage_Core_Model_Resource_Setup */
|
19 |
-
$installer = $this;
|
20 |
-
|
21 |
-
// Set the last run time of the corrected orders feed to the time when the
|
22 |
-
// extension is installed. This should help to reduce the number of untracked
|
23 |
-
// orders included in the initial run of the feed.
|
24 |
-
$installer->setConfigData('marketing_solutions/eems_affiliate/feed/last_run_time', time());
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
/** @var $installer Mage_Core_Model_Resource_Setup */
|
19 |
+
$installer = $this;
|
20 |
+
|
21 |
+
// Set the last run time of the corrected orders feed to the time when the
|
22 |
+
// extension is installed. This should help to reduce the number of untracked
|
23 |
+
// orders included in the initial run of the feed.
|
24 |
+
$installer->setConfigData('marketing_solutions/eems_affiliate/feed/last_run_time', time());
|
app/code/community/EbayEnterprise/Affiliate/sql/eems_affiliate_setup/mysql4-install-1.0.0.1.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
|
18 |
-
/** @var $installer Mage_Core_Model_Resource_Setup */
|
19 |
-
$installer = $this;
|
20 |
-
|
21 |
-
// Set the last run time of the corrected orders feed to the time when the
|
22 |
-
// extension is installed. This should help to reduce the number of untracked
|
23 |
-
// orders included in the initial run of the feed.
|
24 |
-
$installer->setConfigData('marketing_solutions/eems_affiliate/feed/last_run_time', time());
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
|
18 |
+
/** @var $installer Mage_Core_Model_Resource_Setup */
|
19 |
+
$installer = $this;
|
20 |
+
|
21 |
+
// Set the last run time of the corrected orders feed to the time when the
|
22 |
+
// extension is installed. This should help to reduce the number of untracked
|
23 |
+
// orders included in the initial run of the feed.
|
24 |
+
$installer->setConfigData('marketing_solutions/eems_affiliate/feed/last_run_time', time());
|
app/code/community/EbayEnterprise/Affiliate/sql/eems_affiliate_setup/mysql4-upgrade-1.0.0.1-1.2.0.0.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
// Below based on http://stackoverflow.com/questions/9599262/magento-add-new-attribute-to-all-products
|
8 |
+
// Incremented version to get this to run for existing users.
|
9 |
+
$attrCode = 'commissioning_category';
|
10 |
+
|
11 |
+
$objCatalogEavSetup = Mage::getResourceModel('catalog/eav_mysql4_setup', 'core_setup');
|
12 |
+
$attrIdTest = $objCatalogEavSetup->getAttributeId(Mage_Catalog_Model_Product::ENTITY, $attrCode);
|
13 |
+
|
14 |
+
if ($attrIdTest === false) {
|
15 |
+
$objCatalogEavSetup->addAttribute(Mage_Catalog_Model_Product::ENTITY, $attrCode, array(
|
16 |
+
'group' => 'General',
|
17 |
+
'type' => 'int',
|
18 |
+
'backend' => '',
|
19 |
+
'frontend' => '',
|
20 |
+
'label' => 'Commissioning Category',
|
21 |
+
'note' => 'Category that will be used for affiliate sales. If not set, one of the categories assigned to this product will be chosen.',
|
22 |
+
'input' => 'select',
|
23 |
+
'class' => '',
|
24 |
+
'source' => 'eems_affiliate/product_attribute_source_commissioningCategory',
|
25 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
26 |
+
'visible' => true,
|
27 |
+
'required' => false,
|
28 |
+
'user_defined' => false,
|
29 |
+
'default' => null,
|
30 |
+
'visible_on_front' => false,
|
31 |
+
'unique' => false,
|
32 |
+
'is_configurable' => false,
|
33 |
+
'used_for_promo_rules' => false,
|
34 |
+
'apply_to' => 'simple,configurable,bundle,grouped',
|
35 |
+
));
|
36 |
+
}
|
app/design/frontend/base/default/layout/eems_affiliate.xml
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!--
|
3 |
-
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
|
5 |
-
NOTICE OF LICENSE
|
6 |
-
|
7 |
-
This source file is subject to the eBay Enterprise
|
8 |
-
Magento Extensions End User License Agreement
|
9 |
-
that is bundled with this package in the file LICENSE.md.
|
10 |
-
It is also available through the world-wide-web at this URL:
|
11 |
-
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
|
13 |
-
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
-->
|
16 |
-
<layout version="0.1.0">
|
17 |
-
<default>
|
18 |
-
<reference name="head">
|
19 |
-
<block type="eems_affiliate/tracking" name="eems_affiliate.tracking" template="eems_affiliate/tracking.phtml"/>
|
20 |
-
</reference>
|
21 |
-
</default>
|
22 |
-
<checkout_affiliate_success translate="label">
|
23 |
-
<reference name="before_body_end">
|
24 |
-
<block type="eems_affiliate/beacon" name="eems_affiliate.beacon" template="eems_affiliate/beacon.phtml"/>
|
25 |
-
</reference>
|
26 |
-
</checkout_affiliate_success>
|
27 |
-
<checkout_multishipping_success translate="label">
|
28 |
-
<label>Multishipping Checkout Success</label>
|
29 |
-
<update handle="checkout_affiliate_success"/>
|
30 |
-
</checkout_multishipping_success>
|
31 |
-
<checkout_onepage_success translate="label">
|
32 |
-
<label>Onepage Checkout Success</label>
|
33 |
-
<update handle="checkout_affiliate_success"/>
|
34 |
-
</checkout_onepage_success>
|
35 |
-
</layout>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!--
|
3 |
+
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
|
5 |
+
NOTICE OF LICENSE
|
6 |
+
|
7 |
+
This source file is subject to the eBay Enterprise
|
8 |
+
Magento Extensions End User License Agreement
|
9 |
+
that is bundled with this package in the file LICENSE.md.
|
10 |
+
It is also available through the world-wide-web at this URL:
|
11 |
+
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
|
13 |
+
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
-->
|
16 |
+
<layout version="0.1.0">
|
17 |
+
<default>
|
18 |
+
<reference name="head">
|
19 |
+
<block type="eems_affiliate/tracking" name="eems_affiliate.tracking" template="eems_affiliate/tracking.phtml"/>
|
20 |
+
</reference>
|
21 |
+
</default>
|
22 |
+
<checkout_affiliate_success translate="label">
|
23 |
+
<reference name="before_body_end">
|
24 |
+
<block type="eems_affiliate/beacon" name="eems_affiliate.beacon" template="eems_affiliate/beacon.phtml"/>
|
25 |
+
</reference>
|
26 |
+
</checkout_affiliate_success>
|
27 |
+
<checkout_multishipping_success translate="label">
|
28 |
+
<label>Multishipping Checkout Success</label>
|
29 |
+
<update handle="checkout_affiliate_success"/>
|
30 |
+
</checkout_multishipping_success>
|
31 |
+
<checkout_onepage_success translate="label">
|
32 |
+
<label>Onepage Checkout Success</label>
|
33 |
+
<update handle="checkout_affiliate_success"/>
|
34 |
+
</checkout_onepage_success>
|
35 |
+
</layout>
|
app/design/frontend/base/default/template/eems_affiliate/beacon.phtml
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the eBay Enterprise
|
8 |
-
* Magento Extensions End User License Agreement
|
9 |
-
* that is bundled with this package in the file LICENSE.md.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
*
|
13 |
-
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
?>
|
18 |
-
|
19 |
-
<?php if ($this->showBeacon()) :
|
20 |
-
?>
|
21 |
-
<?php $beaconUrl = $this->getBeaconUrl(); ?>
|
22 |
-
<script>
|
23 |
-
(function (d,i) {
|
24 |
-
i=d.createElement('iframe');
|
25 |
-
i.width=i.height=1;
|
26 |
-
i.frameBorder=0;
|
27 |
-
i.src="<?php echo $beaconUrl; ?>";
|
28 |
-
d.body.appendChild(i);
|
29 |
-
}(document));
|
30 |
-
</script>
|
31 |
-
<noscript>
|
32 |
-
<iframe width="1" height="1" frameBorder="0" src="<?php echo $beaconUrl; ?>"></iframe>
|
33 |
-
</noscript>
|
34 |
-
<?php
|
35 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the eBay Enterprise
|
8 |
+
* Magento Extensions End User License Agreement
|
9 |
+
* that is bundled with this package in the file LICENSE.md.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
* @license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
|
19 |
+
<?php if ($this->showBeacon()) :
|
20 |
+
?>
|
21 |
+
<?php $beaconUrl = $this->getBeaconUrl(); ?>
|
22 |
+
<script>
|
23 |
+
(function (d,i) {
|
24 |
+
i=d.createElement('iframe');
|
25 |
+
i.width=i.height=1;
|
26 |
+
i.frameBorder=0;
|
27 |
+
i.src="<?php echo $beaconUrl; ?>";
|
28 |
+
d.body.appendChild(i);
|
29 |
+
}(document));
|
30 |
+
</script>
|
31 |
+
<noscript>
|
32 |
+
<iframe width="1" height="1" frameBorder="0" src="<?php echo $beaconUrl; ?>"></iframe>
|
33 |
+
</noscript>
|
34 |
+
<?php
|
35 |
+
endif;
|
app/design/frontend/base/default/template/eems_affiliate/tracking.phtml
CHANGED
@@ -1,97 +1,97 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright (c) 2013-2014 eBay Enterprise, Inc.
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.md.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
*
|
12 |
-
* @copyright Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
13 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
14 |
-
*/
|
15 |
-
?>
|
16 |
-
|
17 |
-
<?php if ($this->injectJavaScript()) :
|
18 |
-
?>
|
19 |
-
<?php $keyName = $this->getQueryStringKeyName(); ?>
|
20 |
-
<?php $cookieName = $this->getCookieName(); ?>
|
21 |
-
<script type="text/javascript">
|
22 |
-
//<![CDATA[
|
23 |
-
(function (window, document, duration_in_days, key_name, cookie_name) {
|
24 |
-
var milliseconds_in_days = 1000 * 60 * 60 * 24;
|
25 |
-
var query = location.search.substring(1);
|
26 |
-
var source = findAffiliateField(query, key_name);
|
27 |
-
var cookie = getCookie(cookie_name);
|
28 |
-
|
29 |
-
if (source) {
|
30 |
-
// set or update the cookie with the value from the current query string
|
31 |
-
setCookie(cookie_name, source, duration_in_days);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @param cname name of the cookie
|
36 |
-
* @param cvalue value assigned to cookie
|
37 |
-
* @param exdays duration of the cookie in days
|
38 |
-
*/
|
39 |
-
function setCookie(cname, cvalue, exdays)
|
40 |
-
{
|
41 |
-
var d = new Date();
|
42 |
-
d.setTime(d.getTime() + (exdays * milliseconds_in_days));
|
43 |
-
var expires = "expires="+d.toUTCString();
|
44 |
-
document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @param cname name of the cookie
|
49 |
-
* @returns object | null object with the field and value or null if not found
|
50 |
-
*/
|
51 |
-
function getCookie(cname)
|
52 |
-
{
|
53 |
-
var cookies = document.cookie.split(';');
|
54 |
-
for (var i = 0; i < cookies.length; i++) {
|
55 |
-
var keyPair = cookies[i].split('=');
|
56 |
-
if (keyPair.length < 2)
|
57 |
-
continue;
|
58 |
-
var field = keyPair[0].trim();
|
59 |
-
var value = keyPair[1].trim();
|
60 |
-
|
61 |
-
if (field === cname) {
|
62 |
-
return {field: value};
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
return null;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @param query query string minus the '?'
|
71 |
-
* @param field query string field to search for
|
72 |
-
* @returns string | null value of the query string field or null if the field isn't there
|
73 |
-
*/
|
74 |
-
function findAffiliateField(query, field)
|
75 |
-
{
|
76 |
-
if (!query) {
|
77 |
-
return null;
|
78 |
-
}
|
79 |
-
|
80 |
-
var fields = query.split("&");
|
81 |
-
for (var i = 0; i < fields.length; i++) {
|
82 |
-
var keyPair = fields[i].split("=");
|
83 |
-
if (
|
84 |
-
keyPair.length == 2 &&
|
85 |
-
keyPair[0] === field
|
86 |
-
) {
|
87 |
-
return keyPair[1];
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
return null;
|
92 |
-
}
|
93 |
-
}(window, document,
|
94 |
-
//]]>
|
95 |
-
</script>
|
96 |
-
<?php
|
97 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2013-2014 eBay Enterprise, Inc.
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.md.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @copyright Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
13 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
14 |
+
*/
|
15 |
+
?>
|
16 |
+
|
17 |
+
<?php if ($this->injectJavaScript()) :
|
18 |
+
?>
|
19 |
+
<?php $keyName = $this->getQueryStringKeyName(); ?>
|
20 |
+
<?php $cookieName = $this->getCookieName(); ?>
|
21 |
+
<script type="text/javascript">
|
22 |
+
//<![CDATA[
|
23 |
+
(function (window, document, duration_in_days, key_name, cookie_name) {
|
24 |
+
var milliseconds_in_days = 1000 * 60 * 60 * 24;
|
25 |
+
var query = location.search.substring(1);
|
26 |
+
var source = findAffiliateField(query, key_name);
|
27 |
+
var cookie = getCookie(cookie_name);
|
28 |
+
|
29 |
+
if (source) {
|
30 |
+
// set or update the cookie with the value from the current query string
|
31 |
+
setCookie(cookie_name, source, duration_in_days);
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @param cname name of the cookie
|
36 |
+
* @param cvalue value assigned to cookie
|
37 |
+
* @param exdays duration of the cookie in days
|
38 |
+
*/
|
39 |
+
function setCookie(cname, cvalue, exdays)
|
40 |
+
{
|
41 |
+
var d = new Date();
|
42 |
+
d.setTime(d.getTime() + (exdays * milliseconds_in_days));
|
43 |
+
var expires = "expires="+d.toUTCString();
|
44 |
+
document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @param cname name of the cookie
|
49 |
+
* @returns object | null object with the field and value or null if not found
|
50 |
+
*/
|
51 |
+
function getCookie(cname)
|
52 |
+
{
|
53 |
+
var cookies = document.cookie.split(';');
|
54 |
+
for (var i = 0; i < cookies.length; i++) {
|
55 |
+
var keyPair = cookies[i].split('=');
|
56 |
+
if (keyPair.length < 2)
|
57 |
+
continue;
|
58 |
+
var field = keyPair[0].trim();
|
59 |
+
var value = keyPair[1].trim();
|
60 |
+
|
61 |
+
if (field === cname) {
|
62 |
+
return {field: value};
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
return null;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param query query string minus the '?'
|
71 |
+
* @param field query string field to search for
|
72 |
+
* @returns string | null value of the query string field or null if the field isn't there
|
73 |
+
*/
|
74 |
+
function findAffiliateField(query, field)
|
75 |
+
{
|
76 |
+
if (!query) {
|
77 |
+
return null;
|
78 |
+
}
|
79 |
+
|
80 |
+
var fields = query.split("&");
|
81 |
+
for (var i = 0; i < fields.length; i++) {
|
82 |
+
var keyPair = fields[i].split("=");
|
83 |
+
if (
|
84 |
+
keyPair.length == 2 &&
|
85 |
+
keyPair[0] === field
|
86 |
+
) {
|
87 |
+
return keyPair[1];
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
return null;
|
92 |
+
}
|
93 |
+
}(window, document, 365, "<?php echo $keyName ?>", "<?php echo $cookieName ?>"));
|
94 |
+
//]]>
|
95 |
+
</script>
|
96 |
+
<?php
|
97 |
+
endif;
|
app/etc/modules/EbayEnterprise_Affiliate.xml
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!--
|
3 |
-
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
-
|
5 |
-
NOTICE OF LICENSE
|
6 |
-
|
7 |
-
This source file is subject to the eBay Enterprise
|
8 |
-
Magento Extensions End User License Agreement
|
9 |
-
that is bundled with this package in the file LICENSE.md.
|
10 |
-
It is also available through the world-wide-web at this URL:
|
11 |
-
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
-
|
13 |
-
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
-
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
-
-->
|
16 |
-
<config>
|
17 |
-
<modules>
|
18 |
-
<EbayEnterprise_Affiliate>
|
19 |
-
<active>true</active>
|
20 |
-
<codePool>community</codePool>
|
21 |
-
</EbayEnterprise_Affiliate>
|
22 |
-
</modules>
|
23 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!--
|
3 |
+
Copyright (c) 2014 eBay Enterprise, Inc.
|
4 |
+
|
5 |
+
NOTICE OF LICENSE
|
6 |
+
|
7 |
+
This source file is subject to the eBay Enterprise
|
8 |
+
Magento Extensions End User License Agreement
|
9 |
+
that is bundled with this package in the file LICENSE.md.
|
10 |
+
It is also available through the world-wide-web at this URL:
|
11 |
+
http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf
|
12 |
+
|
13 |
+
@copyright Copyright (c) 2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
|
14 |
+
@license http://www.ebayenterprise.com/files/pdf/Magento_Connect_Extensions_EULA_050714.pdf eBay Enterprise Magento Extensions End User License Agreement
|
15 |
+
-->
|
16 |
+
<config>
|
17 |
+
<modules>
|
18 |
+
<EbayEnterprise_Affiliate>
|
19 |
+
<active>true</active>
|
20 |
+
<codePool>community</codePool>
|
21 |
+
</EbayEnterprise_Affiliate>
|
22 |
+
</modules>
|
23 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>eBay_Enterprise_Affiliate_Extension</name>
|
4 |
+
<version>1.2.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>EULA</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>eBay Enterprise Affiliate Extension.</summary>
|
10 |
+
<description>eBay Enterprise Affiliate Extension.</description>
|
11 |
+
<notes>Changelog for 1.2.0.0
|
12 |
+
Options to disable feeds
|
13 |
+
Feeds now set to run daily at 3:00am
|
14 |
+
Support for dynamic commissioning
|
15 |
+
Cookies increased to 365 days</notes>
|
16 |
+
<authors><author><name>Michael A. Smith</name><user>msmith3</user><email>msmith3@ebay.com</email></author><author><name>Philip Preston</name><user>phpreston</user><email>phpreston@ebay.com</email></author></authors>
|
17 |
+
<date>2016-02-19</date>
|
18 |
+
<time>19:53:27</time>
|
19 |
+
<contents><target name="mageetc"><dir name="modules"><file name="EbayEnterprise_Affiliate.xml" hash="c67e54262d466adebba66b7cc0e2df8f"/></dir></target><target name="magecommunity"><dir name="EbayEnterprise"><dir name="Affiliate"><dir name="Block"><file name="Beacon.php" hash="74bafb19d4753d599f71ed80790df8c1"/><file name="Tracking.php" hash="b8e8a1126f487f69dd575f5e14b630b9"/></dir><dir name="Exception"><file name="Configuration.php" hash="a5164f37b8e5e13dfc20561e13ec6c54"/></dir><dir name="Helper"><file name="Config.php" hash="166c7a5a4c3c7955ebf441e2a3d1bbc8"/><file name="Data.php" hash="04c3cf34e7a67ffc330607a4e16e91d5"/><dir name="Map"><file name="Order.php" hash="a53b5894c45d37b10eb50fa8f6c6c350"/><file name="Product.php" hash="f9f4b1337e040d52971fc7f669287c79"/></dir><file name="Map.php" hash="5329d762e01ed3cfe34dad14a9a59c01"/></dir><dir name="Model"><dir name="Feed"><file name="Abstract.php" hash="546bb078e115f4319a7e6052a4feaf4a"/><dir name="Order"><file name="Abstract.php" hash="676d28e0fa5677f70470eb7b32b45c16"/><file name="Basic.php" hash="a06460810245f18d4905dcf9a7bf5220"/><file name="Dynamic.php" hash="44601d213d1823d11d1598da7cab38b5"/><file name="Itemized.php" hash="f5ecb6e8b8f603a4717906aa4f130365"/></dir><file name="Product.php" hash="ecd0ac9efb2fd8feab577b888f8d55d7"/></dir><file name="Observer.php" hash="723ea0e39203210352ea3198b2840bce"/><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="CommissioningCategory.php" hash="0dd81e0901e6519043b31c322516a977"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="079b340ac5e2daa5197268c4464d2505"/><file name="Categories.php" hash="c412da8de21424e65628958a92eaa1c0"/><file name="Ordertypes.php" hash="bfa02f2a94175d49f192d77b9523e717"/><file name="Stockquantity.php" hash="0e4c5b6f0e45b10403c00660b54f3057"/><file name="Stockyesno.php" hash="154bedd15209f8110e69c80b207e7a68"/><file name="Transactiontype.php" hash="cd892832b62349c399ad147ba7217885"/><file name="Visibilityyesno.php" hash="b6de9a44184c9158d3be097b8cb4cec2"/></dir></dir></dir></dir><dir name="Test"><dir name="Block"><file name="BeaconTest.php" hash="c127f7453ab7ee6163760c518c698221"/><dir name="providers"><file name="testShowBeacon.yaml" hash="5b7a80f1de1e4196a9e56f9a71cb51a2"/></dir></dir><dir name="Helper"><file name="DataTest.php" hash="52be41226b17cd44eb29d97ec3ab4612"/><dir name="Map"><file name="ProductTest.php" hash="936eb3b538bd8c9ddc6a65c48a9df4d9"/></dir><dir name="providers"><file name="testIsValidCookie.yaml" hash="b3eb3eb30d78c7e67b7af51768b88492"/></dir></dir><dir name="Model"><dir name="Feed"><file name="AbstractTest.php" hash="98d14d1808a67917ce37fb4ba3b6c3cf"/><dir name="Order"><file name="AbstractTest.php" hash="83c0331bcc04784713ba55c7bad13c81"/><file name="BasicTest.php" hash="eea42c1eb603764f8332bbb4acf00ea5"/><file name="ItemizedTest.php" hash="c81153a22303700811670d0e912431c6"/></dir><file name="ProductTest.php" hash="2b33598eea0fab35aae2c0318d89de57"/></dir><file name="ObserverTest.php" hash="e0e1cd8b8170561513715ef9bbf64942"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="fccf9b602bb22175bfb81148cb216644"/><file name="config.xml" hash="c1d6b9a4d3f79312f331213c63a2e4b9"/><file name="system.xml" hash="ae97dcdaebedcdb3416a18584cd609c8"/></dir><dir name="sql"><dir name="eems_affiliate_setup"><file name="install-1.0.0.1.php" hash="1872e6830dc200364c24f76841b41832"/><file name="mysql4-install-1.0.0.1.php" hash="1872e6830dc200364c24f76841b41832"/><file name="mysql4-upgrade-1.0.0.1-1.2.0.0.php" hash="483d015528132052ad8ca0a07ea8efed"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="eems_affiliate.xml" hash="7d0b7b9a18086a9a61099a753d82f4fc"/></dir><dir name="template"><dir name="eems_affiliate"><file name="beacon.phtml" hash="40d3b19edc66bc22b5dc5ffbeec2507a"/><file name="tracking.phtml" hash="44fb259a8e0e0cf33c7b042976a325c3"/></dir></dir></dir></dir></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.3.0</min><max>5.6.99</max></php></required></dependencies>
|
22 |
+
</package>
|