Peerius_Connect - Version 1.0.9

Version Notes

New configuration option included to allow recommendation content to be returned with full product details including SKUs. The default setting will only allow recommendations to be sent as SKUs.

Download this release

Release Info

Developer Peerius
Extension Peerius_Connect
Version 1.0.9
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.9

Files changed (27) hide show
  1. app/code/community/Peerius/Smartrecs/.DS_Store +0 -0
  2. app/code/community/Peerius/Smartrecs/Block/Recommendations.php +2 -2
  3. app/code/community/Peerius/Smartrecs/Block/Template.php +185 -127
  4. app/code/community/Peerius/Smartrecs/Block/Tracking.php +78 -28
  5. app/code/community/Peerius/Smartrecs/Helper/Data.php +13 -0
  6. app/code/community/Peerius/Smartrecs/Model/.DS_Store +0 -0
  7. app/code/community/Peerius/Smartrecs/Model/Feed/Creator.php +599 -504
  8. app/code/community/Peerius/Smartrecs/Model/SearchLayer.php +36 -24
  9. app/code/community/Peerius/Smartrecs/controllers/FeedController.php +144 -145
  10. app/code/community/Peerius/Smartrecs/controllers/InfoController.php +348 -193
  11. app/code/community/Peerius/Smartrecs/etc/config.xml +97 -97
  12. app/code/community/Peerius/Smartrecs/etc/system.xml +493 -484
  13. app/design/adminhtml/default/default/template/smartrecs/config.phtml +5 -1
  14. app/design/frontend/base/default/template/smartrecs/recs/basket.phtml +51 -9
  15. app/design/frontend/base/default/template/smartrecs/recs/category.phtml +51 -9
  16. app/design/frontend/base/default/template/smartrecs/recs/home.phtml +51 -9
  17. app/design/frontend/base/default/template/smartrecs/recs/product-1.phtml +51 -9
  18. app/design/frontend/base/default/template/smartrecs/recs/product-2.phtml +51 -9
  19. app/design/frontend/base/default/template/smartrecs/recs/search.phtml +51 -9
  20. app/design/frontend/base/default/template/smartrecs/render.phtml +11 -13
  21. app/design/frontend/base/default/template/smartrecs/smartrecs.phtml +56 -54
  22. package.xml +190 -22
  23. skin/adminhtml/default/default/peerius/smartrecs/css/config.css +30 -11
  24. skin/adminhtml/default/default/peerius/smartrecs/img/logo-hover.png +0 -0
  25. skin/adminhtml/default/default/peerius/smartrecs/img/logo-rollover.png +0 -0
  26. skin/adminhtml/default/default/peerius/smartrecs/img/logo.png +0 -0
  27. skin/adminhtml/default/default/peerius/smartrecs/img/navigation.png +0 -0
app/code/community/Peerius/Smartrecs/.DS_Store DELETED
Binary file
app/code/community/Peerius/Smartrecs/Block/Recommendations.php CHANGED
@@ -88,8 +88,8 @@ class Peerius_Smartrecs_Block_Recommendations extends Mage_Core_Block_Template i
88
 
89
  if ($template) {
90
  $template = (strpos($template, DS) === false) ? 'smartrecs/recs/'.$template : $template;
91
-
92
- if ($this->getRequest()->getParam('peeriuslocalpreview') AND !array_key_exists($id, $this->_fixTemplates)) {
93
  return Mage::getSingleton('core/layout')
94
  ->createBlock('smartrecs/template')
95
  ->setTemplate($template)
88
 
89
  if ($template) {
90
  $template = (strpos($template, DS) === false) ? 'smartrecs/recs/'.$template : $template;
91
+
92
+ if ($this->getRequest()->getParam('peeriuslocalpreview') AND !array_key_exists($id, $this->_fixTemplates)) {
93
  return Mage::getSingleton('core/layout')
94
  ->createBlock('smartrecs/template')
95
  ->setTemplate($template)
app/code/community/Peerius/Smartrecs/Block/Template.php CHANGED
@@ -1,127 +1,185 @@
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 $_debugMode;
19
+
20
+ protected function _prepareData() {
21
+
22
+ $debugMode = $this->setDebugMode();
23
+
24
+ $num = false;
25
+ $skus = false;
26
+ $max = false;
27
+
28
+ if ($this->getRequest()->getParam('skus')) {
29
+ $skus = explode(',',$this->getRequest()->getParam('skus'));
30
+ }
31
+
32
+ if ($this->getRequest()->getParam('recs')) {
33
+ $recs = json_decode($this->getRequest()->getParam('recs'));
34
+ $num = count($recs);
35
+ $skus = array();
36
+ for ($i = 0; $i < $num; $i++) {
37
+ $skus[] = $recs[$i]->refCode;
38
+ }
39
+ $dL = $this->_dLog('Template.php => RECS count is '.count($recs).' & SKUS count is '.count($skus));
40
+ $dL = $this->_dLog('Template.php ALL PARAMS => '.print_r($this->getRequest()->getParams(),1));
41
+
42
+ }
43
+ else {
44
+ $dL = $this->_dLog('Template.php => $this->getRequest()->getParam(recs) is empty');
45
+ $dL = $this->_dLog('Template.php ALL PARAMS =>'.print_r($this->getRequest()->getParams(),1));
46
+ }
47
+
48
+ $max = !$max ? (int) $this->getRequest()->getParam('max') : self::DEFAULT_ITEM_NUM;
49
+ $max = $max > self::MAX_ITEM_NUM ? self::MAX_ITEM_NUM : $max;
50
+
51
+ if($this->isRecContentRefCodeOnly())
52
+ {
53
+
54
+ //This is a possible fix for JosephJoseph
55
+ //Enable EAV for JosephJoseph
56
+ $process = Mage::helper('catalog/product_flat')->getProcess();
57
+ //get current setting
58
+ $status = $process->getStatus();
59
+ $process->setStatus(Mage_Index_Model_Process::STATUS_RUNNING);
60
+ $dL = $this->_dLog('Template.php => EAV ENABLED');
61
+ //EAV enabled
62
+
63
+ $this->_productCollection = Mage::getModel('catalog/product')
64
+ ->getCollection()
65
+ ->addAttributeToSelect('*');
66
+
67
+ if ($skus) {
68
+ $this->_productCollection->addAttributeToFilter('SKU', array('in'=>$skus));
69
+ $this->_productCollection->getSelect()->order("find_in_set(SKU,'".implode(',',$skus)."')");
70
+ }
71
+
72
+ $this->_productCollection->getSelect()->limit($max);
73
+ $dL = $this->_dLog($this->_productCollection->getSelect()->__toString());
74
+
75
+ $this->_productCollection->load();
76
+
77
+ //Reset to flat catalog
78
+ $process->setStatus($status);
79
+ $dL = $this->_dLog('Template.php => EAV DISABLED');
80
+ }
81
+ else
82
+ {
83
+ $dL = $this->_dLog('Template.php => RECS RETURNED WITH FULL DETAILS');
84
+ }
85
+
86
+ return $this;
87
+ }
88
+
89
+ protected function _beforeToHtml() {
90
+ $this->_prepareData();
91
+ parent::_beforeToHtml();
92
+ }
93
+
94
+ public function getItems() {
95
+ return $this->_productCollection ? $this->_productCollection : null;
96
+ }
97
+
98
+ /**
99
+ * Count items
100
+ *
101
+ * @return int
102
+ */
103
+ public function getItemCount()
104
+ {
105
+ return count($this->getItems());
106
+ }
107
+
108
+ public function getItemCollection() {
109
+ return $this->_productCollection;
110
+ }
111
+
112
+ public function isRecContentRefCodeOnly()
113
+ {
114
+ return Mage::helper('peerius_smartrecs')->getRecsAsSKUsOnly()? true : false;
115
+ }
116
+
117
+
118
+ public function getRowCount()
119
+ {
120
+ return ceil(count($this->getItemCollection()->getItems())/$this->getColumnCount());
121
+ }
122
+
123
+ public function setColumnCount($columns)
124
+ {
125
+ if (intval($columns) > 0) {
126
+ $this->_columnCount = intval($columns);
127
+ }
128
+ return $this;
129
+ }
130
+
131
+ public function getColumnCount()
132
+ {
133
+ return $this->_columnCount;
134
+ }
135
+
136
+ public function resetItemsIterator()
137
+ {
138
+ $this->getItems();
139
+ reset($this->_productCollection);
140
+ }
141
+
142
+ public function getIterableItem()
143
+ {
144
+ if (is_array($this->_productCollection)) {
145
+ $item = current($this->_productCollection);
146
+ next($this->_productCollection);
147
+ return $item;
148
+ }
149
+
150
+ // the iterator on an object doesn't work like this
151
+ $i = 0;
152
+ foreach ($this->_productCollection as $item) {
153
+ if ($this->_i == $i++) {
154
+ $this->_i++;
155
+ return $item;
156
+ }
157
+ }
158
+ }
159
+
160
+ public function getCurrencyCode()
161
+ {
162
+ //$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
163
+ return Mage::app()->getStore()->getCurrentCurrencyCode();
164
+ }
165
+
166
+ public function getCurrencySymbol()
167
+ {
168
+ return Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
169
+ }
170
+
171
+ private function setDebugMode()
172
+ {
173
+ $this->_debugMode = Mage::getSingleton('core/session')->getPeeriusDebug() != null ? true : false;
174
+ if($this->_debugMode) Mage::log('PEERIUS DEBUG FOR RECS ENABLED', null, 'peerius_smartrec.log');
175
+ return $this->_debugMode;
176
+ }
177
+
178
+ private function _dLog($msg)
179
+ {
180
+ if($this->_debugMode == true) Mage::log($msg, null, 'peerius_smartrec.log');
181
+ return true;
182
+ }
183
+
184
+ }
185
+
app/code/community/Peerius/Smartrecs/Block/Tracking.php CHANGED
@@ -8,6 +8,8 @@
8
  class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
9
 
10
  protected $_pageType;
 
 
11
  /*
12
  * getter for page type
13
  */
@@ -21,7 +23,9 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
21
  */
22
  public function getTrackingPixel() {
23
  $fullActionName = Mage::app()->getFrontController()->getAction()->getFullActionName();
24
-
 
 
25
  switch ($fullActionName) {
26
  case 'cms_index_index':
27
  $routeName = Mage::app()->getRequest()->getRouteName();
@@ -75,7 +79,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
75
  $pixel = array(
76
  'type' => 'home',
77
  'lang' => $this->_getLang(),
78
- 'recContent' => 'refCodeOnly'
79
  );
80
  $user = $this->_getUser();
81
  if ($user) {
@@ -93,7 +97,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
93
  $pixel = array(
94
  'type' => 'product',
95
  'lang' => $this->_getLang(),
96
- 'recContent' => 'refCodeOnly'
97
  );
98
  $user = $this->_getUser();
99
  if ($user) {
@@ -116,7 +120,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
116
  $pixel = array(
117
  'type' => 'category',
118
  'lang' => $this->_getLang(),
119
- 'recContent' => 'refCodeOnly'
120
  );
121
  $user = $this->_getUser();
122
  if ($user) {
@@ -126,6 +130,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
126
  if ($category AND $category->getId()) {
127
  $pixel['category'] = $this->_getCategoryBreadcrumb($category->getId());
128
  }
 
129
  return json_encode($pixel);
130
  }
131
 
@@ -139,7 +144,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
139
  $pixel = array(
140
  'type' => 'basket',
141
  'lang' => $this->_getLang(),
142
- 'recContent' => 'refCodeOnly'
143
  );
144
  $user = $this->_getUser();
145
  if ($user) {
@@ -149,13 +154,23 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
149
  $items = $cart->getAllItems();
150
  $pixel['basket']['items'] = array();
151
  foreach ($items as $item) {
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
  }
@@ -172,7 +187,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
172
  $pixel = array(
173
  'type' => 'checkout',
174
  'lang' => $this->_getLang(),
175
- 'recContent' => 'refCodeOnly'
176
  );
177
  $user = $this->_getUser();
178
  if ($user) {
@@ -181,13 +196,18 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
181
  $cart = Mage::getModel('checkout/cart')->getQuote();
182
  $items = $cart->getAllItems();
183
  foreach ($items as $item) {
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
  }
@@ -213,7 +233,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
213
  $pixel = array(
214
  'type' => 'order',
215
  'lang' => $this->_getLang(),
216
- 'recContent' => 'refCodeOnly'
217
  );
218
  $user = $this->_getUser();
219
  if ($user) {
@@ -224,13 +244,18 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
224
  $pixel['order']['orderNo'] = $order->getIncrementId();
225
  $items = $order->getAllItems();
226
  foreach ($items as $item) {
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
  }
@@ -255,7 +280,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
255
  $pixel = array(
256
  'type' => 'searchresults',
257
  'lang' => $this->_getLang(),
258
- 'recContent' => 'refCodeOnly'
259
  );
260
  $user = $this->_getUser();
261
  if ($user) {
@@ -264,6 +289,8 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
264
  $term = Mage::helper('catalogsearch')->getQueryText();
265
  $pixel['searchResults']['term'] = $this->escapeHtml($term);
266
  $searchResult = array_slice(Mage::registry('peerius_smartrecs_searchresults'), 0, 10);
 
 
267
  $pixel['searchResults']['results'] = $searchResult;
268
  return json_encode($pixel);
269
  }
@@ -277,7 +304,7 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
277
  $pixel = array(
278
  'type' => 'wishlist',
279
  'lang' => $this->_getLang(),
280
- 'recContent' => 'refCodeOnly'
281
  );
282
  $user = $this->_getUser();
283
  if ($user) {
@@ -330,7 +357,6 @@ class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
330
 
331
  $fullPath = array();
332
  foreach ($p as $treeCat) {
333
- // Root-Kategorie 1 überspringen
334
  if ($treeCat <= 2)
335
  continue;
336
  $category = Mage::getModel('catalog/category')
@@ -393,7 +419,31 @@ 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
 
 
8
  class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
9
 
10
  protected $_pageType;
11
+ protected $_debugMode;
12
+ protected $_refCodeOnlyOrFull;
13
  /*
14
  * getter for page type
15
  */
23
  */
24
  public function getTrackingPixel() {
25
  $fullActionName = Mage::app()->getFrontController()->getAction()->getFullActionName();
26
+ $debugMode = $this->setDebugMode();
27
+ $this->_refCodeOnlyOrFull = Mage::helper('peerius_smartrecs')->getRecsAsSKUsOnly()? 'refCodeOnly' : 'full';
28
+
29
  switch ($fullActionName) {
30
  case 'cms_index_index':
31
  $routeName = Mage::app()->getRequest()->getRouteName();
79
  $pixel = array(
80
  'type' => 'home',
81
  'lang' => $this->_getLang(),
82
+ 'recContent' => $this->_refCodeOnlyOrFull
83
  );
84
  $user = $this->_getUser();
85
  if ($user) {
97
  $pixel = array(
98
  'type' => 'product',
99
  'lang' => $this->_getLang(),
100
+ 'recContent' => $this->_refCodeOnlyOrFull
101
  );
102
  $user = $this->_getUser();
103
  if ($user) {
120
  $pixel = array(
121
  'type' => 'category',
122
  'lang' => $this->_getLang(),
123
+ 'recContent' => $this->_refCodeOnlyOrFull
124
  );
125
  $user = $this->_getUser();
126
  if ($user) {
130
  if ($category AND $category->getId()) {
131
  $pixel['category'] = $this->_getCategoryBreadcrumb($category->getId());
132
  }
133
+
134
  return json_encode($pixel);
135
  }
136
 
144
  $pixel = array(
145
  'type' => 'basket',
146
  'lang' => $this->_getLang(),
147
+ 'recContent' => $this->_refCodeOnlyOrFull
148
  );
149
  $user = $this->_getUser();
150
  if ($user) {
154
  $items = $cart->getAllItems();
155
  $pixel['basket']['items'] = array();
156
  foreach ($items as $item) {
157
+ //code pre v 1.0.8
158
+ //if ($item->getParentItem()) continue;
159
+
160
+ //if ($item->getProduct()->getData('visibility')==1) {
161
+ //Mage::log($item->getParentItem()->getProduct()->getData('sku'), null, 'peerius_smartrec.log');
162
+ //continue;
163
+ //}
164
+
165
+ // ignore skus that are not visible as product pages
166
+ if(!$item->getProduct()->isVisibleInSiteVisibility()) continue;
167
+ $dL = $this->_dLog('BASKET TRACKING: '.$item->getProduct()->getData('sku').' is '.strtoupper($item->getProductType()).' & '.($item->getProduct()->isVisibleInSiteVisibility()? "VISIBLE": "NOT VISIBLE"));
168
+
169
+ $priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
170
  $newItem = array(
171
+ 'refCode' => $item->getProduct()->getData('sku'),
172
  'qty' => $item->getQty(),
173
+ 'price' => $priceIncTax
174
  );
175
  $pixel['basket']['items'][] = $newItem;
176
  }
187
  $pixel = array(
188
  'type' => 'checkout',
189
  'lang' => $this->_getLang(),
190
+ 'recContent' => $this->_refCodeOnlyOrFull
191
  );
192
  $user = $this->_getUser();
193
  if ($user) {
196
  $cart = Mage::getModel('checkout/cart')->getQuote();
197
  $items = $cart->getAllItems();
198
  foreach ($items as $item) {
199
+ //code pre v 1.0.8
200
+ //if ($item->getParentItem()) continue;
201
+
202
+ // ignore skus that are not visible as product pages
203
+ if(!$item->getProduct()->isVisibleInSiteVisibility()) continue;
204
+ $dL = $this->_dLog('CHECKOUT TRACKING: '.$item->getProduct()->getData('sku').' is '.strtoupper($item->getProductType()).' & '.($item->getProduct()->isVisibleInSiteVisibility()? "VISIBLE": "NOT VISIBLE"));
205
+
206
+ $priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
207
  $newItem = array(
208
+ 'refCode' => $item->getProduct()->getData('sku'),
209
  'qty' => (int) $item->getQty(),
210
+ 'price' => $priceIncTax
211
  );
212
  $pixel['checkout']['items'][] = $newItem;
213
  }
233
  $pixel = array(
234
  'type' => 'order',
235
  'lang' => $this->_getLang(),
236
+ 'recContent' => $this->_refCodeOnlyOrFull
237
  );
238
  $user = $this->_getUser();
239
  if ($user) {
244
  $pixel['order']['orderNo'] = $order->getIncrementId();
245
  $items = $order->getAllItems();
246
  foreach ($items as $item) {
247
+ //code pre v 1.0.8
248
+ //if ($item->getParentItem()) continue;
249
+
250
+ // ignore skus that are not visible as product pages
251
+ if(!$item->getProduct()->isVisibleInSiteVisibility()) continue;
252
+ $dL = $this->_dLog('ORDER TRACKING: '.$item->getProduct()->getData('sku').' is '.strtoupper($item->getProductType()).' & '.($item->getProduct()->isVisibleInSiteVisibility()? "VISIBLE": "NOT VISIBLE"));
253
+
254
+ $priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
255
  $newItem = array(
256
+ 'refCode' => $item->getProduct()->getData('sku'),
257
  'qty' => (int) $item->getQtyOrdered(),
258
+ 'price' => $priceIncTax
259
  );
260
  $pixel['order']['items'][] = $newItem;
261
  }
280
  $pixel = array(
281
  'type' => 'searchresults',
282
  'lang' => $this->_getLang(),
283
+ 'recContent' => $this->_refCodeOnlyOrFull
284
  );
285
  $user = $this->_getUser();
286
  if ($user) {
289
  $term = Mage::helper('catalogsearch')->getQueryText();
290
  $pixel['searchResults']['term'] = $this->escapeHtml($term);
291
  $searchResult = array_slice(Mage::registry('peerius_smartrecs_searchresults'), 0, 10);
292
+ $dL = $this->_dLog('SEARCH TRACKING: '.print_r($searchResult,1));
293
+
294
  $pixel['searchResults']['results'] = $searchResult;
295
  return json_encode($pixel);
296
  }
304
  $pixel = array(
305
  'type' => 'wishlist',
306
  'lang' => $this->_getLang(),
307
+ 'recContent' => $this->_refCodeOnlyOrFull
308
  );
309
  $user = $this->_getUser();
310
  if ($user) {
357
 
358
  $fullPath = array();
359
  foreach ($p as $treeCat) {
 
360
  if ($treeCat <= 2)
361
  continue;
362
  $category = Mage::getModel('catalog/category')
419
  }
420
  return '<script type="text/JavaScript" src="//'.$this->escapeHtml(Mage::getStoreConfig('peerius/general/client_name')).'.peerius.com/tracker/peerius.page" charset="UTF-8"></script>';
421
  }
422
+
423
+ private function setDebugMode()
424
+ {
425
+ $this->_debugMode = false;
426
+ if(Mage::app()->getRequest()->getParam('pbug') == 1 && Mage::getSingleton('core/session')->getPeeriusDebug()== null)
427
+ {
428
+ Mage::getSingleton('core/session')->setPeeriusDebug(true);
429
+ }
430
+ $this->_debugMode = Mage::getSingleton('core/session')->getPeeriusDebug() != null ? true : false;
431
+
432
+ if(Mage::app()->getRequest()->getParam('pbug') != null && Mage::app()->getRequest()->getParam('pbug') == 0 && Mage::getSingleton('core/session')->getPeeriusDebug()!= null)
433
+ {
434
+ Mage::getSingleton('core/session')->unsPeeriusDebug();
435
+ $this->_debugMode = false;
436
+ }
437
+ if(Mage::app()->getRequest()->getParam('pbug') != null)
438
+ Mage::log('PEERIUS DEBUG '.( Mage::app()->getRequest()->getParam('pbug')==1 ? 'EN' : 'DIS').'ABLED', null, 'peerius_smartrec.log');
439
+ return $this->_debugMode;
440
+ }
441
+
442
+ private function _dLog($msg)
443
+ {
444
+
445
+ if($this->_debugMode == true) Mage::log($msg, null, 'peerius_smartrec.log');
446
+ return true;
447
+ }
448
 
449
+ }
app/code/community/Peerius/Smartrecs/Helper/Data.php CHANGED
@@ -133,4 +133,17 @@ class Peerius_Smartrecs_Helper_Data extends Mage_Core_Helper_Abstract {
133
  return false;
134
 
135
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
133
  return false;
134
 
135
  }
136
+
137
+ /*
138
+ * read the plugin settings to see if recommendations are disabled
139
+ * @return bool
140
+ */
141
+ public function getRecsAsSKUsOnly() {
142
+
143
+ if (Mage::getStoreConfig('peerius/general/enableall') == 1 && Mage::getStoreConfig('peerius/general/getrecsasskusonly') == 1) {
144
+ return true;
145
+ }
146
+ return false;
147
+ }
148
+
149
  }
app/code/community/Peerius/Smartrecs/Model/.DS_Store DELETED
Binary file
app/code/community/Peerius/Smartrecs/Model/Feed/Creator.php CHANGED
@@ -1,505 +1,600 @@
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()) . "_PeeriusFeed" . ".xml";
20
+
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
+ $this->fileName = $clientName . "_PeeriusFeed" . ".xml";
26
+
27
+ if ($this->_createFile()) {
28
+ if (!$this->_writeFeed($website)) {
29
+ return false;
30
+ }
31
+ } else {
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+
37
+ /**
38
+ * @param Mage_Core_Model_Website $website
39
+ * @return bool
40
+ */
41
+ protected function _writeFeed(Mage_Core_Model_Website $website) {
42
+ try {
43
+ $f = new Varien_Io_File();
44
+ $f->write($this->fileName, $this->_getHeader($website) . $this->_getProducts($website) . $this->_getFooter());
45
+ $f->close();
46
+ return true;
47
+ } catch (Exception $ex) {
48
+ $this->log("error writing the feed");
49
+ $this->log($ex->getMessage());
50
+ return false;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * @param $file
56
+ * @return bool
57
+ */
58
+ protected function _createFile() {
59
+ return true;
60
+ // try {
61
+ // $f = new Varien_Io_File();
62
+ // $validator = new Zend_Validate_File_Exists();
63
+ //
64
+ // if (!$validator->isValid($this->fileName)) {
65
+ // $this->log("could not create the smartrec file");
66
+ // return false;
67
+ // }
68
+ // $this->log("SMART-recs file created");
69
+ //
70
+ // fclose($f);
71
+ // return true;
72
+ // } catch (Exception $ex) {
73
+ // $this->log("error during file creation");
74
+ // $this->log($ex->getMessage());
75
+ // return false;
76
+ // }
77
+ }
78
+
79
+ /**
80
+ * generate the rss file header
81
+ * @param Mage_Core_Model_Website $website
82
+ * @return string
83
+ */
84
+ protected function _getHeader(Mage_Core_Model_Website $website) {
85
+ $clientName = $this->_getClientName();
86
+ $rss = '';
87
+ $rss .= '<?xml version="1.0" encoding="UTF-8"?>';
88
+ $rss .= '<rss version="2.0" xmlns:p="http://www.peerius.com/feeds/PeeriusRSS20.xsd">';
89
+ $rss .= '<channel>';
90
+ $rss .= '<title><![CDATA[Rss 2.0 ' . $clientName . ' product catalogue feed]]></title>';
91
+ $rss .= '<link>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '</link>';
92
+ $rss .= '<description><![CDATA[The latest product catalogue feed of ' . $clientName . '.]]></description>';
93
+ return $rss;
94
+ }
95
+
96
+ /**
97
+ * generate the rss file footer
98
+ * @return string
99
+ */
100
+ protected function _getFooter() {
101
+ $rss = '';
102
+ $rss .= '</channel>';
103
+ $rss .= '</rss>';
104
+ return $rss;
105
+ }
106
+
107
+ /**
108
+ * sets the layout
109
+ * @param string $packageName
110
+ * @param string $themeName
111
+ */
112
+ protected function _changeTheme($packageName, $themeName) {
113
+ Mage::getDesign()->setArea('frontend')
114
+ ->setPackageName($packageName)
115
+ ->setTheme($themeName);
116
+ }
117
+
118
+ /**
119
+ * write the products
120
+ * @param Mage_Core_Model_Website $website
121
+ * @return string
122
+ */
123
+ protected function _getProducts(Mage_Core_Model_Website $website) {
124
+ $profilingStart = microtime(true);
125
+ $adapter = Mage::getSingleton("core/resource");
126
+ $visiblityCondition = array('in' => array(2, 3, 4));
127
+ $_catalogInventoryTable = method_exists($adapter, 'getTableName') ? $adapter->getTableName('cataloginventory_stock_item') : 'catalog_category_product_index';
128
+
129
+ //###################### DEBUG CODE :MG #####################
130
+ $debugMode = Mage::app()->getRequest()->getParam('debug') == 1 ? true : false;
131
+ $debugProducts = Mage::app()->getRequest()->getParam('items') ? Mage::app()->getRequest()->getParam('items') : 10;
132
+ $this->log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
133
+ $this->log('DEBUG MODE : '.($debugMode == true ? 'enabled. Creating feed for '. $debugProducts. ' products.' :'disabled'));
134
+
135
+ // Read Attributes to exclude from query string of feed url - Quick hack as some attribute names may cause issues.
136
+ $attribsToExclude = Mage::app()->getRequest()->getParam('attribsToExclude') ? Mage::app()->getRequest()->getParam('attribsToExclude') : "" ;
137
+ if($attribsToExclude && $attribsToExclude!="") $this->log('Attributes to exclude: '.$attribsToExclude, null, 'peerius_smartrec.log');
138
+ //###################### DEBUG CODE :MG #####################
139
+
140
+ $this->log('Feed creation STARTED');
141
+ $this->_changeTheme(Mage::getStoreConfig('design/package/name', $website->getDefaultStore()->getCode()), Mage::getStoreConfig('design/package/theme', $website->getDefaultStore()->getCode()));
142
+
143
+ $rss = '';
144
+
145
+ $productCollection = Mage::getModel('catalog/product')
146
+ ->getCollection()
147
+ ->addWebsiteFilter($website->getWebsiteId())
148
+ ->joinField("qty", $_catalogInventoryTable, 'qty', 'product_id=entity_id', null, 'left')
149
+ ->addAttributeToSelect('*')
150
+ ->addCategoryIds()
151
+ //->addAttributeToFilter('type_id', array('eq' => 'configurable'))
152
+ ->addAttributeToFilter('visibility', $visiblityCondition)
153
+ // ->joinTable('catalog/product_relation', 'child_id=entity_id', array('parent_id' => 'parent_id'), null, 'left')
154
+ ->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
155
+ // ->load();
156
+
157
+ $productsCount = $productCollection->getSize();
158
+ $this->log('Total products found : ' . $productsCount);
159
+
160
+ $ctr = 0;
161
+ $perc = 0;
162
+ $ind = 1;
163
+
164
+ // check if site has prices in multiple currencies - if so, store the currency conversion rates.
165
+ $baseCode = Mage::app()->getBaseCurrencyCode();
166
+ $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
167
+ $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
168
+ $this->log('CURRENCY RATES : '.($rates ? http_build_query($rates) : 'NO RATES - SINGLE CURRENCY'), null, 'peerius_smartrec.log');
169
+
170
+ try {
171
+
172
+ foreach ($productCollection as $product) {
173
+
174
+ //###################### DEBUG CODE :MG #####################
175
+ if ($debugMode && $ctr > $debugProducts) break;
176
+ //###################### DEBUG CODE :MG #####################
177
+
178
+ $categoryIds = $product->getCategoryIds();
179
+ $parentCategoryBreadcrumbs = false;
180
+ $parent = false;
181
+
182
+ // don't export unavailable products
183
+ if (!$product->isAvailable()) {
184
+ $productsCount--;
185
+ continue;
186
+ }
187
+
188
+ // if a product is not in a category skip it also
189
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
190
+ $parent = $this->_getParent($product);
191
+ if ($parent) {
192
+ $parentCategoryBreadcrumbs = $this->_getParentCategoryBreadcrumbs($product);
193
+ $categoryBreadcrumbs = $parentCategoryBreadcrumbs;
194
+ } else {
195
+ $categoryBreadcrumbs = $this->_getCategoryBreadcrumbs($product->getCategoryIds());
196
+ }
197
+ }
198
+
199
+ // is the product or it's product in any category? If not, skip it
200
+ if (!$categoryIds AND !$parentCategoryBreadcrumbs) {
201
+ $productsCount--;
202
+ continue;
203
+ }
204
+
205
+ $rss .= '<item>';
206
+ $rss .= '<title><![CDATA[' . $product->getName() . ']]></title>';
207
+ $rss .= '<link>' . $product->getProductUrl() . '</link>';
208
+ $rss .= '<guid><![CDATA[' . $product->getSku() . ']]></guid>';
209
+ if ($product->getThumbnail())
210
+ $rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getThumbnail() . '</p:imageLink>';
211
+
212
+ // if site has prices in multiple currencies
213
+ if($rates) {
214
+ foreach ($rates as $cur => $rate) {
215
+ $unitPrice = number_format($product->getPrice(), 2, '.', '') * $rate;
216
+ $salePrice = number_format($product->getFinalPrice(), 2, '.', '') * $rate;
217
+ $rss .= '<p:price><p:unitPrice>' . number_format($unitPrice, 2, '.', '') . '</p:unitPrice>
218
+ <p:salePrice>' . number_format($salePrice, 2, '.', '') . '</p:salePrice>
219
+ <p:currency>' . $cur . '</p:currency></p:price>';
220
+ }
221
+ }else{ // single currency site
222
+ $rss .= '<p:price><p:unitPrice>' . number_format($product->getPrice(), 2, '.', '') . '</p:unitPrice>
223
+ <p:salePrice>' . number_format($product->getFinalPrice(), 2, '.', '') . '</p:salePrice>
224
+ <p:currency>' . Mage::app()->getStore($website->getDefaultStore())->getCurrentCurrencyCode() . '</p:currency></p:price>';
225
+ }
226
+
227
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
228
+ $rss .= $this->_getCategoryBreadcrumbs($categoryIds);
229
+ $rss .= '<p:attribute name="minimal_price">' . number_format($product->getMinimalPrice(), 2, '.', '') . '</p:attribute>';
230
+
231
+ $attrArr = Mage::getModel('catalog/product_type_configurable')->getConfigurableAttributesAsArray($product);
232
+
233
+ $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProductCollection($product)
234
+ ->addAttributeToSelect('thumbnail')
235
+ ->addAttributeToSelect('name')
236
+ ->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', 1);
237
+ foreach ($attrArr as $attr) {
238
+ $childProducts->addAttributeToSelect($attr['attribute_code']);
239
+ }
240
+
241
+ foreach ($childProducts as $childProduct) {
242
+ if ($childProduct->getData('visibility') == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
243
+ //$p = Mage::getModel('catalog/product')->load($childProduct->getId());
244
+ $rss .= '<p:variant>';
245
+ //$rss .= '<p:title><![CDATA[' . $childProduct->getName() . ']]></p:title>';
246
+ foreach ($attrArr as $attr) {
247
+ $rss .= '<p:attribute name="' . $attr['attribute_code'] . '"><![CDATA[' . $childProduct->getAttributeText($attr['attribute_code']) . ']]></p:attribute>';
248
+ }
249
+ $rss .= '<p:attribute name="link">' . $childProduct->getProductUrl() . '</p:attribute>';
250
+ $rss .= '<p:attribute name="guid"><![CDATA[' . $childProduct->getSku() . ']]></p:attribute>';
251
+ $rss .= '<p:attribute name="magento_id">' . $childProduct->getId() . '</p:attribute>';
252
+ if ($product->getThumbnail())
253
+ $rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $childProduct->getThumbnail() . '</p:imageLink>';
254
+ $stockItem = $childProduct->getStockItem();
255
+ $stockQty = ($stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) ?
256
+ ((int) $stockItem->getQty() > 0 ? (int) $stockItem->getQty() : 0) : 0;
257
+ $rss .= '<p:stock>' . $stockQty . '</p:stock>';
258
+ $rss .= '</p:variant>';
259
+ }
260
+ }
261
+ } else {
262
+ if ($parent) {
263
+ $rss .= $parent;
264
+ $rss .= $categoryBreadcrumbs;
265
+ } else {
266
+ $rss .= $categoryBreadcrumbs;
267
+ }
268
+ }
269
+
270
+ $rss .= '<pubDate>' . $product->getcreated_at() . '</pubDate>';
271
+ $rss .= '<description><![CDATA[' . $product->getShortDescription() . ']]></description>';
272
+
273
+ if ($product->getAttribute('manufacturer') instanceof Mage_Eav_Model_Entity_Attribute_Abstract) {
274
+ $rss .= '<p:brand><![CDATA[' . $product->getAttributeText('manufacturer') . ']]></p:brand>';
275
+ }
276
+ $rss .= '<p:inStock>' . $this->_getStockStatus($product) . '</p:inStock>';
277
+ $rss .= '<p:stock>' . ((int) $product->getQty() > 0 ? (int) $product->getQty() : 0) . '</p:stock>';
278
+ $rss .= '<p:recommend>Y</p:recommend>';
279
+ $rss .= '<p:recommended><![CDATA[' . $this->_getRecommended($product) . ']]></p:recommended>';
280
+ $rss .= '<p:attribute name="magento_id">' . $product->getId() . '</p:attribute>';
281
+ $rss .= $this->_getAttributes($product,$attribsToExclude);
282
+ $rss .= $this->_getTags($product);
283
+ $rss .= '</item>';
284
+
285
+ $iperc = round($productsCount/10) ;
286
+ $perc = $perc == 0 ? $iperc : $perc;
287
+ if($ctr == $perc) {
288
+ $this->log('Processed ' . $ind++ * 10 . '% of the products...' . $ctr);
289
+ $perc = $iperc * $ind;
290
+ //Mage::throwException('Some Message');
291
+ }
292
+ $ctr++;
293
+ }
294
+
295
+ $this->log('Total entries created : ' . ($ctr - 1) );
296
+ } catch (Exception $e) {
297
+ //echo $this->getPrettyDebugBacktrace();
298
+ $this->log("### ERROR ### : " . $e->getMessage());
299
+ }
300
+
301
+
302
+ if ($productsCount == 0) {
303
+ $this->log("no products found");
304
+ throw new Exception("### ERROR ### : NO products found");
305
+ }
306
+
307
+ $now = microtime(true);
308
+ $this->log("Feed creation COMPLETED in " . date("H:i:s", ($now - $profilingStart)));
309
+ $this->log('Memory used : ' . round(memory_get_peak_usage() / 1048576) . 'MB');
310
+ $this->log('===================================================');
311
+ return $rss;
312
+ }
313
+
314
+ /**
315
+ * generate breadcrumb style categories
316
+ * @param array $currentCatIds
317
+ * @return string
318
+ */
319
+ protected function _getCategoryBreadcrumbs($currentCatIds) {
320
+ $rss = '';
321
+
322
+ if ($currentCatIds) {
323
+ $categoryCollection = Mage::getResourceModel('catalog/category_collection')
324
+ ->addAttributeToSelect('path')
325
+ ->addAttributeToFilter('entity_id', $currentCatIds)
326
+ ->addIsActiveFilter();
327
+
328
+ foreach ($categoryCollection as $cat) {
329
+ $p = explode('/', $cat->getPath());
330
+
331
+ $fullPath = array();
332
+ foreach ($p as $treeCat) {
333
+ // Root-Kategorie
334
+ if ($treeCat <= 2)
335
+ continue;
336
+ $category = Mage::getModel('catalog/category')
337
+ ->setStoreId(Mage::app()->getStore()->getId())
338
+ ->load($treeCat);
339
+ $fullPath[] = $category->getName();
340
+ }
341
+ $rss .= '<category><![CDATA[' . implode('>', $fullPath) . ']]></category>';
342
+ }
343
+ }
344
+ return $rss;
345
+ }
346
+
347
+ /**
348
+ * generate breadcrumb style categories
349
+ * @param product $product
350
+ * @return string
351
+ */
352
+ protected function _getParentCategoryBreadcrumbs($product) {
353
+ $rss = '';
354
+ $parentIds = $this->_getParent($product, true);
355
+ $categoryIds = array();
356
+
357
+ foreach ($parentIds as $parentId) {
358
+ $product = Mage::getModel('catalog/product')->load($parentId);
359
+ $categoryIds = array_merge($categoryIds, $product->getCategoryIds());
360
+ }
361
+
362
+ $rss = $this->_getCategoryBreadcrumbs($categoryIds);
363
+ return $rss;
364
+ }
365
+
366
+ /**
367
+ * retreive the product stock statuss
368
+ * @param Mage_Core_Catalog_Product $product
369
+ * @return string
370
+ */
371
+ protected function _getStockStatus($product) {
372
+ $stockStatus = Mage::getModel('cataloginventory/stock_item')
373
+ ->getCollection()
374
+ ->addFieldToFilter('product_id', $product->getId())
375
+ ->getFirstItem();
376
+
377
+ return $stockStatus ? 'Y' : 'N';
378
+ }
379
+
380
+ /**
381
+ * write the products
382
+ * @param Mage_Core_Catalog_Product $product
383
+ * @return string
384
+ */
385
+ protected function _getRecommended($product) {
386
+ $all = array();
387
+ $related = $product->getRelatedProductIds();
388
+ foreach ($related as $id) {
389
+ $all[$id] = Mage::getModel('catalog/product')->load($id)->getSku();
390
+ //$this->log("Related Product is :".$all[$id]);
391
+ }
392
+
393
+ $crosssell = $product->getCrossSellProducts();
394
+ foreach ($crosssell as $_item) {
395
+ $all[$_item->getId()] = $_item->getSku();
396
+ //$this->log("Cross Selling Product is :".$all[$_item->getId()]);
397
+ }
398
+ $upsell = $product->getUpSellProductCollection();
399
+ foreach ($upsell as $_item) {
400
+ $all[$_item->getId()] = $_item->getSku();
401
+ //$this->log("Up Selling Product is :".$all[$_item->getId()]);
402
+ }
403
+ return implode(',', $all);
404
+ }
405
+
406
+ /**
407
+ * generate comma-separated list of product tags
408
+ * @param Mage_Core_Catalog_Product $product
409
+ * @return string
410
+ */
411
+ protected function _getTags($product) {
412
+ $tag_model = Mage::getModel('tag/tag');
413
+ $tag_collection = $tag_model->getResourceCollection()
414
+ ->addPopularity()
415
+ // ->addStatusFilter($model->getApprovedStatus())
416
+ ->addProductFilter($product->getId())
417
+ ->setFlag('relation', true)
418
+ ->addStoreFilter(Mage::app()->getStore()->getId())
419
+ ->setActiveFilter()
420
+ ->load();
421
+
422
+ $mytags = $tag_collection->getItems();
423
+
424
+ $tagArr = array();
425
+ if (!$tag_collection->getSize()) {
426
+ return '';
427
+ }
428
+
429
+ foreach ($mytags as $tag) {
430
+ $tagArr[] = $tag->getName();
431
+ }
432
+ return '<p:tags>' . implode(',', $tagArr) . '</p:tags>';
433
+ }
434
+
435
+ /**
436
+ * crate front-end attributes rss string
437
+ * @param Mage_Core_Catalog_Product $product
438
+ * @return string
439
+ */
440
+ protected function _getAttributes($product, $attribsToExclude) {
441
+ $attributes = $product->getAttributes();
442
+ $rss = '';
443
+ $attribsToExcludeArray = explode('|',$attribsToExclude);
444
+ foreach ($attributes as $attribute) {
445
+ if ($attribute->getIsVisibleOnFront()) {
446
+ $attributeCode = $attribute->getAttributeCode();
447
+ if (in_array($attributeCode,$attribsToExcludeArray))
448
+ continue;
449
+ else
450
+ {
451
+ $label = $attribute->getFrontend()->getLabel($product);
452
+ $value = $attribute->getFrontend()->getValue($product);
453
+ $rss .= '<p:attribute name="' . $attributeCode . '"><![CDATA[' . $value . ']]></p:attribute>';
454
+ }
455
+ }
456
+ }
457
+ return $rss;
458
+ }
459
+
460
+ /**
461
+ * returns parent product ID if available
462
+ * @param Mage_Core_Catalog_Product $product
463
+ * @param bool return the ids
464
+ * @return int
465
+ */
466
+ protected function _getParent($product, $ids = false) {
467
+ $rss = '';
468
+ $parentIds = false;
469
+ if ($product->getTypeId() == "simple") {
470
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()); // check for grouped product
471
+ if (!$parentIds)
472
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId()); //check for config product
473
+ }
474
+ if ($ids) {
475
+ return $parentIds;
476
+ }
477
+ if ($parentIds) {
478
+ $rss = '<p:attribute name="parent_magento_id">' . implode(',', $parentIds) . '</p:attribute>';
479
+ } else {
480
+ return false;
481
+ }
482
+ return $rss;
483
+ }
484
+
485
+ /**
486
+ * the client name used in the rss feed
487
+ * @return string
488
+ */
489
+ protected function _getClientName() {
490
+ return Mage::getStoreConfig('peerius/general/client_name');
491
+ }
492
+
493
+ /**
494
+ * @param $content
495
+ * @return bool
496
+ */
497
+ protected function _appendToFile($content) {
498
+ try {
499
+ $f = new Varien_Io_File();
500
+ $validator = new Zend_Validate_File_Exists();
501
+
502
+ if (!$validator->isValid($this->fileName)) {
503
+ $this->log("could not create the smartrec file");
504
+ return false;
505
+ }
506
+ $this->log("SMART-recs file created");
507
+
508
+ fclose($f);
509
+ return true;
510
+ } catch (Exception $ex) {
511
+ $this->log("error during file creation");
512
+ $this->log($ex->getMessage());
513
+ return false;
514
+ }
515
+ try {
516
+ $f = new Varien_Io_File();
517
+ $f->write($this->fileName, $content);
518
+ //if (file_put_contents($this->fileName, $content, FILE_APPEND)) {
519
+ return true;
520
+ } catch (Exception $ex) {
521
+ $this->log("error while writing to the feed file");
522
+ $this->log($ex->getMessage());
523
+ return false;
524
+ }
525
+ }
526
+
527
+ public function checkToken() {
528
+ $token = Mage::getStoreConfig('peerius/general/token');
529
+
530
+ if (!$token OR !Mage::app()->getRequest()->getParam('token') OR (Mage::app()->getRequest()->getParam('token') != sha1($token))) {
531
+ $this->log("token error");
532
+ return false;
533
+ }
534
+ return true;
535
+ }
536
+
537
+ /**
538
+ * @param string $message
539
+ */
540
+ protected function log($message) {
541
+ Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
542
+ }
543
+
544
+ protected function getPrettyDebugBacktrace()
545
+ {
546
+ $d = debug_backtrace();
547
+ array_shift($d);
548
+ $siteName = Mage::getStoreConfig('peerius/general/client_name',Mage::app()->getStore());
549
+ $response = '';
550
+ $response .= '<!doctype html><html lang=\'en-gb\'><head><meta charset=\'utf-8\'><title> CONFIG: '.$siteName.'</title>'.$this->getCSS().'</head><body style="font-family:Arial;">';
551
+ $response .= '<section><h1>Peerius Connect Debug : '. $siteName . '</h1>';
552
+ $c1width = strlen(count($d) + 1);
553
+ $c2width = 0;
554
+ foreach ($d as &$f) {
555
+ if (!isset($f['file'])) $f['file'] = '';
556
+ if (!isset($f['line'])) $f['line'] = '';
557
+ if (!isset($f['class'])) $f['class'] = '';
558
+ if (!isset($f['type'])) $f['type'] = '';
559
+ $f['file_rel'] = str_replace(BP . DS, '', $f['file']);
560
+ $thisLen = strlen($f['file_rel'] . ':' . $f['line']);
561
+ if ($c2width < $thisLen) $c2width = $thisLen;
562
+ }
563
+ foreach ($d as $i => $f) {
564
+ $args = '';
565
+ if (isset($f['args'])) {
566
+ $args = array();
567
+ foreach ($f['args'] as $arg) {
568
+ if (is_object($arg)) {
569
+ $str = get_class($arg);
570
+ } elseif (is_array($arg)) {
571
+ $str = 'Array';
572
+ } elseif (is_numeric($arg)) {
573
+ $str = $arg;
574
+ } else {
575
+ $str = "'$arg'";
576
+ }
577
+ $args[] = $str;
578
+ }
579
+ $args = implode(', ', $args);
580
+ }
581
+ $response .= "<div class='boxA'>".$i."</div><div class='boxB'>".$f['file_rel']." : <span class='lnText'>".$f['line'] . "</span></div><div class='boxC'> ". $f['class'].$f['type'].$f['function']." </div><div class='boxB'> ".$args."</div>";
582
+
583
+ }
584
+ $response .= '</section></body></html>';
585
+ return $response;
586
+ }
587
+
588
+ /**
589
+ * return CSS
590
+ */
591
+ protected function getCSS() {
592
+ return "<style type='text/css'>
593
+ .secTitle {clear:both;display:block;float:left;padding:5px;margin:10px 2px 5px 0;width:100%;color:#808080;font-weight:bold; font-size:20px;}
594
+ .boxA { clear:left;display:block;float:left;padding:2px 2px 0 4px;margin:1px;background-color: #60b346 ; width:20px; height:22px; }
595
+ .boxB { float:left;display:in-line;padding:2px 2px 0 4px;margin:1px;background-color: #A9Ae99; width:60%px; height:22px;color:#000; }
596
+ .boxC { float:left;display:in-line;padding:2px 0 0 4px;margin:1px;background-color: #A0b3A6; width:30%px; height:22px;color:#000; }
597
+ .lnText { background-color: #A9Ae99; font-weight:bold; color:#FF0; }
598
+ </style>";
599
+ }
600
  }
app/code/community/Peerius/Smartrecs/Model/SearchLayer.php CHANGED
@@ -1,25 +1,37 @@
1
- <?php
2
-
3
- /**
4
- * @category Peerius
5
- * @package Peerius_Smartrecs
6
- * @author Peerius Ltd
7
- */
8
- class Peerius_Smartrecs_Model_SearchLayer extends Mage_CatalogSearch_Model_Layer {
9
-
10
- /**
11
- * get the found product for the tracking
12
- * @return $this
13
- */
14
- public function prepareProductCollection($collection) {
15
- parent::prepareProductCollection($collection);
16
- $sku = array();
17
- $coll = clone $collection;
18
- foreach ($coll as $item) {
19
- $data = $item->getData();
20
- $sku[] = array('refCode' => $data['sku']);
21
- }
22
- Mage::register('peerius_smartrecs_searchresults', $sku);
23
- return $this;
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
1
+ <?php
2
+
3
+ /**
4
+ * @category Peerius
5
+ * @package Peerius_Smartrecs
6
+ * @author Peerius Ltd
7
+ */
8
+ class Peerius_Smartrecs_Model_SearchLayer extends Mage_CatalogSearch_Model_Layer {
9
+
10
+ /**
11
+ * get the found product for the tracking
12
+ * @return $this
13
+ */
14
+ public function prepareProductCollection($collection) {
15
+ parent::prepareProductCollection($collection);
16
+ $sku = array();
17
+ $coll = clone $collection;
18
+ $cnt = 1;
19
+ foreach ($coll as $item) {
20
+ $data = $item->getData();
21
+ $sku[] = array('refCode' => $data['sku']);
22
+ if($cnt++==1) break;
23
+ }
24
+ Mage::unregister('peerius_smartrecs_searchresults');
25
+ if(Mage::registry('peerius_smartrecs_searchresults') == null) Mage::register('peerius_smartrecs_searchresults', $sku);
26
+ //Mage::log('==========================SEARCH DEBUG=========================', null, 'peerius_smartrec.log');
27
+ //Mage::log(print_r(Mage::registry('peerius_smartrecs_searchresults'), 1), null, 'peerius_smartrec.log');
28
+ //Mage::log('==========================SEARCH DEBUG END=========================', null, 'peerius_smartrec.log');
29
+ //$c = Mage::registry('peerius_smartrecs_searchresults');
30
+ //foreach ($c as $itm => $value) {
31
+ // foreach ($value as $vi => $vv) {
32
+ // Mage::log('peerius_smartrecs_searchresults registry value is '.$vi.'::'.$vv);
33
+ // }
34
+ //}
35
+ return $this;
36
+ }
37
  }
app/code/community/Peerius/Smartrecs/controllers/FeedController.php CHANGED
@@ -1,145 +1,144 @@
1
- <?php
2
-
3
- /**
4
- * create the product feed
5
- * @category Peerius
6
- * @package Peerius_Smartrecs
7
- * @author Peerius Ltd
8
- */
9
- class Peerius_Smartrecs_FeedController extends Mage_Core_Controller_Front_Action {
10
-
11
- /**
12
- * Smartrecs helper
13
- * @return Peerius_Smartrecs_Helper_Confighelper
14
- */
15
- protected function _helper() {
16
- return Mage::helper("peerius_smartrecs/feedhelper");
17
- }
18
-
19
- /**
20
- * create the product feed
21
- * @return null
22
- */
23
- public function createAction() {
24
- if (Mage::app()->getRequest()->getParam('version') AND Mage::app()->getRequest()->getParam('version') == 3) {
25
- $creator = Mage::getSingleton('peerius_smartrecs/feed_creatorsql');
26
- } else {
27
- $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
28
- }
29
-
30
- if ($creator->checkToken()) {
31
- $website = $this->_checkSite();
32
- if (is_null($website)) {
33
- $website = Mage::app()->getWebsite(1);
34
- }
35
- set_time_limit(0);
36
- ignore_user_abort(true);
37
- if ($this->getRequest()->getParam('debug')==1) {
38
- error_reporting(E_ALL);
39
- ini_set('display_errors','on');
40
- }
41
-
42
- $creator->process($website);
43
- }
44
- }
45
-
46
- /**
47
- * return the product feed
48
- * @return null
49
- */
50
- public function showAction() {
51
- if (Mage::app()->getRequest()->getParam('version') AND Mage::app()->getRequest()->getParam('version') == 3) {
52
- $creator = Mage::getSingleton('peerius_smartrecs/feed_creatorsql');
53
- } else {
54
- $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
55
- }
56
-
57
- if ($creator->checkToken()) {
58
- $website = $this->_checkSite();
59
- if (is_null($website)) {
60
- $website = Mage::app()->getWebsite(1);
61
- }
62
- $this->fileName = Mage::getBaseDir('tmp') . DS . str_replace(' ', '_', $website->getName()) .
63
- "_PeeriusFeed" . ".xml";
64
-
65
- $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
66
- $this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
67
- $this->getResponse()->setHeader('Content-Type', 'application/rss+xml; charset=UTF-8');
68
-
69
- $file = new Varien_Io_File();
70
- $this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/rss+xml');
71
- }
72
- }
73
-
74
- /**
75
- * create and show the product feed
76
- * @return null
77
- */
78
- public function createAndShowAction() {
79
- $website = $this->_checkSite();
80
- if (is_null($website)) {
81
- $website = Mage::app()->getWebsite(1);
82
- }
83
- set_time_limit(0);
84
- ignore_user_abort(true);
85
- if ($this->getRequest()->getParam('debug')==1) {
86
- error_log(E_ALL);
87
- ini_set('display_errors','on');
88
- }
89
- if (Mage::app()->getRequest()->getParam('version') AND Mage::app()->getRequest()->getParam('version') == 3) {
90
- $creator = Mage::getSingleton('peerius_smartrecs/feed_creatorsql');
91
- } else {
92
- $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
93
- }
94
-
95
- if ($creator->checkToken()) {
96
- $creator->process($website);
97
-
98
- // ---
99
-
100
-
101
- $this->fileName = Mage::getBaseDir('tmp') . DS . str_replace(' ', '_', $website->getName()) .
102
- "_PeeriusFeed" . ".xml";
103
-
104
- $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
105
- $this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
106
- $this->getResponse()->setHeader('Content-Type', 'application/rss+xml; charset=UTF-8');
107
-
108
- $file = new Varien_Io_File();
109
- $this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/rss+xml');
110
- }
111
- }
112
-
113
- /**
114
- * @param $websiteName
115
- * @return mixed
116
- */
117
- protected function _getWebsiteByName($websiteName) {
118
- return Mage::getResourceModel('core/website_collection')
119
- ->addFieldToFilter('name', $websiteName)
120
- ->getFirstItem();
121
- }
122
-
123
- /**
124
- * the website to create the feed for, e.g. Main Website
125
- * @return Mage_Core_Model_Website
126
- */
127
- protected function _checkSite() {
128
- if ($this->getRequest()->getParam('site')) {
129
- $website = $this->_getWebsiteByName($this->getRequest()->getParam('site'));
130
- }
131
-
132
- if (!isset($website) || !$website->hasData("website_id")) {
133
- return null;
134
- }
135
- return $website;
136
- }
137
-
138
- public function unlockAction() {
139
- $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
140
- if ($creator->checkToken()) {
141
- Mage::getModel('core/config')->saveConfig('peerius/general/creatingfeed', 0);
142
- }
143
- }
144
-
145
- }
1
+ <?php
2
+
3
+ /**
4
+ * create the product feed
5
+ * @category Peerius
6
+ * @package Peerius_Smartrecs
7
+ * @author Peerius Ltd
8
+ */
9
+ class Peerius_Smartrecs_FeedController extends Mage_Core_Controller_Front_Action {
10
+
11
+ /**
12
+ * Smartrecs helper
13
+ * @return Peerius_Smartrecs_Helper_Confighelper
14
+ */
15
+ protected function _helper() {
16
+ return Mage::helper("peerius_smartrecs/feedhelper");
17
+ }
18
+
19
+ /**
20
+ * create the product feed
21
+ * @return null
22
+ */
23
+ public function createAction() {
24
+ if (Mage::app()->getRequest()->getParam('version') AND Mage::app()->getRequest()->getParam('version') == 3) {
25
+ $creator = Mage::getSingleton('peerius_smartrecs/feed_creatorsql');
26
+ } else {
27
+ $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
28
+ }
29
+
30
+ if ($creator->checkToken()) {
31
+ $website = $this->_checkSite();
32
+ if (is_null($website)) {
33
+ $website = Mage::app()->getWebsite(1);
34
+ }
35
+ set_time_limit(0);
36
+ ignore_user_abort(true);
37
+ if ($this->getRequest()->getParam('debug')==1) {
38
+ error_reporting(E_ALL);
39
+ ini_set('display_errors','on');
40
+ }
41
+
42
+ $creator->process($website);
43
+ }
44
+ }
45
+
46
+ /**
47
+ * return the product feed
48
+ * @return null
49
+ */
50
+ public function showAction() {
51
+ if (Mage::app()->getRequest()->getParam('version') AND Mage::app()->getRequest()->getParam('version') == 3) {
52
+ $creator = Mage::getSingleton('peerius_smartrecs/feed_creatorsql');
53
+ } else {
54
+ $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
55
+ }
56
+
57
+ if ($creator->checkToken()) {
58
+ $website = $this->_checkSite();
59
+ if (is_null($website)) {
60
+ $website = Mage::app()->getWebsite(1);
61
+ }
62
+ //$this->fileName = Mage::getBaseDir('tmp') . DS . str_replace(' ', '_', $website->getName()) . "_PeeriusFeed" . ".xml";
63
+ $clientName = Mage::getStoreConfig('peerius/general/client_name');
64
+ $this->fileName = $clientName . "_PeeriusFeed" . ".xml";
65
+
66
+ $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
67
+ $this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
68
+ $this->getResponse()->setHeader('Content-Type', 'application/rss+xml; charset=UTF-8');
69
+
70
+ $file = new Varien_Io_File();
71
+ $this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/rss+xml');
72
+ }
73
+ }
74
+
75
+ /**
76
+ * create and show the product feed
77
+ * @return null
78
+ */
79
+ public function createAndShowAction() {
80
+ $website = $this->_checkSite();
81
+ if (is_null($website)) {
82
+ $website = Mage::app()->getWebsite(1);
83
+ }
84
+ set_time_limit(0);
85
+ ignore_user_abort(true);
86
+ if ($this->getRequest()->getParam('debug')==1) {
87
+ error_log(E_ALL);
88
+ ini_set('display_errors','on');
89
+ }
90
+ if (Mage::app()->getRequest()->getParam('version') AND Mage::app()->getRequest()->getParam('version') == 3) {
91
+ $creator = Mage::getSingleton('peerius_smartrecs/feed_creatorsql');
92
+ } else {
93
+ $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
94
+ }
95
+
96
+ if ($creator->checkToken()) {
97
+ $creator->process($website);
98
+
99
+ //$this->fileName = Mage::getBaseDir('tmp') . DS . str_replace(' ', '_', $website->getName()) . "_PeeriusFeed" . ".xml";
100
+ $clientName = Mage::getStoreConfig('peerius/general/client_name');
101
+ $this->fileName = $clientName . "_PeeriusFeed" . ".xml";
102
+
103
+ $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
104
+ $this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
105
+ $this->getResponse()->setHeader('Content-Type', 'application/rss+xml; charset=UTF-8');
106
+
107
+ $file = new Varien_Io_File();
108
+ $this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/rss+xml');
109
+ }
110
+ }
111
+
112
+ /**
113
+ * @param $websiteName
114
+ * @return mixed
115
+ */
116
+ protected function _getWebsiteByName($websiteName) {
117
+ return Mage::getResourceModel('core/website_collection')
118
+ ->addFieldToFilter('name', $websiteName)
119
+ ->getFirstItem();
120
+ }
121
+
122
+ /**
123
+ * the website to create the feed for, e.g. Main Website
124
+ * @return Mage_Core_Model_Website
125
+ */
126
+ protected function _checkSite() {
127
+ if ($this->getRequest()->getParam('site')) {
128
+ $website = $this->_getWebsiteByName($this->getRequest()->getParam('site'));
129
+ }
130
+
131
+ if (!isset($website) || !$website->hasData("website_id")) {
132
+ return null;
133
+ }
134
+ return $website;
135
+ }
136
+
137
+ public function unlockAction() {
138
+ $creator = Mage::getSingleton('peerius_smartrecs/feed_creator');
139
+ if ($creator->checkToken()) {
140
+ Mage::getModel('core/config')->saveConfig('peerius/general/creatingfeed', 0);
141
+ }
142
+ }
143
+
144
+ }
 
app/code/community/Peerius/Smartrecs/controllers/InfoController.php CHANGED
@@ -1,193 +1,348 @@
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('path',Varien_Data_Collection::SORT_ORDER_ASC);
34
+ $response = '<!doctype html><html lang=\'en-gb\'><head><meta charset=\'utf-8\'><title> CONFIG: '.$siteName.'</title>'.$this->getCSS().'</head><body style="font-family:Arial;">';
35
+ $response .= '<section><h1>Peerius Connect Configuration : '. $siteName . '</h1> (v ' .$connectVersion. ')';
36
+
37
+ $sec1 = "";
38
+ $sec2 = "";
39
+ foreach ($configs as $config) {
40
+ $this->log($config->getPath());
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 enabled for site?';
61
+ $dispValue = ($dispValue == 1) ? 'Yes' : 'No';
62
+ break;
63
+ case "getrecsasskusonly":
64
+ $dispName = 'Return recs as :';
65
+ $dispValue = ($dispValue == 1) ? 'refCodeOnly (only refCodes)' : 'full (includes refCode, title, product url, image url, prices)';
66
+ break;
67
+ case "disable":
68
+ $dispName = 'Are Recs enabled for page?';
69
+ $dispValue = ($dispValue == 0) ? 'Yes' : 'No';
70
+ break;
71
+ case "cronjob":
72
+ $dispName = 'Feed scheduled at?';
73
+ break;
74
+ case "testmode":
75
+ $dispName = 'Is test mode enabled?';
76
+ $dispValue = ($dispValue == 1) ? 'Yes' : 'No';
77
+ break;
78
+ case "registrationstatus":
79
+ $dispName = 'Registration status?';
80
+ $dispValue = ($dispValue == 1) ? 'Registered' : 'Something happend that shouldn\'t have!';
81
+ break;
82
+ case "headline":
83
+ $dispName = 'Widget title';
84
+ break;
85
+ case "number_of_products":
86
+ $dispName = 'Number of recs';
87
+ break;
88
+ case "success":
89
+ $dispName = 'Show recs for all search?';
90
+ $dispValue = ($dispValue == 0) ? 'No, only for zero search' : 'Yes';
91
+ break;
92
+ default:
93
+ break;
94
+ }
95
+
96
+ $response .= '<div class=\'boxA\'>'.ucfirst($dispName).' </div><div class=\'boxB\'> '.$dispValue . "</div><br />";
97
+ }
98
+
99
+ $collection = Mage::getModel('widget/widget_instance')->getCollection();
100
+ $collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
101
+
102
+ if($collection->getSize()>0)
103
+ {
104
+ //$response .= '<div class=\'secTitle\'>Widget Instances</div>';
105
+ foreach($collection as $item)
106
+ {
107
+ $response .= '<div class=\'secTitle\'>Widget Instance: '.$item->title.'</div>';
108
+ $v = $item->widget_parameters;
109
+ $v = str_replace('{','',str_replace('}','',substr($v,5,strlen($v))));
110
+ $w = explode(';',$v);
111
+ //Mage::log('wid params: '.print_r($w,1), null, 'peerius_smartrec.log');
112
+ //Mage::log('widget count : '.count($w), null, 'peerius_smartrec.log');
113
+ for ($x = 0; $x < count($w) ; $x = $x+2)
114
+ {
115
+ $v1 = explode(':',$w[$x]);
116
+ $v2 = explode(':',$w[$x+1]);
117
+ if(str_replace('"','',$v1[2]) != "") {
118
+ $parName = str_replace('"','',$v1[2]);
119
+ $parValue = str_replace('"','',$v2[2]);
120
+ switch ($parName) {
121
+ case "rectype":
122
+ $parName = 'Widget name';
123
+ break;
124
+ case "wtemplate":
125
+ $parName = 'Template';
126
+ break;
127
+ case "headline":
128
+ $parName = 'Widget title';
129
+ break;
130
+ case "max":
131
+ $parName = 'Number of recs';
132
+ break;
133
+ default:
134
+ break;
135
+ }
136
+ $response .= '<div class=\'boxA\'> '.$parName. '</div><div class=\'boxB\'> '.$parValue.' </div><br />';
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ $response .= '<div class=\'secTitle\'></div></section></body></html>';
143
+ $this->getResponse()->setHeader('Content-Type', 'text/html')->setBody($response);
144
+
145
+ }
146
+ }
147
+
148
+ /**
149
+ * when is the cron executed?
150
+ * @return int
151
+ */
152
+ public function createtimeAction() {
153
+ if ($this->checkToken()) {
154
+ $response = (int) Mage::getStoreConfig('peerius/general/cronjob');
155
+
156
+ $this->getResponse()
157
+ ->setHeader('Content-Type', 'text/html')
158
+ ->setBody($response);
159
+ }
160
+ }
161
+
162
+ /**
163
+ * what registration status has the shop
164
+ * @return int
165
+ */
166
+ public function registrationstatusAction() {
167
+ if ($this->checkToken()) {
168
+ $response = (int) Mage::getStoreConfig('peerius/general/registrationstatus');
169
+
170
+ $this->getResponse()
171
+ ->setHeader('Content-Type', 'text/html')
172
+ ->setBody($response);
173
+ }
174
+ }
175
+
176
+ /**
177
+ * what registration status has the shop
178
+ * @return int
179
+ */
180
+ public function registrationerrorAction() {
181
+ if ($this->checkToken()) {
182
+ $response = (int) Mage::getStoreConfig('peerius/general/registrationerror');
183
+
184
+ $this->getResponse()
185
+ ->setHeader('Content-Type', 'text/html')
186
+ ->setBody($response);
187
+ }
188
+ }
189
+
190
+ /*
191
+ * returns the parameters of the created peerius SMARTrecs widgets
192
+ * @return string
193
+ */
194
+ public function widgetsAction() {
195
+ if ($this->checkToken()) {
196
+ $response = '';
197
+ $collection = Mage::getModel('widget/widget_instance')->getCollection();
198
+ $collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
199
+
200
+ foreach($collection as $item)
201
+ {
202
+ $response .= $item->title.'<hr>';
203
+ $response .= $item->widget_parameters;
204
+ $response .= '<br><br><br>';
205
+ }
206
+
207
+ $this->getResponse()
208
+ ->setHeader('Content-Type', 'text/html')
209
+ ->setBody($response);
210
+ }
211
+ }
212
+
213
+ /*
214
+ * resets the registration status
215
+ * @return string
216
+ */
217
+ public function registrationstatusresetAction() {
218
+ if ($this->checkToken()) {
219
+ Mage::getModel('core/config')->saveConfig('peerius/general/registrationstatus', '0');
220
+ Mage::getModel('core/config')->saveConfig('peerius/general/registrationerror', '0');
221
+ }
222
+ }
223
+
224
+ /*
225
+ * deletes the configuration
226
+ * @return string
227
+ */
228
+ public function resetconfigAction() {
229
+ if ($this->checkToken()) {
230
+ $configs = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path',array('like'=>'peerius%'));
231
+
232
+ foreach ($configs as $config) {
233
+ $config->delete($config);
234
+ }
235
+ $response = count($configs) . ' entries deleted';
236
+
237
+ $this->getResponse()
238
+ ->setHeader('Content-Type', 'text/html')
239
+ ->setBody($response);
240
+ }
241
+ }
242
+
243
+ /*
244
+ * sets the admin IP to preview recommendations in test mode
245
+ * @return string
246
+ */
247
+ public function adminipAction() {
248
+ if ($this->checkToken()) {
249
+ if (!filter_var($this->getRequest()->getParam('ip'), FILTER_VALIDATE_IP) === false) {
250
+ Mage::getModel('core/config')->saveConfig('peerius/general/adminip', $this->getRequest()->getParam('ip'));
251
+ }
252
+ }
253
+ }
254
+
255
+ /*
256
+ * reads the admin IP
257
+ * @return string
258
+ */
259
+ public function adminipreadAction() {
260
+ if ($this->checkToken()) {
261
+ $response = Mage::getStoreConfig('peerius/general/adminip');
262
+
263
+ $this->getResponse()
264
+ ->setHeader('Content-Type', 'text/html')
265
+ ->setBody($response);
266
+ }
267
+ }
268
+
269
+ /*
270
+ * checks for the valid token to prevent URL manipulation
271
+ * @return bool
272
+ */
273
+ public function checkToken() {
274
+ $token = Mage::getStoreConfig('peerius/general/token');
275
+
276
+ if (!$token OR !$this->getRequest()->getParam('token') OR ($this->getRequest()->getParam('token') != sha1($token))) {
277
+ $this->log("token error");
278
+ return false;
279
+ }
280
+ return true;
281
+ }
282
+
283
+ /**
284
+ * @param string $message
285
+ */
286
+ protected function log($message) {
287
+ Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
288
+ }
289
+
290
+ /**
291
+ * return CSS
292
+ */
293
+ protected function getCSS() {
294
+ return "<style type='text/css'>
295
+ .secTitle {clear:both;display:block;float:left;padding:5px;margin:10px 0 5px 0;width:100%;color:#808080;font-weight:bold; font-size:20px;}
296
+ .boxA { clear:left;display:block;float:left;padding:2px 0 0 4px;margin:1px;background-color: #60b346 ; width:200px; height:22px; }
297
+ .boxB { float:left;display:in-line;padding:2px 0 0 4px;margin:1px;background-color: #A9Ae99; width:650px; height:22px;color:#000; }
298
+ </style>";
299
+ }
300
+
301
+
302
+ /**
303
+ * return peerius log file
304
+ */
305
+ public function peeriusLogAction() {
306
+ //if ($this->checkToken()) {
307
+ $this->fileName = Mage::getBaseDir('var') . DS . 'log' . DS . Mage::getStoreConfig($this->CONFIG_LOG_FILE_PATH).'peerius_smartrec.log';
308
+ $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
309
+ $this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
310
+ $this->getResponse()->setHeader('Content-Type', 'application/text; charset=UTF-8');
311
+
312
+ $file = new Varien_Io_File();
313
+ $this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/text');
314
+ //}
315
+ }
316
+
317
+ /**
318
+ * return magento log file
319
+ */
320
+ public function magentoLogAction() {
321
+ //if ($this->checkToken()) {
322
+ $this->fileName = Mage::getBaseDir('var') . DS . 'log' . DS . Mage::getStoreConfig($this->CONFIG_LOG_FILE_PATH).'magento.log';
323
+ $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
324
+ $this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
325
+ $this->getResponse()->setHeader('Content-Type', 'application/text; charset=UTF-8');
326
+
327
+ $file = new Varien_Io_File();
328
+ $this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/text');
329
+ //}
330
+ }
331
+
332
+ /**
333
+ * return exception log file
334
+ */
335
+ public function exceptionLogAction() {
336
+ //if ($this->checkToken()) {
337
+ $this->fileName = Mage::getBaseDir('var') . DS . 'log' . DS . Mage::getStoreConfig($this->CONFIG_LOG_FILE_PATH).'exception.log';
338
+ $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
339
+ $this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
340
+ $this->getResponse()->setHeader('Content-Type', 'application/text; charset=UTF-8');
341
+
342
+ $file = new Varien_Io_File();
343
+ $this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/text');
344
+ //}
345
+ }
346
+
347
+ }
348
+
app/code/community/Peerius/Smartrecs/etc/config.xml CHANGED
@@ -1,97 +1,97 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Peerius_Smartrecs>
5
- <version>1.0.2</version>
6
- </Peerius_Smartrecs>
7
- </modules>
8
- <frontend>
9
- <routers>
10
- <peerius_smartrecs>
11
- <use>standard</use>
12
- <args>
13
- <module>Peerius_Smartrecs</module>
14
- <frontName>peerius</frontName>
15
- </args>
16
- </peerius_smartrecs>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <peerius_smartrecs>
21
- <file>smartrecs.xml</file>
22
- </peerius_smartrecs>
23
- </updates>
24
- </layout>
25
- </frontend>
26
- <global>
27
- <models>
28
- <peerius_smartrecs>
29
- <class>Peerius_Smartrecs_Model</class>
30
- </peerius_smartrecs>
31
- <catalogsearch>
32
- <rewrite>
33
- <layer>Peerius_Smartrecs_Model_SearchLayer</layer>
34
- </rewrite>
35
- </catalogsearch>
36
- </models>
37
- <blocks>
38
- <smartrecs>
39
- <class>Peerius_Smartrecs_Block</class>
40
- </smartrecs>
41
- </blocks>
42
- <helpers>
43
- <peerius_smartrecs>
44
- <class>Peerius_Smartrecs_Helper</class>
45
- </peerius_smartrecs>
46
- </helpers>
47
- </global>
48
- <adminhtml>
49
- <layout>
50
- <updates>
51
- <peerius_smartrecs>
52
- <file>smartrecs.xml</file>
53
- </peerius_smartrecs>
54
- </updates>
55
- </layout>
56
- </adminhtml>
57
- <admin>
58
- <routers>
59
- <adminhtml>
60
- <args>
61
- <modules>
62
- <peerius_smartrecs after="Mage_Adminhtml">Peerius_Smartrecs_Adminhtml</peerius_smartrecs>
63
- </modules>
64
- </args>
65
- </adminhtml>
66
- </routers>
67
- </admin>
68
- <default>
69
- <peerius>
70
- <general>
71
- <client_name></client_name>
72
- <cronjob>4</cronjob>
73
- <testmode>1</testmode>
74
- <registrationstatus>0</registrationstatus>
75
- <registrationerror>0</registrationerror>
76
- </general>
77
- <home>
78
- <max>3</max>
79
- </home>
80
- <category>
81
- <max>3</max>
82
- </category>
83
- <product>
84
- <max>3</max>
85
- </product>
86
- <product2>
87
- <max>3</max>
88
- </product2>
89
- <search>
90
- <max>3</max>
91
- </search>
92
- <basket>
93
- <max>3</max>
94
- </basket>
95
- </peerius>
96
- </default>
97
- </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Peerius_Smartrecs>
5
+ <version>1.0.9</version>
6
+ </Peerius_Smartrecs>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <peerius_smartrecs>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Peerius_Smartrecs</module>
14
+ <frontName>peerius</frontName>
15
+ </args>
16
+ </peerius_smartrecs>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <peerius_smartrecs>
21
+ <file>smartrecs.xml</file>
22
+ </peerius_smartrecs>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <models>
28
+ <peerius_smartrecs>
29
+ <class>Peerius_Smartrecs_Model</class>
30
+ </peerius_smartrecs>
31
+ <catalogsearch>
32
+ <rewrite>
33
+ <layer>Peerius_Smartrecs_Model_SearchLayer</layer>
34
+ </rewrite>
35
+ </catalogsearch>
36
+ </models>
37
+ <blocks>
38
+ <smartrecs>
39
+ <class>Peerius_Smartrecs_Block</class>
40
+ </smartrecs>
41
+ </blocks>
42
+ <helpers>
43
+ <peerius_smartrecs>
44
+ <class>Peerius_Smartrecs_Helper</class>
45
+ </peerius_smartrecs>
46
+ </helpers>
47
+ </global>
48
+ <adminhtml>
49
+ <layout>
50
+ <updates>
51
+ <peerius_smartrecs>
52
+ <file>smartrecs.xml</file>
53
+ </peerius_smartrecs>
54
+ </updates>
55
+ </layout>
56
+ </adminhtml>
57
+ <admin>
58
+ <routers>
59
+ <adminhtml>
60
+ <args>
61
+ <modules>
62
+ <peerius_smartrecs after="Mage_Adminhtml">Peerius_Smartrecs_Adminhtml</peerius_smartrecs>
63
+ </modules>
64
+ </args>
65
+ </adminhtml>
66
+ </routers>
67
+ </admin>
68
+ <default>
69
+ <peerius>
70
+ <general>
71
+ <client_name></client_name>
72
+ <cronjob>4</cronjob>
73
+ <testmode>1</testmode>
74
+ <registrationstatus>0</registrationstatus>
75
+ <registrationerror>0</registrationerror>
76
+ </general>
77
+ <home>
78
+ <max>3</max>
79
+ </home>
80
+ <category>
81
+ <max>3</max>
82
+ </category>
83
+ <product>
84
+ <max>3</max>
85
+ </product>
86
+ <product2>
87
+ <max>3</max>
88
+ </product2>
89
+ <search>
90
+ <max>3</max>
91
+ </search>
92
+ <basket>
93
+ <max>3</max>
94
+ </basket>
95
+ </peerius>
96
+ </default>
97
+ </config>
app/code/community/Peerius/Smartrecs/etc/system.xml CHANGED
@@ -1,357 +1,366 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <tabs>
4
- <peerius translate="label">
5
- <label>Peerius</label>
6
- <sort_order>15</sort_order>
7
- </peerius>
8
- </tabs>
9
- <sections>
10
- <peerius translate="Peerius" module="adminhtml">
11
- <label>SMART-recs</label>
12
- <tab>peerius</tab>
13
- <sort_order>10</sort_order>
14
- <show_in_default>1</show_in_default>
15
- <show_in_website>1</show_in_website>
16
- <show_in_store>1</show_in_store>
17
- <groups>
18
- <general translate="General">
19
- <label>General</label>
20
- <sort_order>50</sort_order>
21
- <show_in_default>1</show_in_default>
22
- <show_in_website>1</show_in_website>
23
- <show_in_store>1</show_in_store>
24
- <fields>
25
- <client_name translate="Client Name">
26
- <label>Client Name</label>
27
- <comment>The Peerius client name</comment>
28
- <frontend_type>text</frontend_type>
29
- <sort_order>10</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
- </client_name>
34
- <token translate="Client Token">
35
- <backend_model>peerius_smartrecs/token</backend_model>
36
- <label>Client Token</label>
37
- <comment>The Peerius client token</comment>
38
- <frontend_type>text</frontend_type>
39
- <sort_order>20</sort_order>
40
- <show_in_default>1</show_in_default>
41
- <show_in_website>1</show_in_website>
42
- <show_in_store>1</show_in_store>
43
- </token>
44
- <testmode translate="Test Mode">
45
- <label>Test Mode</label>
46
- <frontend_type>select</frontend_type>
47
- <sort_order>30</sort_order>
48
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
49
- <show_in_default>1</show_in_default>
50
- <show_in_website>1</show_in_website>
51
- <show_in_store>1</show_in_store>
52
- <tooltip><![CDATA[Enable Test Mode if you would like to test recommendations from the IP address of the PC or laptop that you are currently logged on. If you would like to test from a different machine, please use the 'peeriuspreview' parameter as shown:, e.g. www.yourshop.com/?peeriuspreview.<br><br>Only Disable Test Mode if you are ready to go live with Peerius SMART-recs.]]></tooltip>
53
- <comment>If Test Mode is enabled recommendations are only visible to you</comment>
54
- </testmode>
55
- <cronjob translate="Feed generation">
56
- <label>Feed generation</label>
57
- <tooltip>Specify the time when Peerius should create and import the feed</tooltip>
58
- <frontend_type>select</frontend_type>
59
- <source_model>peerius_smartrecs/system_config_source_dropdown_values</source_model>
60
- <sort_order>40</sort_order>
61
- <show_in_default>1</show_in_default>
62
- <show_in_website>1</show_in_website>
63
- <show_in_store>1</show_in_store>
64
- </cronjob>
65
- <widgetheight translate="Recommendation widget heights">
66
- <label>Recommendation widget heights</label>
67
- <comment>The heights of each individual recommendation widget</comment>
68
- <frontend_type>text</frontend_type>
69
- <depends>
70
- <field_name>1</field_name>
71
- </depends>
72
- <sort_order>50</sort_order>
73
- <show_in_default>1</show_in_default>
74
- <show_in_website>1</show_in_website>
75
- <show_in_store>1</show_in_store>
76
- </widgetheight>
77
- <registrationstatus translate="registrationstatus">
78
- <frontend_type>text</frontend_type>
79
- <sort_order>60</sort_order>
80
- <depends>
81
- <field_name>1</field_name>
82
- </depends>
83
- <show_in_default>1</show_in_default>
84
- <show_in_website>1</show_in_website>
85
- <show_in_store>1</show_in_store>
86
- </registrationstatus>
87
- <registrationerror translate="registrationerror">
88
- <frontend_type>text</frontend_type>
89
- <sort_order>60</sort_order>
90
- <depends>
91
- <field_name>1</field_name>
92
- </depends>
93
- <show_in_default>1</show_in_default>
94
- <show_in_website>1</show_in_website>
95
- <show_in_store>1</show_in_store>
96
- </registrationerror>
97
- <enableall translate="Disable All">
98
- <label>Enable recommendations</label>
99
- <frontend_type>select</frontend_type>
100
- <source_model>adminhtml/system_config_source_yesno</source_model>
101
- <sort_order>70</sort_order>
102
- <show_in_default>1</show_in_default>
103
- <show_in_website>1</show_in_website>
104
- <show_in_store>1</show_in_store>
105
- </enableall>
106
- <adminip translate="adminip">
107
- <frontend_type>text</frontend_type>
108
- <depends>
109
- <field_name>1</field_name>
110
- </depends>
111
- <sort_order>80</sort_order>
112
- <show_in_default>1</show_in_default>
113
- <show_in_website>1</show_in_website>
114
- <show_in_store>1</show_in_store>
115
- </adminip>
116
- <creatingfeed translate="creatingfeed">
117
- <frontend_type>text</frontend_type>
118
- <sort_order>90</sort_order>
119
- <depends>
120
- <field_name>1</field_name>
121
- </depends>
122
- <show_in_default>1</show_in_default>
123
- <show_in_website>1</show_in_website>
124
- <show_in_store>1</show_in_store>
125
- </creatingfeed>
126
- </fields>
127
- </general>
128
- <home translate="Home">
129
- <label>Home</label>
130
- <sort_order>80</sort_order>
131
- <show_in_default>1</show_in_default>
132
- <show_in_website>1</show_in_website>
133
- <show_in_store>1</show_in_store>
134
- <fields>
135
- <template>
136
- <label>Template</label>
137
- <frontend_type>select</frontend_type>
138
- <sort_order>81</sort_order>
139
- <show_in_default>1</show_in_default>
140
- <show_in_website>1</show_in_website>
141
- <show_in_store>1</show_in_store>
142
- <source_model>peerius_smartrecs/templates_home</source_model>
143
- <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
144
- <depends>
145
- <disable>0</disable>
146
- </depends>
147
- </template>
148
- <headline translate="Headline">
149
- <label>Title</label>
150
- <frontend_type>text</frontend_type>
151
- <sort_order>82</sort_order>
152
- <show_in_default>1</show_in_default>
153
- <show_in_website>1</show_in_website>
154
- <show_in_store>1</show_in_store>
155
- <tooltip>This will be used as the title of your widget</tooltip>
156
- <depends>
157
- <disable>0</disable>
158
- </depends>
159
- </headline>
160
- <max translate="Max number of products">
161
- <label>Number of products</label>
162
- <frontend_type>select</frontend_type>
163
- <sort_order>83</sort_order>
164
- <show_in_default>1</show_in_default>
165
- <show_in_website>1</show_in_website>
166
- <show_in_store>1</show_in_store>
167
- <source_model>peerius_smartrecs/max</source_model>
168
- <tooltip>Number of products that should be displayed</tooltip>
169
- <depends>
170
- <disable>0</disable>
171
- </depends>
172
- </max>
173
- <disable translate="Enable recommendations">
174
- <label>Enable recommendations</label>
175
- <frontend_type>select</frontend_type>
176
- <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
177
- <sort_order>84</sort_order>
178
- <show_in_default>1</show_in_default>
179
- <show_in_website>1</show_in_website>
180
- <show_in_store>1</show_in_store>
181
- </disable>
182
- </fields>
183
- </home>
184
- <category translate="Category">
185
- <label>Category</label>
186
- <sort_order>90</sort_order>
187
- <show_in_default>1</show_in_default>
188
- <show_in_website>1</show_in_website>
189
- <show_in_store>1</show_in_store>
190
- <fields>
191
- <template>
192
- <label>Template</label>
193
- <frontend_type>select</frontend_type>
194
- <sort_order>91</sort_order>
195
- <show_in_default>1</show_in_default>
196
- <show_in_website>1</show_in_website>
197
- <show_in_store>1</show_in_store>
198
- <source_model>peerius_smartrecs/templates_category</source_model>
199
- <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
200
- <depends>
201
- <disable>0</disable>
202
- </depends>
203
- </template>
204
- <headline translate="Headline">
205
- <label>Title</label>
206
- <frontend_type>text</frontend_type>
207
- <sort_order>92</sort_order>
208
- <show_in_default>1</show_in_default>
209
- <show_in_website>1</show_in_website>
210
- <show_in_store>1</show_in_store>
211
- <tooltip>This will be used as the title of your widget</tooltip>
212
- <depends>
213
- <disable>0</disable>
214
- </depends>
215
- </headline>
216
- <max translate="Number of products">
217
- <label>Number of products</label>
218
- <frontend_type>select</frontend_type>
219
- <sort_order>93</sort_order>
220
- <show_in_default>1</show_in_default>
221
- <show_in_website>1</show_in_website>
222
- <show_in_store>1</show_in_store>
223
- <source_model>peerius_smartrecs/max</source_model>
224
- <tooltip>Number of products that should be displayed</tooltip>
225
- <depends>
226
- <disable>0</disable>
227
- </depends>
228
- </max>
229
- <disable translate="Enable recommendations">
230
- <label>Enable recommendations</label>
231
- <frontend_type>select</frontend_type>
232
- <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
233
- <sort_order>94</sort_order>
234
- <show_in_default>1</show_in_default>
235
- <show_in_website>1</show_in_website>
236
- <show_in_store>1</show_in_store>
237
- </disable>
238
- </fields>
239
- </category>
240
- <product>
241
- <label>Product Widget 1</label>
242
- <sort_order>101</sort_order>
243
- <show_in_default>1</show_in_default>
244
- <show_in_website>1</show_in_website>
245
- <show_in_store>1</show_in_store>
246
- <!--<comment><![CDATA[<a href="/index.php/?peeriuspreview" target="_blank"><em>Preview</em></a>]]></comment>-->
247
- <fields>
248
- <template>
249
- <label>Template</label>
250
- <frontend_type>select</frontend_type>
251
- <sort_order>102</sort_order>
252
- <show_in_default>1</show_in_default>
253
- <show_in_website>1</show_in_website>
254
- <show_in_store>1</show_in_store>
255
- <source_model>peerius_smartrecs/templates_product1</source_model>
256
- <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
257
- <depends>
258
- <disable>0</disable>
259
- </depends>
260
- </template>
261
- <headline translate="Headline">
262
- <label>Title</label>
263
- <frontend_type>text</frontend_type>
264
- <sort_order>103</sort_order>
265
- <show_in_default>1</show_in_default>
266
- <show_in_website>1</show_in_website>
267
- <show_in_store>1</show_in_store>
268
- <tooltip>This will be used as the title of your widget</tooltip>
269
- <depends>
270
- <disable>0</disable>
271
- </depends>
272
- </headline>
273
- <max translate="Number of products">
274
- <label>Number of products</label>
275
- <frontend_type>select</frontend_type>
276
- <sort_order>104</sort_order>
277
- <show_in_default>1</show_in_default>
278
- <show_in_website>1</show_in_website>
279
- <show_in_store>1</show_in_store>
280
- <source_model>peerius_smartrecs/max</source_model>
281
- <tooltip>Number of products that should be displayed</tooltip>
282
- <depends>
283
- <disable>0</disable>
284
- </depends>
285
- </max>
286
- <disable translate="Enable recommendations">
287
- <label>Enable recommendations</label>
288
- <frontend_type>select</frontend_type>
289
- <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
290
- <sort_order>105</sort_order>
291
- <show_in_default>1</show_in_default>
292
- <show_in_website>1</show_in_website>
293
- <show_in_store>1</show_in_store>
294
- </disable>
295
- </fields>
296
- </product>
297
- <product2>
298
- <label>Product Widget 2</label>
299
- <sort_order>110</sort_order>
300
- <show_in_default>1</show_in_default>
301
- <show_in_website>1</show_in_website>
302
- <show_in_store>1</show_in_store>
303
- <!--<comment><![CDATA[<a href="/index.php/?peeriuspreview" target="_blank"><em>Preview</em></a>]]></comment>-->
304
- <fields>
305
- <template>
306
- <label>Template</label>
307
- <frontend_type>select</frontend_type>
308
- <sort_order>113</sort_order>
309
- <show_in_default>1</show_in_default>
310
- <show_in_website>1</show_in_website>
311
- <show_in_store>1</show_in_store>
312
- <source_model>peerius_smartrecs/templates_product2</source_model>
313
- <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
314
- <depends>
315
- <disable>0</disable>
316
- </depends>
317
- </template>
318
- <headline translate="Headline">
319
- <label>Title</label>
320
- <frontend_type>text</frontend_type>
321
- <sort_order>114</sort_order>
322
- <show_in_default>1</show_in_default>
323
- <show_in_website>1</show_in_website>
324
- <show_in_store>1</show_in_store>
325
- <tooltip>This will be used as the title of your widget</tooltip>
326
- <depends>
327
- <disable>0</disable>
328
- </depends>
329
- </headline>
330
- <max translate="Number of products">
331
- <label>Number of products</label>
332
- <frontend_type>select</frontend_type>
333
- <sort_order>115</sort_order>
334
- <show_in_default>1</show_in_default>
335
- <show_in_website>1</show_in_website>
336
- <show_in_store>1</show_in_store>
337
- <source_model>peerius_smartrecs/max</source_model>
338
- <tooltip>Number of products that should be displayed</tooltip>
339
- <depends>
340
- <disable>0</disable>
341
- </depends>
342
- </max>
343
- <disable translate="Enable recommendations">
344
- <label>Enable recommendations</label>
345
- <frontend_type>select</frontend_type>
346
- <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
347
- <sort_order>116</sort_order>
348
- <show_in_default>1</show_in_default>
349
- <show_in_website>1</show_in_website>
350
- <show_in_store>1</show_in_store>
351
- </disable>
352
- </fields>
353
- </product2>
354
- <!--<wishlist>
 
 
 
 
 
 
 
 
 
355
  <label>Wishlist</label>
356
  <sort_order>110</sort_order>
357
  <show_in_default>1</show_in_default>
@@ -396,76 +405,76 @@
396
  </disable>
397
  </fields>
398
  </wishlist>-->
399
- <search>
400
- <label>Search</label>
401
- <sort_order>120</sort_order>
402
- <show_in_default>1</show_in_default>
403
- <show_in_website>1</show_in_website>
404
- <show_in_store>1</show_in_store>
405
- <fields>
406
- <template>
407
- <label>Template</label>
408
- <frontend_type>select</frontend_type>
409
- <sort_order>121</sort_order>
410
- <show_in_default>1</show_in_default>
411
- <show_in_website>1</show_in_website>
412
- <show_in_store>1</show_in_store>
413
- <source_model>peerius_smartrecs/templates_search</source_model>
414
- <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
415
- <depends>
416
- <disable>0</disable>
417
- </depends>
418
- </template>
419
- <headline translate="Headline">
420
- <label>Title</label>
421
- <frontend_type>text</frontend_type>
422
- <sort_order>122</sort_order>
423
- <show_in_default>1</show_in_default>
424
- <show_in_website>1</show_in_website>
425
- <show_in_store>1</show_in_store>
426
- <tooltip>This will be used as title of your widget</tooltip>
427
- <depends>
428
- <disable>0</disable>
429
- </depends>
430
- </headline>
431
- <max translate="Number of products">
432
- <label>Number of products</label>
433
- <frontend_type>select</frontend_type>
434
- <sort_order>123</sort_order>
435
- <show_in_default>1</show_in_default>
436
- <show_in_website>1</show_in_website>
437
- <show_in_store>1</show_in_store>
438
- <source_model>peerius_smartrecs/max</source_model>
439
- <tooltip>Number of products that should be displayed</tooltip>
440
- <depends>
441
- <disable>0</disable>
442
- </depends>
443
- </max>
444
- <success translate="Show for successful search results">
445
- <label>Show for successful search results</label>
446
- <frontend_type>select</frontend_type>
447
- <source_model>adminhtml/system_config_source_yesno</source_model>
448
- <sort_order>124</sort_order>
449
- <show_in_default>1</show_in_default>
450
- <show_in_website>1</show_in_website>
451
- <show_in_store>1</show_in_store>
452
- <tooltip>If this is set to "Yes", the search widget will be displayed on the search page. Default is "No", which displays the search widget only if the search results are empty</tooltip>
453
- <depends>
454
- <disable>0</disable>
455
- </depends>
456
- </success>
457
- <disable translate="Enable recommendations">
458
- <label>Enable recommendations</label>
459
- <frontend_type>select</frontend_type>
460
- <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
461
- <sort_order>125</sort_order>
462
- <show_in_default>1</show_in_default>
463
- <show_in_website>1</show_in_website>
464
- <show_in_store>1</show_in_store>
465
- </disable>
466
- </fields>
467
- </search>
468
- <!--<checkout>
469
  <label>Checkout</label>
470
  <sort_order>130</sort_order>
471
  <show_in_default>1</show_in_default>
@@ -507,63 +516,63 @@
507
  </disable>
508
  </fields>
509
  </checkout>-->
510
- <basket>
511
- <label>Basket</label>
512
- <sort_order>140</sort_order>
513
- <show_in_default>1</show_in_default>
514
- <show_in_website>1</show_in_website>
515
- <show_in_store>1</show_in_store>
516
- <fields>
517
- <template>
518
- <label>Template</label>
519
- <frontend_type>select</frontend_type>
520
- <sort_order>141</sort_order>
521
- <show_in_default>1</show_in_default>
522
- <show_in_website>1</show_in_website>
523
- <show_in_store>1</show_in_store>
524
- <source_model>peerius_smartrecs/templates_basket</source_model>
525
- <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
526
- <depends>
527
- <disable>0</disable>
528
- </depends>
529
- </template>
530
- <headline translate="Headline">
531
- <label>Title</label>
532
- <frontend_type>text</frontend_type>
533
- <sort_order>142</sort_order>
534
- <show_in_default>1</show_in_default>
535
- <show_in_website>1</show_in_website>
536
- <show_in_store>1</show_in_store>
537
- <tooltip>This will be used as title of your widget</tooltip>
538
- <depends>
539
- <disable>0</disable>
540
- </depends>
541
- </headline>
542
- <max translate="Number of products">
543
- <label>Number of products</label>
544
- <frontend_type>select</frontend_type>
545
- <sort_order>143</sort_order>
546
- <show_in_default>1</show_in_default>
547
- <show_in_website>1</show_in_website>
548
- <show_in_store>1</show_in_store>
549
- <source_model>peerius_smartrecs/max</source_model>
550
- <tooltip>Number of products that should be displayed</tooltip>
551
- <depends>
552
- <disable>0</disable>
553
- </depends>
554
- </max>
555
- <disable translate="Enable recommendations">
556
- <label>Enable recommendations</label>
557
- <frontend_type>select</frontend_type>
558
- <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
559
- <sort_order>144</sort_order>
560
- <show_in_default>1</show_in_default>
561
- <show_in_website>1</show_in_website>
562
- <show_in_store>1</show_in_store>
563
- </disable>
564
- </fields>
565
- </basket>
566
- <!--<order>
567
  <label>Order</label>
568
  <sort_order>150</sort_order>
569
  <show_in_default>1</show_in_default>
@@ -605,7 +614,7 @@
605
  </disable>
606
  </fields>
607
  </order>-->
608
- <!--<other>
609
  <label>Other</label>
610
  <sort_order>160</sort_order>
611
  <show_in_default>1</show_in_default>
@@ -647,7 +656,7 @@
647
  </disable>
648
  </fields>
649
  </other>-->
650
- </groups>
651
- </peerius>
652
- </sections>
653
- </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <tabs>
4
+ <peerius translate="label">
5
+ <label>Peerius</label>
6
+ <sort_order>15</sort_order>
7
+ </peerius>
8
+ </tabs>
9
+ <sections>
10
+ <peerius translate="Peerius" module="adminhtml">
11
+ <label>Peerius Connect Admin</label>
12
+ <tab>peerius</tab>
13
+ <sort_order>10</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <general translate="General">
19
+ <label>General</label>
20
+ <sort_order>50</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <fields>
25
+ <client_name translate="Client Name">
26
+ <label>Client Name</label>
27
+ <comment>The Peerius client name</comment>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>51</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
+ </client_name>
34
+ <token translate="Client Token">
35
+ <backend_model>peerius_smartrecs/token</backend_model>
36
+ <label>Client Token</label>
37
+ <comment>The Peerius client token</comment>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>52</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </token>
44
+ <testmode translate="Test Mode">
45
+ <label>Test Mode</label>
46
+ <frontend_type>select</frontend_type>
47
+ <sort_order>53</sort_order>
48
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <tooltip><![CDATA[Enable Test Mode if you would like to test recommendations from the IP address of the PC or laptop that you are currently logged on. If you would like to test from a different machine, please use the 'peeriuspreview' parameter as shown:, e.g. www.yourshop.com/?peeriuspreview.<br><br>Only Disable Test Mode if you are ready to go live with Peerius SMART-recs.]]></tooltip>
53
+ </testmode>
54
+ <cronjob translate="Feed generation">
55
+ <label>Feed generation</label>
56
+ <tooltip>Specify the time when Peerius should create and import the feed</tooltip>
57
+ <frontend_type>select</frontend_type>
58
+ <source_model>peerius_smartrecs/system_config_source_dropdown_values</source_model>
59
+ <sort_order>54</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </cronjob>
64
+ <widgetheight translate="Recommendation widget heights">
65
+ <label>Recommendation widget heights</label>
66
+ <comment>The heights of each individual recommendation widget</comment>
67
+ <frontend_type>text</frontend_type>
68
+ <depends>
69
+ <field_name>1</field_name>
70
+ </depends>
71
+ <sort_order>55</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </widgetheight>
76
+ <registrationstatus translate="registrationstatus">
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>56</sort_order>
79
+ <depends>
80
+ <field_name>1</field_name>
81
+ </depends>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </registrationstatus>
86
+ <registrationerror translate="registrationerror">
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>56</sort_order>
89
+ <depends>
90
+ <field_name>1</field_name>
91
+ </depends>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </registrationerror>
96
+ <enableall translate="Disable All">
97
+ <label>Enable recommendations</label>
98
+ <frontend_type>select</frontend_type>
99
+ <source_model>adminhtml/system_config_source_yesno</source_model>
100
+ <sort_order>57</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </enableall>
105
+ <getrecsasskusonly translate="Get Recommendations as SKUs">
106
+ <label>Get Recommendations as SKUs</label>
107
+ <frontend_type>select</frontend_type>
108
+ <source_model>adminhtml/system_config_source_yesno</source_model>
109
+ <sort_order>58</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ <tooltip><![CDATA[If you do not want Peerius to return recommendations as SKUs that are used to retrieve product details from Magento. Instead, you want to display the product details returned by Peerius, please change this to 'No'.]]></tooltip>
114
+ </getrecsasskusonly>
115
+ <adminip translate="adminip">
116
+ <frontend_type>text</frontend_type>
117
+ <depends>
118
+ <field_name>1</field_name>
119
+ </depends>
120
+ <sort_order>59</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </adminip>
125
+ <creatingfeed translate="creatingfeed">
126
+ <frontend_type>text</frontend_type>
127
+ <sort_order>60</sort_order>
128
+ <depends>
129
+ <field_name>1</field_name>
130
+ </depends>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ </creatingfeed>
135
+ </fields>
136
+ </general>
137
+ <home translate="Home">
138
+ <label>Home</label>
139
+ <sort_order>80</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ <fields>
144
+ <template>
145
+ <label>Template</label>
146
+ <frontend_type>select</frontend_type>
147
+ <sort_order>81</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ <source_model>peerius_smartrecs/templates_home</source_model>
152
+ <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
153
+ <depends>
154
+ <disable>0</disable>
155
+ </depends>
156
+ </template>
157
+ <headline translate="Headline">
158
+ <label>Title</label>
159
+ <frontend_type>text</frontend_type>
160
+ <sort_order>82</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ <tooltip>This will be used as the title of your widget</tooltip>
165
+ <depends>
166
+ <disable>0</disable>
167
+ </depends>
168
+ </headline>
169
+ <max translate="Max number of products">
170
+ <label>Number of products</label>
171
+ <frontend_type>select</frontend_type>
172
+ <sort_order>83</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>1</show_in_store>
176
+ <source_model>peerius_smartrecs/max</source_model>
177
+ <tooltip>Number of products that should be displayed</tooltip>
178
+ <depends>
179
+ <disable>0</disable>
180
+ </depends>
181
+ </max>
182
+ <disable translate="Enable recommendations">
183
+ <label>Enable recommendations</label>
184
+ <frontend_type>select</frontend_type>
185
+ <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
186
+ <sort_order>84</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </disable>
191
+ </fields>
192
+ </home>
193
+ <category translate="Category">
194
+ <label>Category</label>
195
+ <sort_order>90</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ <fields>
200
+ <template>
201
+ <label>Template</label>
202
+ <frontend_type>select</frontend_type>
203
+ <sort_order>91</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</show_in_store>
207
+ <source_model>peerius_smartrecs/templates_category</source_model>
208
+ <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
209
+ <depends>
210
+ <disable>0</disable>
211
+ </depends>
212
+ </template>
213
+ <headline translate="Headline">
214
+ <label>Title</label>
215
+ <frontend_type>text</frontend_type>
216
+ <sort_order>92</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <show_in_store>1</show_in_store>
220
+ <tooltip>This will be used as the title of your widget</tooltip>
221
+ <depends>
222
+ <disable>0</disable>
223
+ </depends>
224
+ </headline>
225
+ <max translate="Number of products">
226
+ <label>Number of products</label>
227
+ <frontend_type>select</frontend_type>
228
+ <sort_order>93</sort_order>
229
+ <show_in_default>1</show_in_default>
230
+ <show_in_website>1</show_in_website>
231
+ <show_in_store>1</show_in_store>
232
+ <source_model>peerius_smartrecs/max</source_model>
233
+ <tooltip>Number of products that should be displayed</tooltip>
234
+ <depends>
235
+ <disable>0</disable>
236
+ </depends>
237
+ </max>
238
+ <disable translate="Enable recommendations">
239
+ <label>Enable recommendations</label>
240
+ <frontend_type>select</frontend_type>
241
+ <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
242
+ <sort_order>94</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>1</show_in_website>
245
+ <show_in_store>1</show_in_store>
246
+ </disable>
247
+ </fields>
248
+ </category>
249
+ <product>
250
+ <label>Product Widget 1</label>
251
+ <sort_order>101</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ <!--<comment><![CDATA[<a href="/index.php/?peeriuspreview" target="_blank"><em>Preview</em></a>]]></comment>-->
256
+ <fields>
257
+ <template>
258
+ <label>Template</label>
259
+ <frontend_type>select</frontend_type>
260
+ <sort_order>102</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ <source_model>peerius_smartrecs/templates_product1</source_model>
265
+ <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
266
+ <depends>
267
+ <disable>0</disable>
268
+ </depends>
269
+ </template>
270
+ <headline translate="Headline">
271
+ <label>Title</label>
272
+ <frontend_type>text</frontend_type>
273
+ <sort_order>103</sort_order>
274
+ <show_in_default>1</show_in_default>
275
+ <show_in_website>1</show_in_website>
276
+ <show_in_store>1</show_in_store>
277
+ <tooltip>This will be used as the title of your widget</tooltip>
278
+ <depends>
279
+ <disable>0</disable>
280
+ </depends>
281
+ </headline>
282
+ <max translate="Number of products">
283
+ <label>Number of products</label>
284
+ <frontend_type>select</frontend_type>
285
+ <sort_order>104</sort_order>
286
+ <show_in_default>1</show_in_default>
287
+ <show_in_website>1</show_in_website>
288
+ <show_in_store>1</show_in_store>
289
+ <source_model>peerius_smartrecs/max</source_model>
290
+ <tooltip>Number of products that should be displayed</tooltip>
291
+ <depends>
292
+ <disable>0</disable>
293
+ </depends>
294
+ </max>
295
+ <disable translate="Enable recommendations">
296
+ <label>Enable recommendations</label>
297
+ <frontend_type>select</frontend_type>
298
+ <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
299
+ <sort_order>105</sort_order>
300
+ <show_in_default>1</show_in_default>
301
+ <show_in_website>1</show_in_website>
302
+ <show_in_store>1</show_in_store>
303
+ </disable>
304
+ </fields>
305
+ </product>
306
+ <product2>
307
+ <label>Product Widget 2</label>
308
+ <sort_order>110</sort_order>
309
+ <show_in_default>1</show_in_default>
310
+ <show_in_website>1</show_in_website>
311
+ <show_in_store>1</show_in_store>
312
+ <!--<comment><![CDATA[<a href="/index.php/?peeriuspreview" target="_blank"><em>Preview</em></a>]]></comment>-->
313
+ <fields>
314
+ <template>
315
+ <label>Template</label>
316
+ <frontend_type>select</frontend_type>
317
+ <sort_order>113</sort_order>
318
+ <show_in_default>1</show_in_default>
319
+ <show_in_website>1</show_in_website>
320
+ <show_in_store>1</show_in_store>
321
+ <source_model>peerius_smartrecs/templates_product2</source_model>
322
+ <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
323
+ <depends>
324
+ <disable>0</disable>
325
+ </depends>
326
+ </template>
327
+ <headline translate="Headline">
328
+ <label>Title</label>
329
+ <frontend_type>text</frontend_type>
330
+ <sort_order>114</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_website>1</show_in_website>
333
+ <show_in_store>1</show_in_store>
334
+ <tooltip>This will be used as the title of your widget</tooltip>
335
+ <depends>
336
+ <disable>0</disable>
337
+ </depends>
338
+ </headline>
339
+ <max translate="Number of products">
340
+ <label>Number of products</label>
341
+ <frontend_type>select</frontend_type>
342
+ <sort_order>115</sort_order>
343
+ <show_in_default>1</show_in_default>
344
+ <show_in_website>1</show_in_website>
345
+ <show_in_store>1</show_in_store>
346
+ <source_model>peerius_smartrecs/max</source_model>
347
+ <tooltip>Number of products that should be displayed</tooltip>
348
+ <depends>
349
+ <disable>0</disable>
350
+ </depends>
351
+ </max>
352
+ <disable translate="Enable recommendations">
353
+ <label>Enable recommendations</label>
354
+ <frontend_type>select</frontend_type>
355
+ <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
356
+ <sort_order>116</sort_order>
357
+ <show_in_default>1</show_in_default>
358
+ <show_in_website>1</show_in_website>
359
+ <show_in_store>1</show_in_store>
360
+ </disable>
361
+ </fields>
362
+ </product2>
363
+ <!--<wishlist>
364
  <label>Wishlist</label>
365
  <sort_order>110</sort_order>
366
  <show_in_default>1</show_in_default>
405
  </disable>
406
  </fields>
407
  </wishlist>-->
408
+ <search>
409
+ <label>Search</label>
410
+ <sort_order>120</sort_order>
411
+ <show_in_default>1</show_in_default>
412
+ <show_in_website>1</show_in_website>
413
+ <show_in_store>1</show_in_store>
414
+ <fields>
415
+ <template>
416
+ <label>Template</label>
417
+ <frontend_type>select</frontend_type>
418
+ <sort_order>121</sort_order>
419
+ <show_in_default>1</show_in_default>
420
+ <show_in_website>1</show_in_website>
421
+ <show_in_store>1</show_in_store>
422
+ <source_model>peerius_smartrecs/templates_search</source_model>
423
+ <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
424
+ <depends>
425
+ <disable>0</disable>
426
+ </depends>
427
+ </template>
428
+ <headline translate="Headline">
429
+ <label>Title</label>
430
+ <frontend_type>text</frontend_type>
431
+ <sort_order>122</sort_order>
432
+ <show_in_default>1</show_in_default>
433
+ <show_in_website>1</show_in_website>
434
+ <show_in_store>1</show_in_store>
435
+ <tooltip>This will be used as title of your widget</tooltip>
436
+ <depends>
437
+ <disable>0</disable>
438
+ </depends>
439
+ </headline>
440
+ <max translate="Number of products">
441
+ <label>Number of products</label>
442
+ <frontend_type>select</frontend_type>
443
+ <sort_order>123</sort_order>
444
+ <show_in_default>1</show_in_default>
445
+ <show_in_website>1</show_in_website>
446
+ <show_in_store>1</show_in_store>
447
+ <source_model>peerius_smartrecs/max</source_model>
448
+ <tooltip>Number of products that should be displayed</tooltip>
449
+ <depends>
450
+ <disable>0</disable>
451
+ </depends>
452
+ </max>
453
+ <success translate="Show for successful search results">
454
+ <label>Show for successful search results</label>
455
+ <frontend_type>select</frontend_type>
456
+ <source_model>adminhtml/system_config_source_yesno</source_model>
457
+ <sort_order>124</sort_order>
458
+ <show_in_default>1</show_in_default>
459
+ <show_in_website>1</show_in_website>
460
+ <show_in_store>1</show_in_store>
461
+ <tooltip>If this is set to "Yes", the search widget will be displayed on the search page. Default is "No", which displays the search widget only if the search results are empty</tooltip>
462
+ <depends>
463
+ <disable>0</disable>
464
+ </depends>
465
+ </success>
466
+ <disable translate="Enable recommendations">
467
+ <label>Enable recommendations</label>
468
+ <frontend_type>select</frontend_type>
469
+ <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
470
+ <sort_order>125</sort_order>
471
+ <show_in_default>1</show_in_default>
472
+ <show_in_website>1</show_in_website>
473
+ <show_in_store>1</show_in_store>
474
+ </disable>
475
+ </fields>
476
+ </search>
477
+ <!--<checkout>
478
  <label>Checkout</label>
479
  <sort_order>130</sort_order>
480
  <show_in_default>1</show_in_default>
516
  </disable>
517
  </fields>
518
  </checkout>-->
519
+ <basket>
520
+ <label>Basket</label>
521
+ <sort_order>140</sort_order>
522
+ <show_in_default>1</show_in_default>
523
+ <show_in_website>1</show_in_website>
524
+ <show_in_store>1</show_in_store>
525
+ <fields>
526
+ <template>
527
+ <label>Template</label>
528
+ <frontend_type>select</frontend_type>
529
+ <sort_order>141</sort_order>
530
+ <show_in_default>1</show_in_default>
531
+ <show_in_website>1</show_in_website>
532
+ <show_in_store>1</show_in_store>
533
+ <source_model>peerius_smartrecs/templates_basket</source_model>
534
+ <tooltip>Edit template files in /frontend/base/default/template/smartrecs/recs/</tooltip>
535
+ <depends>
536
+ <disable>0</disable>
537
+ </depends>
538
+ </template>
539
+ <headline translate="Headline">
540
+ <label>Title</label>
541
+ <frontend_type>text</frontend_type>
542
+ <sort_order>142</sort_order>
543
+ <show_in_default>1</show_in_default>
544
+ <show_in_website>1</show_in_website>
545
+ <show_in_store>1</show_in_store>
546
+ <tooltip>This will be used as title of your widget</tooltip>
547
+ <depends>
548
+ <disable>0</disable>
549
+ </depends>
550
+ </headline>
551
+ <max translate="Number of products">
552
+ <label>Number of products</label>
553
+ <frontend_type>select</frontend_type>
554
+ <sort_order>143</sort_order>
555
+ <show_in_default>1</show_in_default>
556
+ <show_in_website>1</show_in_website>
557
+ <show_in_store>1</show_in_store>
558
+ <source_model>peerius_smartrecs/max</source_model>
559
+ <tooltip>Number of products that should be displayed</tooltip>
560
+ <depends>
561
+ <disable>0</disable>
562
+ </depends>
563
+ </max>
564
+ <disable translate="Enable recommendations">
565
+ <label>Enable recommendations</label>
566
+ <frontend_type>select</frontend_type>
567
+ <source_model>peerius_smartrecs/system_config_source_yesno</source_model>
568
+ <sort_order>144</sort_order>
569
+ <show_in_default>1</show_in_default>
570
+ <show_in_website>1</show_in_website>
571
+ <show_in_store>1</show_in_store>
572
+ </disable>
573
+ </fields>
574
+ </basket>
575
+ <!--<order>
576
  <label>Order</label>
577
  <sort_order>150</sort_order>
578
  <show_in_default>1</show_in_default>
614
  </disable>
615
  </fields>
616
  </order>-->
617
+ <!--<other>
618
  <label>Other</label>
619
  <sort_order>160</sort_order>
620
  <show_in_default>1</show_in_default>
656
  </disable>
657
  </fields>
658
  </other>-->
659
+ </groups>
660
+ </peerius>
661
+ </sections>
662
+ </config>
app/design/adminhtml/default/default/template/smartrecs/config.phtml CHANGED
@@ -22,18 +22,21 @@
22
 
23
  function togglePeeriusSections(show) {
24
  var sections = $$('.section-config');
 
25
  var sectionCnt = sections.length;
26
  if (!show)
27
  {
28
  for (i = 1; i < sectionCnt; i++) {
29
  sections[i].hide();
30
  }
 
31
  }
32
  else
33
  {
34
  for (i = 1; i < sectionCnt; i++) {
35
  sections[i].show();
36
  }
 
37
  }
38
  }
39
 
@@ -58,7 +61,8 @@ if (!Mage::registry('peerius_404')) {
58
  media="all">
59
 
60
  <div style="background: #e9eaeb none repeat scroll 0 0;box-shadow:0 0 50px 0 #fff inset">
61
- <div class="navbar-inner"><a class="brand" style="float:left;margin:0;" href="https://www.peerius.com/">Peerius.com</a></div></div>
 
62
  <br style="clear:both"><br><p>
63
 
64
  <?php if (Mage::getStoreConfig('peerius/general/registrationstatus') < 1) { ?>
22
 
23
  function togglePeeriusSections(show) {
24
  var sections = $$('.section-config');
25
+ var recsAsSKUsList = $$('#row_peerius_general_getrecsasskusonly');
26
  var sectionCnt = sections.length;
27
  if (!show)
28
  {
29
  for (i = 1; i < sectionCnt; i++) {
30
  sections[i].hide();
31
  }
32
+ recsAsSKUsList[0].hide();
33
  }
34
  else
35
  {
36
  for (i = 1; i < sectionCnt; i++) {
37
  sections[i].show();
38
  }
39
+ recsAsSKUsList[0].show();
40
  }
41
  }
42
 
61
  media="all">
62
 
63
  <div style="background: #e9eaeb none repeat scroll 0 0;box-shadow:0 0 50px 0 #fff inset">
64
+ <div class="navbar-inner"><a class="peeriusBrand" style="" href="https://www.peerius.com/">
65
+ <span class="peeriusBrandText">Peerius Connect Admin</span></a></div></div>
66
  <br style="clear:both"><br><p>
67
 
68
  <?php if (Mage::getStoreConfig('peerius/general/registrationstatus') < 1) { ?>
app/design/frontend/base/default/template/smartrecs/recs/basket.phtml CHANGED
@@ -7,13 +7,16 @@ if ($this->getRequest()->getParam('recs')) {
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
- $refCode2id[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
13
-
14
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
 
 
15
  ?>
16
- <?php if($this->getItems()->getSize()): ?>
 
 
17
  <div class="block block-recommendations">
18
  <div class="block-title">
19
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
@@ -22,14 +25,10 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
22
  <ul class="peerius-products-grid">
23
  <?php foreach($this->getItems() as $_item): ?>
24
  <li class="peerius-item">
25
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
26
- <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
27
  <div class="product-details">
28
- </p>
29
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
30
- <!--<?php if ($this->helper('wishlist')->isAllow()) : ?>
31
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>-->
32
- <?php endif; ?>
33
  </div>
34
  </li>
35
  <?php endforeach ?>
@@ -37,4 +36,47 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
37
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
38
  </div>
39
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <?php endif ?>
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
+ $clickId[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
 
13
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
14
+ $curSymbol = $this->getCurrencySymbol();
15
+ $curCode = $this->getCurrencyCode();
16
  ?>
17
+ <?php
18
+ /*Only Edit this block if you are rendering Peerius Recommendations after retrieving the product details from magento */
19
+ if($this->isRecContentRefCodeOnly()): ?>
20
  <div class="block block-recommendations">
21
  <div class="block-title">
22
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
25
  <ul class="peerius-products-grid">
26
  <?php foreach($this->getItems() as $_item): ?>
27
  <li class="peerius-item">
28
+ <a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
29
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
30
  <div class="product-details">
 
31
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
 
 
 
32
  </div>
33
  </li>
34
  <?php endforeach ?>
36
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
37
  </div>
38
  </div>
39
+ <?php
40
+ /*Only Edit this block if you are rendering all product details as sent by Peerius Recommendations .i.e., no Magento lookup done here */
41
+ else: ?>
42
+ <div class="block block-recommendations">
43
+ <div class="block-title">
44
+ <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
45
+ </div>
46
+ <div class="block-content">
47
+ <ul class="peerius-products-grid">
48
+ <?php $json_recs = json_decode($this->getRequest()->getParam('recs'));
49
+ $maxRecs = $this->getRequest()->getParam('max');
50
+ $ctr = 1;
51
+ foreach($json_recs as $_item): ?>
52
+ <?php $cId = $clickId[$_item->refCode]?>
53
+ <li class="peerius-item">
54
+ <a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>" title="<?php echo $this->escapeHtml($_item->title) ?>" class="peerius-product-image">
55
+ <img src="<?php echo $_item->img ?>" width="135" alt="<?php echo $this->escapeHtml($_item->title) ?>" />
56
+ </a>
57
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>"><?php echo $this->escapeHtml($_item->title) ?></a></h2>
58
+ <div class="product-details">
59
+ <div class="price-box">
60
+ <?php if($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice): ?>
61
+ <p class="old-price">
62
+ <span class="price-label">Regular Price:</span>
63
+ <span class="price" id="old-price-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->unitPrice ?></span>
64
+ </p>
65
+ <?php endif ?>
66
+ <p class="special-price">
67
+ <span class="price-label"><?php echo ($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice ? 'Special ': '') ?>Price:</span>
68
+ <span class="price-including-tax">
69
+ <span class="label">Incl. Tax:</span>
70
+ <span class="price" id="price-including-tax-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->salePrice ?></span>
71
+ </span>
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </li>
76
+ <?php if($ctr++ == $maxRecs) break;
77
+ endforeach ?>
78
+ </ul>
79
+ <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
80
+ </div>
81
+ </div>
82
  <?php endif ?>
app/design/frontend/base/default/template/smartrecs/recs/category.phtml CHANGED
@@ -7,13 +7,16 @@ if ($this->getRequest()->getParam('recs')) {
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
- $refCode2id[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
13
-
14
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
 
 
15
  ?>
16
- <?php if($this->getItems()->getSize()): ?>
 
 
17
  <div class="block block-recommendations">
18
  <div class="block-title">
19
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
@@ -22,14 +25,10 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
22
  <ul class="peerius-products-grid">
23
  <?php foreach($this->getItems() as $_item): ?>
24
  <li class="peerius-item">
25
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
26
- <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
27
  <div class="product-details">
28
- </p>
29
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
30
- <!--<?php if ($this->helper('wishlist')->isAllow()) : ?>
31
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>-->
32
- <?php endif; ?>
33
  </div>
34
  </li>
35
  <?php endforeach ?>
@@ -37,4 +36,47 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
37
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
38
  </div>
39
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <?php endif ?>
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
+ $clickId[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
 
13
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
14
+ $curSymbol = $this->getCurrencySymbol();
15
+ $curCode = $this->getCurrencyCode();
16
  ?>
17
+ <?php
18
+ /*Only Edit this block if you are rendering Peerius Recommendations after retrieving the product details from magento */
19
+ if($this->isRecContentRefCodeOnly()): ?>
20
  <div class="block block-recommendations">
21
  <div class="block-title">
22
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
25
  <ul class="peerius-products-grid">
26
  <?php foreach($this->getItems() as $_item): ?>
27
  <li class="peerius-item">
28
+ <a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
29
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
30
  <div class="product-details">
 
31
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
 
 
 
32
  </div>
33
  </li>
34
  <?php endforeach ?>
36
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
37
  </div>
38
  </div>
39
+ <?php
40
+ /*Only Edit this block if you are rendering all product details as sent by Peerius Recommendations .i.e., no Magento lookup done here */
41
+ else: ?>
42
+ <div class="block block-recommendations">
43
+ <div class="block-title">
44
+ <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
45
+ </div>
46
+ <div class="block-content">
47
+ <ul class="peerius-products-grid">
48
+ <?php $json_recs = json_decode($this->getRequest()->getParam('recs'));
49
+ $maxRecs = $this->getRequest()->getParam('max');
50
+ $ctr = 1;
51
+ foreach($json_recs as $_item): ?>
52
+ <?php $cId = $clickId[$_item->refCode]?>
53
+ <li class="peerius-item">
54
+ <a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>" title="<?php echo $this->escapeHtml($_item->title) ?>" class="peerius-product-image">
55
+ <img src="<?php echo $_item->img ?>" width="135" alt="<?php echo $this->escapeHtml($_item->title) ?>" />
56
+ </a>
57
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>"><?php echo $this->escapeHtml($_item->title) ?></a></h2>
58
+ <div class="product-details">
59
+ <div class="price-box">
60
+ <?php if($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice): ?>
61
+ <p class="old-price">
62
+ <span class="price-label">Regular Price:</span>
63
+ <span class="price" id="old-price-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->unitPrice ?></span>
64
+ </p>
65
+ <?php endif ?>
66
+ <p class="special-price">
67
+ <span class="price-label"><?php echo ($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice ? 'Special ': '') ?>Price:</span>
68
+ <span class="price-including-tax">
69
+ <span class="label">Incl. Tax:</span>
70
+ <span class="price" id="price-including-tax-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->salePrice ?></span>
71
+ </span>
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </li>
76
+ <?php if($ctr++ == $maxRecs) break;
77
+ endforeach ?>
78
+ </ul>
79
+ <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
80
+ </div>
81
+ </div>
82
  <?php endif ?>
app/design/frontend/base/default/template/smartrecs/recs/home.phtml CHANGED
@@ -7,13 +7,16 @@ if ($this->getRequest()->getParam('recs')) {
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
- $refCode2id[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
13
-
14
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
 
 
15
  ?>
16
- <?php if($this->getItems()->getSize()): ?>
 
 
17
  <div class="block block-recommendations">
18
  <div class="block-title">
19
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
@@ -22,14 +25,10 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
22
  <ul class="peerius-products-grid">
23
  <?php foreach($this->getItems() as $_item): ?>
24
  <li class="peerius-item">
25
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
26
- <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
27
  <div class="product-details">
28
- </p>
29
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
30
- <!--<?php if ($this->helper('wishlist')->isAllow()) : ?>
31
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>-->
32
- <?php endif; ?>
33
  </div>
34
  </li>
35
  <?php endforeach ?>
@@ -37,4 +36,47 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
37
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
38
  </div>
39
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <?php endif ?>
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
+ $clickId[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
 
13
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
14
+ $curSymbol = $this->getCurrencySymbol();
15
+ $curCode = $this->getCurrencyCode();
16
  ?>
17
+ <?php
18
+ /*Only Edit this block if you are rendering Peerius Recommendations after retrieving the product details from magento */
19
+ if($this->isRecContentRefCodeOnly()): ?>
20
  <div class="block block-recommendations">
21
  <div class="block-title">
22
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
25
  <ul class="peerius-products-grid">
26
  <?php foreach($this->getItems() as $_item): ?>
27
  <li class="peerius-item">
28
+ <a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
29
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
30
  <div class="product-details">
 
31
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
 
 
 
32
  </div>
33
  </li>
34
  <?php endforeach ?>
36
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
37
  </div>
38
  </div>
39
+ <?php
40
+ /*Only Edit this block if you are rendering all product details as sent by Peerius Recommendations .i.e., no Magento lookup done here */
41
+ else: ?>
42
+ <div class="block block-recommendations">
43
+ <div class="block-title">
44
+ <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
45
+ </div>
46
+ <div class="block-content">
47
+ <ul class="peerius-products-grid">
48
+ <?php $json_recs = json_decode($this->getRequest()->getParam('recs'));
49
+ $maxRecs = $this->getRequest()->getParam('max');
50
+ $ctr = 1;
51
+ foreach($json_recs as $_item): ?>
52
+ <?php $cId = $clickId[$_item->refCode]?>
53
+ <li class="peerius-item">
54
+ <a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>" title="<?php echo $this->escapeHtml($_item->title) ?>" class="peerius-product-image">
55
+ <img src="<?php echo $_item->img ?>" width="135" alt="<?php echo $this->escapeHtml($_item->title) ?>" />
56
+ </a>
57
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>"><?php echo $this->escapeHtml($_item->title) ?></a></h2>
58
+ <div class="product-details">
59
+ <div class="price-box">
60
+ <?php if($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice): ?>
61
+ <p class="old-price">
62
+ <span class="price-label">Regular Price:</span>
63
+ <span class="price" id="old-price-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->unitPrice ?></span>
64
+ </p>
65
+ <?php endif ?>
66
+ <p class="special-price">
67
+ <span class="price-label"><?php echo ($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice ? 'Special ': '') ?>Price:</span>
68
+ <span class="price-including-tax">
69
+ <span class="label">Incl. Tax:</span>
70
+ <span class="price" id="price-including-tax-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->salePrice ?></span>
71
+ </span>
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </li>
76
+ <?php if($ctr++ == $maxRecs) break;
77
+ endforeach ?>
78
+ </ul>
79
+ <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
80
+ </div>
81
+ </div>
82
  <?php endif ?>
app/design/frontend/base/default/template/smartrecs/recs/product-1.phtml CHANGED
@@ -7,13 +7,16 @@ if ($this->getRequest()->getParam('recs')) {
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
- $refCode2id[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
13
-
14
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
 
 
15
  ?>
16
- <?php if($this->getItems()->getSize()): ?>
 
 
17
  <div class="block block-recommendations">
18
  <div class="block-title">
19
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
@@ -22,14 +25,10 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
22
  <ul class="peerius-products-grid">
23
  <?php foreach($this->getItems() as $_item): ?>
24
  <li class="peerius-item">
25
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
26
- <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
27
  <div class="product-details">
28
- </p>
29
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
30
- <!--<?php if ($this->helper('wishlist')->isAllow()) : ?>
31
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>-->
32
- <?php endif; ?>
33
  </div>
34
  </li>
35
  <?php endforeach ?>
@@ -37,4 +36,47 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
37
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
38
  </div>
39
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <?php endif ?>
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
+ $clickId[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
 
13
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
14
+ $curSymbol = $this->getCurrencySymbol();
15
+ $curCode = $this->getCurrencyCode();
16
  ?>
17
+ <?php
18
+ /*Only Edit this block if you are rendering Peerius Recommendations after retrieving the product details from magento */
19
+ if($this->isRecContentRefCodeOnly()): ?>
20
  <div class="block block-recommendations">
21
  <div class="block-title">
22
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
25
  <ul class="peerius-products-grid">
26
  <?php foreach($this->getItems() as $_item): ?>
27
  <li class="peerius-item">
28
+ <a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
29
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
30
  <div class="product-details">
 
31
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
 
 
 
32
  </div>
33
  </li>
34
  <?php endforeach ?>
36
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
37
  </div>
38
  </div>
39
+ <?php
40
+ /*Only Edit this block if you are rendering all product details as sent by Peerius Recommendations .i.e., no Magento lookup done here */
41
+ else: ?>
42
+ <div class="block block-recommendations">
43
+ <div class="block-title">
44
+ <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
45
+ </div>
46
+ <div class="block-content">
47
+ <ul class="peerius-products-grid">
48
+ <?php $json_recs = json_decode($this->getRequest()->getParam('recs'));
49
+ $maxRecs = $this->getRequest()->getParam('max');
50
+ $ctr = 1;
51
+ foreach($json_recs as $_item): ?>
52
+ <?php $cId = $clickId[$_item->refCode]?>
53
+ <li class="peerius-item">
54
+ <a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>" title="<?php echo $this->escapeHtml($_item->title) ?>" class="peerius-product-image">
55
+ <img src="<?php echo $_item->img ?>" width="135" alt="<?php echo $this->escapeHtml($_item->title) ?>" />
56
+ </a>
57
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>"><?php echo $this->escapeHtml($_item->title) ?></a></h2>
58
+ <div class="product-details">
59
+ <div class="price-box">
60
+ <?php if($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice): ?>
61
+ <p class="old-price">
62
+ <span class="price-label">Regular Price:</span>
63
+ <span class="price" id="old-price-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->unitPrice ?></span>
64
+ </p>
65
+ <?php endif ?>
66
+ <p class="special-price">
67
+ <span class="price-label"><?php echo ($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice ? 'Special ': '') ?>Price:</span>
68
+ <span class="price-including-tax">
69
+ <span class="label">Incl. Tax:</span>
70
+ <span class="price" id="price-including-tax-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->salePrice ?></span>
71
+ </span>
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </li>
76
+ <?php if($ctr++ == $maxRecs) break;
77
+ endforeach ?>
78
+ </ul>
79
+ <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
80
+ </div>
81
+ </div>
82
  <?php endif ?>
app/design/frontend/base/default/template/smartrecs/recs/product-2.phtml CHANGED
@@ -7,13 +7,16 @@ if ($this->getRequest()->getParam('recs')) {
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
- $refCode2id[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
13
-
14
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
 
 
15
  ?>
16
- <?php if($this->getItems()->getSize()): ?>
 
 
17
  <div class="block block-recommendations">
18
  <div class="block-title">
19
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
@@ -22,14 +25,10 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
22
  <ul class="peerius-products-grid">
23
  <?php foreach($this->getItems() as $_item): ?>
24
  <li class="peerius-item">
25
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
26
- <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
27
  <div class="product-details">
28
- </p>
29
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
30
- <!--<?php if ($this->helper('wishlist')->isAllow()) : ?>
31
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>-->
32
- <?php endif; ?>
33
  </div>
34
  </li>
35
  <?php endforeach ?>
@@ -37,4 +36,47 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
37
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
38
  </div>
39
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <?php endif ?>
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
+ $clickId[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
 
13
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
14
+ $curSymbol = $this->getCurrencySymbol();
15
+ $curCode = $this->getCurrencyCode();
16
  ?>
17
+ <?php
18
+ /*Only Edit this block if you are rendering Peerius Recommendations after retrieving the product details from magento */
19
+ if($this->isRecContentRefCodeOnly()): ?>
20
  <div class="block block-recommendations">
21
  <div class="block-title">
22
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
25
  <ul class="peerius-products-grid">
26
  <?php foreach($this->getItems() as $_item): ?>
27
  <li class="peerius-item">
28
+ <a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
29
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
30
  <div class="product-details">
 
31
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
 
 
 
32
  </div>
33
  </li>
34
  <?php endforeach ?>
36
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
37
  </div>
38
  </div>
39
+ <?php
40
+ /*Only Edit this block if you are rendering all product details as sent by Peerius Recommendations .i.e., no Magento lookup done here */
41
+ else: ?>
42
+ <div class="block block-recommendations">
43
+ <div class="block-title">
44
+ <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
45
+ </div>
46
+ <div class="block-content">
47
+ <ul class="peerius-products-grid">
48
+ <?php $json_recs = json_decode($this->getRequest()->getParam('recs'));
49
+ $maxRecs = $this->getRequest()->getParam('max');
50
+ $ctr = 1;
51
+ foreach($json_recs as $_item): ?>
52
+ <?php $cId = $clickId[$_item->refCode]?>
53
+ <li class="peerius-item">
54
+ <a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>" title="<?php echo $this->escapeHtml($_item->title) ?>" class="peerius-product-image">
55
+ <img src="<?php echo $_item->img ?>" width="135" alt="<?php echo $this->escapeHtml($_item->title) ?>" />
56
+ </a>
57
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>"><?php echo $this->escapeHtml($_item->title) ?></a></h2>
58
+ <div class="product-details">
59
+ <div class="price-box">
60
+ <?php if($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice): ?>
61
+ <p class="old-price">
62
+ <span class="price-label">Regular Price:</span>
63
+ <span class="price" id="old-price-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->unitPrice ?></span>
64
+ </p>
65
+ <?php endif ?>
66
+ <p class="special-price">
67
+ <span class="price-label"><?php echo ($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice ? 'Special ': '') ?>Price:</span>
68
+ <span class="price-including-tax">
69
+ <span class="label">Incl. Tax:</span>
70
+ <span class="price" id="price-including-tax-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->salePrice ?></span>
71
+ </span>
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </li>
76
+ <?php if($ctr++ == $maxRecs) break;
77
+ endforeach ?>
78
+ </ul>
79
+ <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
80
+ </div>
81
+ </div>
82
  <?php endif ?>
app/design/frontend/base/default/template/smartrecs/recs/search.phtml CHANGED
@@ -7,13 +7,16 @@ if ($this->getRequest()->getParam('recs')) {
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
- $refCode2id[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
13
-
14
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
 
 
15
  ?>
16
- <?php if($this->getItems()->getSize()): ?>
 
 
17
  <div class="block block-recommendations">
18
  <div class="block-title">
19
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
@@ -22,14 +25,10 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
22
  <ul class="peerius-products-grid">
23
  <?php foreach($this->getItems() as $_item): ?>
24
  <li class="peerius-item">
25
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
26
- <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
27
  <div class="product-details">
28
- </p>
29
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
30
- <!--<?php if ($this->helper('wishlist')->isAllow()) : ?>
31
- <a onClick="Peerius.smartRecsClick(<?php echo $refCode2id[$_item->getSku()]?>)" href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>-->
32
- <?php endif; ?>
33
  </div>
34
  </li>
35
  <?php endforeach ?>
@@ -37,4 +36,47 @@ $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Produc
37
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
38
  </div>
39
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  <?php endif ?>
7
  for ($i = 0; $i < $num; $i++) {
8
  $refCodeArr[] = $recs[$i]->refCode;
9
  $idArr[] = $recs[$i]->id;
10
+ $clickId[$recs[$i]->refCode] = $recs[$i]->id;
11
  }
12
  }
 
13
  $title = $this->getRequest()->getParam('title') ?: $this->__('Recommended Products');
14
+ $curSymbol = $this->getCurrencySymbol();
15
+ $curCode = $this->getCurrencyCode();
16
  ?>
17
+ <?php
18
+ /*Only Edit this block if you are rendering Peerius Recommendations after retrieving the product details from magento */
19
+ if($this->isRecContentRefCodeOnly()): ?>
20
  <div class="block block-recommendations">
21
  <div class="block-title">
22
  <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
25
  <ul class="peerius-products-grid">
26
  <?php foreach($this->getItems() as $_item): ?>
27
  <li class="peerius-item">
28
+ <a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="peerius-product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
29
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $clickId[$_item->getSku()]?>)" href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h2>
30
  <div class="product-details">
 
31
  <?php echo $this->getPriceHtml($_item, true, '-recommendations') ?>
 
 
 
32
  </div>
33
  </li>
34
  <?php endforeach ?>
36
  <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
37
  </div>
38
  </div>
39
+ <?php
40
+ /*Only Edit this block if you are rendering all product details as sent by Peerius Recommendations .i.e., no Magento lookup done here */
41
+ else: ?>
42
+ <div class="block block-recommendations">
43
+ <div class="block-title">
44
+ <strong><span><?php echo $this->escapeHtml($title) ?></span></strong>
45
+ </div>
46
+ <div class="block-content">
47
+ <ul class="peerius-products-grid">
48
+ <?php $json_recs = json_decode($this->getRequest()->getParam('recs'));
49
+ $maxRecs = $this->getRequest()->getParam('max');
50
+ $ctr = 1;
51
+ foreach($json_recs as $_item): ?>
52
+ <?php $cId = $clickId[$_item->refCode]?>
53
+ <li class="peerius-item">
54
+ <a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>" title="<?php echo $this->escapeHtml($_item->title) ?>" class="peerius-product-image">
55
+ <img src="<?php echo $_item->img ?>" width="135" alt="<?php echo $this->escapeHtml($_item->title) ?>" />
56
+ </a>
57
+ <h2 class="product-name"><p class="product-name"><a onClick="Peerius.smartRecsClick(<?php echo $cId?>)" href="<?php echo $_item->url ?>"><?php echo $this->escapeHtml($_item->title) ?></a></h2>
58
+ <div class="product-details">
59
+ <div class="price-box">
60
+ <?php if($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice): ?>
61
+ <p class="old-price">
62
+ <span class="price-label">Regular Price:</span>
63
+ <span class="price" id="old-price-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->unitPrice ?></span>
64
+ </p>
65
+ <?php endif ?>
66
+ <p class="special-price">
67
+ <span class="price-label"><?php echo ($_item->prices->$curCode->unitPrice != $_item->prices->$curCode->salePrice ? 'Special ': '') ?>Price:</span>
68
+ <span class="price-including-tax">
69
+ <span class="label">Incl. Tax:</span>
70
+ <span class="price" id="price-including-tax-<?php echo $cId?>"><?php echo $curSymbol.$_item->prices->$curCode->salePrice ?></span>
71
+ </span>
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </li>
76
+ <?php if($ctr++ == $maxRecs) break;
77
+ endforeach ?>
78
+ </ul>
79
+ <script type="text/javascript">decorateList('block-recommendations', 'none-recursive')</script>
80
+ </div>
81
+ </div>
82
  <?php endif ?>
app/design/frontend/base/default/template/smartrecs/render.phtml CHANGED
@@ -1,13 +1,11 @@
1
- <?php
2
-
3
- /**
4
- * for the rendering
5
- * @category Peerius
6
- * @package Peerius_Smartrecs
7
- * @author Peerius Ltd
8
- */
9
-
10
- ?>
11
- <!-- Peerius SMART-recs recommendations rendering -->
12
-
13
-
1
+ <?php
2
+
3
+ /**
4
+ * for the rendering
5
+ * @category Peerius
6
+ * @package Peerius_Smartrecs
7
+ * @author Peerius Ltd
8
+ */
9
+ ?>
10
+ <!-- Peerius SMART-recs recommendations rendering -->
11
+
 
 
app/design/frontend/base/default/template/smartrecs/smartrecs.phtml CHANGED
@@ -1,55 +1,57 @@
1
- <?php
2
-
3
- /**
4
- * for the tracking and rendering
5
- * @category Peerius
6
- * @package Peerius_Smartrecs
7
- * @author Peerius Ltd
8
- */
9
-
10
- ?>
11
- <!-- Peerius SMART-recs tracking and rendering -->
12
-
13
- <?php
14
- $renderActive = (file_exists(dirname(__FILE__).'/render.phtml')) ? true:false;
15
-
16
- if (Mage::helper('peerius_smartrecs')->isActive()) {
17
- $trackingPixel = $this->getTrackingPixel();
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';?>;
25
- var renderRoute = '<?php echo $this->escapeHtml(Mage::getUrl('peerius/Render'))?>';
26
-
27
- function parsePeeriusJson(jsonData) {
28
- // render recommendations ...
29
- <?php if ($renderActive):?>
30
- if (!peeriusDisabled) {
31
- jsonData.forEach(function (widget) {
32
- if (null !== $('peerius-smartrecs-'+widget.position)) {
33
- renderRec(widget);
34
- } else {
35
- console.debug('div peerius-smartrecs-'+widget.position + ' not found');
36
- }
37
- });
38
- }
39
- <?php endif;?>
40
- }
41
-
42
- var PeeriusCallbacks={
43
- track:<?php echo $trackingPixel; ?>,
44
- smartRecs:function(jsonData) {
45
- parsePeeriusJson(jsonData);
46
- }
47
- }
48
- </script>
49
- <?php }} ?>
50
-
51
- <?php
52
- if (Mage::helper('peerius_smartrecs')->isActive()) {
53
- echo $this->getTrackingTag();
54
- }
 
 
55
  ?>
1
+ <?php
2
+
3
+ /**
4
+ * for the tracking and rendering
5
+ * @category Peerius
6
+ * @package Peerius_Smartrecs
7
+ * @author Peerius Ltd
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;
15
+
16
+ $enableRecs = Mage::getStoreConfig('peerius/general/enableall') == 1 ? true : false;
17
+
18
+ if (Mage::helper('peerius_smartrecs')->isActive()) {
19
+ $trackingPixel = $this->getTrackingPixel();
20
+ if ($trackingPixel) {
21
+ ?>
22
+
23
+ <script type="text/JavaScript" src="<?php echo $this->escapeHtml(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB))?>js/peerius/smartrecs/smartrecs.js"></script>
24
+ <script type="text/JavaScript">
25
+ <?php if ($renderActive && $enableRecs): ?>
26
+ var peeriusPage = '<?php echo $this->escapeHtml(Mage::helper('peerius_smartrecs')->getPageType());?>';
27
+ var peeriusRecsDisabled = <?php echo $enableRecs ? 'false' : 'true'; ?>;
28
+ var peeriusDisabled = <?php echo Mage::helper('peerius_smartrecs')->getDisabled() ? 'true':'false';?>;
29
+ var renderRoute = '<?php echo $this->escapeHtml(Mage::getUrl('peerius/Render', array('_forced_secure' => $this->getRequest()->isSecure())))?>';
30
+ function parsePeeriusJson(jsonData) {
31
+ // render recommendations ...
32
+ if (!peeriusDisabled && !peeriusRecsDisabled) {
33
+ jsonData.forEach(function (widget) {
34
+ if (null !== $('peerius-smartrecs-'+widget.position)) {
35
+ renderRec(widget);
36
+ } else {
37
+ console.debug('div peerius-smartrecs-'+widget.position + ' not found');
38
+ }
39
+ });
40
+ }
41
+ }
42
+ <?php endif;?>
43
+ var PeeriusCallbacks={track:<?php echo $trackingPixel; ?>};
44
+ <?php if($enableRecs): ?>
45
+ PeeriusCallbacks.smartRecs = function(jsonData) {
46
+ parsePeeriusJson(jsonData);
47
+ }
48
+ <?php endif;?>
49
+
50
+ </script>
51
+ <?php }} ?>
52
+
53
+ <?php
54
+ if (Mage::helper('peerius_smartrecs')->isActive()) {
55
+ echo $this->getTrackingTag();
56
+ }
57
  ?>
package.xml CHANGED
@@ -1,23 +1,191 @@
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>
8
- <extends/>
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.9</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>
8
+ <extends/>
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>New configuration option included to allow recommendation content to be returned with full product details including SKUs. The default setting will only allow recommendations to be sent as SKUs.</notes>
17
+ <authors>
18
+ <author>
19
+ <name>Peerius</name>
20
+ <user>Peerius</user>
21
+ <email>extensions@peerius.com</email>
22
+ </author>
23
+ </authors>
24
+ <date>2016-01-15</date>
25
+ <time>15:03:51</time>
26
+ <contents>
27
+ <target name="magecommunity">
28
+ <dir name="Peerius">
29
+ <dir name="Smartrecs">
30
+ <dir name="Block">
31
+ <file name="Config.php" hash="5d81508e9cf3061d6f34458bbdafff9b"/>
32
+ <file name="Recommendations.php" hash="cc8f955efbd6835d890b8efb864c0cac"/>
33
+ <file name="Template.php" hash="e9431386180c113cfa4660f8ce2c220b"/>
34
+ <file name="Tracking.php" hash="dc187f312b64fa7db93e34bf40291773"/>
35
+ </dir>
36
+ <dir name="Helper">
37
+ <file name="Data.php" hash="07a1c36598d89c28a5c9f902707cb02e"/>
38
+ <file name="Feedhelper.php" hash="5c981f753a3f139dd0798855ec2e51f4"/>
39
+ </dir>
40
+ <dir name="Model">
41
+ <dir name="Feed">
42
+ <file name="Creator.php" hash="41c2c55bc80a1291c49080cdd533d86b"/>
43
+ </dir>
44
+ <file name="Max.php" hash="a3c7eb408d59c3a0b71b9f5f8d85dfa9"/>
45
+ <file name="SearchLayer.php" hash="4457eb768fc387d08700d67b5e1bb55b"/>
46
+ <dir name="System">
47
+ <dir name="Config">
48
+ <dir name="Source">
49
+ <dir name="Dropdown">
50
+ <file name="Values.php" hash="bc71d86dcc6fdb046222c0a051b323b4"/>
51
+ </dir>
52
+ <file name="Yesno.php" hash="4f6cb1392c1496837cc6021cb263aad5"/>
53
+ </dir>
54
+ </dir>
55
+ </dir>
56
+ <dir name="Templates">
57
+ <file name="Basket.php" hash="96eb28e5977acd90ee8bf38f4e938274"/>
58
+ <file name="Category.php" hash="7882da9cd0026ed5bde0360189d593ae"/>
59
+ <file name="Checkout.php" hash="d46564549391af35da90a4a10c9a8093"/>
60
+ <file name="Home.php" hash="44a09df724298154d2f8671572c7f5ea"/>
61
+ <file name="Order.php" hash="3525a61a41f63c4133549254c31c842a"/>
62
+ <file name="Other.php" hash="2cb2c3d3de6d3155b5e33f1f3f8ade00"/>
63
+ <file name="Product1.php" hash="b3f3f27b3b319290f4ce7238b12e77d7"/>
64
+ <file name="Product2.php" hash="65170140bc75324cb0e216a9ba4f2597"/>
65
+ <file name="Search.php" hash="aa1e063656bd5b93a6ea1764dd317bd0"/>
66
+ <file name="Wishlist.php" hash="49daf0c47250b9512d285340c53af644"/>
67
+ </dir>
68
+ <file name="Templates.php" hash="b44ee8b39cf9d2166307ae6eb1500dc8"/>
69
+ <file name="Token.php" hash="2361e10a26b9beb9f066d6ad4827261c"/>
70
+ </dir>
71
+ <dir name="controllers">
72
+ <dir name="Adminhtml">
73
+ <file name="PeeriusController.php" hash="6d72ba380fa0ef6d618a97fc3124cdb7"/>
74
+ </dir>
75
+ <file name="FeedController.php" hash="7b21a1c6a9a8e27314d9b317f94a2e07"/>
76
+ <file name="InfoController.php" hash="915a4388f9cc72c917d6804ac38408c7"/>
77
+ <file name="RenderController.php" hash="e9f46140cb254a24ce9d21288ee9a250"/>
78
+ </dir>
79
+ <dir name="etc">
80
+ <file name="adminhtml.xml" hash="468dbed05f1cb0be9a4062c85e388e04"/>
81
+ <file name="config.xml" hash="e64216f70b3a67775c93966b412ffb13"/>
82
+ <file name="system.xml" hash="580dfd7e143413dc71f2ffc5f5f1de63"/>
83
+ <file name="system_ft.xml" hash="a42d9bf6de1df48c246057a4ef3c3a71"/>
84
+ <file name="widget.xml" hash="2a2a7c7097a33bb761c97d21c4d373f7"/>
85
+ </dir>
86
+ </dir>
87
+ </dir>
88
+ </target>
89
+ <target name="mageetc">
90
+ <dir name="modules">
91
+ <file name="Peerius_Smartrecs.xml" hash="e5c77ca4bb1474945191f4be23a0b390"/>
92
+ </dir>
93
+ </target>
94
+ <target name="mageweb">
95
+ <dir name="js">
96
+ <dir name="peerius">
97
+ <dir name="smartrecs">
98
+ <file name="smartrecs.js" hash="344e4abf974c5d834afbbd5ec22a6785"/>
99
+ </dir>
100
+ </dir>
101
+ </dir>
102
+ </target>
103
+ <target name="magedesign">
104
+ <dir name="frontend">
105
+ <dir name="base">
106
+ <dir name="default">
107
+ <dir name="template">
108
+ <dir name="smartrecs">
109
+ <file name="smartrecs.phtml" hash="eb191cbebb3729fe54294db5981e5a21"/>
110
+ <file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/>
111
+ <file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/>
112
+ <dir name="recs">
113
+ <file name="home.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/>
114
+ <file name="category.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/>
115
+ <file name="product-1.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/>
116
+ <file name="product-2.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/>
117
+ <file name="search.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/>
118
+ <file name="basket.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/>
119
+ </dir>
120
+ </dir>
121
+ </dir>
122
+ <dir name="layout">
123
+ <file name="smartrecs.xml" hash="f52a4fba91d0a70e676ea2b92c7814ba"/>
124
+ </dir>
125
+ </dir>
126
+ </dir>
127
+ </dir>
128
+ <dir name="adminhtml">
129
+ <dir name="default">
130
+ <dir name="default">
131
+ <dir name="layout">
132
+ <file name="smartrecs.xml" hash="b18cea41c87596b4a391060772d62036"/>
133
+ </dir>
134
+ <dir name="template">
135
+ <dir name="smartrecs">
136
+ <file name="config.phtml" hash="e1592ad4495ef3e6b9061e348b35ed1d"/>
137
+ <file name="aclreloadbutton.phtml" hash="5a1baf33dff410aeef3de6811d3c8777"/>
138
+ </dir>
139
+ </dir>
140
+ </dir>
141
+ </dir>
142
+ </dir>
143
+ </target>
144
+ <target name="mageskin">
145
+ <dir>
146
+ <dir name="adminhtml">
147
+ <dir name="default">
148
+ <dir name="default">
149
+ <dir name="peerius">
150
+ <dir name="smartrecs">
151
+ <dir>
152
+ <dir name="css">
153
+ <file name="config.css" hash="bc6e8f257e82345829fa4ab40cd6e73a"/>
154
+ </dir>
155
+ <dir name="img">
156
+ <file name="logo-hover.png" hash="d47a12d82bc3b271f343f590f7de260a"/>
157
+ <file name="logo.png" hash="02fb819ba8faf2b9df42345e6f71463c"/>
158
+ </dir>
159
+ <dir name="js">
160
+ <file name="smartrecs.js" hash="e9fc66f04761d7c0de868f031b592e50"/>
161
+ </dir>
162
+ </dir>
163
+ </dir>
164
+ </dir>
165
+ </dir>
166
+ </dir>
167
+ </dir>
168
+ </dir>
169
+ <dir name="frontend">
170
+ <dir name="base">
171
+ <dir name="default">
172
+ <dir name="css">
173
+ <dir name="peerius_smartrecs">
174
+ <file name="style.css" hash="54f4d88777c86d9b2951183e0323f026"/>
175
+ </dir>
176
+ </dir>
177
+ </dir>
178
+ </dir>
179
+ </dir>
180
+ </target>
181
+ </contents>
182
+ <compatible/>
183
+ <dependencies>
184
+ <required>
185
+ <php>
186
+ <min>5.3.0</min>
187
+ <max>6.0.0</max>
188
+ </php>
189
+ </required>
190
+ </dependencies>
191
+ </package>
skin/adminhtml/default/default/peerius/smartrecs/css/config.css CHANGED
@@ -1,20 +1,38 @@
1
  .navbar-inner {
2
- background: transparent url("../img/navigation.png") repeat-x scroll 0 15px;
3
- height:130px;
 
 
4
  }
5
 
6
- .brand {
7
- background: transparent url("../img/logo-rollover.png") repeat-x scroll 0 0px;
8
  display:block;
9
- font-size: 0;
10
- height: 130px;
11
- line-height: 0;
12
  overflow: hidden;
13
  padding: 0;
14
  position: relative;
15
- width: 130px;
16
  z-index: 3;
17
- margin-left: 100px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
 
20
  .container {
@@ -23,8 +41,9 @@
23
  margin-right:auto;
24
  }
25
 
26
- a.brand:hover {
27
- background-position: 0 -130px;
 
28
  }
29
 
30
  .content-header {
1
  .navbar-inner {
2
+ /*background: transparent url("../img/navigation.png") repeat-none scroll 0 0px;*/
3
+ height:105px;
4
+ width: 500px;
5
+ float:left;
6
  }
7
 
8
+ .peeriusBrand {
9
+ background: transparent url("../img/logo.png") no-repeat scroll 0 0px;
10
  display:block;
11
+ height: 101px;
 
 
12
  overflow: hidden;
13
  padding: 0;
14
  position: relative;
15
+ width: 500px;
16
  z-index: 3;
17
+ margin-left: 0px;
18
+ float:left;
19
+ color:#52a746 ;
20
+ }
21
+
22
+ .peeriusBrandText {
23
+ display:in-line;
24
+ float:left;
25
+ font-size: 20px;
26
+ font-weight: bold;
27
+ height: 101px;
28
+ line-height: 101px;
29
+ overflow: hidden;
30
+ padding: 0;
31
+ position: relative;
32
+ width: 300px;
33
+ z-index: 4;
34
+ margin-left: 105px;
35
+
36
  }
37
 
38
  .container {
41
  margin-right:auto;
42
  }
43
 
44
+ a.peeriusBrand:hover {
45
+ background: transparent url("../img/logo-hover.png") no-repeat scroll 0 0px;
46
+ color: #000;
47
  }
48
 
49
  .content-header {
skin/adminhtml/default/default/peerius/smartrecs/img/logo-hover.png ADDED
Binary file
skin/adminhtml/default/default/peerius/smartrecs/img/logo-rollover.png DELETED
Binary file
skin/adminhtml/default/default/peerius/smartrecs/img/logo.png ADDED
Binary file
skin/adminhtml/default/default/peerius/smartrecs/img/navigation.png DELETED
Binary file