Pepperjam_Network - Version 1.2.2.0

Version Notes

1.2.2.0 Release Notes
- Rebranded to Pepperjam
- Script to import settings from EEAN if previousy installed

Download this release

Release Info

Developer Philip Preston
Extension Pepperjam_Network
Version 1.2.2.0
Comparing to
See all releases


Version 1.2.2.0

Files changed (49) hide show
  1. app/code/community/Pepperjam/Network/Block/Adminhtml/System/Config/Form/Button.php +47 -0
  2. app/code/community/Pepperjam/Network/Block/Beacon.php +332 -0
  3. app/code/community/Pepperjam/Network/Block/Tracking.php +45 -0
  4. app/code/community/Pepperjam/Network/Exception/Configuration.php +20 -0
  5. app/code/community/Pepperjam/Network/Helper/Config.php +301 -0
  6. app/code/community/Pepperjam/Network/Helper/Data.php +178 -0
  7. app/code/community/Pepperjam/Network/Helper/Map.php +112 -0
  8. app/code/community/Pepperjam/Network/Helper/Map/Order.php +172 -0
  9. app/code/community/Pepperjam/Network/Helper/Map/Product.php +135 -0
  10. app/code/community/Pepperjam/Network/Model/Feed/Abstract.php +335 -0
  11. app/code/community/Pepperjam/Network/Model/Feed/Order/Abstract.php +70 -0
  12. app/code/community/Pepperjam/Network/Model/Feed/Order/Basic.php +73 -0
  13. app/code/community/Pepperjam/Network/Model/Feed/Order/Dynamic.php +82 -0
  14. app/code/community/Pepperjam/Network/Model/Feed/Order/Itemized.php +80 -0
  15. app/code/community/Pepperjam/Network/Model/Feed/Product.php +96 -0
  16. app/code/community/Pepperjam/Network/Model/Observer.php +74 -0
  17. app/code/community/Pepperjam/Network/Model/Product/Attribute/Source/CommissioningCategory.php +43 -0
  18. app/code/community/Pepperjam/Network/Model/System/Config/Source/Attributes.php +73 -0
  19. app/code/community/Pepperjam/Network/Model/System/Config/Source/Categories.php +35 -0
  20. app/code/community/Pepperjam/Network/Model/System/Config/Source/Ordertypes.php +39 -0
  21. app/code/community/Pepperjam/Network/Model/System/Config/Source/Stockquantity.php +35 -0
  22. app/code/community/Pepperjam/Network/Model/System/Config/Source/Stockyesno.php +35 -0
  23. app/code/community/Pepperjam/Network/Model/System/Config/Source/Transactiontype.php +28 -0
  24. app/code/community/Pepperjam/Network/Model/System/Config/Source/Visibilityyesno.php +35 -0
  25. app/code/community/Pepperjam/Network/Test/Block/BeaconTest.php +253 -0
  26. app/code/community/Pepperjam/Network/Test/Block/providers/testShowBeacon.yaml +99 -0
  27. app/code/community/Pepperjam/Network/Test/Helper/DataTest.php +53 -0
  28. app/code/community/Pepperjam/Network/Test/Helper/Map/ProductTest.php +173 -0
  29. app/code/community/Pepperjam/Network/Test/Helper/providers/testIsValidCookie.yaml +12 -0
  30. app/code/community/Pepperjam/Network/Test/Model/Feed/AbstractTest.php +291 -0
  31. app/code/community/Pepperjam/Network/Test/Model/Feed/Order/AbstractTest.php +58 -0
  32. app/code/community/Pepperjam/Network/Test/Model/Feed/Order/BasicTest.php +38 -0
  33. app/code/community/Pepperjam/Network/Test/Model/Feed/Order/ItemizedTest.php +38 -0
  34. app/code/community/Pepperjam/Network/Test/Model/Feed/ProductTest.php +167 -0
  35. app/code/community/Pepperjam/Network/Test/Model/ObserverTest.php +61 -0
  36. app/code/community/Pepperjam/Network/controllers/Adminhtml/PepperjamNetworkController.php +100 -0
  37. app/code/community/Pepperjam/Network/etc/adminhtml.xml +37 -0
  38. app/code/community/Pepperjam/Network/etc/config.xml +1041 -0
  39. app/code/community/Pepperjam/Network/etc/system.xml +950 -0
  40. app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/install-1.0.0.1.php +23 -0
  41. app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/mysql4-data-upgrade-1.2.1.0-1.2.2.0.php +116 -0
  42. app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/mysql4-install-1.0.0.1.php +23 -0
  43. app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/mysql4-upgrade-1.0.0.1-1.2.0.0.php +52 -0
  44. app/design/adminhtml/default/default/template/pepperjam_network/system/config/button.phtml +32 -0
  45. app/design/frontend/base/default/layout/pepperjam_network.xml +35 -0
  46. app/design/frontend/base/default/template/pepperjam_network/beacon.phtml +34 -0
  47. app/design/frontend/base/default/template/pepperjam_network/tracking.phtml +98 -0
  48. app/etc/modules/Pepperjam_Network.xml +23 -0
  49. package.xml +20 -0
app/code/community/Pepperjam/Network/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+
18
+ class Pepperjam_Network_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
19
+ {
20
+ protected function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->setTemplate('pepperjam_network/system/config/button.phtml');
24
+ }
25
+
26
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
27
+ {
28
+ return $this->_toHtml();
29
+ }
30
+
31
+ public function getAjaxUninstallUrl()
32
+ {
33
+ return Mage::helper('adminhtml')->getUrl('adminhtml/pepperjamNetwork/uninstall');
34
+ }
35
+
36
+ public function getButtonHtml()
37
+ {
38
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(
39
+ array(
40
+ 'id' => 'pepperjam_network_uninstall',
41
+ 'label' => $this->helper('adminhtml')->__('Uninstall'),
42
+ 'onclick' => 'javascript:uninstall(); return false;',
43
+ ));
44
+
45
+ return $button->toHtml();
46
+ }
47
+ }
app/code/community/Pepperjam/Network/Block/Beacon.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+
18
+ class Pepperjam_Network_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 Pepperjam_Network_Helper_Data */
84
+ protected $_helper = null;
85
+
86
+ /** @var Pepperjam_Network_Helper_Config */
87
+ protected $_configHelper = null;
88
+
89
+ /**
90
+ * @return Pepperjam_Network_Helper_Data
91
+ */
92
+ protected function _getHelper()
93
+ {
94
+ if (!$this->_helper) {
95
+ $this->_helper = Mage::helper('pepperjam_network');
96
+ }
97
+
98
+ return $this->_helper;
99
+ }
100
+
101
+ /**
102
+ * @return Pepperjam_Network_Helper_Config
103
+ */
104
+ protected function _getConfigHelper()
105
+ {
106
+ if (!$this->_configHelper) {
107
+ $this->_configHelper = Mage::helper('pepperjam_network/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('pepperjam_network/config')->isItemizedOrders()) {
140
+ $params = $this->_buildItemizedParams($order);
141
+ } elseif (Mage::helper('pepperjam_network/config')->isDynamicOrders()) {
142
+ $params = $this->_buildDynamicParams($order);
143
+ } else {
144
+ $params = $this->_buildBasicParams($order);
145
+ }
146
+
147
+ $url = Mage::helper('pepperjam_network')->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('pepperjam_network/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('pepperjam_network/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('pepperjam_network/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 (if the pricing is dynamic)
201
+ // total of the bundleis the sum of all child products which are also included
202
+ // in the beacon so including both totals would effectively double the price of
203
+ // the bundle
204
+ //
205
+ // Divide discount amount by quantity to get per item discount
206
+ $total = $item->getPrice() - ($item->getDiscountAmount() / $item->getQtyOrdered());
207
+ if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $item->getProduct()->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC) {
208
+ $total = 0.00;
209
+ }
210
+
211
+ if ($position) {
212
+ // we detected that the current item already exist in the params array
213
+ // and have the key increment position let's simply adjust
214
+ // the qty and total amount
215
+ $params[static::KEY_QTY . $position] += $quantity;
216
+ $amtKey = static::KEY_AMOUNT . $position;
217
+ $params[$amtKey] = number_format($params[$amtKey] + $total, 2, '.', '');
218
+ } else {
219
+ $params = array_merge($params, array(
220
+ static::KEY_ITEM . $increment => $item->getSku(),
221
+ static::KEY_QTY . $increment => $quantity,
222
+ static::KEY_AMOUNT . $increment => number_format($total, 2, '.', ''),
223
+ ));
224
+ $increment++; // only get incremented when a unique key have been appended
225
+ }
226
+ }
227
+ return $params;
228
+ }
229
+
230
+ /**
231
+ * build dynamic order params array for dynamic beacon URL
232
+ * @param Mage_Sales_Model_Order $order
233
+ * @return array
234
+ */
235
+ protected function _buildDynamicParams(Mage_Sales_Model_Order $order)
236
+ {
237
+ $helper = Mage::helper('pepperjam_network');
238
+
239
+ $params = $this->_buildItemizedParams($order);
240
+
241
+ // Swap query key names for dynamic versions
242
+ $params[self::KEY_DYNAMIC_PROGRAM_ID] = $params[self::KEY_PID];
243
+ $params[self::KEY_DYNAMIC_ORDER_ID] = $params[self::KEY_OID];
244
+ unset($params[self::KEY_PID]);
245
+ unset($params[self::KEY_OID]);
246
+ if (isset($params[self::KEY_PROMOCODE])) {
247
+ $params[self::KEY_DYNAMIC_COUPON] = $params[self::KEY_PROMOCODE];
248
+ unset($params[self::KEY_PROMOCODE]);
249
+ }
250
+
251
+ // See if email has any history
252
+ $params[self::KEY_DYNAMIC_NEW_TO_FILE] = (int)$helper->isNewToFile($order);
253
+
254
+ $productIds = array();
255
+ foreach($order->getAllItems() as $item) {
256
+ $productIds[] = $item->getProduct()->getId();
257
+ }
258
+
259
+ $productCollection = Mage::getModel('catalog/product')->getCollection()
260
+ ->addAttributeToFilter('entity_id', array('in', $productIds))
261
+ ->addCategoryIds();
262
+
263
+ // No need for increment, all items are in param already
264
+ $lastPosition = 0;
265
+ foreach($order->getAllItems() as $item) {
266
+ // Every item should be found here
267
+ $position = $this->_getDupePosition($params, $item);
268
+
269
+ // Add category IDs
270
+ $product = $productCollection->getItemById($item->getProduct()->getId());
271
+ $item->getProduct()->setCategoryIds($product->getCategoryIds());
272
+
273
+ // Get item's category
274
+ $params[self::KEY_DYNAMIC_CATEGORY . $position] = $helper->getCommissioningCategory($item);
275
+
276
+ // Update last position
277
+ $lastPosition = max($lastPosition, $position);
278
+ }
279
+
280
+ // Swap key names for dynamic versions
281
+ for($position = 1; $position <= $lastPosition; $position += 1) {
282
+ // Replace query string keys
283
+ $params[self::KEY_DYNAMIC_ITEM_ID . $position] = $params[self::KEY_ITEM . $position];
284
+ $params[self::KEY_DYNAMIC_ITEM_PRICE . $position] = $params[self::KEY_AMOUNT . $position];
285
+ $params[self::KEY_DYNAMIC_QUANTITY . $position] = $params[self::KEY_QTY . $position];
286
+ unset($params[self::KEY_ITEM . $position]);
287
+ unset($params[self::KEY_AMOUNT . $position]);
288
+ unset($params[self::KEY_QTY . $position]);
289
+ }
290
+
291
+ return $params;
292
+ }
293
+
294
+ /**
295
+ * check if the current sku already exists in the params data if so return
296
+ * the position it is found in
297
+ * @param array $params the given array of keys needed to build the beacon URL querystring
298
+ * @param Mage_Sales_Model_Order_Item $item
299
+ * @return int the item position where dupe found otherwise zero
300
+ */
301
+ protected function _getDupePosition(array $params, Mage_Sales_Model_Order_Item $item)
302
+ {
303
+ $key = array_search($item->getSku(), $params, true);
304
+ return ($key !== false)?
305
+ (int) str_replace(static::KEY_ITEM, '', $key) : 0;
306
+ }
307
+
308
+ /**
309
+ * Whether or not to display the beacon.
310
+ *
311
+ * Show the pixel only if tracking is enabled and we have a valid order
312
+ * AND either conditional pixel logic is OFF or it is ON and we have
313
+ * a valid cookie.
314
+ *
315
+ * @return bool
316
+ */
317
+ public function showBeacon()
318
+ {
319
+ $config = $this->_getConfigHelper();
320
+
321
+ return (
322
+ (
323
+ $config->isEnabled() &&
324
+ $this->_getOrder() instanceof Mage_Sales_Model_Order
325
+ ) &&
326
+ (
327
+ $this->_getHelper()->isValidCookie() ||
328
+ !$config->isConditionalPixelEnabled()
329
+ )
330
+ );
331
+ }
332
+ }
app/code/community/Pepperjam/Network/Block/Tracking.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+
18
+ class Pepperjam_Network_Block_Tracking extends Mage_Core_Block_Template
19
+ {
20
+ /**
21
+ * @return string | null
22
+ */
23
+ public function getCookieName()
24
+ {
25
+ return Mage::helper('pepperjam_network')->getSourceCookieName();
26
+ }
27
+
28
+ /**
29
+ * @return string | null
30
+ */
31
+ public function getQueryStringKeyName()
32
+ {
33
+ return Mage::helper('pepperjam_network/config')->getSourceKeyName();
34
+ }
35
+
36
+ /**
37
+ * Whether or not to inject the javascript to set the tracking cookie
38
+ *
39
+ * @return bool
40
+ */
41
+ public function injectJavaScript()
42
+ {
43
+ return (Mage::helper('pepperjam_network/config')->isConditionalPixelEnabled());
44
+ }
45
+ }
app/code/community/Pepperjam/Network/Exception/Configuration.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+
18
+ class Pepperjam_Network_Exception_Configuration extends Mage_Core_Exception
19
+ {
20
+ }
app/code/community/Pepperjam/Network/Helper/Config.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+
18
+ /**
19
+ * @codeCoverageIgnore
20
+ */
21
+ class Pepperjam_Network_Helper_Config
22
+ {
23
+ const BEACON_URL_PATH = 'pepperjam/pepperjam_network/beacon_url';
24
+ const ENABLED_PATH = 'pepperjam/pepperjam_network/active';
25
+ const ORDER_TYPE_PATH = 'pepperjam/pepperjam_network/order_type';
26
+ const PROGRAM_ID_PATH = 'pepperjam/pepperjam_network/program_id';
27
+ const TRANSACTION_TYPE_PATH = 'pepperjam/pepperjam_network/transaction_type';
28
+ const EXPORT_FILE_PATH_CONFIG_PATH = 'pepperjam/pepperjam_network/export_path';
29
+ const CALLBACK_MAPPINGS_PATH = 'pepperjam/pepperjam_network/feeds/callback_mappings';
30
+ const PRODUCT_FEED_MAPPING_PATH = 'pepperjam/pepperjam_network_product_attribute_map';
31
+ const PRODUCT_FEED_FILENAME_FORMAT_PATH = 'pepperjam/pepperjam_network/feeds/product/file_name_format';
32
+ const DYNAMIC_ORDER_FEED_MAPPING_PATH = 'pepperjam/pepperjam_network/feeds/order_dynamic/fields';
33
+ const ITEMIZED_ORDER_FEED_MAPPING_PATH = 'pepperjam/pepperjam_network/feeds/order_itemized/fields';
34
+ const BASIC_ORDER_FEED_MAPPING_PATH = 'pepperjam/pepperjam_network/feeds/order_basic/fields';
35
+ const DYNAMIC_ORDER_FEED_FILE_FORMAT_PATH = 'pepperjam/pepperjam_network/feeds/order_dynamic/file_name_format';
36
+ const ITEMIZED_ORDER_FEED_FILE_FORMAT_PATH = 'pepperjam/pepperjam_network/feeds/order_itemized/file_name_format';
37
+ const BASIC_ORDER_FEED_FILE_FORMAT_PATH = 'pepperjam/pepperjam_network/feeds/order_basic/file_name_format';
38
+ const ORDER_LAST_RUN_PATH = 'pepperjam/pepperjam_network/feed/last_run_time';
39
+ const JS_FILES = 'pepperjam/pepperjam_network/js_files';
40
+ const CONDITIONAL_PIXEL_ENABLED = 'pepperjam/pepperjam_network/conditional_pixel_enabled';
41
+ const SOURCE_KEY_NAME = 'pepperjam/pepperjam_network/source_key_name';
42
+ const PRODUCT_FEED_ENABLED = 'pepperjam/pepperjam_network/product_feed_enabled';
43
+ const ORDER_FEED_ENABLED = 'pepperjam/pepperjam_network/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/Pepperjam/Network/Helper/Data.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+
18
+ class Pepperjam_Network_Helper_Data extends Mage_Core_Helper_Abstract
19
+ {
20
+ /** value for the source cookie */
21
+ const SOURCE_KEY_VALUE_EBAY = 'eean';
22
+ const SOURCE_KEY_VALUE_PEPPERJAM = 'pepperjam';
23
+ /** prefix added to the source key name set in the admin panel to create a unique cookie name */
24
+ const SOURCE_COOKIE_PREFIX = 'pepperjam_network_';
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('pepperjam_network/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('pepperjam_network/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('pepperjam_network/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('pepperjam_network/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('pepperjam_network/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 in_array($value, array(self::SOURCE_KEY_VALUE_PEPPERJAM, self::SOURCE_KEY_VALUE_EBAY));
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/Pepperjam/Network/Helper/Map.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network 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 Pepperjam_Network_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('pepperjam_network/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('pepperjam_network')->parseBoolToYesNo(
108
+ $params['item']->getDataUsingMethod($params['key'])
109
+ )
110
+ );
111
+ }
112
+ }
app/code/community/Pepperjam/Network/Helper/Map/Order.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network 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 Pepperjam_Network_Helper_Map
22
+ */
23
+ class Pepperjam_Network_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('pepperjam_network/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('pepperjam_network/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('pepperjam_network/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 Pepperjam_Network_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('pepperjam_network/map')->getDataValue($params))
157
+ );
158
+ }
159
+
160
+ public function getCategory($params)
161
+ {
162
+ $item = $params['item'];
163
+ return Mage::helper('pepperjam_network')->getCommissioningCategory($item);
164
+ }
165
+
166
+ public function getNewToFile($params)
167
+ {
168
+ $order = $params['item']->getOrder();
169
+
170
+ return (int) Mage::helper('pepperjam_network')->isNewToFile($order);
171
+ }
172
+ }
app/code/community/Pepperjam/Network/Helper/Map/Product.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network 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 Pepperjam_Network_Helper_Map
22
+ */
23
+ class Pepperjam_Network_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('pepperjam_network')->parseBoolToYesNo(
130
+ Mage::getModel('cataloginventory/stock_item')
131
+ ->loadByProduct($params['item'])
132
+ ->getIsInStock()
133
+ );
134
+ }
135
+ }
app/code/community/Pepperjam/Network/Model/Feed/Abstract.php ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ abstract class Pepperjam_Network_Model_Feed_Abstract
18
+ {
19
+ /**
20
+ * The store context the feed is generated for. May be set to any viable store
21
+ * identified.
22
+ * @var Mage_Core_Model_Store
23
+ */
24
+ protected $_store;
25
+ /**
26
+ * Get a collection of items to be included in the feed.
27
+ * @return Varien_Data_Collection
28
+ */
29
+ abstract protected function _getItems();
30
+ /**
31
+ * Get fields to include in the feed. Fields are expected to map to existing
32
+ * callbacks defined in the config.xml.
33
+ * @see self::_invokeCallback
34
+ * @return array
35
+ */
36
+ abstract protected function _getFeedFields();
37
+ /**
38
+ * Gets the filename format for the feed from config for this feed.
39
+ * @return string
40
+ */
41
+ abstract protected function _getFileName();
42
+ /**
43
+ * Get the delimiter to use in the csv file
44
+ * @return string
45
+ * @codeCoverageIgnore
46
+ */
47
+ protected function _getDelimiter()
48
+ {
49
+ return ',';
50
+ }
51
+ /**
52
+ * Get the encolsure to use in the csv file
53
+ * @return string
54
+ * @codeCoverageIgnore
55
+ */
56
+ protected function _getEnclosure()
57
+ {
58
+ return '"';
59
+ }
60
+ /**
61
+ * Set up the store property.
62
+ */
63
+ public function __construct($args = array())
64
+ {
65
+ // Set the store context to the given store or null which whill
66
+ // result in the "current" store.
67
+ $this->setStore(isset($args['store']) ? $args['store'] : null);
68
+ }
69
+ /**
70
+ * Set the store context for the feed, converting whatever viable store
71
+ * ID is passed in to an actual store instance.
72
+ * @see Mage_Core_Model_App::getStore for how various identifiers may be used to represent a store
73
+ * @param null|string|bool|int|Mage_Core_Model_Store
74
+ * @codeCoverageIgnore
75
+ */
76
+ public function setStore($storeId)
77
+ {
78
+ $this->_store = Mage::app()->getStore($storeId);
79
+ return $this;
80
+ }
81
+ /**
82
+ * Get the store instance the feed is being executed within.
83
+ * @return Mage_Core_Model_Store
84
+ * @codeCoverageIgnore
85
+ */
86
+ public function getStore()
87
+ {
88
+ return $this->_store;
89
+ }
90
+ /**
91
+ * Create the feed file and drop it in the configured export directory.
92
+ * @return self
93
+ */
94
+ public function generateFeed()
95
+ {
96
+ $this->_generateFile($this->_buildFeedData());
97
+ return $this;
98
+ }
99
+ /**
100
+ * Create arrays of data that should be included in the feed file. Each array
101
+ * should included a value for every field that is expected to be in the feed.
102
+ * @return array
103
+ */
104
+ protected function _buildFeedData()
105
+ {
106
+ $items = $this->_getItems();
107
+ Mage::log(sprintf('building feed for %d items', $items->count()));
108
+ // array_map must be on an array - $items is a collection so need to get the
109
+ // underlying array to pass to array_map
110
+ return array_map(array($this, '_applyMapping'), $items->getItems());
111
+ }
112
+ /**
113
+ * Use the callback mapping to create the data that represents the given item
114
+ * in the feed.
115
+ * @param mixed $item Likely a Varien_Object but could really be anything.
116
+ * @return array
117
+ */
118
+ protected function _applyMapping($item)
119
+ {
120
+ $fields = array();
121
+ $mappings = Mage::helper('pepperjam_network/config')->getCallbackMappings();
122
+ foreach ($this->_getFeedFields() as $feedField) {
123
+ // If the mapping doesn't exist, supplying an empty array will eventually
124
+ // result in an exception for being an invalid config mapping.
125
+ // @see self::_validateCallbackConfig
126
+ $callback = isset($mappings[$feedField]) ? $mappings[$feedField] : array();
127
+ // exclude any mappings that have a type of "disabled"
128
+ if (!isset($callback['type']) || $callback['type'] !== 'disabled') {
129
+ $fields[] = $this->_invokeCallback($callback, $item);
130
+ }
131
+ }
132
+ return $fields;
133
+ }
134
+ /**
135
+ * Given a set of callback configuration and an item, invoke the configured
136
+ * callback and return the value. The callback configuration must meet the
137
+ * following requirements:
138
+ * - May contain a "type" key indicating the type of factory to use. May be
139
+ * one of:
140
+ * - "disabled" - will not be included in the feed
141
+ * - "helper" - will use the Mage::helper factory
142
+ * - "model" - will use the Mage::getModel factory
143
+ * - "singleton" - will use the Mage::getSingleton factory
144
+ * - If not included, will default to "singleton"
145
+ * - When type is "disabled" no other key/value pairs are required.
146
+ * - If type is not "disabled" the following must be included:
147
+ * - "class" must be a valid class alias for the configured factory type
148
+ * - "method" must be a valid method on the configured class
149
+ * - A "params" key may also be included. If included, its value must be
150
+ * an array of key/value pairs that will be included in the params array
151
+ * passed to the callback method.
152
+ * Every callback will be called with an array of params. The array will
153
+ * contain any key/value pairs added in the config as well as an "item" key
154
+ * which will have the item being mapped as the value and a "store" key which
155
+ * will have the store instance representing the store view context the feed
156
+ * is being generated for.
157
+ *
158
+ * Example configuration:
159
+ * <code>
160
+ * // This callback configuration array:
161
+ * $cfg = array(
162
+ * 'type' => 'helper',
163
+ * 'class' => 'pepperjam_network/map',
164
+ * 'column_name' => 'OID',
165
+ * 'params' => array(
166
+ * 'key' => 'increment_id',
167
+ * ),
168
+ * );
169
+ * // Will result in the following invocation:
170
+ * Mage::helper('pepperjam_network/map')->getDataValue(
171
+ * array('key' => 'increment_id', 'item' => $item)
172
+ * );
173
+ * </code>
174
+ *
175
+ * @see src/app/code/community/Pepperjam/Network/etc/config.xml pepperjam/pepperjam_network/feeds contains mappings used for the affiliate feeds
176
+ * @param array $callbackConfig
177
+ * @param mixed $item
178
+ * @return mixed
179
+ */
180
+ protected function _invokeCallback($callbackConfig, $item)
181
+ {
182
+ $obj = $this->_getCallbackInstance($callbackConfig);
183
+ $params = isset($callbackConfig['params']) ? $callbackConfig['params'] : array();
184
+ $item->setStoreId($this->getStore()->getId());
185
+ $params['item'] = $item;
186
+ $params['store'] = $this->getStore();
187
+ $method = $callbackConfig['method'];
188
+ if (method_exists($obj, $method)) {
189
+ return $obj->$method($params);
190
+ } else {
191
+ throw new Pepperjam_Network_Exception_Configuration(
192
+ sprintf(
193
+ 'Configured callback method %s::%s does not exist',
194
+ get_class($obj),
195
+ $method
196
+ )
197
+ );
198
+ }
199
+ }
200
+ /**
201
+ * Get an instance of the configured callback.
202
+ * @param array $callbackConfig
203
+ * @return mixed
204
+ */
205
+ protected function _getCallbackInstance($callbackConfig)
206
+ {
207
+ $this->_validateCallbackConfig($callbackConfig);
208
+ switch ($callbackConfig['type']) {
209
+ // 'disabled' type callback mappings shouldn't pass through here under
210
+ // "normal" circumstances (filtered out in apply mapping) but if they do,
211
+ // do nothing and return null
212
+ case 'disabled':
213
+ return null;
214
+ case 'helper':
215
+ return Mage::helper($callbackConfig['class']);
216
+ case 'model':
217
+ return Mage::getModel($callbackConfig['class']);
218
+ case 'singleton':
219
+ default:
220
+ return Mage::getSingleton($callbackConfig['class']);
221
+ }
222
+ }
223
+ /**
224
+ * Make sure the callback configuration is valid. If it isn't throw an
225
+ * exception.
226
+ * @param array $callbackConfig
227
+ * @return self
228
+ * @throws Pepperjam_Network_Exception_Configuration If callback configuration is not valid
229
+ */
230
+ protected function _validateCallbackConfig($callbackConfig)
231
+ {
232
+ if (empty($callbackConfig)) {
233
+ throw new Pepperjam_Network_Exception_Configuration('Callback configuration is empty or missing.');
234
+ }
235
+ // When the callback is "disabled" no other configuration is necessary.
236
+ if (isset($callbackConfig['type']) && $callbackConfig['type'] === 'disabled') {
237
+ return $this;
238
+ }
239
+ // If not disabled, must have a class and method - separate checks for
240
+ // more simply providing more useful error messages.
241
+ $missingFields = array_diff(array('class', 'method', 'column_name'), array_keys($callbackConfig));
242
+ if ($missingFields) {
243
+ throw new Pepperjam_Network_Exception_Configuration(
244
+ sprintf('Callback missing %s configuration.', implode(', ', $missingFields))
245
+ );
246
+ }
247
+ return $this;
248
+ }
249
+ /**
250
+ * Create the file and drop it in the configured export directory.
251
+ * @param array $feedData
252
+ * @return self
253
+ */
254
+ protected function _generateFile($feedData)
255
+ {
256
+ if (empty($feedData)) {
257
+ return $this;
258
+ }
259
+ $delimiter = $this->_getDelimiter();
260
+ $enclosure = $this->_getEnclosure();
261
+
262
+ $tmpFile = fopen('php://temp', 'r+');
263
+ fputcsv($tmpFile, $this->_getHeaders(), $delimiter, $enclosure);
264
+ foreach ($feedData as $row) {
265
+ fputcsv($tmpFile, $row, $delimiter, $enclosure);
266
+ }
267
+ rewind($tmpFile);
268
+
269
+ $targetPath = $this->_generateFilePath();
270
+ $this->_checkAndCreateFolder(dirname($targetPath));
271
+
272
+ // send the contents of the temp stream to the actual file
273
+ file_put_contents(
274
+ $targetPath,
275
+ stream_get_contents($tmpFile)
276
+ );
277
+ return $this;
278
+ }
279
+ /**
280
+ * Generate the full path to the location where the file should be created.
281
+ * @return string
282
+ */
283
+ protected function _generateFilePath()
284
+ {
285
+ return self::normalPaths(
286
+ Mage::getBaseDir(),
287
+ Mage::helper('pepperjam_network/config', $this->getStore())->getExportFilePath(),
288
+ $this->_getFileName()
289
+ );
290
+ }
291
+ /**
292
+ * The CSV file headers should be the keys used in the configured mappings.
293
+ * @return array
294
+ */
295
+ protected function _getHeaders()
296
+ {
297
+ $mappings = Mage::helper('pepperjam_network/config')->getCallbackMappings();
298
+ $headers = array();
299
+ foreach ($this->_getFeedFields() as $field) {
300
+ $callbackMapping = isset($mappings[$field]) ? $mappings[$field] : array();
301
+ if (!isset($callbackMapping['type']) || $callbackMapping['type'] !== 'disabled') {
302
+ $this->_validateCallbackConfig($callbackMapping);
303
+ $headers[] = $callbackMapping['column_name'];
304
+ }
305
+ }
306
+ return $headers;
307
+ }
308
+ /**
309
+ * Make sure that all necessary directories in the given path exist. Create
310
+ * any that do not.
311
+ * @param string $dirPath
312
+ * @return self
313
+ */
314
+ protected function _checkAndCreateFolder($dirPath)
315
+ {
316
+ // Use the model factory to allow for DI via the factory
317
+ $fileIo = Mage::getModel('Varien_Io_File');
318
+ $fileIo->open(array('path' => Mage::getBaseDir()));
319
+ $fileIo->checkAndCreateFolder($dirPath);
320
+ return $this;
321
+ }
322
+ /**
323
+ * Given an arbitrary array of arguments, join them to make a valid path.
324
+ * @param string $_,... Parts of the path to be joined
325
+ * @return string
326
+ */
327
+ public static function normalPaths()
328
+ {
329
+ $paths = implode(DS, func_get_args());
330
+ // Retain a single leading slash; otherwise remove all leading, trailing
331
+ // and duplicate slashes.
332
+ return ((substr($paths, 0, 1) === DS) ? DS : '') .
333
+ implode(DS, array_filter(explode(DS, $paths)));
334
+ }
335
+ }
app/code/community/Pepperjam/Network/Model/Feed/Order/Abstract.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ abstract class Pepperjam_Network_Model_Feed_Order_Abstract extends Pepperjam_Network_Model_Feed_Abstract
18
+ {
19
+ // Time format to use for the SQL statements
20
+ const SELECT_TIME_FORMAT = 'Y-m-d H:i:s';
21
+ const FILENAME_TIME_FORMAT = 'YmdHis';
22
+ /**
23
+ * Time stamp considered to be the time at which the feed runs - used for
24
+ * generating the file name and the cutoff time for capturing order changes.
25
+ * @var int
26
+ */
27
+ protected $_startTime;
28
+ /**
29
+ * Allow for the "start" time of the feed to be passed in the constructor
30
+ * $args array. If given, this should be the time at which the feed is run.
31
+ * @param array $args
32
+ */
33
+ public function __construct($args = array())
34
+ {
35
+ parent::__construct($args);
36
+ $this->_startTime = isset($args['start_time']) ? $args['start_time'] : time();
37
+ }
38
+ /**
39
+ * Get the ids of all stores that should be included in the feed. Only orders
40
+ * placed for these stores will be included in the corrected feed.
41
+ * @return array
42
+ */
43
+ protected function _getStoreIdsToInclude()
44
+ {
45
+ return array_map(
46
+ function ($store) {
47
+ return $store->getId();
48
+ },
49
+ Mage::helper('pepperjam_network')->getAllStoresForProgramId(
50
+ Mage::helper('pepperjam_network/config')->getProgramId($this->_store)
51
+ )
52
+ );
53
+ }
54
+ /**
55
+ * @see parent::_getFileName
56
+ */
57
+ protected function _getFileName()
58
+ {
59
+ return sprintf(
60
+ $this->_getFileNameFormat(),
61
+ Mage::helper('pepperjam_network/config')->getProgramId($this->getStore()),
62
+ date(static::FILENAME_TIME_FORMAT, $this->_startTime)
63
+ );
64
+ }
65
+ /**
66
+ * Get the format string used to build the feed file name.
67
+ * @return string
68
+ */
69
+ abstract protected function _getFileNameFormat();
70
+ }
app/code/community/Pepperjam/Network/Model/Feed/Order/Basic.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_Feed_Order_Basic extends Pepperjam_Network_Model_Feed_Order_Abstract
18
+ {
19
+ /**
20
+ * @see parent::_getItems
21
+ */
22
+ protected function _getItems()
23
+ {
24
+ $lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('pepperjam_network/config')->getOrderLastRunTime() ?: 0);
25
+ $startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
26
+ $storeIds = $this->_getStoreIdsToInclude();
27
+
28
+ $collection = Mage::getResourceModel('sales/order_collection');
29
+ $select = $collection->getSelect();
30
+ $select
31
+ ->joinLeft(
32
+ array('cmo' => $collection->getTable('sales/creditmemo')),
33
+ 'main_table.entity_id = cmo.order_id',
34
+ array()
35
+ )
36
+ // this is far more pure SQL than should be here but I don't see a way to
37
+ // get the proper groupings of where clauses without doing this
38
+ ->where(
39
+ 'main_table.store_id IN (?)',
40
+ $storeIds
41
+ )
42
+ ->where(
43
+ "(main_table.original_increment_id IS NOT NULL AND main_table.created_at >= :lastRunTime AND main_table.created_at < :startTime) OR" .
44
+ "(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR" .
45
+ "(main_table.state = 'canceled' AND main_table.updated_at >= :lastRunTime AND main_table.updated_at < :startTime AND main_table.relation_child_id IS NULL)"
46
+ );
47
+
48
+ $collection->addBindParam(':lastRunTime', $lastRunTime)
49
+ ->addBindParam(':startTime', $startTime);
50
+
51
+ return $collection;
52
+ }
53
+ /**
54
+ * Get an array of callback mappings for the feed. Should result in an array
55
+ * with keys for the field in the CSV and a value of an array used to
56
+ * represent a mapping callback.
57
+ * @see parent::_invokeCallback
58
+ */
59
+ protected function _getFeedFields()
60
+ {
61
+ return explode(',', Mage::helper('pepperjam_network/config')->getBasicOrderFeedFields());
62
+ }
63
+ /**
64
+ * Get the file name format from config. Doesn't pass store context as the
65
+ * file name format should only ever exist at the global level.
66
+ * @see parent::_getFileNameFormat
67
+ * @codeCoverageIgnore
68
+ */
69
+ protected function _getFileNameFormat()
70
+ {
71
+ return Mage::helper('pepperjam_network/config')->getBasicOrderFeedFileFormat();
72
+ }
73
+ }
app/code/community/Pepperjam/Network/Model/Feed/Order/Dynamic.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_Feed_Order_Dynamic extends Pepperjam_Network_Model_Feed_Order_Abstract
18
+ {
19
+ /**
20
+ * @see parent::_getItems
21
+ */
22
+ protected function _getItems()
23
+ {
24
+ $lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('pepperjam_network/config')->getOrderLastRunTime() ?: 0);
25
+ $startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
26
+ $storeIds = $this->_getStoreIdsToInclude();
27
+
28
+ $collection = Mage::getResourceModel('sales/order_item_collection');
29
+ $select = $collection->getSelect();
30
+ $select
31
+ ->joinLeft(
32
+ array('o' => $collection->getTable('sales/order')),
33
+ 'main_table.order_id = o.entity_id',
34
+ array('o.increment_id', 'o.original_increment_id')
35
+ )
36
+ ->joinLeft(
37
+ array('cmo' => $collection->getTable('sales/creditmemo')),
38
+ 'main_table.order_id = cmo.order_id',
39
+ array()
40
+ )
41
+ // this is far more pure SQL than should be here but I don't see a way to
42
+ // get the proper groupings of where clauses without doing this
43
+ ->where(
44
+ // get only items within the correct store scope and filter out any
45
+ // configurable used simple products
46
+ '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)',
47
+ $storeIds
48
+ )
49
+ ->where(
50
+ "(o.original_increment_id IS NOT NULL AND o.created_at >= :lastRunTime AND o.created_at < :startTime) OR " .
51
+ "(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR " .
52
+ "(o.state = 'canceled' AND o.updated_at >= :lastRunTime AND o.updated_at < :startTime AND o.relation_child_id IS NULL)"
53
+ )
54
+ // The left joins can leave duplicate item rows
55
+ // But the selected items will be identical, so we don't need them.
56
+ ->distinct();
57
+
58
+ $collection->addBindParam(':lastRunTime', $lastRunTime)
59
+ ->addBindParam(':startTime', $startTime);
60
+
61
+ return $collection;
62
+ }
63
+
64
+ /**
65
+ * @see parent::_getFeedFields
66
+ */
67
+ protected function _getFeedFields()
68
+ {
69
+ return explode(',', Mage::helper('pepperjam_network/config')->getDynamicOrderFeedFields());
70
+ }
71
+
72
+ /**
73
+ * Get the file name format from config. Doesn't pass store context as the
74
+ * file name format should only ever exist at the global level.
75
+ * @see parent::_getFileNameFormat
76
+ * @codeCoverageIgnore
77
+ */
78
+ protected function _getFileNameFormat()
79
+ {
80
+ return Mage::helper('pepperjam_network/config')->getDynamicOrderFeedFileFormat();
81
+ }
82
+ }
app/code/community/Pepperjam/Network/Model/Feed/Order/Itemized.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_Feed_Order_Itemized extends Pepperjam_Network_Model_Feed_Order_Abstract
18
+ {
19
+ /**
20
+ * @see parent::_getItems
21
+ */
22
+ protected function _getItems()
23
+ {
24
+ $lastRunTime = date(static::SELECT_TIME_FORMAT, Mage::helper('pepperjam_network/config')->getOrderLastRunTime() ?: 0);
25
+ $startTime = date(static::SELECT_TIME_FORMAT, $this->_startTime);
26
+ $storeIds = $this->_getStoreIdsToInclude();
27
+
28
+ $collection = Mage::getResourceModel('sales/order_item_collection');
29
+ $select = $collection->getSelect();
30
+ $select
31
+ ->joinLeft(
32
+ array('o' => $collection->getTable('sales/order')),
33
+ 'main_table.order_id = o.entity_id',
34
+ array('o.increment_id', 'o.original_increment_id')
35
+ )
36
+ ->joinLeft(
37
+ array('cmo' => $collection->getTable('sales/creditmemo')),
38
+ 'main_table.order_id = cmo.order_id',
39
+ array()
40
+ )
41
+ // this is far more pure SQL than should be here but I don't see a way to
42
+ // get the proper groupings of where clauses without doing this
43
+ ->where(
44
+ // get only items within the correct store scope and filter out any
45
+ // configurable used simple products
46
+ '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)',
47
+ $storeIds
48
+ )
49
+ ->where(
50
+ "(o.original_increment_id IS NOT NULL AND o.created_at >= :lastRunTime AND o.created_at < :startTime) OR " .
51
+ "(cmo.created_at IS NOT NULL AND cmo.created_at >= :lastRunTime AND cmo.created_at < :startTime) OR " .
52
+ "(o.state = 'canceled' AND o.updated_at >= :lastRunTime AND o.updated_at < :startTime AND o.relation_child_id IS NULL)"
53
+ )
54
+ // The left joins can leave duplicate item rows
55
+ // But the selected items will be identical, so we don't need them.
56
+ ->distinct();
57
+
58
+ $collection->addBindParam(':lastRunTime', $lastRunTime)
59
+ ->addBindParam(':startTime', $startTime);
60
+
61
+ return $collection;
62
+ }
63
+ /**
64
+ * @see parent::_getFeedFields
65
+ */
66
+ protected function _getFeedFields()
67
+ {
68
+ return explode(',', Mage::helper('pepperjam_network/config')->getItemizedOrderFeedFields());
69
+ }
70
+ /**
71
+ * Get the file name format from config. Doesn't pass store context as the
72
+ * file name format should only ever exist at the global level.
73
+ * @see parent::_getFileNameFormat
74
+ * @codeCoverageIgnore
75
+ */
76
+ protected function _getFileNameFormat()
77
+ {
78
+ return Mage::helper('pepperjam_network/config')->getItemizedOrderFeedFileFormat();
79
+ }
80
+ }
app/code/community/Pepperjam/Network/Model/Feed/Product.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_Feed_Product extends Pepperjam_Network_Model_Feed_Abstract
18
+ {
19
+ const DELIMITER = "\t";
20
+ /**
21
+ * @see parent::_getItems
22
+ */
23
+ protected function _getItems()
24
+ {
25
+ return Mage::getResourceModel('catalog/product_collection')
26
+ ->setStore($this->getStore())
27
+ ->addAttributeToSelect(array('*'))
28
+ ->addStoreFilter($this->getStore())
29
+ ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
30
+ }
31
+ /**
32
+ * Get an array of callback mappings for the feed. Should result in an array
33
+ * with keys for the field in the CSV and a value of an array used to
34
+ * represent a mapping callback.
35
+ * @see parent::_invokeCallback
36
+ */
37
+ protected function _getFeedFields()
38
+ {
39
+ $store = $this->getStore();
40
+ $callbackMap = Mage::helper('pepperjam_network/config')->getCallbackMappings($store);
41
+ return array_filter(array_map(
42
+ function ($key) use ($callbackMap) {
43
+ return isset($callbackMap[$key])? $callbackMap[$key]['column_name'] : null;
44
+ },
45
+ array_keys(Mage::helper('pepperjam_network/config')->getProductFeedFields($store))
46
+ ));
47
+ }
48
+ /**
49
+ * @see parent::_applyMapping
50
+ * @param mixed $item Likely a Varien_Object but could really be anything.
51
+ * @return array
52
+ */
53
+ protected function _applyMapping($item)
54
+ {
55
+ $fields = array();
56
+ $helper = Mage::helper('pepperjam_network/config');
57
+ $store = $this->getStore();
58
+ $mappings = $helper->getCallbackMappings($store);
59
+ $columns = $helper->getProductFeedFields($store);
60
+ foreach ($this->_getFeedFields() as $feedField) {
61
+ // If the mapping doesn't exist, supplying an empty array will eventually
62
+ // result in an exception for being an invalid config mapping.
63
+ // @see self::_validateCallbackConfig
64
+ $callback = isset($mappings[$feedField]) ? $mappings[$feedField] : array();
65
+ if ($columns[$feedField]) {
66
+ $callback['params']['key'] = $columns[$feedField];
67
+ }
68
+ // exclude any mappings that have a type of "disabled"
69
+ if (!isset($callback['type']) || $callback['type'] !== 'disabled') {
70
+ $fields[] = $this->_invokeCallback($callback, $item);
71
+ }
72
+ }
73
+ return $fields;
74
+ }
75
+ /**
76
+ * @see parent::_getFileName
77
+ */
78
+ protected function _getFileName()
79
+ {
80
+ $config = Mage::helper('pepperjam_network/config');
81
+ $store = $this->getStore();
82
+ return sprintf(
83
+ $config->getProductFeedFilenameFormat($store),
84
+ $config->getProgramId($this->getStore($store))
85
+ );
86
+ }
87
+ /**
88
+ * @see Pepperjam_Network_Model_Feed_Abstract::_getDelimiter
89
+ * @return string
90
+ * @codeCoverageIgnore
91
+ */
92
+ protected function _getDelimiter()
93
+ {
94
+ return static::DELIMITER;
95
+ }
96
+ }
app/code/community/Pepperjam/Network/Model/Observer.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_Observer
18
+ {
19
+ const PRODUCT_LOG_MESSAGE = 'Generating Product feed: program id %s, default store view: %s';
20
+ /**
21
+ * This observer method is the entry point to generating product feed when
22
+ * the CRONJOB 'pepperjam_network_generate_product_feed' run.
23
+ * @return void
24
+ */
25
+ public function createProductFeed()
26
+ {
27
+ if (!Mage::getStoreConfig('pepperjam/pepperjam_network/product_feed_enabled')) {
28
+ Mage::log(Mage::helper('pepperjam_network')->__('Product feed disabled'), Zend_Log::NOTICE);
29
+ return;
30
+ }
31
+
32
+ $helper = Mage::helper('pepperjam_network');
33
+ foreach ($helper->getAllProgramIds() as $programId) {
34
+ $store = $helper->getStoreForProgramId($programId);
35
+ Mage::log(
36
+ sprintf(static::PRODUCT_LOG_MESSAGE, $programId, $store->getName()),
37
+ Zend_Log::INFO
38
+ );
39
+
40
+ Mage::getModel('pepperjam_network/feed_product', array(
41
+ 'store' => $store
42
+ ))->generateFeed();
43
+ }
44
+ }
45
+ /**
46
+ * Generate the order corrected feed.
47
+ * @return self
48
+ */
49
+ public function createCorrectedOrdersFeed()
50
+ {
51
+ if (!Mage::getStoreConfig('pepperjam/pepperjam_network/order_feed_enabled')) {
52
+ Mage::log(Mage::helper('pepperjam_network')->__('Corrected order feed disabled'), Zend_Log::NOTICE);
53
+ return;
54
+ }
55
+
56
+ $startTime = time();
57
+
58
+ $feedAlias = 'feed_order_'.Mage::helper('pepperjam_network/config')->getOrderType();
59
+
60
+ Mage::log(sprintf('[%s] Generating %s feed', __CLASS__, $feedAlias), Zend_Log::INFO);
61
+
62
+ $helper = Mage::helper('pepperjam_network');
63
+ foreach ($helper->getAllProgramIds() as $programId) {
64
+ Mage::getModel(
65
+ "pepperjam_network/{$feedAlias}",
66
+ array('store' => $helper->getStoreForProgramId($programId), 'start_time' => $startTime)
67
+ )->generateFeed();
68
+ }
69
+
70
+ Mage::helper('pepperjam_network/config')->updateOrderLastRunTime($startTime);
71
+
72
+ return $this;
73
+ }
74
+ }
app/code/community/Pepperjam/Network/Model/Product/Attribute/Source/CommissioningCategory.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_Product_Attribute_Source_CommissioningCategory extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
18
+ {
19
+ public function getAllOptions()
20
+ {
21
+ $rootCategoryId = Mage::app()->getStore()->getRootCategoryId();
22
+ $rootCategories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('name')->addFieldToFilter('parent_id', $rootCategoryId);
23
+
24
+ $categoryOptions = array(array('value' => '', 'label' => ''));
25
+
26
+ $this->_addChildren($categoryOptions, $rootCategories->getFirstItem()->getChildrenCategories(), 0);
27
+
28
+ return $categoryOptions;
29
+ }
30
+
31
+ protected function _addChildren(&$options, $categories, $level)
32
+ {
33
+ if (!$categories->count())
34
+ return;
35
+
36
+ foreach($categories as $category) {
37
+ $options[] = array('value' => $category->getId(), 'label' => str_repeat('-', $level) . $category->getName());
38
+
39
+ $subcategories = $category->getChildrenCategories();
40
+ $this->_addChildren($options, $subcategories, $level+1);
41
+ }
42
+ }
43
+ }
app/code/community/Pepperjam/Network/Model/System/Config/Source/Attributes.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_System_Config_Source_Attributes
18
+ {
19
+ const PRODUCT_URL_VALUE = 'product_url';
20
+ const PRODUCT_URL_LABEL = 'Product Url';
21
+ /**
22
+ * Get product attributes
23
+ * @return array
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ $helper = Mage::helper('catalog');
28
+ $collection = Mage::getSingleton('eav/config')
29
+ ->getEntityType(Mage_Catalog_Model_Product::ENTITY)
30
+ ->getAttributeCollection();
31
+ $attributes = array(array('value' => '', 'label' => ''));
32
+ foreach ($collection as $attribute) {
33
+ $attributes[] = array(
34
+ 'value' => $attribute->getAttributeCode(),
35
+ 'label' => $helper->__($attribute->getFrontendLabel() ?
36
+ $attribute->getFrontendLabel() :
37
+ $this->_convertToTitleCase($attribute->getAttributeCode()))
38
+ );
39
+ }
40
+ $attributes[] = array(
41
+ 'value' => static::PRODUCT_URL_VALUE,
42
+ 'label' => $helper->__(static::PRODUCT_URL_LABEL)
43
+ );
44
+ // sort the attribute options by label
45
+ usort($attributes, array($this, '_compareLabels'));
46
+ return $attributes;
47
+ }
48
+ /**
49
+ * Convert the attribute code to title case. Replace '_'s with spaces
50
+ * and capitalize each word.
51
+ * @param string $attributeCode
52
+ * @return string
53
+ */
54
+ protected function _convertToTitleCase($attributeCode)
55
+ {
56
+ return ucwords(str_replace('_', ' ', $attributeCode));
57
+ }
58
+ /**
59
+ * Comparison method for sorting options by "label" key.
60
+ * @param array $a
61
+ * @param array $b
62
+ * @return int
63
+ */
64
+ protected function _compareLabels($a, $b)
65
+ {
66
+ $aLabel = strtolower($a['label']);
67
+ $bLabel = strtolower($b['label']);
68
+ if ($aLabel === $bLabel) {
69
+ return 0;
70
+ }
71
+ return $aLabel < $bLabel ? -1 : 1;
72
+ }
73
+ }
app/code/community/Pepperjam/Network/Model/System/Config/Source/Categories.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_System_Config_Source_Categories
18
+ {
19
+ const CATEGORY_VALUE = 'category';
20
+ const CATEGORY_LABEL = 'Product Categories';
21
+ /**
22
+ * Get category attributes
23
+ * @return array
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => '', 'label' => ''),
29
+ array(
30
+ 'value' => static::CATEGORY_VALUE,
31
+ 'label' => Mage::helper('catalog')->__(static::CATEGORY_LABEL)
32
+ )
33
+ );
34
+ }
35
+ }
app/code/community/Pepperjam/Network/Model/System/Config/Source/Ordertypes.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_System_Config_Source_Ordertypes
18
+ {
19
+ public function toOptionArray()
20
+ {
21
+ $helper = Mage::helper('pepperjam_network');
22
+ $config = Mage::helper('pepperjam_network/config');
23
+
24
+ return array(
25
+ array(
26
+ 'value' => $config::ORDER_TYPE_BASIC,
27
+ 'label' => $helper->__('Basic'),
28
+ ),
29
+ array(
30
+ 'value' => $config::ORDER_TYPE_ITEMIZED,
31
+ 'label' => $helper->__('Itemized'),
32
+ ),
33
+ array(
34
+ 'value' => $config::ORDER_TYPE_DYNAMIC,
35
+ 'label' => $helper->__('Dynamic'),
36
+ ),
37
+ );
38
+ }
39
+ }
app/code/community/Pepperjam/Network/Model/System/Config/Source/Stockquantity.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_System_Config_Source_Stockquantity
18
+ {
19
+ const STOCK_QTY_VALUE = 'qty';
20
+ const STOCK_QTY_LABEL = 'Quantity';
21
+ /**
22
+ * Get quantity in stock list
23
+ * @return array
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => '', 'label' => ''),
29
+ array(
30
+ 'value' => static::STOCK_QTY_VALUE,
31
+ 'label' => Mage::helper('catalog')->__(static::STOCK_QTY_LABEL)
32
+ )
33
+ );
34
+ }
35
+ }
app/code/community/Pepperjam/Network/Model/System/Config/Source/Stockyesno.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_System_Config_Source_Stockyesno
18
+ {
19
+ const IN_STOCK_VALUE = 'in_stock';
20
+ const IN_STOCK_LABEL = 'Inventory Stock Availability';
21
+ /**
22
+ * Get in stock list
23
+ * @return array
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => '', 'label' => ''),
29
+ array(
30
+ 'value' => static::IN_STOCK_VALUE,
31
+ 'label' => Mage::helper('catalog')->__(static::IN_STOCK_LABEL)
32
+ )
33
+ );
34
+ }
35
+ }
app/code/community/Pepperjam/Network/Model/System/Config/Source/Transactiontype.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_System_Config_Source_Transactiontype
18
+ {
19
+ /**
20
+ * Get available Transaction Type options
21
+ * @return array
22
+ */
23
+ public function toOptionArray()
24
+ {
25
+ $helper = Mage::helper('pepperjam_network');
26
+ return array('1' => $helper->__('Sale'), '2' => $helper->__('Lead'));
27
+ }
28
+ }
app/code/community/Pepperjam/Network/Model/System/Config/Source/Visibilityyesno.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Model_System_Config_Source_Visibilityyesno
18
+ {
19
+ const VISIBILITY_VALUE = 'visibility';
20
+ const VISIBILITY_LABEL = 'Visibility';
21
+ /**
22
+ * Get product visibility list
23
+ * @return array
24
+ */
25
+ public function toOptionArray()
26
+ {
27
+ return array(
28
+ array('value' => '', 'label' => ''),
29
+ array(
30
+ 'value' => static::VISIBILITY_VALUE,
31
+ 'label' => Mage::helper('catalog')->__(static::VISIBILITY_LABEL)
32
+ )
33
+ );
34
+ }
35
+ }
app/code/community/Pepperjam/Network/Test/Block/BeaconTest.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Block_BeaconTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Get a mock of the config helper to return expected system configurations.
21
+ * @param string $programId
22
+ * @param string $transactionType
23
+ * @param string $itemizeOrders
24
+ * @return Mock_Pepperjam_Network_Helper_Config
25
+ */
26
+ protected function _getConfigHelper($programId, $transactionType, $itemizeOrders)
27
+ {
28
+ $helper = $this->getHelperMock('pepperjam_network/config', array(
29
+ 'getProgramId', 'getTransactionType', 'isItemizedOrders', 'isDynamicOrders',
30
+ ));
31
+ $helper->expects($this->any())
32
+ ->method('getProgramId')
33
+ ->will($this->returnValue($programId));
34
+ $helper->expects($this->any())
35
+ ->method('getTransactionType')
36
+ ->will($this->returnValue($transactionType));
37
+ $helper->expects($this->any())
38
+ ->method('isItemizedOrders')
39
+ ->will($this->returnValue($itemizeOrders));
40
+ $helper->expects($this->any())
41
+ ->method('isDynamicOrders')
42
+ ->will($this->returnValue($itemizeOrders));
43
+ return $helper;
44
+ }
45
+ /**
46
+ * Test building the basic beacon url. Should only include order level
47
+ * information about the order in the url params.
48
+ */
49
+ public function testGetBeaconUrlBasic()
50
+ {
51
+ $orderId = '000012';
52
+ $subtotal = '10.99';
53
+ $discount = '-5.00';
54
+ $couponCode = 'COUPON';
55
+ $programId = 'PROGRAM ID';
56
+ $transactionType = 'TRANS TYPE';
57
+ $itemizeOrders = false;
58
+ $params = array(
59
+ 'PID' => $programId,
60
+ 'OID' => $orderId,
61
+ 'PROMOCODE' => $couponCode,
62
+ 'AMOUNT' => '5.99',
63
+ 'TYPE' => $transactionType
64
+ );
65
+ $beaconUrl = 'https://example.com/track';
66
+ $order = Mage::getModel('sales/order', array(
67
+ 'increment_id' => $orderId,
68
+ 'subtotal' => $subtotal,
69
+ 'coupon_code' => $couponCode,
70
+ 'discount_amount' => $discount,
71
+ ));
72
+ // mock out the config helper to setup expected system configurations
73
+ $this->replaceByMock(
74
+ 'helper',
75
+ 'pepperjam_network/config',
76
+ $this->_getConfigHelper($programId, $transactionType, $itemizeOrders)
77
+ );
78
+ $helper = $this->getHelperMock('pepperjam_network/data', array('buildBeaconUrl'));
79
+ $helper->expects($this->once())
80
+ ->method('buildBeaconUrl')
81
+ ->with($this->identicalTo($params))
82
+ ->will($this->returnValue($beaconUrl));
83
+ $this->replaceByMock('helper', 'pepperjam_network', $helper);
84
+
85
+ $block = $this->getBlockMock('pepperjam_network/beacon', array('_getOrder'));
86
+ $block->expects($this->any())
87
+ ->method('_getOrder')
88
+ ->will($this->returnValue($order));
89
+
90
+ $this->assertSame($beaconUrl, $block->getBeaconUrl());
91
+ }
92
+ /**
93
+ * Test building the itemized beacon url. Should include item level details
94
+ * in the url params for each item in the order.
95
+ */
96
+ public function testGetBeaconUrlItemized()
97
+ {
98
+ $programId = 'PROGRAM ID';
99
+ // should use itemized beacon when itemize orders is true
100
+ $itemizeOrders = true;
101
+ $orderId = '000012';
102
+ $couponCode = 'COUPON';
103
+ $itemSku = 'sku-12345';
104
+ $altSku = 'sku-54321';
105
+ $itemQty = 2;
106
+ $altQty = 3;
107
+ $itemAmt = '12.34';
108
+ $altAmt = '10.67';
109
+ $discountAmt = '5.00';
110
+ $bundleSku = 'bundle-sku-made-up-of-child-skus';
111
+ $bundleQty = 1;
112
+ // This is the expected final output from the method - gets returned from
113
+ // the pepperjam_network/data helper when called with the right params.
114
+ $beaconUrl = 'https://example.com/track?PARAM=Value';
115
+ // These are the "correct" params the helper method should be called with.
116
+ // Order of the array is significant - both to the test and the
117
+ // actual implementation.
118
+ $beaconParams = array(
119
+ 'PID' => $programId,
120
+ 'OID' => $orderId,
121
+ 'PROMOCODE' => $couponCode,
122
+ 'INT' => 'ITEMIZED',
123
+ 'ITEM1' => $itemSku,
124
+ 'QTY1' => $itemQty * 2,
125
+ 'TOTALAMOUNT1' => number_format(($itemAmt - $discountAmt) * 2, 2),
126
+ 'ITEM2' => $altSku,
127
+ 'QTY2' => $altQty,
128
+ 'TOTALAMOUNT2' => $altAmt,
129
+ 'ITEM3' => $bundleSku,
130
+ 'QTY3' => $bundleQty,
131
+ 'TOTALAMOUNT3' => '0.00',
132
+ );
133
+
134
+ $item = Mage::getModel('sales/order_item', array(
135
+ 'sku' => $itemSku, 'qty_ordered' => $itemQty, 'row_total' => $itemAmt,
136
+ 'parent_item_id' => null, 'discount_amount' => $discountAmt,
137
+ 'product_type' => 'simple',
138
+ ));
139
+ $itemDupe = Mage::getModel('sales/order_item', array(
140
+ 'sku' => $itemSku, 'qty_ordered' => $itemQty, 'row_total' => $itemAmt,
141
+ 'parent_item_id' => null, 'discount_amount' => $discountAmt,
142
+ 'product_type' => 'simple',
143
+ ));
144
+ $parentItem = Mage::getModel('sales/order_item', array(
145
+ 'sku' => $altSku, 'qty_ordered' => $altQty, 'row_total' => $altAmt,
146
+ 'parent_item_id' => null, 'discount_amount' => 0.00,
147
+ 'product_type' => 'configurable',
148
+ ));
149
+ $altItem = Mage::getModel('sales/order_item', array(
150
+ 'sku' => $altSku, 'qty_ordered' => $altQty, 'row_total' => 0.00,
151
+ 'parent_item_id' => '2', 'discount_amount' => 0.00,
152
+ 'product_type' => 'simple',
153
+ ));
154
+ $bundleItem = Mage::getModel('sales/order_item', array(
155
+ 'sku' => $bundleSku, 'qty_ordered' => $bundleQty, 'row_total' => '500.00',
156
+ 'parent_item_id' => null, 'discount_amount' => 0.00,
157
+ 'product_type' => 'bundle',
158
+ ));
159
+ $order = Mage::getModel('sales/order', array(
160
+ 'increment_id' => $orderId, 'coupon_code' => $couponCode,
161
+ ));
162
+ $order->addItem($item);
163
+ $order->addItem($itemDupe);
164
+ $order->addItem($parentItem);
165
+ $order->addItem($altItem);
166
+ $order->addItem($bundleItem);
167
+
168
+ // mock out the config helper to setup expected system configurations
169
+ $this->replaceByMock(
170
+ 'helper',
171
+ 'pepperjam_network/config',
172
+ $this->_getConfigHelper($programId, null, $itemizeOrders)
173
+ );
174
+
175
+ $helper = $this->getHelperMock('pepperjam_network/data', array('buildBeaconUrl'));
176
+ $helper->expects($this->once())
177
+ ->method('buildBeaconUrl')
178
+ ->with($this->identicalTo($beaconParams))
179
+ ->will($this->returnValue($beaconUrl));
180
+ $this->replaceByMock('helper', 'pepperjam_network', $helper);
181
+
182
+ $block = $this->getBlockMock('pepperjam_network/beacon', array('_getOrder'));
183
+ $block->expects($this->any())
184
+ ->method('_getOrder')
185
+ ->will($this->returnValue($order));
186
+
187
+ $this->assertSame($beaconUrl, $block->getBeaconUrl());
188
+ }
189
+ /**
190
+ * Test that Pepperjam_Network_Block_Beacon::_getOrder will be invoked
191
+ * by this test and expect it to return Mage_Sales_Model_Order object
192
+ */
193
+ public function testGetOrder()
194
+ {
195
+ $orderId = '00000084848';
196
+ $session = $this->getModelMockBuilder('checkout/session')
197
+ ->disableOriginalConstructor()
198
+ ->setMethods(null)
199
+ ->getMock();
200
+ $session->setLastOrderId($orderId);
201
+ $this->replaceByMock('singleton', 'checkout/session', $session);
202
+
203
+ $order = $this->getModelMock('sales/order', array('load'));
204
+ $order->expects($this->once())
205
+ ->method('load')
206
+ ->with($this->identicalTo($orderId))
207
+ ->will($this->returnSelf());
208
+ $this->replaceByMock('model', 'sales/order', $order);
209
+
210
+ $beacon = $this->getBlockMock('pepperjam_network/beacon', array());
211
+ EcomDev_Utils_Reflection::setRestrictedPropertyValue($beacon, '_order', null);
212
+
213
+ $this->assertSame($order, EcomDev_Utils_Reflection::invokeRestrictedMethod(
214
+ $beacon,
215
+ '_getOrder',
216
+ array()
217
+ ));
218
+ }
219
+ /**
220
+ * Test that Pepperjam_Network_Block_Beacon::showBeacon will return true
221
+ * only if tracking is enabled and we have a valid order
222
+ * AND either conditional pixel logic is OFF or it is ON and we have
223
+ * a valid cookie.
224
+ *
225
+ * @dataProvider dataProvider
226
+ */
227
+ public function testShowBeacon($isEnabled, $isOrder, $isPixelLogicEnabled, $isValidCookie, $expectedResult)
228
+ {
229
+ $configHelper = $this->getHelperMock('pepperjam_network/config', array('isEnabled', 'isConditionalPixelEnabled'));
230
+ $configHelper->expects($this->any())
231
+ ->method('isEnabled')
232
+ ->will($this->returnValue($isEnabled));
233
+
234
+ $configHelper->expects($this->any())
235
+ ->method('isConditionalPixelEnabled')
236
+ ->will($this->returnValue($isPixelLogicEnabled));
237
+ $this->replaceByMock('helper', 'pepperjam_network/config', $configHelper);
238
+
239
+ $dataHelper = $this->getHelperMock('pepperjam_network', array('isValidCookie'));
240
+ $dataHelper->expects(($this->any()))
241
+ ->method('isValidCookie')
242
+ ->will($this->returnValue($isValidCookie));
243
+ $this->replaceByMock('helper', 'pepperjam_network', $dataHelper);
244
+
245
+ $order = (bool)$isOrder ? Mage::getModel('sales/order') : null;
246
+ $beacon = $this->getBlockMock('pepperjam_network/beacon', array('_getOrder'));
247
+ $beacon->expects($this->any())
248
+ ->method('_getOrder')
249
+ ->will($this->returnValue($order));
250
+
251
+ $this->assertEquals((bool)$expectedResult, $beacon->showBeacon());
252
+ }
253
+ }
app/code/community/Pepperjam/Network/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/Pepperjam/Network/Test/Helper/DataTest.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Helper_DataTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test that Pepperjam_Network_Helper_Data::buildBeaconUrl yields the
21
+ * expected, escaped url with query string when passed an array of params to append.
22
+ */
23
+ public function testBuildBeaconUrl()
24
+ {
25
+ $beaconUrl = 'https://example.com/track';
26
+ $params = array('KEY1' => 'K1', 'KEY2' => 'K2');
27
+ $result = $beaconUrl . '?' . http_build_query($params);
28
+
29
+ $cfgHelper = $this->getHelperMock('pepperjam_network/config', array('getBeaconBaseUrl'));
30
+ $cfgHelper->expects($this->once())
31
+ ->method('getBeaconBaseUrl')
32
+ ->will($this->returnValue($beaconUrl));
33
+ $this->replaceByMock('helper', 'pepperjam_network/config', $cfgHelper);
34
+
35
+ $this->assertSame($result, Mage::helper('pepperjam_network/data')->buildBeaconUrl($params));
36
+ }
37
+
38
+ /**
39
+ * @dataProvider dataProvider
40
+ */
41
+ public function testIsValidCookie($cookie, $value, $expectedResult)
42
+ {
43
+ $dataHelper = $this->getHelperMock('pepperjam_network', array('getSourceCookieName'));
44
+ $dataHelper->expects(($this->any()))
45
+ ->method('getSourceCookieName')
46
+ ->will($this->returnValue('ebay_enterprise_affiliate_source'));
47
+ $this->replaceByMock('helper', 'pepperjam_network', $dataHelper);
48
+
49
+ $_COOKIE[$cookie] = $value;
50
+
51
+ $this->assertEquals((bool)$expectedResult, $dataHelper->isValidCookie());
52
+ }
53
+ }
app/code/community/Pepperjam/Network/Test/Helper/Map/ProductTest.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Helper_Map_ProductTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test that Pepperjam_Network_Helper_Map_Product::getCategory will
21
+ * return a string of root category separated with the symbol '>' with inner
22
+ * category to the the inner most category.
23
+ */
24
+ public function testGetCategory()
25
+ {
26
+
27
+ $categoryIds = array('1','2','3');
28
+ $path = implode('/', $categoryIds);
29
+ $categories = array('cat one', 'cat two', 'cat three');
30
+ $collection = Mage::getResourceModel('catalog/category_collection');
31
+
32
+ $categoryObjects = array();
33
+ foreach ($categories as $index => $name) {
34
+ $category = Mage::getModel('catalog/category', array(
35
+ 'name' => $name, 'entity_id' => $index + 9999, 'path' => $path
36
+ ));
37
+ $categoryObjects[] = $category;
38
+ $collection->addItem($category);
39
+ }
40
+
41
+ $productCategoryColl = Mage::getResourceModel('catalog/category_collection');
42
+ ;
43
+ $productCategoryColl->addItem($categoryObjects[2]);
44
+ $product = $this->getModelMock('catalog/product', array('getCategoryCollection'));
45
+ $product->expects($this->once())
46
+ ->method('getCategoryCollection')
47
+ ->will($this->returnValue($productCategoryColl));
48
+
49
+ $params = array('item' => $product);
50
+
51
+ $result = implode(' > ', $categories);
52
+
53
+ $mapProduct = $this->getHelperMock('pepperjam_network/map_product', array('_getCategoriesByIds'));
54
+ $mapProduct->expects($this->once())
55
+ ->method('_getCategoriesByIds')
56
+ ->with($this->identicalTo($categoryIds))
57
+ ->will($this->returnValue($collection));
58
+
59
+ $this->assertSame($result, $mapProduct->getCategory($params));
60
+ }
61
+ /**
62
+ * Test that Pepperjam_Network_Helper_Map_Product::getImageUrl will
63
+ * return an absolute URL to an image view.
64
+ */
65
+ public function testGetImageUrl()
66
+ {
67
+ $key = 'image';
68
+ $image = '/k/o/some-product-image.jpg';
69
+ $mediaUrl = 'http://www.example.com/' .
70
+ Pepperjam_Network_Helper_Map_Product::MEDIA_PATH . $image;
71
+
72
+ $product = $this->getModelMockBuilder('catalog/product')
73
+ ->disableOriginalConstructor()
74
+ ->setMethods(array('getDataUsingMethod'))
75
+ ->getMock();
76
+ $product->expects($this->once())
77
+ ->method('getDataUsingMethod')
78
+ ->with($this->identicalTo($key))
79
+ ->will($this->returnValue($image));
80
+
81
+ $params = array('item' => $product, 'key' => $key);
82
+
83
+ $helperProduct = $this->getHelperMock('pepperjam_network/map_product', array(
84
+ '_getAbsoluteImagePath'
85
+ ));
86
+
87
+ $helperProduct->expects($this->once())
88
+ ->method('_getAbsoluteImagePath')
89
+ ->with($this->identicalTo($image))
90
+ ->will($this->returnValue($mediaUrl));
91
+
92
+ $this->assertSame($mediaUrl, $helperProduct->getImageUrl($params));
93
+ }
94
+ /**
95
+ * Test that Pepperjam_Network_Helper_Map_Product::getInStockQty will
96
+ * return an integer value representing the manage stock qty of a product.
97
+ */
98
+ public function testGetInStockQty()
99
+ {
100
+ $qty = 999;
101
+ $product = Mage::getModel('catalog/product');
102
+ $params = array('item' => $product);
103
+
104
+ $stockItem = $this->getModelMockBuilder('cataloginventory/stock_item')
105
+ ->disableOriginalConstructor()
106
+ ->setMethods(array('loadByProduct', 'getQty'))
107
+ ->getMock();
108
+ $stockItem->expects($this->once())
109
+ ->method('loadByProduct')
110
+ ->with($this->identicalTo($product))
111
+ ->will($this->returnSelf());
112
+ $stockItem->expects($this->once())
113
+ ->method('getQty')
114
+ ->will($this->returnValue($qty));
115
+ $this->replaceByMock('model', 'cataloginventory/stock_item', $stockItem);
116
+
117
+ $this->assertSame($qty, Mage::helper('pepperjam_network/map_product')->getInStockQty($params));
118
+ }
119
+ /**
120
+ * Test that Pepperjam_Network_Helper_Map_Product::_getCategoriesByIds
121
+ * will be invoked by this test passing an array of category entity ids
122
+ * and will return a Mage_Catalog_Model_Resource_Category_Collection
123
+ */
124
+ public function testGetCategoriesByIds()
125
+ {
126
+ $entityIds = array(1,2,3);
127
+ $collection = $this->getResourceModelMockBuilder('catalog/category_collection')
128
+ ->disableOriginalConstructor()
129
+ ->setMethods(array('addAttributeToSelect', 'addAttributeToFilter', 'load'))
130
+ ->getMock();
131
+ $collection->expects($this->once())
132
+ ->method('addAttributeToSelect')
133
+ ->with($this->identicalTo(array('name', 'entity_id')))
134
+ ->will($this->returnSelf());
135
+ $collection->expects($this->once())
136
+ ->method('addAttributeToFilter')
137
+ ->with($this->identicalTo(array(array('attribute' => 'entity_id', 'in' => $entityIds))))
138
+ ->will($this->returnSelf());
139
+ $collection->expects($this->once())
140
+ ->method('load')
141
+ ->will($this->returnSelf());
142
+ $this->replaceByMock('resource_model', 'catalog/category_collection', $collection);
143
+
144
+ $mapProduct = $this->getHelperMock('pepperjam_network/map_product', array());
145
+
146
+ $this->assertSame($collection, EcomDev_Utils_Reflection::invokeRestrictedMethod(
147
+ $mapProduct,
148
+ '_getCategoriesByIds',
149
+ array($entityIds)
150
+ ));
151
+ }
152
+ /**
153
+ * Test that Pepperjam_Network_Helper_Map_Product::getInStockYesNo will
154
+ * be called by this test passing an array with key item map to a
155
+ * Mage_Catalog_Model_Product object and expects it to return the string value 'yes'.
156
+ */
157
+ public function testGetInStockYesNo()
158
+ {
159
+ $result = 'yes';
160
+ $isInStock = '1';
161
+ $params = array('item' => Mage::getModel('catalog/product'));
162
+
163
+ $stockItem = $this->getModelMock('cataloginventory/stock_item', array('loadByProduct'));
164
+ $stockItem->expects($this->once())
165
+ ->method('loadByProduct')
166
+ ->with($this->identicalTo($params['item']))
167
+ ->will($this->returnSelf());
168
+ $stockItem->setIsInstock($isInStock);
169
+ $this->replaceByMock('model', 'cataloginventory/stock_item', $stockItem);
170
+
171
+ $this->assertSame($result, Mage::helper('pepperjam_network/map_product')->getInStockYesNo($params));
172
+ }
173
+ }
app/code/community/Pepperjam/Network/Test/Helper/providers/testIsValidCookie.yaml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -
2
+ - pepperjam_network_source
3
+ - eean
4
+ - 1
5
+ -
6
+ - pepperjam_network_source
7
+ - invalid_value
8
+ - 0
9
+ -
10
+ - invalid_cookie_name
11
+ - eean
12
+ - 0
app/code/community/Pepperjam/Network/Test/Model/Feed/AbstractTest.php ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Model_Feed_AbstractTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test generating a feed file
21
+ */
22
+ public function testGenerateFeed()
23
+ {
24
+ $feedData = array(array('one', 'two', 'three'));
25
+ $feed = $this->getModelMock(
26
+ 'pepperjam_network/feed_abstract',
27
+ array('_buildFeedData', '_generateFile'),
28
+ true
29
+ );
30
+ $feed->expects($this->once())
31
+ ->method('_buildFeedData')
32
+ ->will($this->returnValue($feedData));
33
+ $feed->expects($this->once())
34
+ ->method('_generateFile')
35
+ ->with($this->identicalTo($feedData))
36
+ ->will($this->returnSelf());
37
+ $this->assertSame($feed, $feed->generateFeed());
38
+ }
39
+ /**
40
+ * Test generating array of data to place into feed
41
+ */
42
+ public function testBuildFeedData()
43
+ {
44
+ $itemOneMappedData = array('item', 'one', 'data');
45
+ $itemTwoMappedData = array('item', 'two', 'data');
46
+ $feedData = array($itemOneMappedData, $itemTwoMappedData);
47
+
48
+ $itemCollection = new Varien_Data_Collection();
49
+ $itemOne = Mage::getModel('sales/order');
50
+ $itemTwo = Mage::getModel('sales/order');
51
+ $itemCollection->addItem($itemOne)->addItem($itemTwo);
52
+
53
+ $feed = $this->getModelMock(
54
+ 'pepperjam_network/feed_abstract',
55
+ array('_getItems', '_applyMapping'),
56
+ true
57
+ );
58
+ // get items will vary per feed type - itemized order, basic order or product
59
+ $feed->expects($this->once())
60
+ ->method('_getItems')
61
+ ->will($this->returnValue($itemCollection));
62
+ // should get called once for each item, returning the array of item data for the feed
63
+ $feed->expects($this->exactly(2))
64
+ ->method('_applyMapping')
65
+ ->will($this->returnValueMap(array(
66
+ array($itemOne, $itemOneMappedData),
67
+ array($itemTwo, $itemTwoMappedData),
68
+ )));
69
+
70
+ $this->assertSame(
71
+ $feedData,
72
+ EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_buildFeedData')
73
+ );
74
+ }
75
+ /**
76
+ * Test applying the configured mapping to the item to get back an array of
77
+ * data for each field in the feed.
78
+ */
79
+ public function testApplyMapping()
80
+ {
81
+ $orderAmt = 23.23;
82
+ $store = Mage::app()->getStore();
83
+ $fields = array('fieldA', 'fieldB');
84
+ // callback mapping to use
85
+ $mappings = array(
86
+ 'fieldA' => array(
87
+ 'class' => 'pepperjam_network/map_order', 'type' => 'helper',
88
+ 'method' => 'getOrderAmount', 'params' => array('key' => 'value'),
89
+ 'column_name' => 'OID'
90
+ ),
91
+ 'fieldB' => array('type' => 'disabled'),
92
+ );
93
+ $itemData = array($orderAmt);
94
+ // The type of this object will vary depending on feed type but will likely
95
+ // be a descendent of Varien_Object. It shouldn't matter much to the test
96
+ // as it should just get passed through to the callbacks.
97
+ $item = new Varien_Object();
98
+
99
+ // All callbacks setup to use this helper
100
+ $feedHelper = $this->getHelperMock(
101
+ 'pepperjam_network/map_order',
102
+ array('getOrderAmount')
103
+ );
104
+ $feedHelper->expects($this->once())
105
+ ->method('getOrderAmount')
106
+ ->with($this->identicalTo(array('key' => 'value', 'item' => $item, 'store' => $store)))
107
+ ->will($this->returnValue($orderAmt));
108
+ $this->replaceByMock('helper', 'pepperjam_network/map_order', $feedHelper);
109
+
110
+ $config = $this->getHelperMock('pepperjam_network/config', array('getCallbackMappings'));
111
+ $config->expects($this->any())
112
+ ->method('getCallbackMappings')
113
+ ->will($this->returnValue($mappings));
114
+ $this->replaceByMock('helper', 'pepperjam_network/config', $config);
115
+
116
+ $feed = $this->getModelMock(
117
+ 'pepperjam_network/feed_abstract',
118
+ array('_getFeedFields'),
119
+ true,
120
+ array(array('store' => $store))
121
+ );
122
+ // The _getFeedFields method will be defined for each type of feed and should
123
+ // return array of mapped fields to include.
124
+ $feed->expects($this->any())
125
+ ->method('_getFeedFields')
126
+ ->will($this->returnValue($fields));
127
+
128
+ $this->assertSame(
129
+ $itemData,
130
+ EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_applyMapping', array($item))
131
+ );
132
+ }
133
+ /**
134
+ * Test that when a configured method does not exist on the specified class,
135
+ * an exception is thrown.
136
+ */
137
+ public function testInvokeCallbackFailures()
138
+ {
139
+ $callbackConfig = array('class' => 'pepperjam_network', 'type' => 'helper', 'method' => 'getSomething');
140
+ $feed = $this->getModelMock(
141
+ 'pepperjam_network/feed_abstract',
142
+ array('_getCallbackInstance'),
143
+ true
144
+ );
145
+ // Sub an object that will certainly not have the configured method on it.
146
+ $feed->expects($this->once())
147
+ ->method('_getCallbackInstance')
148
+ ->with($this->identicalTo($callbackConfig))
149
+ ->will($this->returnValue(new StdClass));
150
+
151
+ $this->setExpectedException('Pepperjam_Network_Exception_Configuration');
152
+ EcomDev_Utils_Reflection::invokeRestrictedMethod(
153
+ $feed,
154
+ '_invokeCallback',
155
+ array($callbackConfig, new Varien_Object())
156
+ );
157
+ }
158
+ /**
159
+ * Provide a sample callback configuration and whether the callback is
160
+ * expected to be deemed valid.
161
+ * @return array
162
+ */
163
+ public function provideCallbacksToValidate()
164
+ {
165
+ return array(
166
+ array(
167
+ array(),
168
+ false
169
+ ),
170
+ array(
171
+ array('type' => 'disabled'),
172
+ true
173
+ ),
174
+ array(
175
+ array('type' => 'disabled', 'class' => 'pepperjam_network'),
176
+ true
177
+ ),
178
+ array(
179
+ array('type' => 'model'),
180
+ false
181
+ ),
182
+ array(
183
+ array('type' => 'singleton', 'class' => 'pepperjam_network/feed_abstract'),
184
+ false
185
+ ),
186
+ array(
187
+ array('type' => 'helper', 'class' => 'pepperjam_network/map', 'method' => 'getOrderId'),
188
+ false
189
+ ),
190
+ array(
191
+ array('type' => 'helper', 'class' => 'pepperjam_network/map', 'method' => 'getOrderId', 'column_name' => 'OID'),
192
+ true
193
+ ),
194
+ );
195
+ }
196
+ /**
197
+ * Test checking for a callback configuration to be valid. When the is valid
198
+ * param indicates the configuration is invalid, an exception should be
199
+ * thrown. Otherwise, the method should simply reurun self.
200
+ * @param array $config Array of config data to validate
201
+ * @param boolean $isValid Is the config data valid
202
+ * @dataProvider provideCallbacksToValidate
203
+ */
204
+ public function testValidateCallbackConfig($config, $isValid)
205
+ {
206
+ $feed = $this->getModelMock(
207
+ 'pepperjam_network/feed_abstract',
208
+ array(),
209
+ true
210
+ );
211
+
212
+ if (!$isValid) {
213
+ $this->setExpectedException('Pepperjam_Network_Exception_Configuration');
214
+ }
215
+
216
+ $result = EcomDev_Utils_Reflection::invokeRestrictedMethod(
217
+ $feed,
218
+ '_validateCallbackConfig',
219
+ array($config)
220
+ );
221
+ if ($isValid) {
222
+ $this->assertSame($result, $feed);
223
+ }
224
+ }
225
+ /**
226
+ * Test getting column headers based on the configured mappings for the feed.
227
+ */
228
+ public function testGetHeaders()
229
+ {
230
+ $fields = array('program_id', 'order_id');
231
+ $mapping = array(
232
+ 'program_id' => array('class' => 'some/class', 'method' => 'getProgramId', 'column_name' => 'PID'),
233
+ 'order_id' => array('class' => 'some/class', 'method' => 'getOrderId', 'column_name' => 'OID'),
234
+ );
235
+
236
+ $config = $this->getHelperMock('pepperjam_network/config', array('getCallbackMappings'));
237
+ $config->expects($this->any())
238
+ ->method('getCallbackMappings')
239
+ ->will($this->returnValue($mapping));
240
+ $this->replaceByMock('helper', 'pepperjam_network/config', $config);
241
+
242
+ $feed = $this->getModelMock(
243
+ 'pepperjam_network/feed_abstract',
244
+ array('_getFeedFields'),
245
+ true
246
+ );
247
+ $feed->expects($this->once())
248
+ ->method('_getFeedFields')
249
+ ->will($this->returnValue($fields));
250
+
251
+ $this->assertSame(
252
+ // keys don't matter, so make sure to compare just values to values
253
+ array('PID', 'OID'),
254
+ array_values(EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getHeaders'))
255
+ );
256
+ }
257
+ /**
258
+ * Test generating the full path to the file. Should consist of Magento's
259
+ * base dir, the configured export feed path, and the name of the file.
260
+ */
261
+ public function testGenerateFilePath()
262
+ {
263
+ $format = 'file_name.csv';
264
+ $configuredPath = 'var/feed/export';
265
+ $configHelper = $this->getHelperMock(
266
+ 'pepperjam_network/config',
267
+ array('getExportFilePath', 'getProgramId')
268
+ );
269
+ $configHelper->expects($this->any())
270
+ ->method('getExportFilePath')
271
+ ->will($this->returnValue($configuredPath));
272
+ $configHelper->expects($this->any())
273
+ ->method('getProgramId')
274
+ ->will($this->returnValue('PROGRAM_ID'));
275
+ $this->replaceByMock('helper', 'pepperjam_network/config', $configHelper);
276
+
277
+ $feed = $this->getModelMock(
278
+ 'pepperjam_network/feed_abstract',
279
+ array('_getFileName'),
280
+ true
281
+ );
282
+ $feed->expects($this->any())
283
+ ->method('_getFileName')
284
+ ->will($this->returnValue($format));
285
+
286
+ $this->assertSame(
287
+ Mage::getBaseDir() . DS . 'var/feed/export' . DS . $format,
288
+ EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_generateFilePath')
289
+ );
290
+ }
291
+ }
app/code/community/Pepperjam/Network/Test/Model/Feed/Order/AbstractTest.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Model_Feed_Order_AbstractTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test generating the file name using the
21
+ */
22
+ public function testGetFileName()
23
+ {
24
+ $format = '%s_corrected_orders_%s.csv';
25
+ $programId = 'PROGRAM_ID';
26
+ $time = 1397829577;
27
+ $formattedTime = date('YmdHis', $time);
28
+ $fileName = "{$programId}_corrected_orders_{$formattedTime}.csv";
29
+
30
+ // get the default store to be used as context for config getting
31
+ $store = Mage::app()->getStore();
32
+ // get the order feed instance with the expected store and start time injected
33
+ $feed = $this->getModelMock(
34
+ 'pepperjam_network/feed_order_itemized',
35
+ array('_getFileNameFormat'),
36
+ true,
37
+ array(array('store' => $store, 'start_time' => $time))
38
+ );
39
+ $feed->expects($this->any())
40
+ ->method('_getFileNameFormat')
41
+ ->will($this->returnValue($format));
42
+
43
+ $config = $this->getHelperMock('pepperjam_network/config', array('getProgramId'));
44
+ // Will have different program ids per feed so store context definitely
45
+ // matters when getting this value.
46
+ $config->expects($this->any())
47
+ ->method('getProgramId')
48
+ ->with($this->identicalTo($store))
49
+ ->will($this->returnValue($programId));
50
+ $this->replaceByMock('helper', 'pepperjam_network/config', $config);
51
+
52
+ $generated = EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getFileName');
53
+ $this->assertSame(
54
+ $fileName,
55
+ $generated
56
+ );
57
+ }
58
+ }
app/code/community/Pepperjam/Network/Test/Model/Feed/Order/BasicTest.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Model_Feed_Order_BasicTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test getting the fields to include in the feed. Should be pulling the
21
+ * comma-separated list of fields from config.xml and splitting it to produce
22
+ * an array of fields.
23
+ * @return array
24
+ */
25
+ public function testFeedFields()
26
+ {
27
+ $config = $this->getHelperMock('pepperjam_network/config', array('getBasicOrderFeedFields'));
28
+ $config->expects($this->any())
29
+ ->method('getBasicOrderFeedFields')
30
+ ->will($this->returnValue('one,two,three'));
31
+ $this->replaceByMock('helper', 'pepperjam_network/config', $config);
32
+ $feed = Mage::getModel('pepperjam_network/feed_order_basic');
33
+ $this->assertSame(
34
+ array('one', 'two', 'three'),
35
+ EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getFeedFields')
36
+ );
37
+ }
38
+ }
app/code/community/Pepperjam/Network/Test/Model/Feed/Order/ItemizedTest.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Model_Feed_Order_ItemizedTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test getting the fields to include in the feed. Should be pulling the
21
+ * comma-separated list of fields from config.xml and splitting it to produce
22
+ * an array of fields.
23
+ * @return array
24
+ */
25
+ public function testFeedFields()
26
+ {
27
+ $config = $this->getHelperMock('pepperjam_network/config', array('getItemizedOrderFeedFields'));
28
+ $config->expects($this->any())
29
+ ->method('getItemizedOrderFeedFields')
30
+ ->will($this->returnValue('one,two,three'));
31
+ $this->replaceByMock('helper', 'pepperjam_network/config', $config);
32
+ $feed = Mage::getModel('pepperjam_network/feed_order_itemized');
33
+ $this->assertSame(
34
+ array('one', 'two', 'three'),
35
+ EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_getFeedFields')
36
+ );
37
+ }
38
+ }
app/code/community/Pepperjam/Network/Test/Model/Feed/ProductTest.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Model_Feed_ProductTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test that Pepperjam_Network_Model_Feed_Product::_getItems will return
21
+ * a Mage_Catalog_Model_Resource_Product_Collection
22
+ */
23
+ public function testGetItems()
24
+ {
25
+ $store = Mage::getModel('core/store');
26
+ $collection = $this->getResourceModelMockBuilder('catalog/product_collection')
27
+ ->disableOriginalConstructor()
28
+ ->setMethods(array('setStore', 'addAttributeToSelect', 'addStoreFilter', 'addFieldToFilter'))
29
+ ->getMock();
30
+ $collection->expects($this->once())
31
+ ->method('setStore')
32
+ ->with($this->identicalTo($store))
33
+ ->will($this->returnSelf());
34
+ $collection->expects($this->once())
35
+ ->method('addAttributeToSelect')
36
+ ->with($this->identicalTo(array('*')))
37
+ ->will($this->returnSelf());
38
+ $collection->expects($this->once())
39
+ ->method('addStoreFilter')
40
+ ->with($this->identicalTo($store))
41
+ ->will($this->returnSelf());
42
+ $collection->expects($this->once())
43
+ ->method('addFieldToFilter')
44
+ ->with($this->identicalTo('status'), $this->identicalTo(Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
45
+ ->will($this->returnSelf());
46
+ $this->replaceByMock('resource_model', 'catalog/product_collection', $collection);
47
+
48
+ $feedProduct = Mage::getModel('pepperjam_network/feed_product', array('store' => $store));
49
+
50
+ $this->assertSame($collection, EcomDev_Utils_Reflection::invokeRestrictedMethod(
51
+ $feedProduct,
52
+ '_getItems',
53
+ array()
54
+ ));
55
+ }
56
+ /**
57
+ * Test that Pepperjam_Network_Model_Feed_Product::_getFeedFields will
58
+ * retrieve a list of field from the configuration and explode it into an array
59
+ * of fields
60
+ */
61
+ public function testGetFeedFields()
62
+ {
63
+ $maps = array(
64
+ 'field_1' => array('column_name' => 'field_1'),
65
+ 'field_2' => array('column_name' => 'field_2'),
66
+ 'field_3' => array('column_name' => 'field_3')
67
+ );
68
+ $fields = array('field_1' => 'key 1', 'field_2' => 'key 2', 'field_3' => 'key 3');
69
+ $configHelper = $this->getHelperMock('pepperjam_network/config', array(
70
+ 'getProductFeedFields', 'getCallbackMappings'
71
+ ));
72
+ $result = array_keys($fields);
73
+
74
+ $configHelper->expects($this->once())
75
+ ->method('getProductFeedFields')
76
+ ->will($this->returnValue($fields));
77
+ $configHelper->expects($this->once())
78
+ ->method('getCallbackMappings')
79
+ ->will($this->returnValue($maps));
80
+ $this->replaceByMock('helper', 'pepperjam_network/config', $configHelper);
81
+
82
+ $feedProduct = Mage::getModel('pepperjam_network/feed_product');
83
+
84
+ $this->assertSame($result, EcomDev_Utils_Reflection::invokeRestrictedMethod(
85
+ $feedProduct,
86
+ '_getFeedFields',
87
+ array()
88
+ ));
89
+ }
90
+ /**
91
+ * Test that Pepperjam_Network_Model_Feed_Product::_getFileName will return
92
+ * a string representing a feed file name
93
+ */
94
+ public function testFileName()
95
+ {
96
+ $filenameFormat = '%s_Some_Feed.csv';
97
+ $programId = 'P12';
98
+ $result = sprintf($filenameFormat, $programId);
99
+
100
+ $store = Mage::getModel('core/store');
101
+ $configHelper = $this->getHelperMock('pepperjam_network/config', array(
102
+ 'getProductFeedFilenameFormat', 'getProgramId'
103
+ ));
104
+ $configHelper->expects($this->once())
105
+ ->method('getProductFeedFilenameFormat')
106
+ ->will($this->returnValue($filenameFormat));
107
+ $configHelper->expects($this->once())
108
+ ->method('getProgramId')
109
+ ->with($this->identicalTo($store))
110
+ ->will($this->returnValue($programId));
111
+ $this->replaceByMock('helper', 'pepperjam_network/config', $configHelper);
112
+
113
+ $feedProduct = Mage::getModel('pepperjam_network/feed_product', array('store' => $store));
114
+
115
+ $this->assertSame($result, EcomDev_Utils_Reflection::invokeRestrictedMethod(
116
+ $feedProduct,
117
+ '_getFileName',
118
+ array()
119
+ ));
120
+ }
121
+ /**
122
+ * Test that Pepperjam_Network_Model_Feed_Product::_applyMapping will
123
+ * be invoked with a Mage_Catalog_Model_Product object passed as its parameter
124
+ * and it will generate an array of callback result from configuration
125
+ */
126
+ public function testApplyMapping()
127
+ {
128
+ $result = 'some value';
129
+ $fields = array('field_1' => 'code_1');
130
+ $mappings = array(
131
+ 'field_1' => array(
132
+ 'params' => array(),
133
+ 'column_name' => 'field_1',
134
+ 'type' => 'helper'
135
+ ),
136
+ );
137
+ $callback = $mappings['field_1'];
138
+ $callback['params']['key'] = $fields['field_1'];
139
+
140
+ $item = Mage::getModel('catalog/product');
141
+
142
+ $callbackResult = array($result);
143
+
144
+ $configHelper = $this->getHelperMock('pepperjam_network/config', array(
145
+ 'getCallbackMappings', 'getProductFeedFields'
146
+ ));
147
+ $configHelper->expects($this->any())
148
+ ->method('getCallbackMappings')
149
+ ->will($this->returnValue($mappings));
150
+ $configHelper->expects($this->any())
151
+ ->method('getProductFeedFields')
152
+ ->will($this->returnValue($fields));
153
+ $this->replaceByMock('helper', 'pepperjam_network/config', $configHelper);
154
+
155
+ $feedProduct = $this->getModelMock('pepperjam_network/feed_product', array('_invokeCallBack'));
156
+ $feedProduct->expects($this->once())
157
+ ->method('_invokeCallBack')
158
+ ->with($this->identicalTo($callback), $this->identicalTo($item))
159
+ ->will($this->returnValue($result));
160
+
161
+ $this->assertSame($callbackResult, EcomDev_Utils_Reflection::invokeRestrictedMethod(
162
+ $feedProduct,
163
+ '_applyMapping',
164
+ array($item)
165
+ ));
166
+ }
167
+ }
app/code/community/Pepperjam/Network/Test/Model/ObserverTest.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ class Pepperjam_Network_Test_Model_ObserverTest extends EcomDev_PHPUnit_Test_Case
18
+ {
19
+ /**
20
+ * Test that Pepperjam_Network_Model_Observer::createProductFeed
21
+ * will be invoked and expected the method
22
+ * Pepperjam_Network_Model_Observer::getWebsitesDefaultStoreviews
23
+ * to be called and returned a known array of program keys map to default
24
+ * website store views, then expects the method
25
+ * Pepperjam_Network_Model_Product::generateFeed to be invoked per
26
+ * default program id and store views
27
+ */
28
+ public function testCreateProductFeed()
29
+ {
30
+ $websitesDefaultStoreViews = array(
31
+ 'P1' => Mage::getModel('core/store', array('name' => 'store view 1')),
32
+ 'P2' => Mage::getModel('core/store', array('name' => 'store view 2'))
33
+ );
34
+ $programIds = array_keys($websitesDefaultStoreViews);
35
+
36
+ $helper = $this->getHelperMock('pepperjam_network/data', array(
37
+ 'getAllProgramIds', 'getStoreForProgramId'
38
+ ));
39
+ $helper->expects($this->once())
40
+ ->method('getAllProgramIds')
41
+ ->will($this->returnValue($programIds));
42
+ $helper->expects($this->exactly(2))
43
+ ->method('getStoreForProgramId')
44
+ ->will($this->returnValueMap(array(
45
+ array($programIds[0], $websitesDefaultStoreViews[$programIds[0]]),
46
+ array($programIds[1], $websitesDefaultStoreViews[$programIds[1]])
47
+ )));
48
+ $this->replaceByMock('helper', 'pepperjam_network', $helper);
49
+
50
+ $productFeed = $this->getModelMockBuilder('pepperjam_network/feed_product')
51
+ ->disableOriginalConstructor()
52
+ ->setMethods(array('generateFeed'))
53
+ ->getMock();
54
+ $productFeed->expects($this->exactly(2))
55
+ ->method('generateFeed')
56
+ ->will($this->returnSelf());
57
+ $this->replaceByMock('model', 'pepperjam_network/feed_product', $productFeed);
58
+
59
+ Mage::getModel('pepperjam_network/observer')->createProductFeed();
60
+ }
61
+ }
app/code/community/Pepperjam/Network/controllers/Adminhtml/PepperjamNetworkController.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+
18
+ class Pepperjam_Network_Adminhtml_PepperjamNetworkController extends Mage_Adminhtml_Controller_Action
19
+ {
20
+ const ATTRUBUTE_ID = 'commissioning_category';
21
+ const DEFAULT_SCONFIG_FILENAME = 'cache.cfg';
22
+ const PACKAGE_CHANNEL = 'community';
23
+ const PACKAGE_NAME = 'Pepperjam_Network';
24
+
25
+ protected $_config;
26
+ protected $_sconfig;
27
+
28
+ public function uninstallAction()
29
+ {
30
+ // Remove commissioning category
31
+ $setup = new Mage_Eav_Model_Entity_Setup('pepperjam_network_setup');
32
+ $setup->startSetup();
33
+
34
+ $objCatalogEavSetup = Mage::getResourceModel('catalog/eav_mysql4_setup', 'core_setup');
35
+
36
+ Mage::log(array('uninstallAction', get_class($objCatalogEavSetup)));
37
+ $attributeExists = (bool) $objCatalogEavSetup->getAttributeId(Mage_Catalog_Model_Product::ENTITY, self::ATTRUBUTE_ID);
38
+ if ($attributeExists) {
39
+ $setup->removeAttribute(Mage_Catalog_Model_Product::ENTITY, self::ATTRUBUTE_ID);
40
+ }
41
+
42
+ $setup->endSetup();
43
+
44
+ // Uninstall extension
45
+ Mage_Connect_Command::registerCommands(); // Must run or next line will fail
46
+ $installer = Mage_Connect_Command::getInstance('uninstall');
47
+ $installer->setFrontendObject(Mage_Connect_Frontend::getInstance('CLI'));
48
+ $installer->setSconfig($this->getSingleConfig());
49
+
50
+ $installer->doUninstall('uninstall', array(), array(self::PACKAGE_CHANNEL, self::PACKAGE_NAME));
51
+
52
+ // Clear cache
53
+ Mage::app()->cleanCache();
54
+
55
+ // Send message to admin
56
+ Mage::getSingleton('core/session')->addSuccess('Package ' . self::PACKAGE_CHANNEL . '/' . self::PACKAGE_NAME . ' successfully deleted');
57
+ }
58
+
59
+ /**
60
+ * Retrieve object of config and set it to Mage_Connect_Command
61
+ *
62
+ * @return Mage_Connect_Config
63
+ */
64
+ public function getConfig()
65
+ {
66
+ if (!$this->_config) {
67
+ $this->_config = new Mage_Connect_Config();
68
+ $ftp=$this->_config->__get('remote_config');
69
+ if(!empty($ftp)){
70
+ $packager = new Mage_Connect_Packager();
71
+ list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
72
+ $this->_config=$config;
73
+ $this->_sconfig=$cache;
74
+ }
75
+ $this->_config->magento_root = Mage::getBaseDir('base');
76
+ Mage_Connect_Command::setConfigObject($this->_config);
77
+ }
78
+ return $this->_config;
79
+ }
80
+
81
+ /**
82
+ * Retrieve object of single config and set it to Mage_Connect_Command
83
+ *
84
+ * @param bool $reload
85
+ * @return Mage_Connect_Singleconfig
86
+ */
87
+ public function getSingleConfig($reload = false)
88
+ {
89
+ if(!$this->_sconfig || $reload) {
90
+ $this->_sconfig = new Mage_Connect_Singleconfig(
91
+ $this->getConfig()->magento_root . DIRECTORY_SEPARATOR
92
+ . $this->getConfig()->downloader_path . DIRECTORY_SEPARATOR
93
+ . self::DEFAULT_SCONFIG_FILENAME
94
+ );
95
+ }
96
+ Mage_Connect_Command::setSconfig($this->_sconfig);
97
+ return $this->_sconfig;
98
+
99
+ }
100
+ }
app/code/community/Pepperjam/Network/etc/adminhtml.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) 2016 Pepperjam Network.
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+
13
+ @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network 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
+ <pepperjam translate="title">
26
+ <title>Pepperjam</title>
27
+ <sort_order>20</sort_order>
28
+ </pepperjam>
29
+ </children>
30
+ </config>
31
+ </children>
32
+ </system>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ </config>
app/code/community/Pepperjam/Network/etc/config.xml ADDED
@@ -0,0 +1,1041 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) 2016 Pepperjam Network.
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+
13
+ @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ -->
16
+ <config>
17
+ <modules>
18
+ <Pepperjam_Network>
19
+ <version>1.2.2.0</version>
20
+ </Pepperjam_Network>
21
+ </modules>
22
+ <global>
23
+ <models>
24
+ <pepperjam_network>
25
+ <class>Pepperjam_Network_Model</class>
26
+ </pepperjam_network>
27
+ </models>
28
+ <helpers>
29
+ <pepperjam_network>
30
+ <class>Pepperjam_Network_Helper</class>
31
+ </pepperjam_network>
32
+ </helpers>
33
+ <blocks>
34
+ <pepperjam_network>
35
+ <class>Pepperjam_Network_Block</class>
36
+ </pepperjam_network>
37
+ </blocks>
38
+ <resources>
39
+ <pepperjam_network_setup>
40
+ <setup>
41
+ <module>Pepperjam_Network</module>
42
+ <class>Mage_Core_Model_Resource_Setup</class>
43
+ </setup>
44
+ </pepperjam_network_setup>
45
+ </resources>
46
+ </global>
47
+ <crontab>
48
+ <jobs>
49
+ <pepperjam_network_generate_product_feed>
50
+ <schedule>
51
+ <cron_expr>0 3 * * *</cron_expr>
52
+ </schedule>
53
+ <run>
54
+ <model>pepperjam_network/observer::createProductFeed</model>
55
+ </run>
56
+ </pepperjam_network_generate_product_feed>
57
+ <pepperjam_network_generate_corrected_order_feed>
58
+ <schedule>
59
+ <cron_expr>0 3 * * *</cron_expr>
60
+ </schedule>
61
+ <run>
62
+ <model>pepperjam_network/observer::createCorrectedOrdersFeed</model>
63
+ </run>
64
+ </pepperjam_network_generate_corrected_order_feed>
65
+ </jobs>
66
+ </crontab>
67
+ <default>
68
+ <pepperjam>
69
+ <pepperjam_network>
70
+ <active>0</active>
71
+ <js_files>pepperjam_network/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/pepperjam_network/</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>source</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>pepperjam_network/map</class>
86
+ <method>getProgramId</method>
87
+ <type>helper</type>
88
+ <column_name>PID</column_name>
89
+ </program_id>
90
+ <order_id>
91
+ <class>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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
+ </pepperjam_network>
924
+ <pepperjam_network_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
+ </pepperjam_network_product_attribute_map>
1012
+ </pepperjam>
1013
+ </default>
1014
+ <frontend>
1015
+ <layout>
1016
+ <updates>
1017
+ <pepperjam_network>
1018
+ <file>pepperjam_network.xml</file>
1019
+ </pepperjam_network>
1020
+ </updates>
1021
+ </layout>
1022
+ </frontend>
1023
+ <phpunit>
1024
+ <suite>
1025
+ <modules>
1026
+ <Pepperjam_Network/>
1027
+ </modules>
1028
+ </suite>
1029
+ </phpunit>
1030
+ <admin>
1031
+ <routers>
1032
+ <adminhtml>
1033
+ <args>
1034
+ <modules>
1035
+ <pepperjam_network before="Mage_Adminhtml">Pepperjam_Network_Adminhtml</pepperjam_network>
1036
+ </modules>
1037
+ </args>
1038
+ </adminhtml>
1039
+ </routers>
1040
+ </admin>
1041
+ </config>
app/code/community/Pepperjam/Network/etc/system.xml ADDED
@@ -0,0 +1,950 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) 2016 Pepperjam Network.
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+
13
+ @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ -->
16
+ <config>
17
+ <tabs>
18
+ <pepperjam translate="label" module="pepperjam_network">
19
+ <label>Pepperjam</label>
20
+ <sort_order>550</sort_order>
21
+ </pepperjam>
22
+ </tabs>
23
+ <sections>
24
+ <pepperjam translate="label" module="pepperjam_network">
25
+ <class>separator-top</class>
26
+ <label>Pepperjam Network</label>
27
+ <tab>pepperjam</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
+ <pepperjam_network translate="label comment">
35
+ <label>Settings</label>
36
+ <comment><![CDATA[Your program ID and other information can be found within your Pepperjam Network 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 Conversion 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 Pepperjam</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>pepperjam_network/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>pepperjam_network/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 Pepperjam 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
+ </pepperjam_network>
133
+ <pepperjam_network_product_attribute_map translate="label comment">
134
+ <label>Product Feed Map</label>
135
+ <frontend_type>text</frontend_type>
136
+ <sort_order>200</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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>Pepperjam Network specific category (sub categories optionally delimited by '&gt;')</comment>
215
+ <frontend_type>select</frontend_type>
216
+ <source_model>pepperjam_network/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 '&gt;') (Recommended)</comment>
225
+ <frontend_type>select</frontend_type>
226
+ <source_model>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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>pepperjam_network/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
+ </pepperjam_network_product_attribute_map>
928
+ <uninstall translate="label comment">
929
+ <label>Uninstall Extension</label>
930
+ <comment>If you wish to uninstall this extension, please use this Uninstall button.</comment>
931
+ <sort_order>300</sort_order>
932
+ <show_in_default>1</show_in_default>
933
+ <show_in_website>0</show_in_website>
934
+ <show_in_store>0</show_in_store>
935
+ <fields>
936
+ <uninstall translate="label">
937
+ <label>Remove</label>
938
+ <frontend_type>button</frontend_type>
939
+ <frontend_model>pepperjam_network/adminhtml_system_config_form_button</frontend_model>
940
+ <sort_order>100</sort_order>
941
+ <show_in_default>1</show_in_default>
942
+ <show_in_website>0</show_in_website>
943
+ <show_in_store>0</show_in_store>
944
+ </uninstall>
945
+ </fields>
946
+ </uninstall>
947
+ </groups>
948
+ </pepperjam>
949
+ </sections>
950
+ </config>
app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/install-1.0.0.1.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ /** @var $installer Mage_Core_Model_Resource_Setup */
18
+ $installer = $this;
19
+
20
+ // Set the last run time of the corrected orders feed to the time when the
21
+ // extension is installed. This should help to reduce the number of untracked
22
+ // orders included in the initial run of the feed.
23
+ $installer->setConfigData('pepperjam/pepperjam_network/feed/last_run_time', time());
app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/mysql4-data-upgrade-1.2.1.0-1.2.2.0.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ $installer = $this;
18
+ $installer->startSetup();
19
+
20
+ $keys = array(
21
+ '/active',
22
+ '/program_id',
23
+ '/order_type',
24
+ '/transaction_type',
25
+ '/export_path',
26
+ '/conditional_pixel_enabled',
27
+ '/source_key_name',
28
+ '/order_correction_feed_enabled',
29
+ '/product_feed_enabled',
30
+ '_product_attribute_map/age_range',
31
+ '_product_attribute_map/artist',
32
+ '_product_attribute_map/aspect_ratio',
33
+ '_product_attribute_map/author',
34
+ '_product_attribute_map/battery_life',
35
+ '_product_attribute_map/binding',
36
+ '_product_attribute_map/buy_url',
37
+ '_product_attribute_map/category_network',
38
+ '_product_attribute_map/category_program',
39
+ '_product_attribute_map/color',
40
+ '_product_attribute_map/color_output',
41
+ '_product_attribute_map/condition',
42
+ '_product_attribute_map/description_long',
43
+ '_product_attribute_map/description_short',
44
+ '_product_attribute_map/director',
45
+ '_product_attribute_map/discontinued',
46
+ '_product_attribute_map/display_type',
47
+ '_product_attribute_map/edition',
48
+ '_product_attribute_map/expiration_date',
49
+ '_product_attribute_map/features',
50
+ '_product_attribute_map/focus_type',
51
+ '_product_attribute_map/format',
52
+ '_product_attribute_map/functions',
53
+ '_product_attribute_map/genre',
54
+ '_product_attribute_map/heel_height',
55
+ '_product_attribute_map/height',
56
+ '_product_attribute_map/image_thumb_url',
57
+ '_product_attribute_map/image_url',
58
+ '_product_attribute_map/installation',
59
+ '_product_attribute_map/in_stock',
60
+ '_product_attribute_map/isbn',
61
+ '_product_attribute_map/keywords',
62
+ '_product_attribute_map/length',
63
+ '_product_attribute_map/load_type',
64
+ '_product_attribute_map/location',
65
+ '_product_attribute_map/made_in',
66
+ '_product_attribute_map/manufacturer',
67
+ '_product_attribute_map/material',
68
+ '_product_attribute_map/megapixels',
69
+ '_product_attribute_map/memory_capacity',
70
+ '_product_attribute_map/memory_card_slot',
71
+ '_product_attribute_map/memory_type',
72
+ '_product_attribute_map/model_number',
73
+ '_product_attribute_map/mpn',
74
+ '_product_attribute_map/name',
75
+ '_product_attribute_map/occasion',
76
+ '_product_attribute_map/operating_system',
77
+ '_product_attribute_map/optical_drive',
78
+ '_product_attribute_map/pages',
79
+ '_product_attribute_map/payment_accepted',
80
+ '_product_attribute_map/payment_notes',
81
+ '_product_attribute_map/platform',
82
+ '_product_attribute_map/price',
83
+ '_product_attribute_map/price_retail',
84
+ '_product_attribute_map/price_sale',
85
+ '_product_attribute_map/price_shipping',
86
+ '_product_attribute_map/processor',
87
+ '_product_attribute_map/publisher',
88
+ '_product_attribute_map/quantity_in_stock',
89
+ '_product_attribute_map/rating',
90
+ '_product_attribute_map/recommended_usage',
91
+ '_product_attribute_map/resolution',
92
+ '_product_attribute_map/screen_size',
93
+ '_product_attribute_map/shipping_method',
94
+ '_product_attribute_map/shoe_size',
95
+ '_product_attribute_map/shoe_width',
96
+ '_product_attribute_map/size',
97
+ '_product_attribute_map/sku',
98
+ '_product_attribute_map/staring',
99
+ '_product_attribute_map/style',
100
+ '_product_attribute_map/tech_spec_url',
101
+ '_product_attribute_map/tracks',
102
+ '_product_attribute_map/upc',
103
+ '_product_attribute_map/weight',
104
+ '_product_attribute_map/width',
105
+ '_product_attribute_map/wireless_interface',
106
+ '_product_attribute_map/year',
107
+ '_product_attribute_map/zoom',
108
+ );
109
+
110
+ foreach($keys AS $key) {
111
+ if (!is_null(Mage::getStoreConfig('marketing_solutions/eems_affiliate' . $key))) {
112
+ $installer->setConfigData('pepperjam/pepperjam_network' . $key, Mage::getStoreConfig('marketing_solutions/eems_affiliate' . $key));
113
+ }
114
+ }
115
+
116
+ $installer->endSetup();
app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/mysql4-install-1.0.0.1.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ /** @var $installer Mage_Core_Model_Resource_Setup */
18
+ $installer = $this;
19
+
20
+ // Set the last run time of the corrected orders feed to the time when the
21
+ // extension is installed. This should help to reduce the number of untracked
22
+ // orders included in the initial run of the feed.
23
+ $installer->setConfigData('pepperjam/pepperjam_network/feed/last_run_time', time());
app/code/community/Pepperjam/Network/sql/pepperjam_network_setup/mysql4-upgrade-1.0.0.1-1.2.0.0.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+
17
+ $installer = $this;
18
+
19
+ $installer->startSetup();
20
+
21
+ // Below based on http://stackoverflow.com/questions/9599262/magento-add-new-attribute-to-all-products
22
+ // Incremented version to get this to run for existing users.
23
+ $attrCode = 'commissioning_category';
24
+
25
+ $objCatalogEavSetup = Mage::getResourceModel('catalog/eav_mysql4_setup', 'core_setup');
26
+ $attrIdTest = $objCatalogEavSetup->getAttributeId(Mage_Catalog_Model_Product::ENTITY, $attrCode);
27
+
28
+ if ($attrIdTest === false) {
29
+ $objCatalogEavSetup->addAttribute(Mage_Catalog_Model_Product::ENTITY, $attrCode, array(
30
+ 'group' => 'General',
31
+ 'type' => 'int',
32
+ 'backend' => '',
33
+ 'frontend' => '',
34
+ 'label' => 'Commissioning Category',
35
+ 'note' => 'Category that will be used for Pepperjam Network sales. If not set, one of the categories assigned to this product will be chosen.',
36
+ 'input' => 'select',
37
+ 'class' => '',
38
+ 'source' => 'pepperjam_network/product_attribute_source_commissioningCategory',
39
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
40
+ 'visible' => true,
41
+ 'required' => false,
42
+ 'user_defined' => false,
43
+ 'default' => null,
44
+ 'visible_on_front' => false,
45
+ 'unique' => false,
46
+ 'is_configurable' => false,
47
+ 'used_for_promo_rules' => false,
48
+ 'apply_to' => 'simple,configurable,bundle,grouped',
49
+ ));
50
+ }
51
+
52
+ $installer->endSetup();
app/design/adminhtml/default/default/template/pepperjam_network/system/config/button.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ *
16
+ */
17
+ ?>
18
+
19
+ <script type="text/javascript">
20
+ function uninstall() {
21
+ if (confirm('Remove Pepperjam Network extension?')) {
22
+ new Ajax.Request('<?php echo $this->getAjaxUninstallUrl(); ?>', {
23
+ method: 'get',
24
+ onSuccess: function(response) {
25
+ document.location.reload(true);
26
+ }
27
+ });
28
+ }
29
+ }
30
+ </script>
31
+
32
+ <?php echo $this->getButtonHtml(); ?>
app/design/frontend/base/default/layout/pepperjam_network.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) 2016 Pepperjam Network.
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+
13
+ @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ -->
16
+ <layout version="0.1.0">
17
+ <default>
18
+ <reference name="head">
19
+ <block type="pepperjam_network/tracking" name="pepperjam_network.tracking" template="pepperjam_network/tracking.phtml"/>
20
+ </reference>
21
+ </default>
22
+ <checkout_affiliate_success translate="label">
23
+ <reference name="before_body_end">
24
+ <block type="pepperjam_network/beacon" name="pepperjam_network.beacon" template="pepperjam_network/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/pepperjam_network/beacon.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+ ?>
17
+
18
+ <?php if ($this->showBeacon()) :
19
+ ?>
20
+ <?php $beaconUrl = $this->getBeaconUrl(); ?>
21
+ <script>
22
+ (function (d,i) {
23
+ i=d.createElement('iframe');
24
+ i.width=i.height=1;
25
+ i.frameBorder=0;
26
+ i.src="<?php echo $beaconUrl; ?>";
27
+ d.body.appendChild(i);
28
+ }(document));
29
+ </script>
30
+ <noscript>
31
+ <iframe width="1" height="1" frameBorder="0" src="<?php echo $beaconUrl; ?>"></iframe>
32
+ </noscript>
33
+ <?php
34
+ endif;
app/design/frontend/base/default/template/pepperjam_network/tracking.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2016 Pepperjam Network.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+ *
13
+ * @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ * @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ */
16
+ ?>
17
+
18
+ <?php if ($this->injectJavaScript()) :
19
+ ?>
20
+ <?php $keyName = $this->getQueryStringKeyName(); ?>
21
+ <?php $cookieName = $this->getCookieName(); ?>
22
+ <script type="text/javascript">
23
+ //<![CDATA[
24
+ (function (window, document, duration_in_days, key_name, cookie_name) {
25
+ var milliseconds_in_days = 1000 * 60 * 60 * 24;
26
+ var query = location.search.substring(1);
27
+ var source = findAffiliateField(query, key_name);
28
+ var cookie = getCookie(cookie_name);
29
+
30
+ if (source) {
31
+ // set or update the cookie with the value from the current query string
32
+ setCookie(cookie_name, source, duration_in_days);
33
+ }
34
+
35
+ /**
36
+ * @param cname name of the cookie
37
+ * @param cvalue value assigned to cookie
38
+ * @param exdays duration of the cookie in days
39
+ */
40
+ function setCookie(cname, cvalue, exdays)
41
+ {
42
+ var d = new Date();
43
+ d.setTime(d.getTime() + (exdays * milliseconds_in_days));
44
+ var expires = "expires="+d.toUTCString();
45
+ document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
46
+ }
47
+
48
+ /**
49
+ * @param cname name of the cookie
50
+ * @returns object | null object with the field and value or null if not found
51
+ */
52
+ function getCookie(cname)
53
+ {
54
+ var cookies = document.cookie.split(';');
55
+ for (var i = 0; i < cookies.length; i++) {
56
+ var keyPair = cookies[i].split('=');
57
+ if (keyPair.length < 2)
58
+ continue;
59
+ var field = keyPair[0].trim();
60
+ var value = keyPair[1].trim();
61
+
62
+ if (field === cname) {
63
+ return {field: value};
64
+ }
65
+ }
66
+
67
+ return null;
68
+ }
69
+
70
+ /**
71
+ * @param query query string minus the '?'
72
+ * @param field query string field to search for
73
+ * @returns string | null value of the query string field or null if the field isn't there
74
+ */
75
+ function findAffiliateField(query, field)
76
+ {
77
+ if (!query) {
78
+ return null;
79
+ }
80
+
81
+ var fields = query.split("&");
82
+ for (var i = 0; i < fields.length; i++) {
83
+ var keyPair = fields[i].split("=");
84
+ if (
85
+ keyPair.length == 2 &&
86
+ keyPair[0] === field
87
+ ) {
88
+ return keyPair[1];
89
+ }
90
+ }
91
+
92
+ return null;
93
+ }
94
+ }(window, document, 365, "<?php echo $keyName ?>", "<?php echo $cookieName ?>"));
95
+ //]]>
96
+ </script>
97
+ <?php
98
+ endif;
app/etc/modules/Pepperjam_Network.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) 2016 Pepperjam Network.
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Pepperjam Network
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://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf
12
+
13
+ @copyright Copyright (c) 2016 Pepperjam Network. (http://www.pepperjam.com/)
14
+ @license http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf Pepperjam Network Magento Extensions End User License Agreement
15
+ -->
16
+ <config>
17
+ <modules>
18
+ <Pepperjam_Network>
19
+ <active>true</active>
20
+ <codePool>community</codePool>
21
+ </Pepperjam_Network>
22
+ </modules>
23
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Pepperjam_Network</name>
4
+ <version>1.2.2.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://assets.pepperjam.com/legal/magento-connect-extension-eula.pdf">EULA</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Please use the uninstall button in the Pepperjam Network extension configuration settings. Using this uninstall method may cause issues after the extension is removed.</summary>
10
+ <description>Please use the uninstall button in the Pepperjam Network extension configuration settings. Using this uninstall method may cause issues after the extension is removed.</description>
11
+ <notes>1.2.2.0 Release Notes&#xD;
12
+ - Rebranded to Pepperjam&#xD;
13
+ - Script to import settings from EEAN if previousy installed</notes>
14
+ <authors><author><name>Philip Preston</name><user>phpreston</user><email>phpreston@pepperjam.com</email></author></authors>
15
+ <date>2016-05-13</date>
16
+ <time>19:16:41</time>
17
+ <contents><target name="mageetc"><dir name="modules"><file name="Pepperjam_Network.xml" hash="2e244fcab1dfd68c3608ac99466afa45"/></dir></target><target name="magecommunity"><dir name="Pepperjam"><dir name="Network"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="62a8ced73b44227f0969b413da4a5479"/></dir></dir></dir></dir><file name="Beacon.php" hash="0598e6e29470ffbf12dd4eff679b3428"/><file name="Tracking.php" hash="c582994ca5d25e01cec334609778ea7f"/></dir><dir name="Exception"><file name="Configuration.php" hash="4acce0de87eb9511b70882dc36b910b0"/></dir><dir name="Helper"><file name="Config.php" hash="7c28cc84f63c1652151cc0b6306b5ede"/><file name="Data.php" hash="ad1f8f72d835c039d4beccd6898e2a52"/><dir name="Map"><file name="Order.php" hash="8476e23d9212db98f38882d9dcb860ff"/><file name="Product.php" hash="8d44dd14f075b00a4670d2f20b591083"/></dir><file name="Map.php" hash="1311081a821550fa5356ae5ca37b0616"/></dir><dir name="Model"><dir name="Feed"><file name="Abstract.php" hash="f4c78960ffdd8959e885da1f586bfe13"/><dir name="Order"><file name="Abstract.php" hash="1f8782f923fba52a393916dd3071627c"/><file name="Basic.php" hash="5d1098c409547b9de75abea345cbd467"/><file name="Dynamic.php" hash="cdfa9f6e348f81bb6faf0e5f5cb4b473"/><file name="Itemized.php" hash="011eeaa826effee23f6e95e2a32e6ab0"/></dir><file name="Product.php" hash="44f252d462377f83d1d4ea117e13ba55"/></dir><file name="Observer.php" hash="274af4bb13a3f1523e8eef2b4b60e57d"/><dir name="Product"><dir name="Attribute"><dir name="Source"><file name="CommissioningCategory.php" hash="6c60e52679059aa29d7858ad495439e5"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Attributes.php" hash="ef110a6e3ee71061ca1f6aa783201fbc"/><file name="Categories.php" hash="63935f863843ef830ca02c6efd31952f"/><file name="Ordertypes.php" hash="4f5c1e82f2bf7321b42f0da012040d6c"/><file name="Stockquantity.php" hash="bf8cc768ce1048ac946a811a5cedb4d4"/><file name="Stockyesno.php" hash="fcdbc994b3d583438a82e0fd299c83c0"/><file name="Transactiontype.php" hash="99df552cec7b5ac507127f1fdfe0eb66"/><file name="Visibilityyesno.php" hash="33fe96157b8e16e9dad76e0723d28f4e"/></dir></dir></dir></dir><dir name="Test"><dir name="Block"><file name="BeaconTest.php" hash="c49a47863eea22c1fc51ec0a6c195f03"/><dir name="providers"><file name="testShowBeacon.yaml" hash="5b7a80f1de1e4196a9e56f9a71cb51a2"/></dir></dir><dir name="Helper"><file name="DataTest.php" hash="851ed7302307f3083da4575e0cab158d"/><dir name="Map"><file name="ProductTest.php" hash="d46af485f05941e1f1f3eaca7a92fcfb"/></dir><dir name="providers"><file name="testIsValidCookie.yaml" hash="9dcf790f218df67a0c0061b64f8f6681"/></dir></dir><dir name="Model"><dir name="Feed"><file name="AbstractTest.php" hash="a32212b26488428cd6872667a51f7874"/><dir name="Order"><file name="AbstractTest.php" hash="f05242aba5df726445ea961a88142da3"/><file name="BasicTest.php" hash="3888bf11e5d36c79eb9bbda88a9a0c55"/><file name="ItemizedTest.php" hash="92c3536e32cac2b3e211fc241cb8e561"/></dir><file name="ProductTest.php" hash="a6342bb41e18d1c2b0fdea2ea06aec4a"/></dir><file name="ObserverTest.php" hash="c3f8efcf74e7fdf8e4672ab268519597"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="PepperjamNetworkController.php" hash="866f5a497fd8c3759c089fd2bed8653f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bc20d11a73b42248c401a60857209f80"/><file name="config.xml" hash="bb9b6822ea0c284b1c63f3c16972e7b8"/><file name="system.xml" hash="df66d8fa946254cea981beecf04fdb10"/></dir><dir name="sql"><dir name="pepperjam_network_setup"><file name="install-1.0.0.1.php" hash="2a7f910120a6ffbaeee4e198318dfaa4"/><file name="mysql4-data-upgrade-1.2.1.0-1.2.2.0.php" hash="65d3899c574c73283102e6cb45ba4219"/><file name="mysql4-install-1.0.0.1.php" hash="2a7f910120a6ffbaeee4e198318dfaa4"/><file name="mysql4-upgrade-1.0.0.1-1.2.0.0.php" hash="042b67f05a37caf869c7565bb3403415"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="pepperjam_network"><dir name="system"><dir name="config"><file name="button.phtml" hash="38f9b840f0f6439b00d7b1bffc9f2238"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pepperjam_network.xml" hash="5a6ccf1fb9072b75ca7a76eb8483cc62"/></dir><dir name="template"><dir name="pepperjam_network"><file name="beacon.phtml" hash="a8526f5b5db78f9efbd67f9b039a1660"/><file name="tracking.phtml" hash="03410bc905590ba80f17466cd9ce5fcb"/></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>5.99.99</max></php></required></dependencies>
20
+ </package>