Version Notes
Fixed p:recommended attribute in feed to include SKUs instead of magento ids.
Download this release
Release Info
Developer | Peerius |
Extension | Peerius_Connect |
Version | 1.0.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.8
- app/code/community/Peerius/Smartrecs/.DS_Store +0 -0
- app/code/community/Peerius/Smartrecs/Block/Template.php +127 -127
- app/code/community/Peerius/Smartrecs/Block/Tracking.php +67 -20
- app/code/community/Peerius/Smartrecs/Model/.DS_Store +0 -0
- app/code/community/Peerius/Smartrecs/Model/Feed/Creator.php +589 -504
- app/code/community/Peerius/Smartrecs/Model/SearchLayer.php +36 -24
- app/code/community/Peerius/Smartrecs/controllers/FeedController.php +144 -145
- app/code/community/Peerius/Smartrecs/controllers/InfoController.php +344 -193
- app/code/community/Peerius/Smartrecs/etc/config.xml +97 -97
- app/design/frontend/base/default/template/smartrecs/render.phtml +11 -13
- app/design/frontend/base/default/template/smartrecs/smartrecs.phtml +56 -54
- package.xml +8 -8
app/code/community/Peerius/Smartrecs/.DS_Store
DELETED
Binary file
|
app/code/community/Peerius/Smartrecs/Block/Template.php
CHANGED
@@ -1,127 +1,127 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @category Peerius
|
5 |
-
* @package Peerius_Smartrecs
|
6 |
-
* @author Peerius Ltd
|
7 |
-
*/
|
8 |
-
class Peerius_Smartrecs_Block_Template extends Mage_Catalog_Block_Product_List {
|
9 |
-
|
10 |
-
const DEFAULT_ITEM_NUM = 3;
|
11 |
-
|
12 |
-
const MAX_ITEM_NUM = 10;
|
13 |
-
|
14 |
-
protected $_columnCount = 4;
|
15 |
-
|
16 |
-
protected $_i = 0;
|
17 |
-
|
18 |
-
protected function _prepareData() {
|
19 |
-
$this->_productCollection = Mage::getModel('catalog/product')
|
20 |
-
->getCollection()
|
21 |
-
->addAttributeToSelect('*');
|
22 |
-
|
23 |
-
$num = false;
|
24 |
-
|
25 |
-
$
|
26 |
-
|
27 |
-
if ($this->getRequest()->getParam('skus')) {
|
28 |
-
$skus = explode(',',$this->getRequest()->getParam('skus'));
|
29 |
-
}
|
30 |
-
|
31 |
-
if ($this->getRequest()->getParam('recs')) {
|
32 |
-
$recs = json_decode($this->getRequest()->getParam('recs'));
|
33 |
-
$num = count($recs);
|
34 |
-
$skus = array();
|
35 |
-
for ($i = 0; $i < $num; $i++) {
|
36 |
-
$skus[] = $recs[$i]->refCode;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
if ($skus) {
|
41 |
-
$this->_productCollection->addAttributeToFilter('SKU', array('in'=>$skus));
|
42 |
-
$this->_productCollection->getSelect()->order("find_in_set(SKU,'".implode(',',$skus)."')");
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
if (!$max) {
|
47 |
-
$max = (int) $this->getRequest()->getParam('max') ?: self::DEFAULT_ITEM_NUM;
|
48 |
-
}
|
49 |
-
|
50 |
-
if ($max > self::MAX_ITEM_NUM) {
|
51 |
-
$max = self::MAX_ITEM_NUM;
|
52 |
-
}
|
53 |
-
|
54 |
-
$this->_productCollection->getSelect()->limit($max);
|
55 |
-
|
56 |
-
$this->_productCollection->load();
|
57 |
-
|
58 |
-
return $this;
|
59 |
-
}
|
60 |
-
|
61 |
-
protected function _beforeToHtml() {
|
62 |
-
$this->_prepareData();
|
63 |
-
parent::_beforeToHtml();
|
64 |
-
}
|
65 |
-
|
66 |
-
public function getItems() {
|
67 |
-
return $this->_productCollection;
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Count items
|
72 |
-
*
|
73 |
-
* @return int
|
74 |
-
*/
|
75 |
-
public function getItemCount()
|
76 |
-
{
|
77 |
-
return count($this->getItems());
|
78 |
-
}
|
79 |
-
|
80 |
-
public function getItemCollection() {
|
81 |
-
return $this->_productCollection;
|
82 |
-
}
|
83 |
-
|
84 |
-
|
85 |
-
public function getRowCount()
|
86 |
-
{
|
87 |
-
return ceil(count($this->getItemCollection()->getItems())/$this->getColumnCount());
|
88 |
-
}
|
89 |
-
|
90 |
-
public function setColumnCount($columns)
|
91 |
-
{
|
92 |
-
if (intval($columns) > 0) {
|
93 |
-
$this->_columnCount = intval($columns);
|
94 |
-
}
|
95 |
-
return $this;
|
96 |
-
}
|
97 |
-
|
98 |
-
public function getColumnCount()
|
99 |
-
{
|
100 |
-
return $this->_columnCount;
|
101 |
-
}
|
102 |
-
|
103 |
-
public function resetItemsIterator()
|
104 |
-
{
|
105 |
-
$this->getItems();
|
106 |
-
reset($this->_productCollection);
|
107 |
-
}
|
108 |
-
|
109 |
-
public function getIterableItem()
|
110 |
-
{
|
111 |
-
if (is_array($this->_productCollection)) {
|
112 |
-
$item = current($this->_productCollection);
|
113 |
-
next($this->_productCollection);
|
114 |
-
return $item;
|
115 |
-
}
|
116 |
-
|
117 |
-
// the iterator on an object doesn't work like this
|
118 |
-
$i = 0;
|
119 |
-
foreach ($this->_productCollection as $item) {
|
120 |
-
if ($this->_i == $i++) {
|
121 |
-
$this->_i++;
|
122 |
-
return $item;
|
123 |
-
}
|
124 |
-
}
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @category Peerius
|
5 |
+
* @package Peerius_Smartrecs
|
6 |
+
* @author Peerius Ltd
|
7 |
+
*/
|
8 |
+
class Peerius_Smartrecs_Block_Template extends Mage_Catalog_Block_Product_List {
|
9 |
+
|
10 |
+
const DEFAULT_ITEM_NUM = 3;
|
11 |
+
|
12 |
+
const MAX_ITEM_NUM = 10;
|
13 |
+
|
14 |
+
protected $_columnCount = 4;
|
15 |
+
|
16 |
+
protected $_i = 0;
|
17 |
+
|
18 |
+
protected function _prepareData() {
|
19 |
+
$this->_productCollection = Mage::getModel('catalog/product')
|
20 |
+
->getCollection()
|
21 |
+
->addAttributeToSelect('*');
|
22 |
+
|
23 |
+
$num = false;
|
24 |
+
$skus = false;
|
25 |
+
$max = false;
|
26 |
+
|
27 |
+
if ($this->getRequest()->getParam('skus')) {
|
28 |
+
$skus = explode(',',$this->getRequest()->getParam('skus'));
|
29 |
+
}
|
30 |
+
|
31 |
+
if ($this->getRequest()->getParam('recs')) {
|
32 |
+
$recs = json_decode($this->getRequest()->getParam('recs'));
|
33 |
+
$num = count($recs);
|
34 |
+
$skus = array();
|
35 |
+
for ($i = 0; $i < $num; $i++) {
|
36 |
+
$skus[] = $recs[$i]->refCode;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
if ($skus) {
|
41 |
+
$this->_productCollection->addAttributeToFilter('SKU', array('in'=>$skus));
|
42 |
+
$this->_productCollection->getSelect()->order("find_in_set(SKU,'".implode(',',$skus)."')");
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
if (!$max) {
|
47 |
+
$max = (int) $this->getRequest()->getParam('max') ?: self::DEFAULT_ITEM_NUM;
|
48 |
+
}
|
49 |
+
|
50 |
+
if ($max > self::MAX_ITEM_NUM) {
|
51 |
+
$max = self::MAX_ITEM_NUM;
|
52 |
+
}
|
53 |
+
|
54 |
+
$this->_productCollection->getSelect()->limit($max);
|
55 |
+
|
56 |
+
$this->_productCollection->load();
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
protected function _beforeToHtml() {
|
62 |
+
$this->_prepareData();
|
63 |
+
parent::_beforeToHtml();
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getItems() {
|
67 |
+
return $this->_productCollection;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Count items
|
72 |
+
*
|
73 |
+
* @return int
|
74 |
+
*/
|
75 |
+
public function getItemCount()
|
76 |
+
{
|
77 |
+
return count($this->getItems());
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getItemCollection() {
|
81 |
+
return $this->_productCollection;
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
public function getRowCount()
|
86 |
+
{
|
87 |
+
return ceil(count($this->getItemCollection()->getItems())/$this->getColumnCount());
|
88 |
+
}
|
89 |
+
|
90 |
+
public function setColumnCount($columns)
|
91 |
+
{
|
92 |
+
if (intval($columns) > 0) {
|
93 |
+
$this->_columnCount = intval($columns);
|
94 |
+
}
|
95 |
+
return $this;
|
96 |
+
}
|
97 |
+
|
98 |
+
public function getColumnCount()
|
99 |
+
{
|
100 |
+
return $this->_columnCount;
|
101 |
+
}
|
102 |
+
|
103 |
+
public function resetItemsIterator()
|
104 |
+
{
|
105 |
+
$this->getItems();
|
106 |
+
reset($this->_productCollection);
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getIterableItem()
|
110 |
+
{
|
111 |
+
if (is_array($this->_productCollection)) {
|
112 |
+
$item = current($this->_productCollection);
|
113 |
+
next($this->_productCollection);
|
114 |
+
return $item;
|
115 |
+
}
|
116 |
+
|
117 |
+
// the iterator on an object doesn't work like this
|
118 |
+
$i = 0;
|
119 |
+
foreach ($this->_productCollection as $item) {
|
120 |
+
if ($this->_i == $i++) {
|
121 |
+
$this->_i++;
|
122 |
+
return $item;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
app/code/community/Peerius/Smartrecs/Block/Tracking.php
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
|
9 |
|
10 |
protected $_pageType;
|
|
|
11 |
/*
|
12 |
* getter for page type
|
13 |
*/
|
@@ -21,7 +22,7 @@ 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();
|
@@ -126,6 +127,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 |
|
@@ -149,13 +151,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 |
-
|
153 |
-
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
$newItem = array(
|
156 |
-
'refCode' => $item->
|
157 |
'qty' => $item->getQty(),
|
158 |
-
'price' => $
|
159 |
);
|
160 |
$pixel['basket']['items'][] = $newItem;
|
161 |
}
|
@@ -181,13 +193,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 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
187 |
$newItem = array(
|
188 |
-
'refCode' => $item->
|
189 |
'qty' => (int) $item->getQty(),
|
190 |
-
'price' => $
|
191 |
);
|
192 |
$pixel['checkout']['items'][] = $newItem;
|
193 |
}
|
@@ -224,13 +241,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 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
230 |
$newItem = array(
|
231 |
-
'refCode' => $item->
|
232 |
'qty' => (int) $item->getQtyOrdered(),
|
233 |
-
'price' => $
|
234 |
);
|
235 |
$pixel['order']['items'][] = $newItem;
|
236 |
}
|
@@ -264,6 +286,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 |
}
|
@@ -330,7 +354,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 +416,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 |
-
|
397 |
-
|
398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
|
|
8 |
class Peerius_Smartrecs_Block_Tracking extends Mage_Core_Block_Template {
|
9 |
|
10 |
protected $_pageType;
|
11 |
+
protected $_debugMode;
|
12 |
/*
|
13 |
* getter for page type
|
14 |
*/
|
22 |
*/
|
23 |
public function getTrackingPixel() {
|
24 |
$fullActionName = Mage::app()->getFrontController()->getAction()->getFullActionName();
|
25 |
+
$debuMode = $this->setDebugMode();
|
26 |
switch ($fullActionName) {
|
27 |
case 'cms_index_index':
|
28 |
$routeName = Mage::app()->getRequest()->getRouteName();
|
127 |
if ($category AND $category->getId()) {
|
128 |
$pixel['category'] = $this->_getCategoryBreadcrumb($category->getId());
|
129 |
}
|
130 |
+
|
131 |
return json_encode($pixel);
|
132 |
}
|
133 |
|
151 |
$items = $cart->getAllItems();
|
152 |
$pixel['basket']['items'] = array();
|
153 |
foreach ($items as $item) {
|
154 |
+
//code pre v 1.0.8
|
155 |
+
//if ($item->getParentItem()) continue;
|
156 |
+
|
157 |
+
//if ($item->getProduct()->getData('visibility')==1) {
|
158 |
+
//Mage::log($item->getParentItem()->getProduct()->getData('sku'), null, 'peerius_smartrec.log');
|
159 |
+
//continue;
|
160 |
+
//}
|
161 |
+
|
162 |
+
// ignore skus that are not visible as product pages
|
163 |
+
if(!$item->getProduct()->isVisibleInSiteVisibility()) continue;
|
164 |
+
$dL = $this->_dLog('BASKET TRACKING: '.$item->getProduct()->getData('sku').' is '.strtoupper($item->getProductType()).' & '.($item->getProduct()->isVisibleInSiteVisibility()? "VISIBLE": "NOT VISIBLE"));
|
165 |
+
|
166 |
+
$priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
|
167 |
$newItem = array(
|
168 |
+
'refCode' => $item->getProduct()->getData('sku'),
|
169 |
'qty' => $item->getQty(),
|
170 |
+
'price' => $priceIncTax
|
171 |
);
|
172 |
$pixel['basket']['items'][] = $newItem;
|
173 |
}
|
193 |
$cart = Mage::getModel('checkout/cart')->getQuote();
|
194 |
$items = $cart->getAllItems();
|
195 |
foreach ($items as $item) {
|
196 |
+
//code pre v 1.0.8
|
197 |
+
//if ($item->getParentItem()) continue;
|
198 |
+
|
199 |
+
// ignore skus that are not visible as product pages
|
200 |
+
if(!$item->getProduct()->isVisibleInSiteVisibility()) continue;
|
201 |
+
$dL = $this->_dLog('CHECKOUT TRACKING: '.$item->getProduct()->getData('sku').' is '.strtoupper($item->getProductType()).' & '.($item->getProduct()->isVisibleInSiteVisibility()? "VISIBLE": "NOT VISIBLE"));
|
202 |
+
|
203 |
+
$priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
|
204 |
$newItem = array(
|
205 |
+
'refCode' => $item->getProduct()->getData('sku'),
|
206 |
'qty' => (int) $item->getQty(),
|
207 |
+
'price' => $priceIncTax
|
208 |
);
|
209 |
$pixel['checkout']['items'][] = $newItem;
|
210 |
}
|
241 |
$pixel['order']['orderNo'] = $order->getIncrementId();
|
242 |
$items = $order->getAllItems();
|
243 |
foreach ($items as $item) {
|
244 |
+
//code pre v 1.0.8
|
245 |
+
//if ($item->getParentItem()) continue;
|
246 |
+
|
247 |
+
// ignore skus that are not visible as product pages
|
248 |
+
if(!$item->getProduct()->isVisibleInSiteVisibility()) continue;
|
249 |
+
$dL = $this->_dLog('ORDER TRACKING: '.$item->getProduct()->getData('sku').' is '.strtoupper($item->getProductType()).' & '.($item->getProduct()->isVisibleInSiteVisibility()? "VISIBLE": "NOT VISIBLE"));
|
250 |
+
|
251 |
+
$priceIncTax = Mage::helper('tax')->getPrice($item, $item->getPrice(), true);
|
252 |
$newItem = array(
|
253 |
+
'refCode' => $item->getProduct()->getData('sku'),
|
254 |
'qty' => (int) $item->getQtyOrdered(),
|
255 |
+
'price' => $priceIncTax
|
256 |
);
|
257 |
$pixel['order']['items'][] = $newItem;
|
258 |
}
|
286 |
$term = Mage::helper('catalogsearch')->getQueryText();
|
287 |
$pixel['searchResults']['term'] = $this->escapeHtml($term);
|
288 |
$searchResult = array_slice(Mage::registry('peerius_smartrecs_searchresults'), 0, 10);
|
289 |
+
$dL = $this->_dLog('SEARCH TRACKING: '.print_r($searchResult,1));
|
290 |
+
|
291 |
$pixel['searchResults']['results'] = $searchResult;
|
292 |
return json_encode($pixel);
|
293 |
}
|
354 |
|
355 |
$fullPath = array();
|
356 |
foreach ($p as $treeCat) {
|
|
|
357 |
if ($treeCat <= 2)
|
358 |
continue;
|
359 |
$category = Mage::getModel('catalog/category')
|
416 |
}
|
417 |
return '<script type="text/JavaScript" src="//'.$this->escapeHtml(Mage::getStoreConfig('peerius/general/client_name')).'.peerius.com/tracker/peerius.page" charset="UTF-8"></script>';
|
418 |
}
|
419 |
+
|
420 |
+
private function setDebugMode()
|
421 |
+
{
|
422 |
+
$this->_debugMode = false;
|
423 |
+
if(Mage::app()->getRequest()->getParam('pbug') == 1 && Mage::getSingleton('core/session')->getPeeriusDebug()== null)
|
424 |
+
{
|
425 |
+
Mage::getSingleton('core/session')->setPeeriusDebug(true);
|
426 |
+
}
|
427 |
+
$this->_debugMode = Mage::getSingleton('core/session')->getPeeriusDebug() != null ? true : false;
|
428 |
+
|
429 |
+
if(Mage::app()->getRequest()->getParam('pbug') != null && Mage::app()->getRequest()->getParam('pbug') == 0 && Mage::getSingleton('core/session')->getPeeriusDebug()!= null)
|
430 |
+
{
|
431 |
+
Mage::getSingleton('core/session')->unsPeeriusDebug();
|
432 |
+
$this->_debugMode = false;
|
433 |
+
}
|
434 |
+
if(Mage::app()->getRequest()->getParam('pbug') != null)
|
435 |
+
Mage::log('PEERIUS DEBUG '.( Mage::app()->getRequest()->getParam('pbug')==1 ? 'EN' : 'DIS').'ABLED', null, 'peerius_smartrec.log');
|
436 |
+
return $this->_debugMode;
|
437 |
+
}
|
438 |
+
|
439 |
+
private function _dLog($msg)
|
440 |
+
{
|
441 |
+
|
442 |
+
if($this->_debugMode == true) Mage::log($msg, null, 'peerius_smartrec.log');
|
443 |
+
return true;
|
444 |
+
}
|
445 |
|
446 |
+
}
|
app/code/community/Peerius/Smartrecs/Model/.DS_Store
DELETED
Binary file
|
app/code/community/Peerius/Smartrecs/Model/Feed/Creator.php
CHANGED
@@ -1,505 +1,590 @@
|
|
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 |
-
|
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 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
* @
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
//
|
63 |
-
//
|
64 |
-
//
|
65 |
-
//
|
66 |
-
//
|
67 |
-
//
|
68 |
-
//
|
69 |
-
//
|
70 |
-
// $
|
71 |
-
//
|
72 |
-
//
|
73 |
-
//
|
74 |
-
//
|
75 |
-
//
|
76 |
-
//
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
*
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
$
|
88 |
-
$rss = '
|
89 |
-
$rss .= '
|
90 |
-
$rss .= '<
|
91 |
-
$rss .= '<
|
92 |
-
$rss .= '<
|
93 |
-
$rss
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
$rss
|
104 |
-
$rss
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
*
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
*
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
$
|
127 |
-
$
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
$
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
->
|
143 |
-
|
144 |
-
->
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
->
|
149 |
-
|
150 |
-
|
151 |
-
//
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
<
|
203 |
-
</
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
$
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
$
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
}
|
401 |
-
|
402 |
-
/**
|
403 |
-
*
|
404 |
-
* @param Mage_Core_Catalog_Product $product
|
405 |
-
* @return string
|
406 |
-
*/
|
407 |
-
protected function
|
408 |
-
$
|
409 |
-
$
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
$
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
$
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
return
|
471 |
-
}
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
$this->
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
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 |
+
//###################### DEBUG CODE :MG #####################
|
135 |
+
|
136 |
+
$this->log('Feed creation STARTED');
|
137 |
+
$this->_changeTheme(Mage::getStoreConfig('design/package/name', $website->getDefaultStore()->getCode()), Mage::getStoreConfig('design/package/theme', $website->getDefaultStore()->getCode()));
|
138 |
+
|
139 |
+
$rss = '';
|
140 |
+
|
141 |
+
$productCollection = Mage::getModel('catalog/product')
|
142 |
+
->getCollection()
|
143 |
+
->addWebsiteFilter($website->getWebsiteId())
|
144 |
+
->joinField("qty", $_catalogInventoryTable, 'qty', 'product_id=entity_id', null, 'left')
|
145 |
+
->addAttributeToSelect('*')
|
146 |
+
->addCategoryIds()
|
147 |
+
//->addAttributeToFilter('type_id', array('eq' => 'configurable'))
|
148 |
+
->addAttributeToFilter('visibility', $visiblityCondition)
|
149 |
+
// ->joinTable('catalog/product_relation', 'child_id=entity_id', array('parent_id' => 'parent_id'), null, 'left')
|
150 |
+
->addPriceData(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID, $website->getWebsiteId());
|
151 |
+
// ->load();
|
152 |
+
|
153 |
+
$productsCount = $productCollection->getSize();
|
154 |
+
$this->log('Total products found : ' . $productsCount);
|
155 |
+
|
156 |
+
$ctr = 0;
|
157 |
+
$perc = 0;
|
158 |
+
$ind = 1;
|
159 |
+
|
160 |
+
// check if site has prices in multiple currencies - if so, store the currency conversion rates.
|
161 |
+
$baseCode = Mage::app()->getBaseCurrencyCode();
|
162 |
+
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
|
163 |
+
$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCode, array_values($allowedCurrencies));
|
164 |
+
Mage::log('RATES: '.($rates ? print_r($rates,1) : 'NO RATES - SINGLE CURRENCY'), null, 'peerius_smartrec.log');
|
165 |
+
|
166 |
+
try {
|
167 |
+
|
168 |
+
foreach ($productCollection as $product) {
|
169 |
+
|
170 |
+
//###################### DEBUG CODE :MG #####################
|
171 |
+
if ($debugMode && $ctr > $debugProducts) break;
|
172 |
+
//###################### DEBUG CODE :MG #####################
|
173 |
+
|
174 |
+
$categoryIds = $product->getCategoryIds();
|
175 |
+
$parentCategoryBreadcrumbs = false;
|
176 |
+
$parent = false;
|
177 |
+
|
178 |
+
// don't export unavailable products
|
179 |
+
if (!$product->isAvailable()) {
|
180 |
+
$productsCount--;
|
181 |
+
continue;
|
182 |
+
}
|
183 |
+
|
184 |
+
// if a product is not in a category skip it also
|
185 |
+
if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
|
186 |
+
$parent = $this->_getParent($product);
|
187 |
+
if ($parent) {
|
188 |
+
$parentCategoryBreadcrumbs = $this->_getParentCategoryBreadcrumbs($product);
|
189 |
+
$categoryBreadcrumbs = $parentCategoryBreadcrumbs;
|
190 |
+
} else {
|
191 |
+
$categoryBreadcrumbs = $this->_getCategoryBreadcrumbs($product->getCategoryIds());
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
// is the product or it's product in any category? If not, skip it
|
196 |
+
if (!$categoryIds AND !$parentCategoryBreadcrumbs) {
|
197 |
+
$productsCount--;
|
198 |
+
continue;
|
199 |
+
}
|
200 |
+
|
201 |
+
$rss .= '<item>';
|
202 |
+
$rss .= '<title><![CDATA[' . $product->getName() . ']]></title>';
|
203 |
+
$rss .= '<link>' . $product->getProductUrl() . '</link>';
|
204 |
+
$rss .= '<guid>' . $product->getSku() . '</guid>';
|
205 |
+
if ($product->getThumbnail())
|
206 |
+
$rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $product->getThumbnail() . '</p:imageLink>';
|
207 |
+
|
208 |
+
// if site has prices in multiple currencies
|
209 |
+
if($rates) {
|
210 |
+
foreach ($rates as $cur => $rate) {
|
211 |
+
$unitPrice = number_format($product->getPrice(), 2, '.', '') * $rate;
|
212 |
+
$salePrice = number_format($product->getFinalPrice(), 2, '.', '') * $rate;
|
213 |
+
$rss .= '<p:price><p:unitPrice>' . number_format($unitPrice, 2, '.', '') . '</p:unitPrice>
|
214 |
+
<p:salePrice>' . number_format($salePrice, 2, '.', '') . '</p:salePrice>
|
215 |
+
<p:currency>' . $cur . '</p:currency></p:price>';
|
216 |
+
}
|
217 |
+
}else{ // single currency site
|
218 |
+
$rss .= '<p:price><p:unitPrice>' . number_format($product->getPrice(), 2, '.', '') . '</p:unitPrice>
|
219 |
+
<p:salePrice>' . number_format($product->getFinalPrice(), 2, '.', '') . '</p:salePrice>
|
220 |
+
<p:currency>' . Mage::app()->getStore($website->getDefaultStore())->getCurrentCurrencyCode() . '</p:currency></p:price>';
|
221 |
+
}
|
222 |
+
|
223 |
+
if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
224 |
+
$rss .= $this->_getCategoryBreadcrumbs($categoryIds);
|
225 |
+
$rss .= '<p:attribute name="minimal_price">' . number_format($product->getMinimalPrice(), 2, '.', '') . '</p:attribute>';
|
226 |
+
|
227 |
+
$attrArr = Mage::getModel('catalog/product_type_configurable')->getConfigurableAttributesAsArray($product);
|
228 |
+
|
229 |
+
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProductCollection($product)
|
230 |
+
->addAttributeToSelect('thumbnail')
|
231 |
+
->addAttributeToSelect('name')
|
232 |
+
->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', 1);
|
233 |
+
foreach ($attrArr as $attr) {
|
234 |
+
$childProducts->addAttributeToSelect($attr['attribute_code']);
|
235 |
+
}
|
236 |
+
|
237 |
+
foreach ($childProducts as $childProduct) {
|
238 |
+
if ($childProduct->getData('visibility') == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
|
239 |
+
//$p = Mage::getModel('catalog/product')->load($childProduct->getId());
|
240 |
+
$rss .= '<p:variant>';
|
241 |
+
//$rss .= '<p:title><![CDATA[' . $childProduct->getName() . ']]></p:title>';
|
242 |
+
foreach ($attrArr as $attr) {
|
243 |
+
$rss .= '<p:attribute name="' . $attr['attribute_code'] . '"><![CDATA[' . $childProduct->getAttributeText($attr['attribute_code']) . ']]></p:attribute>';
|
244 |
+
}
|
245 |
+
$rss .= '<p:attribute name="link">' . $childProduct->getProductUrl() . '</p:attribute>';
|
246 |
+
$rss .= '<p:attribute name="guid">' . $childProduct->getSku() . '</p:attribute>';
|
247 |
+
$rss .= '<p:attribute name="magento_id">' . $childProduct->getId() . '</p:attribute>';
|
248 |
+
if ($product->getThumbnail())
|
249 |
+
$rss .= '<p:imageLink>' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product' . $childProduct->getThumbnail() . '</p:imageLink>';
|
250 |
+
$stockItem = $childProduct->getStockItem();
|
251 |
+
$stockQty = ($stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) ?
|
252 |
+
((int) $stockItem->getQty() > 0 ? (int) $stockItem->getQty() : 0) : 0;
|
253 |
+
$rss .= '<p:stock>' . $stockQty . '</p:stock>';
|
254 |
+
$rss .= '</p:variant>';
|
255 |
+
}
|
256 |
+
}
|
257 |
+
} else {
|
258 |
+
if ($parent) {
|
259 |
+
$rss .= $parent;
|
260 |
+
$rss .= $categoryBreadcrumbs;
|
261 |
+
} else {
|
262 |
+
$rss .= $categoryBreadcrumbs;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
$rss .= '<pubDate>' . $product->getcreated_at() . '</pubDate>';
|
267 |
+
$rss .= '<description><![CDATA[' . $product->getDescription() . ']]></description>';
|
268 |
+
|
269 |
+
if ($product->getAttribute('manufacturer') instanceof Mage_Eav_Model_Entity_Attribute_Abstract) {
|
270 |
+
$rss .= '<p:brand><![CDATA[' . $product->getAttributeText('manufacturer') . ']]></p:brand>';
|
271 |
+
}
|
272 |
+
$rss .= '<p:inStock>' . $this->_getStockStatus($product) . '</p:inStock>';
|
273 |
+
$rss .= '<p:stock>' . ((int) $product->getQty() > 0 ? (int) $product->getQty() : 0) . '</p:stock>';
|
274 |
+
$rss .= '<p:recommend>Y</p:recommend>';
|
275 |
+
$rss .= '<p:recommended>' . $this->_getRecommended($product) . '</p:recommended>';
|
276 |
+
$rss .= '<p:attribute name="magento_id">' . $product->getId() . '</p:attribute>';
|
277 |
+
$rss .= $this->_getAttributes($product);
|
278 |
+
$rss .= $this->_getTags($product);
|
279 |
+
$rss .= '</item>';
|
280 |
+
|
281 |
+
$iperc = round($productsCount/10) ;
|
282 |
+
$perc = $perc == 0 ? $iperc : $perc;
|
283 |
+
if($ctr == $perc) {
|
284 |
+
$this->log('Processed ' . $ind++ * 10 . '% of the products...' . $ctr);
|
285 |
+
$perc = $iperc * $ind;
|
286 |
+
//Mage::throwException('Some Message');
|
287 |
+
}
|
288 |
+
$ctr++;
|
289 |
+
}
|
290 |
+
|
291 |
+
$this->log('Total entries created : ' . ($ctr - 1) );
|
292 |
+
} catch (Exception $e) {
|
293 |
+
//echo $this->getPrettyDebugBacktrace();
|
294 |
+
$this->log("### ERROR ### : " . $e->getMessage());
|
295 |
+
}
|
296 |
+
|
297 |
+
|
298 |
+
if ($productsCount == 0) {
|
299 |
+
$this->log("no products found");
|
300 |
+
throw new Exception("### ERROR ### : NO products found");
|
301 |
+
}
|
302 |
+
|
303 |
+
$now = microtime(true);
|
304 |
+
$this->log("Feed creation COMPLETED in " . date("H:i:s", ($now - $profilingStart)));
|
305 |
+
$this->log('Memory used : ' . round(memory_get_peak_usage() / 1048576) . 'MB');
|
306 |
+
$this->log('===================================================');
|
307 |
+
return $rss;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* generate breadcrumb style categories
|
312 |
+
* @param array $currentCatIds
|
313 |
+
* @return string
|
314 |
+
*/
|
315 |
+
protected function _getCategoryBreadcrumbs($currentCatIds) {
|
316 |
+
$rss = '';
|
317 |
+
|
318 |
+
if ($currentCatIds) {
|
319 |
+
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
|
320 |
+
->addAttributeToSelect('path')
|
321 |
+
->addAttributeToFilter('entity_id', $currentCatIds)
|
322 |
+
->addIsActiveFilter();
|
323 |
+
|
324 |
+
foreach ($categoryCollection as $cat) {
|
325 |
+
$p = explode('/', $cat->getPath());
|
326 |
+
|
327 |
+
$fullPath = array();
|
328 |
+
foreach ($p as $treeCat) {
|
329 |
+
// Root-Kategorie 1 überspringen
|
330 |
+
if ($treeCat <= 2)
|
331 |
+
continue;
|
332 |
+
$category = Mage::getModel('catalog/category')
|
333 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
334 |
+
->load($treeCat);
|
335 |
+
$fullPath[] = $category->getName();
|
336 |
+
}
|
337 |
+
$rss .= '<category><![CDATA[' . implode('>', $fullPath) . ']]></category>';
|
338 |
+
}
|
339 |
+
}
|
340 |
+
return $rss;
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* generate breadcrumb style categories
|
345 |
+
* @param product $product
|
346 |
+
* @return string
|
347 |
+
*/
|
348 |
+
protected function _getParentCategoryBreadcrumbs($product) {
|
349 |
+
$rss = '';
|
350 |
+
$parentIds = $this->_getParent($product, true);
|
351 |
+
$categoryIds = array();
|
352 |
+
|
353 |
+
foreach ($parentIds as $parentId) {
|
354 |
+
$product = Mage::getModel('catalog/product')->load($parentId);
|
355 |
+
$categoryIds = array_merge($categoryIds, $product->getCategoryIds());
|
356 |
+
}
|
357 |
+
|
358 |
+
$rss = $this->_getCategoryBreadcrumbs($categoryIds);
|
359 |
+
return $rss;
|
360 |
+
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* retreive the product stock statuss
|
364 |
+
* @param Mage_Core_Catalog_Product $product
|
365 |
+
* @return string
|
366 |
+
*/
|
367 |
+
protected function _getStockStatus($product) {
|
368 |
+
$stockStatus = Mage::getModel('cataloginventory/stock_item')
|
369 |
+
->getCollection()
|
370 |
+
->addFieldToFilter('product_id', $product->getId())
|
371 |
+
->getFirstItem();
|
372 |
+
|
373 |
+
return $stockStatus ? 'Y' : 'N';
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* write the products
|
378 |
+
* @param Mage_Core_Catalog_Product $product
|
379 |
+
* @return string
|
380 |
+
*/
|
381 |
+
protected function _getRecommended($product) {
|
382 |
+
$all = array();
|
383 |
+
$related = $product->getRelatedProductIds();
|
384 |
+
foreach ($related as $id) {
|
385 |
+
$all[$id] = Mage::getModel('catalog/product')->load($id)->getSku();
|
386 |
+
//$this->log("Related Product is :".$all[$id]);
|
387 |
+
}
|
388 |
+
|
389 |
+
$crosssell = $product->getCrossSellProducts();
|
390 |
+
foreach ($crosssell as $_item) {
|
391 |
+
$all[$_item->getId()] = $_item->getSku();
|
392 |
+
//$this->log("Cross Selling Product is :".$all[$_item->getId()]);
|
393 |
+
}
|
394 |
+
$upsell = $product->getUpSellProductCollection();
|
395 |
+
foreach ($upsell as $_item) {
|
396 |
+
$all[$_item->getId()] = $_item->getSku();
|
397 |
+
//$this->log("Up Selling Product is :".$all[$_item->getId()]);
|
398 |
+
}
|
399 |
+
return implode(',', $all);
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* generate comma-separated list of product tags
|
404 |
+
* @param Mage_Core_Catalog_Product $product
|
405 |
+
* @return string
|
406 |
+
*/
|
407 |
+
protected function _getTags($product) {
|
408 |
+
$tag_model = Mage::getModel('tag/tag');
|
409 |
+
$tag_collection = $tag_model->getResourceCollection()
|
410 |
+
->addPopularity()
|
411 |
+
// ->addStatusFilter($model->getApprovedStatus())
|
412 |
+
->addProductFilter($product->getId())
|
413 |
+
->setFlag('relation', true)
|
414 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
415 |
+
->setActiveFilter()
|
416 |
+
->load();
|
417 |
+
|
418 |
+
$mytags = $tag_collection->getItems();
|
419 |
+
|
420 |
+
$tagArr = array();
|
421 |
+
if (!$tag_collection->getSize()) {
|
422 |
+
return '';
|
423 |
+
}
|
424 |
+
|
425 |
+
foreach ($mytags as $tag) {
|
426 |
+
$tagArr[] = $tag->getName();
|
427 |
+
}
|
428 |
+
return '<p:tags>' . implode(',', $tagArr) . '</p:tags>';
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* crate front-end attributes rss string
|
433 |
+
* @param Mage_Core_Catalog_Product $product
|
434 |
+
* @return string
|
435 |
+
*/
|
436 |
+
protected function _getAttributes($product) {
|
437 |
+
$attributes = $product->getAttributes();
|
438 |
+
$rss = '';
|
439 |
+
foreach ($attributes as $attribute) {
|
440 |
+
if ($attribute->getIsVisibleOnFront()) {
|
441 |
+
$attributeCode = $attribute->getAttributeCode();
|
442 |
+
$label = $attribute->getFrontend()->getLabel($product);
|
443 |
+
$value = $attribute->getFrontend()->getValue($product);
|
444 |
+
$rss .= '<p:attribute name="' . $attributeCode . '"><![CDATA[' . $value . ']]></p:attribute>';
|
445 |
+
}
|
446 |
+
}
|
447 |
+
return $rss;
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* returns parent product ID if available
|
452 |
+
* @param Mage_Core_Catalog_Product $product
|
453 |
+
* @param bool return the ids
|
454 |
+
* @return int
|
455 |
+
*/
|
456 |
+
protected function _getParent($product, $ids = false) {
|
457 |
+
$rss = '';
|
458 |
+
$parentIds = false;
|
459 |
+
if ($product->getTypeId() == "simple") {
|
460 |
+
$parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId()); // check for grouped product
|
461 |
+
if (!$parentIds)
|
462 |
+
$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId()); //check for config product
|
463 |
+
}
|
464 |
+
if ($ids) {
|
465 |
+
return $parentIds;
|
466 |
+
}
|
467 |
+
if ($parentIds) {
|
468 |
+
$rss = '<p:attribute name="parent_magento_id">' . implode(',', $parentIds) . '</p:attribute>';
|
469 |
+
} else {
|
470 |
+
return false;
|
471 |
+
}
|
472 |
+
return $rss;
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* the client name used in the rss feed
|
477 |
+
* @return string
|
478 |
+
*/
|
479 |
+
protected function _getClientName() {
|
480 |
+
return Mage::getStoreConfig('peerius/general/client_name');
|
481 |
+
}
|
482 |
+
|
483 |
+
/**
|
484 |
+
* @param $content
|
485 |
+
* @return bool
|
486 |
+
*/
|
487 |
+
protected function _appendToFile($content) {
|
488 |
+
try {
|
489 |
+
$f = new Varien_Io_File();
|
490 |
+
$validator = new Zend_Validate_File_Exists();
|
491 |
+
|
492 |
+
if (!$validator->isValid($this->fileName)) {
|
493 |
+
$this->log("could not create the smartrec file");
|
494 |
+
return false;
|
495 |
+
}
|
496 |
+
$this->log("SMART-recs file created");
|
497 |
+
|
498 |
+
fclose($f);
|
499 |
+
return true;
|
500 |
+
} catch (Exception $ex) {
|
501 |
+
$this->log("error during file creation");
|
502 |
+
$this->log($ex->getMessage());
|
503 |
+
return false;
|
504 |
+
}
|
505 |
+
try {
|
506 |
+
$f = new Varien_Io_File();
|
507 |
+
$f->write($this->fileName, $content);
|
508 |
+
//if (file_put_contents($this->fileName, $content, FILE_APPEND)) {
|
509 |
+
return true;
|
510 |
+
} catch (Exception $ex) {
|
511 |
+
$this->log("error while writing to the feed file");
|
512 |
+
$this->log($ex->getMessage());
|
513 |
+
return false;
|
514 |
+
}
|
515 |
+
}
|
516 |
+
|
517 |
+
public function checkToken() {
|
518 |
+
$token = Mage::getStoreConfig('peerius/general/token');
|
519 |
+
|
520 |
+
if (!$token OR !Mage::app()->getRequest()->getParam('token') OR (Mage::app()->getRequest()->getParam('token') != sha1($token))) {
|
521 |
+
$this->log("token error");
|
522 |
+
return false;
|
523 |
+
}
|
524 |
+
return true;
|
525 |
+
}
|
526 |
+
|
527 |
+
/**
|
528 |
+
* @param string $message
|
529 |
+
*/
|
530 |
+
protected function log($message) {
|
531 |
+
Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
|
532 |
+
}
|
533 |
+
|
534 |
+
protected function getPrettyDebugBacktrace()
|
535 |
+
{
|
536 |
+
$d = debug_backtrace();
|
537 |
+
array_shift($d);
|
538 |
+
$siteName = Mage::getStoreConfig('peerius/general/client_name',Mage::app()->getStore());
|
539 |
+
$response = '';
|
540 |
+
$response .= '<!doctype html><html lang=\'en-gb\'><head><meta charset=\'utf-8\'><title> CONFIG: '.$siteName.'</title>'.$this->getCSS().'</head><body style="font-family:Arial;">';
|
541 |
+
$response .= '<section><h1>Peerius Connect Debug : '. $siteName . '</h1>';
|
542 |
+
$c1width = strlen(count($d) + 1);
|
543 |
+
$c2width = 0;
|
544 |
+
foreach ($d as &$f) {
|
545 |
+
if (!isset($f['file'])) $f['file'] = '';
|
546 |
+
if (!isset($f['line'])) $f['line'] = '';
|
547 |
+
if (!isset($f['class'])) $f['class'] = '';
|
548 |
+
if (!isset($f['type'])) $f['type'] = '';
|
549 |
+
$f['file_rel'] = str_replace(BP . DS, '', $f['file']);
|
550 |
+
$thisLen = strlen($f['file_rel'] . ':' . $f['line']);
|
551 |
+
if ($c2width < $thisLen) $c2width = $thisLen;
|
552 |
+
}
|
553 |
+
foreach ($d as $i => $f) {
|
554 |
+
$args = '';
|
555 |
+
if (isset($f['args'])) {
|
556 |
+
$args = array();
|
557 |
+
foreach ($f['args'] as $arg) {
|
558 |
+
if (is_object($arg)) {
|
559 |
+
$str = get_class($arg);
|
560 |
+
} elseif (is_array($arg)) {
|
561 |
+
$str = 'Array';
|
562 |
+
} elseif (is_numeric($arg)) {
|
563 |
+
$str = $arg;
|
564 |
+
} else {
|
565 |
+
$str = "'$arg'";
|
566 |
+
}
|
567 |
+
$args[] = $str;
|
568 |
+
}
|
569 |
+
$args = implode(', ', $args);
|
570 |
+
}
|
571 |
+
$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>";
|
572 |
+
|
573 |
+
}
|
574 |
+
$response .= '</section></body></html>';
|
575 |
+
return $response;
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* return CSS
|
580 |
+
*/
|
581 |
+
protected function getCSS() {
|
582 |
+
return "<style type='text/css'>
|
583 |
+
.secTitle {clear:both;display:block;float:left;padding:5px;margin:10px 2px 5px 0;width:100%;color:#808080;font-weight:bold; font-size:20px;}
|
584 |
+
.boxA { clear:left;display:block;float:left;padding:2px 2px 0 4px;margin:1px;background-color: #60b346 ; width:20px; height:22px; }
|
585 |
+
.boxB { float:left;display:in-line;padding:2px 2px 0 4px;margin:1px;background-color: #A9Ae99; width:60%px; height:22px;color:#000; }
|
586 |
+
.boxC { float:left;display:in-line;padding:2px 0 0 4px;margin:1px;background-color: #A0b3A6; width:30%px; height:22px;color:#000; }
|
587 |
+
.lnText { background-color: #A9Ae99; font-weight:bold; color:#FF0; }
|
588 |
+
</style>";
|
589 |
+
}
|
590 |
}
|
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 |
-
|
19 |
-
|
20 |
-
$
|
21 |
-
|
22 |
-
|
23 |
-
|
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 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
$this->getResponse()->setHeader('
|
67 |
-
$this->getResponse()->setHeader('
|
68 |
-
|
69 |
-
|
70 |
-
$
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
*
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
$this->fileName =
|
102 |
-
|
103 |
-
|
104 |
-
$this->getResponse()->setHeader('
|
105 |
-
$this->getResponse()->setHeader('
|
106 |
-
|
107 |
-
|
108 |
-
$file
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
* @
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
->
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
*
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
$creator
|
140 |
-
|
141 |
-
|
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,344 @@
|
|
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 |
-
*
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
$
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
$
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$response .= '<
|
93 |
-
}
|
94 |
-
|
95 |
-
$
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
$response
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* syncing the products to the peerius server
|
5 |
+
* @category Peerius
|
6 |
+
* @package Peerius_Smartrecs
|
7 |
+
* @author Peerius Ltd
|
8 |
+
*/
|
9 |
+
class Peerius_Smartrecs_InfoController extends Mage_Core_Controller_Front_Action {
|
10 |
+
|
11 |
+
|
12 |
+
/*
|
13 |
+
* returns the parameters of the created peerius SMARTrecs widgets
|
14 |
+
* @return string
|
15 |
+
*/
|
16 |
+
public function allconfigAction() {
|
17 |
+
if ($this->checkToken()) {
|
18 |
+
|
19 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
20 |
+
$modulesArray = (array)$modules;
|
21 |
+
$connectVersion = 'unknown';
|
22 |
+
//foreach ($modulesArray as $module) {
|
23 |
+
// $this->log($module->getName()." is on version ".$module->version);
|
24 |
+
//}
|
25 |
+
|
26 |
+
if($modulesArray['Peerius_Smartrecs']->is('active')) {
|
27 |
+
$connectVersion = $modulesArray['Peerius_Smartrecs']->version;
|
28 |
+
$this->log("Peerius_Connect version is ".$connectVersion);
|
29 |
+
} else {
|
30 |
+
$this->log("Peerius_Connect is not available");
|
31 |
+
}
|
32 |
+
|
33 |
+
$configs = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path',array('like'=>'peerius%'))->setOrder('config_id',Varien_Data_Collection::SORT_ORDER_ASC);
|
34 |
+
$siteName = Mage::getStoreConfig('peerius/general/client_name',Mage::app()->getStore());
|
35 |
+
$response = '<!doctype html><html lang=\'en-gb\'><head><meta charset=\'utf-8\'><title> CONFIG: '.$siteName.'</title>'.$this->getCSS().'</head><body style="font-family:Arial;">';
|
36 |
+
$response .= '<section><h1>Peerius Connect Configuration : '. $siteName . '</h1> (v ' .$connectVersion. ')';
|
37 |
+
|
38 |
+
$sec1 = "";
|
39 |
+
$sec2 = "";
|
40 |
+
foreach ($configs as $config) {
|
41 |
+
$path = str_replace('max','number_of_products', $config->getPath());
|
42 |
+
|
43 |
+
$name_arr = explode ("/", $path);
|
44 |
+
$sec1 = $name_arr[1];
|
45 |
+
$secName = ($sec1 != $sec2) ? $sec1 : "";
|
46 |
+
$sec2 = $sec1;
|
47 |
+
if($secName!="") {
|
48 |
+
$response .= '<div class=\'secTitle\'>'.ucfirst($secName). ' Config: </div>';
|
49 |
+
}
|
50 |
+
$paramName = $name_arr[2];
|
51 |
+
$paramValue = $config->getValue();
|
52 |
+
$dispName = $paramName;
|
53 |
+
$dispValue = $paramValue;
|
54 |
+
|
55 |
+
switch ($paramName) {
|
56 |
+
case "token":
|
57 |
+
$dispValue = $dispValue.' (ENCODED: '.sha1($dispValue).')';
|
58 |
+
break;
|
59 |
+
case "enableall":
|
60 |
+
$dispName = 'Are Recs anabled for site?';
|
61 |
+
$dispValue = ($dispValue == 1) ? 'Yes' : 'No';
|
62 |
+
break;
|
63 |
+
case "disable":
|
64 |
+
$dispName = 'Are Recs enabled for page?';
|
65 |
+
$dispValue = ($dispValue == 0) ? 'Yes' : 'No';
|
66 |
+
break;
|
67 |
+
case "cronjob":
|
68 |
+
$dispName = 'Feed scheduled at?';
|
69 |
+
break;
|
70 |
+
case "testmode":
|
71 |
+
$dispName = 'Is test mode enabled?';
|
72 |
+
$dispValue = ($dispValue == 1) ? 'Yes' : 'No';
|
73 |
+
break;
|
74 |
+
case "registrationstatus":
|
75 |
+
$dispName = 'Registration status?';
|
76 |
+
$dispValue = ($dispValue == 1) ? 'Registered' : 'Something happend that shouldn\'t have!';
|
77 |
+
break;
|
78 |
+
case "headline":
|
79 |
+
$dispName = 'Widget title';
|
80 |
+
break;
|
81 |
+
case "number_of_products":
|
82 |
+
$dispName = 'Number of recs';
|
83 |
+
break;
|
84 |
+
case "success":
|
85 |
+
$dispName = 'Show recs for all search?';
|
86 |
+
$dispValue = ($dispValue == 0) ? 'No, only for zero search' : 'Yes';
|
87 |
+
break;
|
88 |
+
default:
|
89 |
+
break;
|
90 |
+
}
|
91 |
+
|
92 |
+
$response .= '<div class=\'boxA\'>'.ucfirst($dispName).' </div><div class=\'boxB\'> '.$dispValue . "</div><br />";
|
93 |
+
}
|
94 |
+
|
95 |
+
$collection = Mage::getModel('widget/widget_instance')->getCollection();
|
96 |
+
$collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
|
97 |
+
|
98 |
+
if($collection->getSize()>0)
|
99 |
+
{
|
100 |
+
//$response .= '<div class=\'secTitle\'>Widget Instances</div>';
|
101 |
+
foreach($collection as $item)
|
102 |
+
{
|
103 |
+
$response .= '<div class=\'secTitle\'>Widget Instance: '.$item->title.'</div>';
|
104 |
+
$v = $item->widget_parameters;
|
105 |
+
$v = str_replace('{','',str_replace('}','',substr($v,5,strlen($v))));
|
106 |
+
$w = explode(';',$v);
|
107 |
+
//Mage::log('wid params: '.print_r($w,1), null, 'peerius_smartrec.log');
|
108 |
+
//Mage::log('widget count : '.count($w), null, 'peerius_smartrec.log');
|
109 |
+
for ($x = 0; $x < count($w) ; $x = $x+2)
|
110 |
+
{
|
111 |
+
$v1 = explode(':',$w[$x]);
|
112 |
+
$v2 = explode(':',$w[$x+1]);
|
113 |
+
if(str_replace('"','',$v1[2]) != "") {
|
114 |
+
$parName = str_replace('"','',$v1[2]);
|
115 |
+
$parValue = str_replace('"','',$v2[2]);
|
116 |
+
switch ($parName) {
|
117 |
+
case "rectype":
|
118 |
+
$parName = 'Widget name';
|
119 |
+
break;
|
120 |
+
case "wtemplate":
|
121 |
+
$parName = 'Template';
|
122 |
+
break;
|
123 |
+
case "headline":
|
124 |
+
$parName = 'Widget title';
|
125 |
+
break;
|
126 |
+
case "max":
|
127 |
+
$parName = 'Number of recs';
|
128 |
+
break;
|
129 |
+
default:
|
130 |
+
break;
|
131 |
+
}
|
132 |
+
$response .= '<div class=\'boxA\'> '.$parName. '</div><div class=\'boxB\'> '.$parValue.' </div><br />';
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
$response .= '<div class=\'secTitle\'></div></section></body></html>';
|
139 |
+
$this->getResponse()->setHeader('Content-Type', 'text/html')->setBody($response);
|
140 |
+
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* when is the cron executed?
|
146 |
+
* @return int
|
147 |
+
*/
|
148 |
+
public function createtimeAction() {
|
149 |
+
if ($this->checkToken()) {
|
150 |
+
$response = (int) Mage::getStoreConfig('peerius/general/cronjob');
|
151 |
+
|
152 |
+
$this->getResponse()
|
153 |
+
->setHeader('Content-Type', 'text/html')
|
154 |
+
->setBody($response);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* what registration status has the shop
|
160 |
+
* @return int
|
161 |
+
*/
|
162 |
+
public function registrationstatusAction() {
|
163 |
+
if ($this->checkToken()) {
|
164 |
+
$response = (int) Mage::getStoreConfig('peerius/general/registrationstatus');
|
165 |
+
|
166 |
+
$this->getResponse()
|
167 |
+
->setHeader('Content-Type', 'text/html')
|
168 |
+
->setBody($response);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* what registration status has the shop
|
174 |
+
* @return int
|
175 |
+
*/
|
176 |
+
public function registrationerrorAction() {
|
177 |
+
if ($this->checkToken()) {
|
178 |
+
$response = (int) Mage::getStoreConfig('peerius/general/registrationerror');
|
179 |
+
|
180 |
+
$this->getResponse()
|
181 |
+
->setHeader('Content-Type', 'text/html')
|
182 |
+
->setBody($response);
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
/*
|
187 |
+
* returns the parameters of the created peerius SMARTrecs widgets
|
188 |
+
* @return string
|
189 |
+
*/
|
190 |
+
public function widgetsAction() {
|
191 |
+
if ($this->checkToken()) {
|
192 |
+
$response = '';
|
193 |
+
$collection = Mage::getModel('widget/widget_instance')->getCollection();
|
194 |
+
$collection->addFieldToFilter('instance_type', 'smartrecs/recommendations');
|
195 |
+
|
196 |
+
foreach($collection as $item)
|
197 |
+
{
|
198 |
+
$response .= $item->title.'<hr>';
|
199 |
+
$response .= $item->widget_parameters;
|
200 |
+
$response .= '<br><br><br>';
|
201 |
+
}
|
202 |
+
|
203 |
+
$this->getResponse()
|
204 |
+
->setHeader('Content-Type', 'text/html')
|
205 |
+
->setBody($response);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/*
|
210 |
+
* resets the registration status
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
public function registrationstatusresetAction() {
|
214 |
+
if ($this->checkToken()) {
|
215 |
+
Mage::getModel('core/config')->saveConfig('peerius/general/registrationstatus', '0');
|
216 |
+
Mage::getModel('core/config')->saveConfig('peerius/general/registrationerror', '0');
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/*
|
221 |
+
* deletes the configuration
|
222 |
+
* @return string
|
223 |
+
*/
|
224 |
+
public function resetconfigAction() {
|
225 |
+
if ($this->checkToken()) {
|
226 |
+
$configs = Mage::getModel('core/config_data')->getCollection()->addFieldToFilter('path',array('like'=>'peerius%'));
|
227 |
+
|
228 |
+
foreach ($configs as $config) {
|
229 |
+
$config->delete($config);
|
230 |
+
}
|
231 |
+
$response = count($configs) . ' entries deleted';
|
232 |
+
|
233 |
+
$this->getResponse()
|
234 |
+
->setHeader('Content-Type', 'text/html')
|
235 |
+
->setBody($response);
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
/*
|
240 |
+
* sets the admin IP to preview recommendations in test mode
|
241 |
+
* @return string
|
242 |
+
*/
|
243 |
+
public function adminipAction() {
|
244 |
+
if ($this->checkToken()) {
|
245 |
+
if (!filter_var($this->getRequest()->getParam('ip'), FILTER_VALIDATE_IP) === false) {
|
246 |
+
Mage::getModel('core/config')->saveConfig('peerius/general/adminip', $this->getRequest()->getParam('ip'));
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
/*
|
252 |
+
* reads the admin IP
|
253 |
+
* @return string
|
254 |
+
*/
|
255 |
+
public function adminipreadAction() {
|
256 |
+
if ($this->checkToken()) {
|
257 |
+
$response = Mage::getStoreConfig('peerius/general/adminip');
|
258 |
+
|
259 |
+
$this->getResponse()
|
260 |
+
->setHeader('Content-Type', 'text/html')
|
261 |
+
->setBody($response);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/*
|
266 |
+
* checks for the valid token to prevent URL manipulation
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function checkToken() {
|
270 |
+
$token = Mage::getStoreConfig('peerius/general/token');
|
271 |
+
|
272 |
+
if (!$token OR !$this->getRequest()->getParam('token') OR ($this->getRequest()->getParam('token') != sha1($token))) {
|
273 |
+
$this->log("token error");
|
274 |
+
return false;
|
275 |
+
}
|
276 |
+
return true;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* @param string $message
|
281 |
+
*/
|
282 |
+
protected function log($message) {
|
283 |
+
Mage::helper('peerius_smartrecs')->log(Zend_Log::DEBUG, $message);
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* return CSS
|
288 |
+
*/
|
289 |
+
protected function getCSS() {
|
290 |
+
return "<style type='text/css'>
|
291 |
+
.secTitle {clear:both;display:block;float:left;padding:5px;margin:10px 0 5px 0;width:100%;color:#808080;font-weight:bold; font-size:20px;}
|
292 |
+
.boxA { clear:left;display:block;float:left;padding:2px 0 0 4px;margin:1px;background-color: #60b346 ; width:200px; height:22px; }
|
293 |
+
.boxB { float:left;display:in-line;padding:2px 0 0 4px;margin:1px;background-color: #A9Ae99; width:650px; height:22px;color:#000; }
|
294 |
+
</style>";
|
295 |
+
}
|
296 |
+
|
297 |
+
|
298 |
+
/**
|
299 |
+
* return peerius log file
|
300 |
+
*/
|
301 |
+
public function peeriusLogAction() {
|
302 |
+
//if ($this->checkToken()) {
|
303 |
+
$this->fileName = Mage::getBaseDir('var') . DS . 'log' . DS . Mage::getStoreConfig($this->CONFIG_LOG_FILE_PATH).'peerius_smartrec.log';
|
304 |
+
$this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
|
305 |
+
$this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
|
306 |
+
$this->getResponse()->setHeader('Content-Type', 'application/text; charset=UTF-8');
|
307 |
+
|
308 |
+
$file = new Varien_Io_File();
|
309 |
+
$this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/text');
|
310 |
+
//}
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* return magento log file
|
315 |
+
*/
|
316 |
+
public function magentoLogAction() {
|
317 |
+
//if ($this->checkToken()) {
|
318 |
+
$this->fileName = Mage::getBaseDir('var') . DS . 'log' . DS . Mage::getStoreConfig($this->CONFIG_LOG_FILE_PATH).'magento.log';
|
319 |
+
$this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
|
320 |
+
$this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
|
321 |
+
$this->getResponse()->setHeader('Content-Type', 'application/text; charset=UTF-8');
|
322 |
+
|
323 |
+
$file = new Varien_Io_File();
|
324 |
+
$this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/text');
|
325 |
+
//}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* return exception log file
|
330 |
+
*/
|
331 |
+
public function exceptionLogAction() {
|
332 |
+
//if ($this->checkToken()) {
|
333 |
+
$this->fileName = Mage::getBaseDir('var') . DS . 'log' . DS . Mage::getStoreConfig($this->CONFIG_LOG_FILE_PATH).'exception.log';
|
334 |
+
$this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate');
|
335 |
+
$this->getResponse()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
|
336 |
+
$this->getResponse()->setHeader('Content-Type', 'application/text; charset=UTF-8');
|
337 |
+
|
338 |
+
$file = new Varien_Io_File();
|
339 |
+
$this->_prepareDownloadResponse($this->fileName, $file->read($this->fileName), 'application/text');
|
340 |
+
//}
|
341 |
+
}
|
342 |
+
|
343 |
+
}
|
344 |
+
|
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.
|
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.8</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/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 |
-
|
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 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
}
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
}
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
<?php
|
52 |
-
|
53 |
-
|
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,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Peerius_Connect</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php#sthash.1eAD3rgO.dpuf">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -9,15 +9,15 @@
|
|
9 |
<summary>The trusted partner for personalisation.</summary>
|
10 |
<description>The Peerius Connect extension allows you to add personalised product recommendations to your website. This extension performs the following key functions:
|
11 |

|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
</description>
|
16 |
-
<notes>
|
17 |
<authors><author><name>Peerius</name><user>Peerius</user><email>extensions@peerius.com</email></author></authors>
|
18 |
-
<date>
|
19 |
-
<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="
|
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.8</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php#sthash.1eAD3rgO.dpuf">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>The trusted partner for personalisation.</summary>
|
10 |
<description>The Peerius Connect extension allows you to add personalised product recommendations to your website. This extension performs the following key functions:
|
11 |

|
12 |
+
Creates a feed containing product and category information from your site catalogue.
|
13 |
+
Adds a tracking script that allows Peerius to track user behaviour on your site.
|
14 |
+
Renders recommendations that you enable on pre-configured pages.
|
15 |
</description>
|
16 |
+
<notes>Fixed p:recommended attribute in feed to include SKUs instead of magento ids.</notes>
|
17 |
<authors><author><name>Peerius</name><user>Peerius</user><email>extensions@peerius.com</email></author></authors>
|
18 |
+
<date>2016-01-15</date>
|
19 |
+
<time>15:03:51</time>
|
20 |
+
<contents><target name="magecommunity"><dir name="Peerius"><dir name="Smartrecs"><dir name="Block"><file name="Config.php" hash="5d81508e9cf3061d6f34458bbdafff9b"/><file name="Recommendations.php" hash="cc8f955efbd6835d890b8efb864c0cac"/><file name="Template.php" hash="e9431386180c113cfa4660f8ce2c220b"/><file name="Tracking.php" hash="dc187f312b64fa7db93e34bf40291773"/></dir><dir name="Helper"><file name="Data.php" hash="07a1c36598d89c28a5c9f902707cb02e"/><file name="Feedhelper.php" hash="5c981f753a3f139dd0798855ec2e51f4"/></dir><dir name="Model"><dir name="Feed"><file name="Creator.php" hash="41c2c55bc80a1291c49080cdd533d86b"/></dir><file name="Max.php" hash="a3c7eb408d59c3a0b71b9f5f8d85dfa9"/><file name="SearchLayer.php" hash="4457eb768fc387d08700d67b5e1bb55b"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Values.php" hash="bc71d86dcc6fdb046222c0a051b323b4"/></dir><file name="Yesno.php" hash="4f6cb1392c1496837cc6021cb263aad5"/></dir></dir></dir><dir name="Templates"><file name="Basket.php" hash="96eb28e5977acd90ee8bf38f4e938274"/><file name="Category.php" hash="7882da9cd0026ed5bde0360189d593ae"/><file name="Checkout.php" hash="d46564549391af35da90a4a10c9a8093"/><file name="Home.php" hash="44a09df724298154d2f8671572c7f5ea"/><file name="Order.php" hash="3525a61a41f63c4133549254c31c842a"/><file name="Other.php" hash="2cb2c3d3de6d3155b5e33f1f3f8ade00"/><file name="Product1.php" hash="b3f3f27b3b319290f4ce7238b12e77d7"/><file name="Product2.php" hash="65170140bc75324cb0e216a9ba4f2597"/><file name="Search.php" hash="aa1e063656bd5b93a6ea1764dd317bd0"/><file name="Wishlist.php" hash="49daf0c47250b9512d285340c53af644"/></dir><file name="Templates.php" hash="b44ee8b39cf9d2166307ae6eb1500dc8"/><file name="Token.php" hash="2361e10a26b9beb9f066d6ad4827261c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PeeriusController.php" hash="6d72ba380fa0ef6d618a97fc3124cdb7"/></dir><file name="FeedController.php" hash="7b21a1c6a9a8e27314d9b317f94a2e07"/><file name="InfoController.php" hash="915a4388f9cc72c917d6804ac38408c7"/><file name="RenderController.php" hash="e9f46140cb254a24ce9d21288ee9a250"/></dir><dir name="etc"><file name="adminhtml.xml" hash="468dbed05f1cb0be9a4062c85e388e04"/><file name="config.xml" hash="e64216f70b3a67775c93966b412ffb13"/><file name="system.xml" hash="580dfd7e143413dc71f2ffc5f5f1de63"/><file name="system_ft.xml" hash="a42d9bf6de1df48c246057a4ef3c3a71"/><file name="widget.xml" hash="2a2a7c7097a33bb761c97d21c4d373f7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Peerius_Smartrecs.xml" hash="e5c77ca4bb1474945191f4be23a0b390"/></dir></target><target name="mageweb"><dir name="js"><dir name="peerius"><dir name="smartrecs"><file name="smartrecs.js" hash="344e4abf974c5d834afbbd5ec22a6785"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="smartrecs"><file name="smartrecs.phtml" hash="eb191cbebb3729fe54294db5981e5a21"/><file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/><file name="render.phtml" hash="b508a2f71675d7a37b942cc41d2c5692"/><dir name="recs"><file name="home.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="category.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="product-1.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="product-2.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="search.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/><file name="basket.phtml" hash="9179ca699b638cc8fb6d9755b8f0ebe2"/></dir></dir></dir><dir name="layout"><file name="smartrecs.xml" hash="f52a4fba91d0a70e676ea2b92c7814ba"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="smartrecs.xml" hash="b18cea41c87596b4a391060772d62036"/></dir><dir name="template"><dir name="smartrecs"><file name="config.phtml" hash="e1592ad4495ef3e6b9061e348b35ed1d"/><file name="aclreloadbutton.phtml" hash="5a1baf33dff410aeef3de6811d3c8777"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="peerius"><dir name="smartrecs"><dir><dir name="css"><file name="config.css" hash="bc6e8f257e82345829fa4ab40cd6e73a"/></dir><dir name="img"><file name="logo-rollover.png" hash="d47a12d82bc3b271f343f590f7de260a"/><file name="navigation.png" hash="02fb819ba8faf2b9df42345e6f71463c"/></dir><dir name="js"><file name="smartrecs.js" hash="e9fc66f04761d7c0de868f031b592e50"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="peerius_smartrecs"><file name="style.css" hash="54f4d88777c86d9b2951183e0323f026"/></dir></dir></dir></dir></dir></target></contents>
|
21 |
<compatible/>
|
22 |
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
23 |
</package>
|