Peerius_Connect - Version 1.0.7

Version Notes

Fixed p:recommended attribute in feed to include SKUs instead of magento ids.

Download this release

Release Info

Developer Peerius
Extension Peerius_Connect
Version 1.0.7
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.7

app/code/community/Peerius/Smartrecs/.DS_Store DELETED
Binary file
app/code/community/Peerius/Smartrecs/Block/Template.php CHANGED
@@ -1,127 +1,127 @@
1
- <?php
2
-
3
- /**
4
- * @category Peerius
5
- * @package Peerius_Smartrecs
6
- * @author Peerius Ltd
7
- */
8
- class Peerius_Smartrecs_Block_Template extends Mage_Catalog_Block_Product_List {
9
-
10
- const DEFAULT_ITEM_NUM = 3;
11
-
12
- const MAX_ITEM_NUM = 10;
13
-
14
- protected $_columnCount = 4;
15
-
16
- protected $_i = 0;
17
-
18
- protected function _prepareData() {
19
- $this->_productCollection = Mage::getModel('catalog/product')
20
- ->getCollection()
21
- ->addAttributeToSelect('*');
22
-
23
- $num = false;
24
-
25
- $skus = false;
26
-
27
- if ($this->getRequest()->getParam('skus')) {
28
- $skus = explode(',',$this->getRequest()->getParam('skus'));
29
- }
30
-
31
- if ($this->getRequest()->getParam('recs')) {
32
- $recs = json_decode($this->getRequest()->getParam('recs'));
33
- $num = count($recs);
34
- $skus = array();
35
- for ($i = 0; $i < $num; $i++) {
36
- $skus[] = $recs[$i]->refCode;
37
- }
38
- }
39
-
40
- if ($skus) {
41
- $this->_productCollection->addAttributeToFilter('SKU', array('in'=>$skus));
42
- $this->_productCollection->getSelect()->order("find_in_set(SKU,'".implode(',',$skus)."')");
43
- }
44
-
45
-
46
- if (!$max) {
47
- $max = (int) $this->getRequest()->getParam('max') ?: self::DEFAULT_ITEM_NUM;
48
- }
49
-
50
- if ($max > self::MAX_ITEM_NUM) {
51
- $max = self::MAX_ITEM_NUM;
52
- }
53
-
54
- $this->_productCollection->getSelect()->limit($max);
55
-
56
- $this->_productCollection->load();
57
-
58
- return $this;
59
- }
60
-
61
- protected function _beforeToHtml() {
62
- $this->_prepareData();
63
- parent::_beforeToHtml();
64
- }
65
-
66
- public function getItems() {
67
- return $this->_productCollection;
68
- }
69
-
70
- /**
71
- * Count items
72
- *
73
- * @return int
74
- */
75
- public function getItemCount()
76
- {
77
- return count($this->getItems());
78
- }
79
-
80
- public function getItemCollection() {
81
- return $this->_productCollection;
82
- }
83
-
84
-
85
- public function getRowCount()
86
- {
87
- return ceil(count($this->getItemCollection()->getItems())/$this->getColumnCount());
88
- }
89
-
90
- public function setColumnCount($columns)
91
- {
92
- if (intval($columns) > 0) {
93
- $this->_columnCount = intval($columns);
94
- }
95
- return $this;
96
- }
97
-
98
- public function getColumnCount()
99
- {
100
- return $this->_columnCount;
101
- }
102
-
103
- public function resetItemsIterator()
104
- {
105
- $this->getItems();
106
- reset($this->_productCollection);
107
- }
108
-
109
- public function getIterableItem()
110
- {
111
- if (is_array($this->_productCollection)) {
112
- $item = current($this->_productCollection);
113
- next($this->_productCollection);
114
- return $item;
115
- }
116
-
117
- // the iterator on an object doesn't work like this
118
- $i = 0;
119
- foreach ($this->_productCollection as $item) {
120
- if ($this->_i == $i++) {
121
- $this->_i++;
122
- return $item;
123
- }
124
- }
125
- }
126
- }
127
-
1
+ <?php
2
+
3
+ /**
4
+ * @category Peerius
5
+ * @package Peerius_Smartrecs
6
+ * @author Peerius Ltd
7
+ */
8
+ class Peerius_Smartrecs_Block_Template extends Mage_Catalog_Block_Product_List {
9
+
10
+ const DEFAULT_ITEM_NUM = 3;
11
+
12
+ const MAX_ITEM_NUM = 10;
13
+
14
+ protected $_columnCount = 4;
15
+
16
+ protected $_i = 0;
17
+
18
+ protected function _prepareData() {
19
+ $this->_productCollection = Mage::getModel('catalog/product')
20
+ ->getCollection()
21
+ ->addAttributeToSelect('*');
22
+
23
+ $num = false;
24
+ $skus = false;
25
+ $max = false;
26
+
27
+ if ($this->getRequest()->getParam('skus')) {
28
+ $skus = explode(',',$this->getRequest()->getParam('skus'));
29
+ }
30
+
31
+ if ($this->getRequest()->getParam('recs')) {
32
+ $recs = json_decode($this->getRequest()->getParam('recs'));
33
+ $num = count($recs);
34
+ $skus = array();
35
+ for ($i = 0; $i < $num; $i++) {
36
+ $skus[] = $recs[$i]->refCode;
37
+ }
38
+ }
39
+
40
+ if ($skus) {
41
+ $this->_productCollection->addAttributeToFilter('SKU', array('in'=>$skus));
42
+ $this->_productCollection->getSelect()->order("find_in_set(SKU,'".implode(',',$skus)."')");
43
+ }
44
+
45
+
46
+ if (!$max) {
47
+ $max = (int) $this->getRequest()->getParam('max') ?: self::DEFAULT_ITEM_NUM;
48
+ }
49
+
50
+ if ($max > self::MAX_ITEM_NUM) {
51
+ $max = self::MAX_ITEM_NUM;
52
+ }
53
+
54
+ $this->_productCollection->getSelect()->limit($max);
55
+
56
+ $this->_productCollection->load();
57
+
58
+ return $this;
59
+ }
60
+
61
+ protected function _beforeToHtml() {
62
+ $this->_prepareData();
63
+ parent::_beforeToHtml();
64
+ }
65
+
66
+ public function getItems() {
67
+ return $this->_productCollection;
68
+ }
69
+
70
+ /**
71
+ * Count items
72
+ *
73
+ * @return int
74
+ */
75
+ public function getItemCount()
76
+ {
77
+ return count($this->getItems());
78
+ }
79
+
80
+ public function getItemCollection() {
81
+ return $this->_productCollection;
82
+ }
83
+
84
+
85
+ public function getRowCount()
86
+ {
87
+ return ceil(count($this->getItemCollection()->getItems())/$this->getColumnCount());
88
+ }
89
+
90
+ public function setColumnCount($columns)
91
+ {
92
+ if (intval($columns) > 0) {
93
+ $this->_columnCount = intval($columns);
94
+ }
95
+ return $this;
96
+ }
97
+
98
+ public function getColumnCount()
99
+ {
100
+ return $this->_columnCount;
101
+ }
102
+
103
+ public function resetItemsIterator()
104
+ {
105
+ $this->getItems();
106
+ reset($this->_productCollection);
107
+ }
108
+
109
+ public function getIterableItem()
110
+ {
111
+ if (is_array($this->_productCollection)) {
112
+ $item = current($this->_productCollection);
113
+ next($this->_productCollection);
114
+ return $item;
115
+ }
116
+
117
+ // the iterator on an object doesn't work like this
118
+ $i = 0;
119
+ foreach ($this->_productCollection as $item) {
120
+ if ($this->_i == $i++) {
121
+ $this->_i++;
122
+ return $item;
123
+ }
124
+ }
125
+ }
126
+ }
127
+
app/code/community/Peerius/Smartrecs/Block/Tracking.php CHANGED
@@ -152,10 +152,11 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
152
  if ($item->getParentItem()) {
153
  continue;
154
  }
 
155
  $newItem = array(
156
  'refCode' => $item->getSku(),
157
  'qty' => $item->getQty(),
158
- 'price' => $item->getPrice()
159
  );
160
  $pixel['basket']['items'][] = $newItem;
161
  }
@@ -184,10 +185,11 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
184
  if ($item->getParentItem()) {
185
  continue;
186
  }
 
187
  $newItem = array(
188
  'refCode' => $item->getSku(),
189
  'qty' => (int) $item->getQty(),
190
- 'price' => $item->getPrice()
191
  );
192
  $pixel['checkout']['items'][] = $newItem;
193
  }
@@ -227,10 +229,11 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
227
  if ($item->getParentItem()) {
228
  continue;
229
  }
 
230
  $newItem = array(
231
  'refCode' => $item->getSku(),
232
  'qty' => (int) $item->getQtyOrdered(),
233
- 'price' => $item->getPrice()
234
  );
235
  $pixel['order']['items'][] = $newItem;
236
  }
@@ -393,7 +396,5 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
393
  }
394
  return '<script type="text/JavaScript" src="//'.$this->escapeHtml(Mage::getStoreConfig('peerius/general/client_name')).'.peerius.com/tracker/peerius.page" charset="UTF-8"></script>';
395
  }
396
- // alert(JSON.stringify(PeeriusCallbacks))
397
 
398
- }
399
-
152
  if ($item->getParentItem()) {
153
  continue;
154
  }
155
+ $priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
156
  $newItem = array(
157
  'refCode' => $item->getSku(),
158
  'qty' => $item->getQty(),
159
+ 'price' => $priceIncTax
160
  );
161
  $pixel['basket']['items'][] = $newItem;
162
  }
185
  if ($item->getParentItem()) {
186
  continue;
187
  }
188
+ $priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
189
  $newItem = array(
190
  'refCode' => $item->getSku(),
191
  'qty' => (int) $item->getQty(),
192
+ 'price' => $priceIncTax
193
  );
194
  $pixel['checkout']['items'][] = $newItem;
195
  }
229
  if ($item->getParentItem()) {
230
  continue;
231
  }
232
+ $priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
233
  $newItem = array(
234
  'refCode' => $item->getSku(),
235
  'qty' => (int) $item->getQtyOrdered(),
236
+ 'price' => $priceIncTax
237
  );
238
  $pixel['order']['items'][] = $newItem;
239
  }
396
  }
397
  return '<script type="text/JavaScript" src="//'.$this->escapeHtml(Mage::getStoreConfig('peerius/general/client_name')).'.peerius.com/tracker/peerius.page" charset="UTF-8"></script>';
398
  }
 
399
 
400
+ }
 
app/code/community/Peerius/Smartrecs/Model/.DS_Store DELETED
Binary file
app/code/community/Peerius/Smartrecs/Model/Feed/Creator.php CHANGED
@@ -1,505 +1,510 @@
1
- <?php
2
-
3
- /**
4
- * @category Peerius
5
- * @package Peerius_Smartrecs
6
- * @author Peerius Ltd
7
- */
8
- class Peerius_Smartrecs_Model_Feed_Creator {
9
-
10
- protected $fileName;
11
- protected $secretKey;
12
- protected $clientName;
13
- protected $token;
14
-
15
- /**
16
- * method to create the feed
17
- * */
18
- public function process(Mage_Core_Model_Website $website) {
19
- $this->fileName = Mage::getBaseDir('tmp') . DS . str_replace(' ', '_', $website->getName()) .
20
- "_PeeriusFeed" . ".xml";
21
- $clientName = Mage::getStoreConfig('peerius/general/client_name');
22
- $this->secretKey = Mage::getStoreConfig('peerius/general/secret_key');
23
- $this->clientName = Mage::getStoreConfig('peerius/general/client_name');
24
- $this->token = Mage::getStoreConfig('peerius/general/token');
25
-
26
- if ($this->_createFile()) {
27
- if (!$this->_writeFeed($website)) {
28
- return false;
29
- }
30
- } else {
31
- return false;
32
- }
33
- return true;
34
- }
35
-
36
- /**
37
- * @param Mage_Core_Model_Website $website
38
- * @return bool
39
- */
40
- protected function _writeFeed(Mage_Core_Model_Website $website) {
41
-
42
- try {
43
- $f = new Varien_Io_File();
44
- $f->write($this->fileName, $this->_getHeader($website) .
45
- $this->_getProducts($website) . $this->_getFooter());
46
-
47
- $f->close();
48
- return true;
49
- } catch (Exception $ex) {
50
- $this->log("error writing the feed");
51
- $this->log($ex->getMessage());
52
- return false;
53
- }
54
- }
55
-
56
- /**
57
- * @param $file
58
- * @return bool
59
- */
60
- protected function _createFile() {
61
- return true;
62
- // try {
63
- // $f = new Varien_Io_File();
64
- // $validator = new Zend_Validate_File_Exists();
65
- //
66
- // if (!$validator->isValid($this->fileName)) {
67
- // $this->log("could not create the smartrec file");
68
- // return false;
69
- // }
70
- // $this->log("SMART-recs file created");
71
- //
72
- // fclose($f);
73
- // return true;
74
- // } catch (Exception $ex) {
75
- // $this->log("error during file creation");
76
- // $this->log($ex->getMessage());
77
- // return false;
78
- // }
79
- }
80
-
81
- /**
82
- * generate the rss file header
83
- * @param Mage_Core_Model_Website $website
84
- * @return string
85
- */
86
- protected function _getHeader(Mage_Core_Model_Website $website) {
87
- $clientName = $this->_getClientName();
88
- $rss = '';
89
- $rss .= '<?xml version="1.0" encoding="UTF-8"?>';
90
- $rss .= '<rss version="2.0" xmlns:p="http://www.peerius.com/feeds/PeeriusRSS20.xsd">';
91
- $rss .= '<channel>';
92
- $rss .= '<title><![CDATA[Rss 2.0 ' . $clientName . ' product catalogue feed]]></title>';
93
- $rss .= '<link>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '</link>';
94
- $rss .= '<description><![CDATA[The latest product catalogue feed of ' . $clientName . '.]]></description>';
95
- return $rss;
96
- }
97
-
98
- /**
99
- * generate the rss file footer
100
- * @return string
101
- */
102
- protected function _getFooter() {
103
- $rss = '';
104
- $rss .= '</channel>';
105
- $rss .= '</rss>';
106
- return $rss;
107
- }
108
-
109
- /**
110
- * sets the layout
111
- * @param string $packageName
112
- * @param string $themeName
113
- */
114
- protected function _changeTheme($packageName, $themeName) {
115
- Mage::getDesign()->setArea('frontend')
116
- ->setPackageName($packageName)
117
- ->setTheme($themeName);
118
- }
119
-
120
- /**
121
- * write the products
122
- * @param Mage_Core_Model_Website $website
123
- * @return string
124
- */
125
- protected function _getProducts(Mage_Core_Model_Website $website) {
126
- $profilingStart = microtime(true);
127
- $adapter = Mage::getSingleton("core/resource");
128
- $visiblityCondition = array('in' => array(2, 3, 4));
129
- $_catalogInventoryTable = method_exists($adapter, 'getTableName') ? $adapter->getTableName('cataloginventory_stock_item') : 'catalog_category_product_index';
130
-
131
- $this->log('started writing products');
132
-
133
- $this->_changeTheme(Mage::getStoreConfig('design/package/name', $website->getDefaultStore()->getCode()), Mage::getStoreConfig('design/package/theme', $website->getDefaultStore()->getCode()));
134
-
135
- $rss = '';
136
-
137
- $productCollection = Mage::getModel('catalog/product')
138
- ->getCollection()
139
- ->addWebsiteFilter($website->getWebsiteId())
140
- ->joinField("qty", $_catalogInventoryTable, 'qty', 'product_id=entity_id', null, 'left')
141
- ->addAttributeToSelect('*')
142
- ->addCategoryIds()
143
- //->addAttributeToFilter('type_id', array('eq' => 'configurable'))
144
- ->addAttributeToFilter('visibility', $visiblityCondition)
145
- // ->joinTable('catalog/product_relation', 'child_id=entity_id', array(
146
- // 'parent_id' => 'parent_id'
147
- // ), null, 'left')
148
- ->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
149
- // ->load();
150
-
151
- // if (Mage::app()->getRequest()->getParam('skus')) {
152
- // $skus = explode(',', Mage::app()->getRequest()->getParam('skus'));
153
- // $productCollection->addAttributeToFilter('SKU', array('like' => $skus));
154
- // }
155
-
156
- //Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($productCollection);
157
- //Mage::getModel('cataloginventory/stock_status')->addStockStatusToProducts($productCollection);
158
-
159
- $productsCount = $productCollection->getSize();
160
-
161
- try {
162
-
163
- foreach ($productCollection as $product) {
164
- // if ($rCnt++ > 500) continue;
165
- $categoryIds = $product->getCategoryIds();
166
- $parentCategoryBreadcrumbs = false;
167
- $parent = false;
168
-
169
- // don't export unavailable products
170
- if (!$product->isAvailable()) {
171
- $productsCount--;
172
- continue;
173
- }
174
-
175
-
176
- // if a product is not in a category skip it also
177
- if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
178
- $parent = $this->_getParent($product);
179
- if ($parent) {
180
- $parentCategoryBreadcrumbs = $this->_getParentCategoryBreadcrumbs($product);
181
- $categoryBreadcrumbs = $parentCategoryBreadcrumbs;
182
- } else {
183
- $categoryBreadcrumbs = $this->_getCategoryBreadcrumbs($product->getCategoryIds());
184
- }
185
- }
186
-
187
- // is the product or it's product in any category? If not, skip it
188
- if (!$categoryIds AND !$parentCategoryBreadcrumbs) {
189
- $productsCount--;
190
- continue;
191
- }
192
-
193
- $rss .= '<item>';
194
- $rss .= '<title><![CDATA[' . $product->getName() . ']]></title>';
195
- $rss .= '<link>' . $product->getProductUrl() . '</link>';
196
- $rss .= '<guid>' . $product->getSku() . '</guid>';
197
- if ($product->getThumbnail())
198
- $rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getThumbnail() . '</p:imageLink>';
199
- $rss .= '<p:price>
200
- <p:unitPrice>' . number_format($product->getPrice(), 2, '.', '') . '</p:unitPrice>
201
- <p:salePrice>' . number_format($product->getFinalPrice(), 2, '.', '') . '</p:salePrice>
202
- <p:currency>' . Mage::app()->getStore($website->getDefaultStore())->getCurrentCurrencyCode() . '</p:currency>
203
- </p:price>';
204
-
205
-
206
- if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
207
- $rss .= $this->_getCategoryBreadcrumbs($categoryIds);
208
- $rss .= '<p:attribute name="minimal_price">' . number_format($product->getMinimalPrice(), 2, '.', '') . '</p:attribute>';
209
-
210
- $attrArr = Mage::getModel('catalog/product_type_configurable')->getConfigurableAttributesAsArray($product);
211
-
212
- $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProductCollection($product)
213
- ->addAttributeToSelect('thumbnail')
214
- ->addAttributeToSelect('name')
215
- ->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', 1);
216
- foreach ($attrArr as $attr) {
217
- $childProducts->addAttributeToSelect($attr['attribute_code']);
218
- }
219
-
220
- foreach ($childProducts as $childProduct) {
221
- if ($childProduct->getData('visibility') == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
222
- //$p = Mage::getModel('catalog/product')->load($childProduct->getId());
223
- $rss .= '<p:variant>';
224
- //$rss .= '<p:title><![CDATA[' . $childProduct->getName() . ']]></p:title>';
225
- foreach ($attrArr as $attr) {
226
- $rss .= '<p:attribute name="' . $attr['attribute_code'] . '"><![CDATA[' . $childProduct->getAttributeText($attr['attribute_code']) . ']]></p:attribute>';
227
- }
228
- $rss .= '<p:attribute name="link">' . $childProduct->getProductUrl() . '</p:attribute>';
229
- $rss .= '<p:attribute name="guid">' . $childProduct->getSku() . '</p:attribute>';
230
- $rss .= '<p:attribute name="magento_id">' . $childProduct->getId() . '</p:attribute>';
231
- if ($product->getThumbnail())
232
- $rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $childProduct->getThumbnail() . '</p:imageLink>';
233
- $stockItem = $childProduct->getStockItem();
234
- $stockQty = ($stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) ?
235
- (int) $stockItem->getQty() : 0;
236
- $rss .= '<p:stock>' . $stockQty . '</p:stock>';
237
- $rss .= '</p:variant>';
238
- }
239
- }
240
- } else {
241
- if ($parent) {
242
- $rss .= $parent;
243
- $rss .= $categoryBreadcrumbs;
244
- } else {
245
- $rss .= $categoryBreadcrumbs;
246
- }
247
- }
248
-
249
-
250
- $rss .= '<pubDate>' . $product->getcreated_at() . '</pubDate>';
251
- $rss .= '<description><![CDATA[' . $product->getDescription() . ']]></description>';
252
-
253
- if ($product->getAttribute('manufacturer') instanceof Mage_Eav_Model_Entity_Attribute_Abstract) {
254
- $rss .= '<p:brand><![CDATA[' . $product->getAttributeText('manufacturer') . ']]></p:brand>';
255
- }
256
- $rss .= '<p:inStock>' . $this->_getStockStatus($product) . '</p:inStock>';
257
- $rss .= '<p:stock>' . (int) $product->getQty() . '</p:stock>';
258
- $rss .= '<p:recommend>Y</p:recommend>';
259
- $rss .= '<p:recommended>' . $this->_getRecommended($product) . '</p:recommended>';
260
- $rss .= '<p:attribute name="magento_id">' . $product->getId() . '</p:attribute>';
261
- $rss .= $this->_getAttributes($product);
262
- $rss .= $this->_getTags($product);
263
- $rss .= '</item>';
264
- }
265
-
266
- $this->log($productsCount . " items");
267
- } catch (Exception $e) {
268
- $this->log("an error occured: " . $e->getMessage());
269
- }
270
- $this->log("done");
271
-
272
-
273
- if ($productsCount == 0) {
274
- $this->log("no products found");
275
- throw new Exception("no products found");
276
- }
277
-
278
- $now = microtime(true);
279
-
280
- $this->log('Elapsed ' . date("H:i:s", ($now - $profilingStart)));
281
- $this->log('Memory ' . memory_get_peak_usage() / 1048576 . 'MB');
282
- return $rss;
283
- }
284
-
285
- /**
286
- * generate breadcrumb style categories
287
- * @param array $currentCatIds
288
- * @return string
289
- */
290
- protected function _getCategoryBreadcrumbs($currentCatIds) {
291
- $rss = '';
292
-
293
- if ($currentCatIds) {
294
- $categoryCollection = Mage::getResourceModel('catalog/category_collection')
295
- ->addAttributeToSelect('path')
296
- ->addAttributeToFilter('entity_id', $currentCatIds)
297
- ->addIsActiveFilter();
298
-
299
- foreach ($categoryCollection as $cat) {
300
- $p = explode('/', $cat->getPath());
301
-
302
- $fullPath = array();
303
- foreach ($p as $treeCat) {
304
- // Root-Kategorie 1 überspringen
305
- if ($treeCat <= 2)
306
- continue;
307
- $category = Mage::getModel('catalog/category')
308
- ->setStoreId(Mage::app()->getStore()->getId())
309
- ->load($treeCat);
310
- $fullPath[] = $category->getName();
311
- }
312
- $rss .= '<category><![CDATA[' . implode('>', $fullPath) . ']]></category>';
313
- }
314
- }
315
- return $rss;
316
- }
317
-
318
- /**
319
- * generate breadcrumb style categories
320
- * @param product $product
321
- * @return string
322
- */
323
- protected function _getParentCategoryBreadcrumbs($product) {
324
- $rss = '';
325
- $parentIds = $this->_getParent($product, true);
326
- $categoryIds = array();
327
-
328
- foreach ($parentIds as $parentId) {
329
- $product = Mage::getModel('catalog/product')->load($parentId);
330
- $categoryIds = array_merge($categoryIds, $product->getCategoryIds());
331
- }
332
-
333
- $rss = $this->_getCategoryBreadcrumbs($categoryIds);
334
- return $rss;
335
- }
336
-
337
- /**
338
- * retreive the product stock statuss
339
- * @param Mage_Core_Catalog_Product $product
340
- * @return string
341
- */
342
- protected function _getStockStatus($product) {
343
- $stockStatus = Mage::getModel('cataloginventory/stock_item')
344
- ->getCollection()
345
- ->addFieldToFilter('product_id', $product->getId())
346
- ->getFirstItem();
347
-
348
- return $stockStatus ? 'Y' : 'N';
349
- }
350
-
351
- /**
352
- * write the products
353
- * @param Mage_Core_Catalog_Product $product
354
- * @return string
355
- */
356
- protected function _getRecommended($product) {
357
- $all = array();
358
- $related = $product->getRelatedProductIds();
359
- foreach ($related as $id) {
360
- $all[$id] = $id;
361
- }
362
- $crosssell = $product->getCrossSellProducts();
363
- foreach ($crosssell as $_item) {
364
- $all[$_item->getId()] = $_item->getId();
365
- }
366
- $upsell = $product->getUpSellProductCollection();
367
- foreach ($upsell as $_item) {
368
- $all[$_item->getId()] = $_item->getId();
369
- }
370
- return implode(',', $all);
371
- }
372
-
373
- /**
374
- * generate comma-separated list of product tags
375
- * @param Mage_Core_Catalog_Product $product
376
- * @return string
377
- */
378
- protected function _getTags($product) {
379
- $tag_model = Mage::getModel('tag/tag');
380
- $tag_collection = $tag_model->getResourceCollection()
381
- ->addPopularity()
382
- // ->addStatusFilter($model->getApprovedStatus())
383
- ->addProductFilter($product->getId())
384
- ->setFlag('relation', true)
385
- ->addStoreFilter(Mage::app()->getStore()->getId())
386
- ->setActiveFilter()
387
- ->load();
388
-
389
- $mytags = $tag_collection->getItems();
390
-
391
- $tagArr = array();
392
- if (!$tag_collection->getSize()) {
393
- return '';
394
- }
395
-
396
- foreach ($mytags as $tag) {
397
- $tagArr[] = $tag->getName();
398
- }
399
- return '<p:tags>' . implode(',', $tagArr) . '</p:tags>';
400
- }
401
-
402
- /**
403
- * crate front-end attributes rss string
404
- * @param Mage_Core_Catalog_Product $product
405
- * @return string
406
- */
407
- protected function _getAttributes($product) {
408
- $attributes = $product->getAttributes();
409
- $rss = '';
410
- foreach ($attributes as $attribute) {
411
- if ($attribute->getIsVisibleOnFront()) {
412
- $attributeCode = $attribute->getAttributeCode();
413
- $label = $attribute->getFrontend()->getLabel($product);
414
- $value = $attribute->getFrontend()->getValue($product);
415
- $rss .= '<p:attribute name="' . $attributeCode . '"><![CDATA[' . $value . ']]></p:attribute>';
416
- }
417
- }
418
- return $rss;
419
- }
420
-
421
- /**
422
- * returns parent product ID if available
423
- * @param Mage_Core_Catalog_Product $product
424
- * @param bool return the ids
425
- * @return int
426
- */
427
- protected function _getParent($product, $ids = false) {
428
- $rss = '';
429
- $parentIds = false;
430
- if ($product->getTypeId() == "simple") {
431
- $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()); // check for grouped product
432
- if (!$parentIds)
433
- $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId()); //check for config product
434
- }
435
- if ($ids) {
436
- return $parentIds;
437
- }
438
- if ($parentIds) {
439
- $rss = '<p:attribute name="parent_magento_id">' . implode(',', $parentIds) . '</p:attribute>';
440
- } else {
441
- return false;
442
- }
443
- return $rss;
444
- }
445
-
446
- /**
447
- * the client name used in the rss feed
448
- * @return string
449
- */
450
- protected function _getClientName() {
451
- return Mage::getStoreConfig('peerius/general/client_name');
452
- }
453
-
454
- /**
455
- * @param $content
456
- * @return bool
457
- */
458
- protected function _appendToFile($content) {
459
- try {
460
- $f = new Varien_Io_File();
461
- $validator = new Zend_Validate_File_Exists();
462
-
463
- if (!$validator->isValid($this->fileName)) {
464
- $this->log("could not create the smartrec file");
465
- return false;
466
- }
467
- $this->log("SMART-recs file created");
468
-
469
- fclose($f);
470
- return true;
471
- } catch (Exception $ex) {
472
- $this->log("error during file creation");
473
- $this->log($ex->getMessage());
474
- return false;
475
- }
476
- try {
477
- $f = new Varien_Io_File();
478
- $f->write($this->fileName, $content);
479
- //if (file_put_contents($this->fileName, $content, FILE_APPEND)) {
480
- return true;
481
- } catch (Exception $ex) {
482
- $this->log("error while writing to the feed file");
483
- $this->log($ex->getMessage());
484
- return false;
485
- }
486
- }
487
-
488
- public function checkToken() {
489
- $token = Mage::getStoreConfig('peerius/general/token');
490
-
491
- if (!$token OR !Mage::app()->getRequest()->getParam('token') OR (Mage::app()->getRequest()->getParam('token') != sha1($token))) {
492
- $this->log("token error");
493
- return false;
494
- }
495
- return true;
496
- }
497
-
498
- /**
499
- * @param string $message
500
- */
501
- protected function log($message) {
502
- Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
503
- }
504
-
 
 
 
 
 
505
  }
1
+ <?php
2
+
3
+ /**
4
+ * @category Peerius
5
+ * @package Peerius_Smartrecs
6
+ * @author Peerius Ltd
7
+ */
8
+ class Peerius_Smartrecs_Model_Feed_Creator {
9
+
10
+ protected $fileName;
11
+ protected $secretKey;
12
+ protected $clientName;
13
+ protected $token;
14
+
15
+ /**
16
+ * method to create the feed
17
+ * */
18
+ public function process(Mage_Core_Model_Website $website) {
19
+ $this->fileName = Mage::getBaseDir('tmp') . DS . str_replace(' ', '_', $website->getName()) .
20
+ "_PeeriusFeed" . ".xml";
21
+ $clientName = Mage::getStoreConfig('peerius/general/client_name');
22
+ $this->secretKey = Mage::getStoreConfig('peerius/general/secret_key');
23
+ $this->clientName = Mage::getStoreConfig('peerius/general/client_name');
24
+ $this->token = Mage::getStoreConfig('peerius/general/token');
25
+
26
+ if ($this->_createFile()) {
27
+ if (!$this->_writeFeed($website)) {
28
+ return false;
29
+ }
30
+ } else {
31
+ return false;
32
+ }
33
+ return true;
34
+ }
35
+
36
+ /**
37
+ * @param Mage_Core_Model_Website $website
38
+ * @return bool
39
+ */
40
+ protected function _writeFeed(Mage_Core_Model_Website $website) {
41
+
42
+ try {
43
+ $f = new Varien_Io_File();
44
+ $f->write($this->fileName, $this->_getHeader($website) .
45
+ $this->_getProducts($website) . $this->_getFooter());
46
+
47
+ $f->close();
48
+ return true;
49
+ } catch (Exception $ex) {
50
+ $this->log("error writing the feed");
51
+ $this->log($ex->getMessage());
52
+ return false;
53
+ }
54
+ }
55
+
56
+ /**
57
+ * @param $file
58
+ * @return bool
59
+ */
60
+ protected function _createFile() {
61
+ return true;
62
+ // try {
63
+ // $f = new Varien_Io_File();
64
+ // $validator = new Zend_Validate_File_Exists();
65
+ //
66
+ // if (!$validator->isValid($this->fileName)) {
67
+ // $this->log("could not create the smartrec file");
68
+ // return false;
69
+ // }
70
+ // $this->log("SMART-recs file created");
71
+ //
72
+ // fclose($f);
73
+ // return true;
74
+ // } catch (Exception $ex) {
75
+ // $this->log("error during file creation");
76
+ // $this->log($ex->getMessage());
77
+ // return false;
78
+ // }
79
+ }
80
+
81
+ /**
82
+ * generate the rss file header
83
+ * @param Mage_Core_Model_Website $website
84
+ * @return string
85
+ */
86
+ protected function _getHeader(Mage_Core_Model_Website $website) {
87
+ $clientName = $this->_getClientName();
88
+ $rss = '';
89
+ $rss .= '<?xml version="1.0" encoding="UTF-8"?>';
90
+ $rss .= '<rss version="2.0" xmlns:p="http://www.peerius.com/feeds/PeeriusRSS20.xsd">';
91
+ $rss .= '<channel>';
92
+ $rss .= '<title><![CDATA[Rss 2.0 ' . $clientName . ' product catalogue feed]]></title>';
93
+ $rss .= '<link>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '</link>';
94
+ $rss .= '<description><![CDATA[The latest product catalogue feed of ' . $clientName . '.]]></description>';
95
+ return $rss;
96
+ }
97
+
98
+ /**
99
+ * generate the rss file footer
100
+ * @return string
101
+ */
102
+ protected function _getFooter() {
103
+ $rss = '';
104
+ $rss .= '</channel>';
105
+ $rss .= '</rss>';
106
+ return $rss;
107
+ }
108
+
109
+ /**
110
+ * sets the layout
111
+ * @param string $packageName
112
+ * @param string $themeName
113
+ */
114
+ protected function _changeTheme($packageName, $themeName) {
115
+ Mage::getDesign()->setArea('frontend')
116
+ ->setPackageName($packageName)
117
+ ->setTheme($themeName);
118
+ }
119
+
120
+ /**
121
+ * write the products
122
+ * @param Mage_Core_Model_Website $website
123
+ * @return string
124
+ */
125
+ protected function _getProducts(Mage_Core_Model_Website $website) {
126
+ $profilingStart = microtime(true);
127
+ $adapter = Mage::getSingleton("core/resource");
128
+ $visiblityCondition = array('in' => array(2, 3, 4));
129
+ $_catalogInventoryTable = method_exists($adapter, 'getTableName') ? $adapter->getTableName('cataloginventory_stock_item') : 'catalog_category_product_index';
130
+
131
+ //###################### DEBUG CODE :MG #####################
132
+ $debugMode = Mage::app()->getRequest()->getParam('debug') == 1 ? true : false;
133
+ $debugProducts = Mage::app()->getRequest()->getParam('items') ? Mage::app()->getRequest()->getParam('items') : 10;
134
+ $this->log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
135
+ $this->log('DEBUG MODE : '.($debugMode == true ? 'enabled. Creating feed for '. $debugProducts. ' products.' :'disabled'));
136
+ //###################### DEBUG CODE :MG #####################
137
+
138
+ $this->log('Feed creation STARTED');
139
+
140
+ $this->_changeTheme(Mage::getStoreConfig('design/package/name', $website->getDefaultStore()->getCode()), Mage::getStoreConfig('design/package/theme', $website->getDefaultStore()->getCode()));
141
+
142
+ $rss = '';
143
+
144
+ $productCollection = Mage::getModel('catalog/product')
145
+ ->getCollection()
146
+ ->addWebsiteFilter($website->getWebsiteId())
147
+ ->joinField("qty", $_catalogInventoryTable, 'qty', 'product_id=entity_id', null, 'left')
148
+ ->addAttributeToSelect('*')
149
+ ->addCategoryIds()
150
+ //->addAttributeToFilter('type_id', array('eq' => 'configurable'))
151
+ ->addAttributeToFilter('visibility', $visiblityCondition)
152
+ // ->joinTable('catalog/product_relation', 'child_id=entity_id', array('parent_id' => 'parent_id'), null, 'left')
153
+ ->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
154
+ // ->load();
155
+
156
+ $productsCount = $productCollection->getSize();
157
+ $this->log('Total products found : ' . $productsCount);
158
+
159
+ $ctr = 0;
160
+
161
+ try {
162
+ foreach ($productCollection as $product) {
163
+
164
+ //###################### DEBUG CODE :MG #####################
165
+ if ($debugMode && $ctr > $debugProducts) break;
166
+ //###################### DEBUG CODE :MG #####################
167
+
168
+ $categoryIds = $product->getCategoryIds();
169
+ $parentCategoryBreadcrumbs = false;
170
+ $parent = false;
171
+
172
+ // don't export unavailable products
173
+ if (!$product->isAvailable()) {
174
+ $productsCount--;
175
+ continue;
176
+ }
177
+
178
+ // if a product is not in a category skip it also
179
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
180
+ $parent = $this->_getParent($product);
181
+ if ($parent) {
182
+ $parentCategoryBreadcrumbs = $this->_getParentCategoryBreadcrumbs($product);
183
+ $categoryBreadcrumbs = $parentCategoryBreadcrumbs;
184
+ } else {
185
+ $categoryBreadcrumbs = $this->_getCategoryBreadcrumbs($product->getCategoryIds());
186
+ }
187
+ }
188
+
189
+ // is the product or it's product in any category? If not, skip it
190
+ if (!$categoryIds AND !$parentCategoryBreadcrumbs) {
191
+ $productsCount--;
192
+ continue;
193
+ }
194
+
195
+ $rss .= '<item>';
196
+ $rss .= '<title><![CDATA[' . $product->getName() . ']]></title>';
197
+ $rss .= '<link>' . $product->getProductUrl() . '</link>';
198
+ $rss .= '<guid>' . $product->getSku() . '</guid>';
199
+ if ($product->getThumbnail())
200
+ $rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getThumbnail() . '</p:imageLink>';
201
+ $rss .= '<p:price>
202
+ <p:unitPrice>' . number_format($product->getPrice(), 2, '.', '') . '</p:unitPrice>
203
+ <p:salePrice>' . number_format($product->getFinalPrice(), 2, '.', '') . '</p:salePrice>
204
+ <p:currency>' . Mage::app()->getStore($website->getDefaultStore())->getCurrentCurrencyCode() . '</p:currency>
205
+ </p:price>';
206
+
207
+
208
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
209
+ $rss .= $this->_getCategoryBreadcrumbs($categoryIds);
210
+ $rss .= '<p:attribute name="minimal_price">' . number_format($product->getMinimalPrice(), 2, '.', '') . '</p:attribute>';
211
+
212
+ $attrArr = Mage::getModel('catalog/product_type_configurable')->getConfigurableAttributesAsArray($product);
213
+
214
+ $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProductCollection($product)
215
+ ->addAttributeToSelect('thumbnail')
216
+ ->addAttributeToSelect('name')
217
+ ->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', 1);
218
+ foreach ($attrArr as $attr) {
219
+ $childProducts->addAttributeToSelect($attr['attribute_code']);
220
+ }
221
+
222
+ foreach ($childProducts as $childProduct) {
223
+ if ($childProduct->getData('visibility') == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
224
+ //$p = Mage::getModel('catalog/product')->load($childProduct->getId());
225
+ $rss .= '<p:variant>';
226
+ //$rss .= '<p:title><![CDATA[' . $childProduct->getName() . ']]></p:title>';
227
+ foreach ($attrArr as $attr) {
228
+ $rss .= '<p:attribute name="' . $attr['attribute_code'] . '"><![CDATA[' . $childProduct->getAttributeText($attr['attribute_code']) . ']]></p:attribute>';
229
+ }
230
+ $rss .= '<p:attribute name="link">' . $childProduct->getProductUrl() . '</p:attribute>';
231
+ $rss .= '<p:attribute name="guid">' . $childProduct->getSku() . '</p:attribute>';
232
+ $rss .= '<p:attribute name="magento_id">' . $childProduct->getId() . '</p:attribute>';
233
+ if ($product->getThumbnail())
234
+ $rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $childProduct->getThumbnail() . '</p:imageLink>';
235
+ $stockItem = $childProduct->getStockItem();
236
+ $stockQty = ($stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) ?
237
+ ((int) $stockItem->getQty() > 0 ? (int) $stockItem->getQty() : 0) : 0;
238
+ $rss .= '<p:stock>' . $stockQty . '</p:stock>';
239
+ $rss .= '</p:variant>';
240
+ }
241
+ }
242
+ } else {
243
+ if ($parent) {
244
+ $rss .= $parent;
245
+ $rss .= $categoryBreadcrumbs;
246
+ } else {
247
+ $rss .= $categoryBreadcrumbs;
248
+ }
249
+ }
250
+
251
+ $rss .= '<pubDate>' . $product->getcreated_at() . '</pubDate>';
252
+ $rss .= '<description><![CDATA[' . $product->getDescription() . ']]></description>';
253
+
254
+ if ($product->getAttribute('manufacturer') instanceof Mage_Eav_Model_Entity_Attribute_Abstract) {
255
+ $rss .= '<p:brand><![CDATA[' . $product->getAttributeText('manufacturer') . ']]></p:brand>';
256
+ }
257
+ $rss .= '<p:inStock>' . $this->_getStockStatus($product) . '</p:inStock>';
258
+ $rss .= '<p:stock>' . ((int) $product->getQty() > 0 ? (int) $product->getQty() : 0) . '</p:stock>';
259
+ $rss .= '<p:recommend>Y</p:recommend>';
260
+ $rss .= '<p:recommended>' . $this->_getRecommended($product) . '</p:recommended>';
261
+ $rss .= '<p:attribute name="magento_id">' . $product->getId() . '</p:attribute>';
262
+ $rss .= $this->_getAttributes($product);
263
+ $rss .= $this->_getTags($product);
264
+ $rss .= '</item>';
265
+ $ctr++;
266
+ }
267
+
268
+ $this->log('Total entries created : ' . ($ctr - 1) );
269
+ } catch (Exception $e) {
270
+ $this->log("an error occured: " . $e->getMessage());
271
+ }
272
+
273
+
274
+ if ($productsCount == 0) {
275
+ $this->log("no products found");
276
+ throw new Exception("no products found");
277
+ }
278
+
279
+ $now = microtime(true);
280
+ $this->log("Feed creation COMPLETED in " . date("H:i:s", ($now - $profilingStart)));
281
+ $this->log('Memory used : ' . round(memory_get_peak_usage() / 1048576) . 'MB');
282
+ $this->log('===================================================');
283
+ return $rss;
284
+ }
285
+
286
+ /**
287
+ * generate breadcrumb style categories
288
+ * @param array $currentCatIds
289
+ * @return string
290
+ */
291
+ protected function _getCategoryBreadcrumbs($currentCatIds) {
292
+ $rss = '';
293
+
294
+ if ($currentCatIds) {
295
+ $categoryCollection = Mage::getResourceModel('catalog/category_collection')
296
+ ->addAttributeToSelect('path')
297
+ ->addAttributeToFilter('entity_id', $currentCatIds)
298
+ ->addIsActiveFilter();
299
+
300
+ foreach ($categoryCollection as $cat) {
301
+ $p = explode('/', $cat->getPath());
302
+
303
+ $fullPath = array();
304
+ foreach ($p as $treeCat) {
305
+ // Root-Kategorie 1 überspringen
306
+ if ($treeCat <= 2)
307
+ continue;
308
+ $category = Mage::getModel('catalog/category')
309
+ ->setStoreId(Mage::app()->getStore()->getId())
310
+ ->load($treeCat);
311
+ $fullPath[] = $category->getName();
312
+ }
313
+ $rss .= '<category><![CDATA[' . implode('>', $fullPath) . ']]></category>';
314
+ }
315
+ }
316
+ return $rss;
317
+ }
318
+
319
+ /**
320
+ * generate breadcrumb style categories
321
+ * @param product $product
322
+ * @return string
323
+ */
324
+ protected function _getParentCategoryBreadcrumbs($product) {
325
+ $rss = '';
326
+ $parentIds = $this->_getParent($product, true);
327
+ $categoryIds = array();
328
+
329
+ foreach ($parentIds as $parentId) {
330
+ $product = Mage::getModel('catalog/product')->load($parentId);
331
+ $categoryIds = array_merge($categoryIds, $product->getCategoryIds());
332
+ }
333
+
334
+ $rss = $this->_getCategoryBreadcrumbs($categoryIds);
335
+ return $rss;
336
+ }
337
+
338
+ /**
339
+ * retreive the product stock statuss
340
+ * @param Mage_Core_Catalog_Product $product
341
+ * @return string
342
+ */
343
+ protected function _getStockStatus($product) {
344
+ $stockStatus = Mage::getModel('cataloginventory/stock_item')
345
+ ->getCollection()
346
+ ->addFieldToFilter('product_id', $product->getId())
347
+ ->getFirstItem();
348
+
349
+ return $stockStatus ? 'Y' : 'N';
350
+ }
351
+
352
+ /**
353
+ * write the products
354
+ * @param Mage_Core_Catalog_Product $product
355
+ * @return string
356
+ */
357
+ protected function _getRecommended($product) {
358
+ $all = array();
359
+ $related = $product->getRelatedProductIds();
360
+ foreach ($related as $id) {
361
+ $all[$id] = Mage::getModel('catalog/product')->load($id)->getSku();
362
+ //$this->log("Related Product is :".$all[$id]);
363
+ }
364
+
365
+ $crosssell = $product->getCrossSellProducts();
366
+ foreach ($crosssell as $_item) {
367
+ $all[$_item->getId()] = $_item->getSku();
368
+ //$this->log("Cross Selling Product is :".$all[$_item->getId()]);
369
+ }
370
+ $upsell = $product->getUpSellProductCollection();
371
+ foreach ($upsell as $_item) {
372
+ $all[$_item->getId()] = $_item->getSku();
373
+ //$this->log("Up Selling Product is :".$all[$_item->getId()]);
374
+ }
375
+ return implode(',', $all);
376
+ }
377
+
378
+ /**
379
+ * generate comma-separated list of product tags
380
+ * @param Mage_Core_Catalog_Product $product
381
+ * @return string
382
+ */
383
+ protected function _getTags($product) {
384
+ $tag_model = Mage::getModel('tag/tag');
385
+ $tag_collection = $tag_model->getResourceCollection()
386
+ ->addPopularity()
387
+ // ->addStatusFilter($model->getApprovedStatus())
388
+ ->addProductFilter($product->getId())
389
+ ->setFlag('relation', true)
390
+ ->addStoreFilter(Mage::app()->getStore()->getId())
391
+ ->setActiveFilter()
392
+ ->load();
393
+
394
+ $mytags = $tag_collection->getItems();
395
+
396
+ $tagArr = array();
397
+ if (!$tag_collection->getSize()) {
398
+ return '';
399
+ }
400
+
401
+ foreach ($mytags as $tag) {
402
+ $tagArr[] = $tag->getName();
403
+ }
404
+ return '<p:tags>' . implode(',', $tagArr) . '</p:tags>';
405
+ }
406
+
407
+ /**
408
+ * crate front-end attributes rss string
409
+ * @param Mage_Core_Catalog_Product $product
410
+ * @return string
411
+ */
412
+ protected function _getAttributes($product) {
413
+ $attributes = $product->getAttributes();
414
+ $rss = '';
415
+ foreach ($attributes as $attribute) {
416
+ if ($attribute->getIsVisibleOnFront()) {
417
+ $attributeCode = $attribute->getAttributeCode();
418
+ $label = $attribute->getFrontend()->getLabel($product);
419
+ $value = $attribute->getFrontend()->getValue($product);
420
+ $rss .= '<p:attribute name="' . $attributeCode . '"><![CDATA[' . $value . ']]></p:attribute>';
421
+ }
422
+ }
423
+ return $rss;
424
+ }
425
+
426
+ /**
427
+ * returns parent product ID if available
428
+ * @param Mage_Core_Catalog_Product $product
429
+ * @param bool return the ids
430
+ * @return int
431
+ */
432
+ protected function _getParent($product, $ids = false) {
433
+ $rss = '';
434
+ $parentIds = false;
435
+ if ($product->getTypeId() == "simple") {
436
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()); // check for grouped product
437
+ if (!$parentIds)
438
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId()); //check for config product
439
+ }
440
+ if ($ids) {
441
+ return $parentIds;
442
+ }
443
+ if ($parentIds) {
444
+ $rss = '<p:attribute name="parent_magento_id">' . implode(',', $parentIds) . '</p:attribute>';
445
+ } else {
446
+ return false;
447
+ }
448
+ return $rss;
449
+ }
450
+
451
+ /**
452
+ * the client name used in the rss feed
453
+ * @return string
454
+ */
455
+ protected function _getClientName() {
456
+ return Mage::getStoreConfig('peerius/general/client_name');
457
+ }
458
+
459
+ /**
460
+ * @param $content
461
+ * @return bool
462
+ */
463
+ protected function _appendToFile($content) {
464
+ try {
465
+ $f = new Varien_Io_File();
466
+ $validator = new Zend_Validate_File_Exists();
467
+
468
+ if (!$validator->isValid($this->fileName)) {
469
+ $this->log("could not create the smartrec file");
470
+ return false;
471
+ }
472
+ $this->log("SMART-recs file created");
473
+
474
+ fclose($f);
475
+ return true;
476
+ } catch (Exception $ex) {
477
+ $this->log("error during file creation");
478
+ $this->log($ex->getMessage());
479
+ return false;
480
+ }
481
+ try {
482
+ $f = new Varien_Io_File();
483
+ $f->write($this->fileName, $content);
484
+ //if (file_put_contents($this->fileName, $content, FILE_APPEND)) {
485
+ return true;
486
+ } catch (Exception $ex) {
487
+ $this->log("error while writing to the feed file");
488
+ $this->log($ex->getMessage());
489
+ return false;
490
+ }
491
+ }
492
+
493
+ public function checkToken() {
494
+ $token = Mage::getStoreConfig('peerius/general/token');
495
+
496
+ if (!$token OR !Mage::app()->getRequest()->getParam('token') OR (Mage::app()->getRequest()->getParam('token') != sha1($token))) {
497
+ $this->log("token error");
498
+ return false;
499
+ }
500
+ return true;
501
+ }
502
+
503
+ /**
504
+ * @param string $message
505
+ */
506
+ protected function log($message) {
507
+ Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
508
+ }
509
+
510
  }
app/code/community/Peerius/Smartrecs/controllers/InfoController.php CHANGED
@@ -1,193 +1,265 @@
1
- <?php
2
-
3
- /**
4
- * syncing the products to the peerius server
5
- * @category Peerius
6
- * @package Peerius_Smartrecs
7
- * @author Peerius Ltd
8
- */
9
- class Peerius_Smartrecs_InfoController extends Mage_Core_Controller_Front_Action {
10
-
11
- /**
12
- * when is the cron executed?
13
- * @return int
14
- */
15
- public function createtimeAction() {
16
- if ($this->checkToken()) {
17
- $response = (int) Mage::getStoreConfig('peerius/general/cronjob');
18
-
19
- $this->getResponse()
20
- ->setHeader('Content-Type', 'text/html')
21
- ->setBody($response);
22
- }
23
- }
24
-
25
- /**
26
- * what registration status has the shop
27
- * @return int
28
- */
29
- public function registrationstatusAction() {
30
- if ($this->checkToken()) {
31
- $response = (int) Mage::getStoreConfig('peerius/general/registrationstatus');
32
-
33
- $this->getResponse()
34
- ->setHeader('Content-Type', 'text/html')
35
- ->setBody($response);
36
- }
37
- }
38
-
39
- /**
40
- * what registration status has the shop
41
- * @return int
42
- */
43
- public function registrationerrorAction() {
44
- if ($this->checkToken()) {
45
- $response = (int) Mage::getStoreConfig('peerius/general/registrationerror');
46
-
47
- $this->getResponse()
48
- ->setHeader('Content-Type', 'text/html')
49
- ->setBody($response);
50
- }
51
- }
52
-
53
- /*
54
- * returns the parameters of the created peerius SMARTrecs widgets
55
- * @return string
56
- */
57
- public function widgetsAction() {
58
- if ($this->checkToken()) {
59
- $response = '';
60
- $collection = Mage::getModel('widget/widget_instance')->getCollection();
61
- $collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
62
-
63
- foreach($collection as $item)
64
- {
65
- $response .= $item->title.'<hr>';
66
- $response .= $item->widget_parameters;
67
- $response .= '<br><br><br>';
68
- }
69
-
70
- $this->getResponse()
71
- ->setHeader('Content-Type', 'text/html')
72
- ->setBody($response);
73
- }
74
- }
75
-
76
- /*
77
- * returns the parameters of the created peerius SMARTrecs widgets
78
- * @return string
79
- */
80
- public function allconfigAction() {
81
- if ($this->checkToken()) {
82
- $response = '';
83
-
84
- $response .= '<h1>Standard Widgets</h1>';
85
- $configs = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path',array('like'=>'peerius%'))->setOrder('path');
86
-
87
- foreach ($configs as $config) {
88
- $path = str_replace('max','number_of_products', $config->getPath());
89
- $value = $config->getValue();
90
- $response .= 'Config: ' . $path.'<br>';
91
- $response .= 'Value: ' . $value;
92
- $response .= '<hr>';
93
- }
94
-
95
- $response .= '<h1>Widget Instance Manager</h1>';
96
-
97
-
98
- $collection = Mage::getModel('widget/widget_instance')->getCollection();
99
- $collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
100
-
101
- foreach($collection as $item)
102
- {
103
- $response .= $item->title.'<hr>';
104
- $response .= $item->widget_parameters;
105
- $response .= '<br><br><br>';
106
- }
107
-
108
-
109
- $this->getResponse()
110
- ->setHeader('Content-Type', 'text/html')
111
- ->setBody($response);
112
- }
113
- }
114
-
115
- /*
116
- * resets the registration status
117
- * @return string
118
- */
119
- public function registrationstatusresetAction() {
120
- if ($this->checkToken()) {
121
- Mage::getModel('core/config')->saveConfig('peerius/general/registrationstatus', '0');
122
- Mage::getModel('core/config')->saveConfig('peerius/general/registrationerror', '0');
123
- }
124
- }
125
-
126
-
127
- /*
128
- * deletes the configuration
129
- * @return string
130
- */
131
- public function resetconfigAction() {
132
- if ($this->checkToken()) {
133
- $configs = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path',array('like'=>'peerius%'));
134
-
135
- foreach ($configs as $config) {
136
- $config->delete($config);
137
- }
138
- $response = count($configs) . ' entries deleted';
139
-
140
- $this->getResponse()
141
- ->setHeader('Content-Type', 'text/html')
142
- ->setBody($response);
143
- }
144
- }
145
-
146
- /*
147
- * sets the admin IP to preview recommendations in test mode
148
- * @return string
149
- */
150
- public function adminipAction() {
151
- if ($this->checkToken()) {
152
- if (!filter_var($this->getRequest()->getParam('ip'), FILTER_VALIDATE_IP) === false) {
153
- Mage::getModel('core/config')->saveConfig('peerius/general/adminip', $this->getRequest()->getParam('ip'));
154
- }
155
- }
156
- }
157
-
158
- /*
159
- * reads the admin IP
160
- * @return string
161
- */
162
- public function adminipreadAction() {
163
- if ($this->checkToken()) {
164
- $response = Mage::getStoreConfig('peerius/general/adminip');
165
-
166
- $this->getResponse()
167
- ->setHeader('Content-Type', 'text/html')
168
- ->setBody($response);
169
- }
170
- }
171
-
172
- /*
173
- * checks for the valid token to prevent URL manipulation
174
- * @return bool
175
- */
176
- public function checkToken() {
177
- $token = Mage::getStoreConfig('peerius/general/token');
178
-
179
- if (!$token OR !$this->getRequest()->getParam('token') OR ($this->getRequest()->getParam('token') != sha1($token))) {
180
- $this->log("token error");
181
- return false;
182
- }
183
- return true;
184
- }
185
-
186
- /**
187
- * @param string $message
188
- */
189
- protected function log($message) {
190
- Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
191
- }
192
-
193
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * syncing the products to the peerius server
5
+ * @category Peerius
6
+ * @package Peerius_Smartrecs
7
+ * @author Peerius Ltd
8
+ */
9
+ class Peerius_Smartrecs_InfoController extends Mage_Core_Controller_Front_Action {
10
+
11
+
12
+ /*
13
+ * returns the parameters of the created peerius SMARTrecs widgets
14
+ * @return string
15
+ */
16
+ public function allconfigAction() {
17
+ if ($this->checkToken()) {
18
+
19
+ $modules = Mage::getConfig()->getNode('modules')->children();
20
+ $modulesArray = (array)$modules;
21
+ $connectVersion = 'unknown';
22
+ //foreach ($modulesArray as $module) {
23
+ // $this->log($module->getName()." is on version ".$module->version);
24
+ //}
25
+
26
+ if($modulesArray['Peerius_Smartrecs']->is('active')) {
27
+ $connectVersion = $modulesArray['Peerius_Smartrecs']->version;
28
+ $this->log("Peerius_Connect version is ".$connectVersion);
29
+ } else {
30
+ $this->log("Peerius_Connect is not available");
31
+ }
32
+
33
+ $configs = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path',array('like'=>'peerius%'))->setOrder('config_id',Varien_Data_Collection::SORT_ORDER_ASC);
34
+ $siteName = Mage::getStoreConfig('peerius/general/client_name',Mage::app()->getStore());
35
+ $response = '<!doctype html><html lang=\'en-gb\'><head><meta charset=\'utf-8\'><title> CONFIG: '.$siteName.'</title>'.$this->getCSS().'</head><body style="font-family:Arial;">';
36
+ $response .= '<section><h1>Peerius Connect Configuration : '. $siteName . '</h1> (v ' .$connectVersion. ')';
37
+
38
+ $sec1 = "";
39
+ $sec2 = "";
40
+ foreach ($configs as $config) {
41
+ $path = str_replace('max','number_of_products', $config->getPath());
42
+
43
+ $name_arr = explode ("/", $path);
44
+ $sec1 = $name_arr[1];
45
+ $secName = ($sec1 != $sec2) ? $sec1 : "";
46
+ $sec2 = $sec1;
47
+ if($secName!="") {
48
+ $response .= '<div class=\'secTitle\'>'.ucfirst($secName). ' Config: </div>';
49
+ }
50
+ $paramName = $name_arr[2];
51
+ $paramValue = $config->getValue();
52
+ $dispName = $paramName;
53
+ $dispValue = $paramValue;
54
+
55
+ switch ($paramName) {
56
+ case "token":
57
+ $dispValue = $dispValue.' (ENCODED: '.sha1($dispValue).')';
58
+ break;
59
+ case "enableall":
60
+ $dispName = 'Are Recs anabled for site?';
61
+ $dispValue = ($dispValue == 1) ? 'Yes' : 'No';
62
+ break;
63
+ case "disable":
64
+ $dispName = 'Are Recs enabled for page?';
65
+ $dispValue = ($dispValue == 0) ? 'Yes' : 'No';
66
+ break;
67
+ case "cronjob":
68
+ $dispName = 'Feed scheduled at?';
69
+ break;
70
+ case "testmode":
71
+ $dispName = 'Is test mode enabled?';
72
+ $dispValue = ($dispValue == 1) ? 'Yes' : 'No';
73
+ break;
74
+ case "registrationstatus":
75
+ $dispName = 'Registration status?';
76
+ $dispValue = ($dispValue == 1) ? 'Registered' : 'Something happend that shouldn\'t have!';
77
+ break;
78
+ case "headline":
79
+ $dispName = 'Widget title';
80
+ break;
81
+ case "success":
82
+ $dispName = 'Show recs for all search?';
83
+ $dispValue = ($dispValue == 0) ? 'No, only for zero search' : 'Yes';
84
+ break;
85
+ default:
86
+ break;
87
+ }
88
+
89
+ $response .= '<div class=\'boxA\'>'.ucfirst($dispName).' </div><div class=\'boxB\'> '.$dispValue . "</div><br />";
90
+ }
91
+
92
+ $collection = Mage::getModel('widget/widget_instance')->getCollection();
93
+ $collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
94
+
95
+ if($collection->getSize()>0)
96
+ {
97
+ $response .= '<h1>Widget Instance Manager</h1>';
98
+ foreach($collection as $item)
99
+ {
100
+ $response .= $item->title.'<hr>';
101
+ $response .= $item->widget_parameters;
102
+ $response .= '<br><br><br>';
103
+ }
104
+ }
105
+
106
+ $response .= '</section></body></html>';
107
+ $this->getResponse()->setHeader('Content-Type', 'text/html')->setBody($response);
108
+
109
+ }
110
+ }
111
+
112
+ /**
113
+ * when is the cron executed?
114
+ * @return int
115
+ */
116
+ public function createtimeAction() {
117
+ if ($this->checkToken()) {
118
+ $response = (int) Mage::getStoreConfig('peerius/general/cronjob');
119
+
120
+ $this->getResponse()
121
+ ->setHeader('Content-Type', 'text/html')
122
+ ->setBody($response);
123
+ }
124
+ }
125
+
126
+ /**
127
+ * what registration status has the shop
128
+ * @return int
129
+ */
130
+ public function registrationstatusAction() {
131
+ if ($this->checkToken()) {
132
+ $response = (int) Mage::getStoreConfig('peerius/general/registrationstatus');
133
+
134
+ $this->getResponse()
135
+ ->setHeader('Content-Type', 'text/html')
136
+ ->setBody($response);
137
+ }
138
+ }
139
+
140
+ /**
141
+ * what registration status has the shop
142
+ * @return int
143
+ */
144
+ public function registrationerrorAction() {
145
+ if ($this->checkToken()) {
146
+ $response = (int) Mage::getStoreConfig('peerius/general/registrationerror');
147
+
148
+ $this->getResponse()
149
+ ->setHeader('Content-Type', 'text/html')
150
+ ->setBody($response);
151
+ }
152
+ }
153
+
154
+ /*
155
+ * returns the parameters of the created peerius SMARTrecs widgets
156
+ * @return string
157
+ */
158
+ public function widgetsAction() {
159
+ if ($this->checkToken()) {
160
+ $response = '';
161
+ $collection = Mage::getModel('widget/widget_instance')->getCollection();
162
+ $collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
163
+
164
+ foreach($collection as $item)
165
+ {
166
+ $response .= $item->title.'<hr>';
167
+ $response .= $item->widget_parameters;
168
+ $response .= '<br><br><br>';
169
+ }
170
+
171
+ $this->getResponse()
172
+ ->setHeader('Content-Type', 'text/html')
173
+ ->setBody($response);
174
+ }
175
+ }
176
+
177
+ /*
178
+ * resets the registration status
179
+ * @return string
180
+ */
181
+ public function registrationstatusresetAction() {
182
+ if ($this->checkToken()) {
183
+ Mage::getModel('core/config')->saveConfig('peerius/general/registrationstatus', '0');
184
+ Mage::getModel('core/config')->saveConfig('peerius/general/registrationerror', '0');
185
+ }
186
+ }
187
+
188
+ /*
189
+ * deletes the configuration
190
+ * @return string
191
+ */
192
+ public function resetconfigAction() {
193
+ if ($this->checkToken()) {
194
+ $configs = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path',array('like'=>'peerius%'));
195
+
196
+ foreach ($configs as $config) {
197
+ $config->delete($config);
198
+ }
199
+ $response = count($configs) . ' entries deleted';
200
+
201
+ $this->getResponse()
202
+ ->setHeader('Content-Type', 'text/html')
203
+ ->setBody($response);
204
+ }
205
+ }
206
+
207
+ /*
208
+ * sets the admin IP to preview recommendations in test mode
209
+ * @return string
210
+ */
211
+ public function adminipAction() {
212
+ if ($this->checkToken()) {
213
+ if (!filter_var($this->getRequest()->getParam('ip'), FILTER_VALIDATE_IP) === false) {
214
+ Mage::getModel('core/config')->saveConfig('peerius/general/adminip', $this->getRequest()->getParam('ip'));
215
+ }
216
+ }
217
+ }
218
+
219
+ /*
220
+ * reads the admin IP
221
+ * @return string
222
+ */
223
+ public function adminipreadAction() {
224
+ if ($this->checkToken()) {
225
+ $response = Mage::getStoreConfig('peerius/general/adminip');
226
+
227
+ $this->getResponse()
228
+ ->setHeader('Content-Type', 'text/html')
229
+ ->setBody($response);
230
+ }
231
+ }
232
+
233
+ /*
234
+ * checks for the valid token to prevent URL manipulation
235
+ * @return bool
236
+ */
237
+ public function checkToken() {
238
+ $token = Mage::getStoreConfig('peerius/general/token');
239
+
240
+ if (!$token OR !$this->getRequest()->getParam('token') OR ($this->getRequest()->getParam('token') != sha1($token))) {
241
+ $this->log("token error");
242
+ return false;
243
+ }
244
+ return true;
245
+ }
246
+
247
+ /**
248
+ * @param string $message
249
+ */
250
+ protected function log($message) {
251
+ Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
252
+ }
253
+
254
+ /**
255
+ * return CSS
256
+ */
257
+ protected function getCSS() {
258
+ return "<style type='text/css'>
259
+ .secTitle {clear:both;display:block;float:left;padding:5px;margin:10px 0 5px 0;width:100%;color:#808080;font-weight:bold; font-size:20px;}
260
+ .boxA { clear:left;display:block;float:left;padding:2px 0 0 4px;margin:1px;background-color: #60b346 ; width:200px; height:22px; }
261
+ .boxB { float:left;display:in-line;padding:2px 0 0 4px;margin:1px;background-color: #A9Ae99; width:650px; height:22px;color:#000; }
262
+ </style>";
263
+ }
264
+
265
+ }
app/code/community/Peerius/Smartrecs/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Peerius_Smartrecs>
5
- <version>1.0.2</version>
6
  </Peerius_Smartrecs>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Peerius_Smartrecs>
5
+ <version>1.0.7</version>
6
  </Peerius_Smartrecs>
7
  </modules>
8
  <frontend>
app/design/frontend/base/default/template/smartrecs/smartrecs.phtml CHANGED
@@ -8,7 +8,7 @@
8
  */
9
 
10
  ?>
11
- <!-- Peerius SMART-recs tracking and rendering -->
12
 
13
  <?php
14
  $renderActive = (file_exists(dirname(__FILE__).'/render.phtml')) ? true:false;
@@ -18,7 +18,7 @@ if (Mage::helper('peerius_smartrecs')->isActive()) {
18
  if ($trackingPixel) {
19
  ?>
20
 
21
- <script type="text/JavaScript" src="/js/peerius/smartrecs/smartrecs.js"></script>
22
  <script type="text/JavaScript">
23
  var peeriusPage = '<?php echo $this->escapeHtml(Mage::helper('peerius_smartrecs')->getPageType());?>';
24
  var peeriusDisabled = <?php echo Mage::helper('peerius_smartrecs')->getDisabled() ? 'true':'false';?>;
8
  */
9
 
10
  ?>
11
+ <!-- Peerius SMART-recs tracking and rendering [<?php echo $this->escapeHtml(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB))?>]-->
12
 
13
  <?php
14
  $renderActive = (file_exists(dirname(__FILE__).'/render.phtml')) ? true:false;
18
  if ($trackingPixel) {
19
  ?>
20
 
21
+ <script type="text/JavaScript" src="<?php echo $this->escapeHtml(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB))?>js/peerius/smartrecs/smartrecs.js"></script>
22
  <script type="text/JavaScript">
23
  var peeriusPage = '<?php echo $this->escapeHtml(Mage::helper('peerius_smartrecs')->getPageType());?>';
24
  var peeriusDisabled = <?php echo Mage::helper('peerius_smartrecs')->getDisabled() ? 'true':'false';?>;
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Peerius_Connect</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php#sthash.1eAD3rgO.dpuf">OSL v3.0</license>
7
  <channel>community</channel>
@@ -9,15 +9,15 @@
9
  <summary>The trusted partner for personalisation.</summary>
10
  <description>The Peerius Connect extension allows you to add personalised product recommendations to your website. This extension performs the following key functions:&#xD;
11
  &#xD;
12
- Creates a feed containing product and category information from your site catalogue.&#xD;
13
- Adds a tracking script that allows Peerius to track user behaviour on your site.&#xD;
14
- Renders recommendations that you enable on pre-configured pages.&#xD;
15
  </description>
16
- <notes>Show search result recommendations only on empty search results if not set in config.</notes>
17
  <authors><author><name>Peerius</name><user>Peerius</user><email>extensions@peerius.com</email></author></authors>
18
- <date>2015-12-20</date>
19
- <time>21:05:08</time>
20
- <contents><target name="magecommunity"><dir name="Peerius"><dir name="Smartrecs"><dir name="Block"><file name="Config.php" hash="5d81508e9cf3061d6f34458bbdafff9b"/><file name="Recommendations.php" hash="cc8f955efbd6835d890b8efb864c0cac"/><file name="Template.php" hash="e9431386180c113cfa4660f8ce2c220b"/><file name="Tracking.php" hash="e096d0cfc453614464a6b82525bbd834"/></dir><dir name="Helper"><file name="Data.php" hash="07a1c36598d89c28a5c9f902707cb02e"/><file name="Feedhelper.php" hash="5c981f753a3f139dd0798855ec2e51f4"/></dir><dir name="Model"><dir name="Feed"><file name="Creator.php" hash="4e1f88e9a6ac56f4c5b16a61a6734808"/></dir><file name="Max.php" hash="a3c7eb408d59c3a0b71b9f5f8d85dfa9"/><file name="SearchLayer.php" hash="4457eb768fc387d08700d67b5e1bb55b"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Values.php" hash="bc71d86dcc6fdb046222c0a051b323b4"/></dir><file name="Yesno.php" hash="4f6cb1392c1496837cc6021cb263aad5"/></dir></dir></dir><dir name="Templates"><file name="Basket.php" hash="96eb28e5977acd90ee8bf38f4e938274"/><file name="Category.php" hash="7882da9cd0026ed5bde0360189d593ae"/><file name="Checkout.php" hash="d46564549391af35da90a4a10c9a8093"/><file name="Home.php" hash="44a09df724298154d2f8671572c7f5ea"/><file name="Order.php" hash="3525a61a41f63c4133549254c31c842a"/><file name="Other.php" hash="2cb2c3d3de6d3155b5e33f1f3f8ade00"/><file name="Product1.php" hash="b3f3f27b3b319290f4ce7238b12e77d7"/><file name="Product2.php" hash="65170140bc75324cb0e216a9ba4f2597"/><file name="Search.php" hash="aa1e063656bd5b93a6ea1764dd317bd0"/><file name="Wishlist.php" hash="49daf0c47250b9512d285340c53af644"/></dir><file name="Templates.php" hash="b44ee8b39cf9d2166307ae6eb1500dc8"/><file name="Token.php" hash="2361e10a26b9beb9f066d6ad4827261c"/><file name=".DS_Store" hash="121fcc7ffb2eda1059e7fd2cba768368"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PeeriusController.php" hash="6d72ba380fa0ef6d618a97fc3124cdb7"/></dir><file name="FeedController.php" hash="7b21a1c6a9a8e27314d9b317f94a2e07"/><file name="InfoController.php" hash="915a4388f9cc72c917d6804ac38408c7"/><file name="RenderController.php" hash="e9f46140cb254a24ce9d21288ee9a250"/></dir><dir name="etc"><file name="adminhtml.xml" hash="468dbed05f1cb0be9a4062c85e388e04"/><file name="config.xml" hash="e64216f70b3a67775c93966b412ffb13"/><file name="system.xml" hash="580dfd7e143413dc71f2ffc5f5f1de63"/><file name="system_ft.xml" hash="a42d9bf6de1df48c246057a4ef3c3a71"/><file name="widget.xml" hash="2a2a7c7097a33bb761c97d21c4d373f7"/></dir><file name=".DS_Store" hash="c9ad824fadf49b3c7a9e0648d7cdac61"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Peerius_Smartrecs.xml" hash="e5c77ca4bb1474945191f4be23a0b390"/></dir></target><target name="mageweb"><dir name="js"><dir name="peerius"><dir name="smartrecs"><file name="smartrecs.js" hash="344e4abf974c5d834afbbd5ec22a6785"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="smartrecs"><file name="smartrecs.phtml" hash="eb191cbebb3729fe54294db5981e5a21"/><file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/><file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/><dir name="recs"><file name="home.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="category.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="product-1.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="product-2.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="search.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="basket.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/></dir></dir></dir><dir name="layout"><file name="smartrecs.xml" hash="f52a4fba91d0a70e676ea2b92c7814ba"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="smartrecs.xml" hash="b18cea41c87596b4a391060772d62036"/></dir><dir name="template"><dir name="smartrecs"><file name="config.phtml" hash="e1592ad4495ef3e6b9061e348b35ed1d"/><file name="aclreloadbutton.phtml" hash="5a1baf33dff410aeef3de6811d3c8777"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="peerius"><dir name="smartrecs"><dir><dir name="css"><file name="config.css" hash="bc6e8f257e82345829fa4ab40cd6e73a"/></dir><dir name="img"><file name="logo-rollover.png" hash="d47a12d82bc3b271f343f590f7de260a"/><file name="navigation.png" hash="02fb819ba8faf2b9df42345e6f71463c"/></dir><dir name="js"><file name="smartrecs.js" hash="e9fc66f04761d7c0de868f031b592e50"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="peerius_smartrecs"><file name="style.css" hash="54f4d88777c86d9b2951183e0323f026"/></dir></dir></dir></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Peerius_Connect</name>
4
+ <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php#sthash.1eAD3rgO.dpuf">OSL v3.0</license>
7
  <channel>community</channel>
9
  <summary>The trusted partner for personalisation.</summary>
10
  <description>The Peerius Connect extension allows you to add personalised product recommendations to your website. This extension performs the following key functions:&#xD;
11
  &#xD;
12
+ Creates a feed containing product and category information from your site catalogue.&#xD;
13
+ Adds a tracking script that allows Peerius to track user behaviour on your site.&#xD;
14
+ Renders recommendations that you enable on pre-configured pages.&#xD;
15
  </description>
16
+ <notes>Fixed p:recommended attribute in feed to include SKUs instead of magento ids.</notes>
17
  <authors><author><name>Peerius</name><user>Peerius</user><email>extensions@peerius.com</email></author></authors>
18
+ <date>2016-01-15</date>
19
+ <time>15:03:51</time>
20
+ <contents><target name="magecommunity"><dir name="Peerius"><dir name="Smartrecs"><dir name="Block"><file name="Config.php" hash="5d81508e9cf3061d6f34458bbdafff9b"/><file name="Recommendations.php" hash="cc8f955efbd6835d890b8efb864c0cac"/><file name="Template.php" hash="e9431386180c113cfa4660f8ce2c220b"/><file name="Tracking.php" hash="dc187f312b64fa7db93e34bf40291773"/></dir><dir name="Helper"><file name="Data.php" hash="07a1c36598d89c28a5c9f902707cb02e"/><file name="Feedhelper.php" hash="5c981f753a3f139dd0798855ec2e51f4"/></dir><dir name="Model"><dir name="Feed"><file name="Creator.php" hash="41c2c55bc80a1291c49080cdd533d86b"/></dir><file name="Max.php" hash="a3c7eb408d59c3a0b71b9f5f8d85dfa9"/><file name="SearchLayer.php" hash="4457eb768fc387d08700d67b5e1bb55b"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Values.php" hash="bc71d86dcc6fdb046222c0a051b323b4"/></dir><file name="Yesno.php" hash="4f6cb1392c1496837cc6021cb263aad5"/></dir></dir></dir><dir name="Templates"><file name="Basket.php" hash="96eb28e5977acd90ee8bf38f4e938274"/><file name="Category.php" hash="7882da9cd0026ed5bde0360189d593ae"/><file name="Checkout.php" hash="d46564549391af35da90a4a10c9a8093"/><file name="Home.php" hash="44a09df724298154d2f8671572c7f5ea"/><file name="Order.php" hash="3525a61a41f63c4133549254c31c842a"/><file name="Other.php" hash="2cb2c3d3de6d3155b5e33f1f3f8ade00"/><file name="Product1.php" hash="b3f3f27b3b319290f4ce7238b12e77d7"/><file name="Product2.php" hash="65170140bc75324cb0e216a9ba4f2597"/><file name="Search.php" hash="aa1e063656bd5b93a6ea1764dd317bd0"/><file name="Wishlist.php" hash="49daf0c47250b9512d285340c53af644"/></dir><file name="Templates.php" hash="b44ee8b39cf9d2166307ae6eb1500dc8"/><file name="Token.php" hash="2361e10a26b9beb9f066d6ad4827261c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PeeriusController.php" hash="6d72ba380fa0ef6d618a97fc3124cdb7"/></dir><file name="FeedController.php" hash="7b21a1c6a9a8e27314d9b317f94a2e07"/><file name="InfoController.php" hash="915a4388f9cc72c917d6804ac38408c7"/><file name="RenderController.php" hash="e9f46140cb254a24ce9d21288ee9a250"/></dir><dir name="etc"><file name="adminhtml.xml" hash="468dbed05f1cb0be9a4062c85e388e04"/><file name="config.xml" hash="e64216f70b3a67775c93966b412ffb13"/><file name="system.xml" hash="580dfd7e143413dc71f2ffc5f5f1de63"/><file name="system_ft.xml" hash="a42d9bf6de1df48c246057a4ef3c3a71"/><file name="widget.xml" hash="2a2a7c7097a33bb761c97d21c4d373f7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Peerius_Smartrecs.xml" hash="e5c77ca4bb1474945191f4be23a0b390"/></dir></target><target name="mageweb"><dir name="js"><dir name="peerius"><dir name="smartrecs"><file name="smartrecs.js" hash="344e4abf974c5d834afbbd5ec22a6785"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="smartrecs"><file name="smartrecs.phtml" hash="eb191cbebb3729fe54294db5981e5a21"/><file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/><file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/><dir name="recs"><file name="home.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="category.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="product-1.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="product-2.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="search.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="basket.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/></dir></dir></dir><dir name="layout"><file name="smartrecs.xml" hash="f52a4fba91d0a70e676ea2b92c7814ba"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="smartrecs.xml" hash="b18cea41c87596b4a391060772d62036"/></dir><dir name="template"><dir name="smartrecs"><file name="config.phtml" hash="e1592ad4495ef3e6b9061e348b35ed1d"/><file name="aclreloadbutton.phtml" hash="5a1baf33dff410aeef3de6811d3c8777"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="peerius"><dir name="smartrecs"><dir><dir name="css"><file name="config.css" hash="bc6e8f257e82345829fa4ab40cd6e73a"/></dir><dir name="img"><file name="logo-rollover.png" hash="d47a12d82bc3b271f343f590f7de260a"/><file name="navigation.png" hash="02fb819ba8faf2b9df42345e6f71463c"/></dir><dir name="js"><file name="smartrecs.js" hash="e9fc66f04761d7c0de868f031b592e50"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="peerius_smartrecs"><file name="style.css" hash="54f4d88777c86d9b2951183e0323f026"/></dir></dir></dir></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>