Superb_Recommend - Version 0.0.10

Version Notes

Get Started:
Go to http://recommend.pro and register

see https://github.com/wearesuperb/recommend-magento-module

Download this release

Release Info

Developer Superb
Extension Superb_Recommend
Version 0.0.10
Comparing to
See all releases


Version 0.0.10

Files changed (44) hide show
  1. app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Customer/Attribute.php +56 -0
  2. app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Customer/Recommend/Attribute.php +56 -0
  3. app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Product/Attribute.php +56 -0
  4. app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Product/Recommend/Attribute.php +56 -0
  5. app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Status.php +55 -0
  6. app/code/community/Superb/Recommend/Block/Adminhtml/System/Config/Form/Field/Array/Customer/Attributes.php +71 -0
  7. app/code/community/Superb/Recommend/Block/Adminhtml/System/Config/Form/Field/Array/Product/Attributes.php +71 -0
  8. app/code/community/Superb/Recommend/Block/Block.php +104 -0
  9. app/code/community/Superb/Recommend/Block/Cart/Block.php +20 -0
  10. app/code/community/Superb/Recommend/Block/Panel.php +37 -0
  11. app/code/community/Superb/Recommend/Block/Slot.php +53 -0
  12. app/code/community/Superb/Recommend/Block/Static/Block.php +55 -0
  13. app/code/community/Superb/Recommend/Block/System/Config/Form/Field/Advanced.php +25 -0
  14. app/code/community/Superb/Recommend/Block/System/Config/Form/Fieldset/Advanced.php +25 -0
  15. app/code/community/Superb/Recommend/Helper/Admin.php +113 -0
  16. app/code/community/Superb/Recommend/Helper/Api.php +350 -0
  17. app/code/community/Superb/Recommend/Helper/Data.php +629 -0
  18. app/code/community/Superb/Recommend/Model/Observer.php +548 -0
  19. app/code/community/Superb/Recommend/Model/Pagecache/Container/Block.php +71 -0
  20. app/code/community/Superb/Recommend/Model/Session.php +24 -0
  21. app/code/community/Superb/Recommend/Model/System/Config/Backend/Data/Cron.php +56 -0
  22. app/code/community/Superb/Recommend/Model/System/Config/Backend/Date.php +54 -0
  23. app/code/community/Superb/Recommend/Model/System/Config/Backend/Slot.php +46 -0
  24. app/code/community/Superb/Recommend/Model/System/Config/Backend/Status/Cron.php +56 -0
  25. app/code/community/Superb/Recommend/Model/System/Config/Source/Cron/Frequency.php +53 -0
  26. app/code/community/Superb/Recommend/Model/System/Config/Source/Customer/Attribute.php +53 -0
  27. app/code/community/Superb/Recommend/Model/System/Config/Source/Customer/Recommend/Attribute.php +41 -0
  28. app/code/community/Superb/Recommend/Model/System/Config/Source/Panel.php +42 -0
  29. app/code/community/Superb/Recommend/Model/System/Config/Source/Product/Attribute.php +53 -0
  30. app/code/community/Superb/Recommend/Model/System/Config/Source/Product/Recommend/Attribute.php +41 -0
  31. app/code/community/Superb/Recommend/Model/System/Config/Source/Thumbnail.php +49 -0
  32. app/code/community/Superb/Recommend/etc/adminhtml.xml +37 -0
  33. app/code/community/Superb/Recommend/etc/cache.xml +26 -0
  34. app/code/community/Superb/Recommend/etc/config.xml +178 -0
  35. app/code/community/Superb/Recommend/etc/system.xml +241 -0
  36. app/design/frontend/base/default/layout/superbrecommend.xml +145 -0
  37. app/design/frontend/base/default/template/recommend_tracker/block.phtml +27 -0
  38. app/design/frontend/base/default/template/recommend_tracker/colmain.phtml +38 -0
  39. app/design/frontend/base/default/template/recommend_tracker/force.phtml +23 -0
  40. app/design/frontend/base/default/template/recommend_tracker/panel.phtml +24 -0
  41. app/design/frontend/base/default/template/recommend_tracker/slot.phtml +24 -0
  42. app/design/frontend/base/default/template/recommend_tracker/static.phtml +38 -0
  43. app/etc/modules/Superb_Recommend.xml +24 -0
  44. package.xml +21 -0
app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Customer/Attribute.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Adminhtml_Form_Field_Customer_Attribute extends Mage_Core_Block_Html_Select
19
+ {
20
+
21
+ protected function _getAttributes(){
22
+ if (!$this->hasData('attributes')){
23
+ $attributes = Mage::getModel('superbrecommend/system_config_source_customer_attribute')->toOptionArray();
24
+ $this->setData('attributes', $attributes);
25
+ }
26
+ return $this->_getData('attributes');
27
+ }
28
+
29
+ public function _toHtml(){
30
+ if (!$this->getOptions()){
31
+ foreach($this->_getAttributes() as $attribute){
32
+ $this->addOption($attribute['value'], $this->quoteEscape($attribute['label']));
33
+ }
34
+ }
35
+ return parent::_toHtml();
36
+ }
37
+
38
+ public function setInputName($value){
39
+ return $this->setName($value);
40
+ }
41
+
42
+ protected function _optionToHtml($option, $selected=false){
43
+ $selectedHtml = $selected ? ' selected="selected"' : '';
44
+ if ($this->getIsRenderToJsTemplate() === true){
45
+ $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}';
46
+ }
47
+ $html = '<option value="'.$this->htmlEscape($option['value']).'"'.$selectedHtml.'>'.$this->escapeHtml($this->jsQuoteEscape($option['label'])).'</option>';
48
+
49
+ return $html;
50
+ }
51
+
52
+ public function calcOptionHash($optionValue){
53
+ return sprintf('%u', crc32($this->getName() . $this->getId() . $optionValue));
54
+ }
55
+
56
+ }
app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Customer/Recommend/Attribute.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Adminhtml_Form_Field_Customer_Recommend_Attribute extends Mage_Core_Block_Html_Select
19
+ {
20
+
21
+ protected function _getAttributes(){
22
+ if (!$this->hasData('attributes')){
23
+ $attributes = Mage::getModel('superbrecommend/system_config_source_customer_recommend_attribute')->toOptionArray();
24
+ $this->setData('attributes', $attributes);
25
+ }
26
+ return $this->_getData('attributes');
27
+ }
28
+
29
+ public function _toHtml(){
30
+ if (!$this->getOptions()){
31
+ foreach($this->_getAttributes() as $attribute){
32
+ $this->addOption($attribute['value'], $this->quoteEscape($attribute['label']));
33
+ }
34
+ }
35
+ return parent::_toHtml();
36
+ }
37
+
38
+ public function setInputName($value){
39
+ return $this->setName($value);
40
+ }
41
+
42
+ protected function _optionToHtml($option, $selected=false){
43
+ $selectedHtml = $selected ? ' selected="selected"' : '';
44
+ if ($this->getIsRenderToJsTemplate() === true){
45
+ $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}';
46
+ }
47
+ $html = '<option value="'.$this->htmlEscape($option['value']).'"'.$selectedHtml.'>'.$this->escapeHtml($this->jsQuoteEscape($option['label'])).'</option>';
48
+
49
+ return $html;
50
+ }
51
+
52
+ public function calcOptionHash($optionValue){
53
+ return sprintf('%u', crc32($this->getName() . $this->getId() . $optionValue));
54
+ }
55
+
56
+ }
app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Product/Attribute.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Adminhtml_Form_Field_Product_Attribute extends Mage_Core_Block_Html_Select
19
+ {
20
+
21
+ protected function _getAttributes(){
22
+ if (!$this->hasData('attributes')){
23
+ $attributes = Mage::getModel('superbrecommend/system_config_source_product_attribute')->toOptionArray();
24
+ $this->setData('attributes', $attributes);
25
+ }
26
+ return $this->_getData('attributes');
27
+ }
28
+
29
+ public function _toHtml(){
30
+ if (!$this->getOptions()){
31
+ foreach($this->_getAttributes() as $attribute){
32
+ $this->addOption($attribute['value'], $this->quoteEscape($attribute['label']));
33
+ }
34
+ }
35
+ return parent::_toHtml();
36
+ }
37
+
38
+ public function setInputName($value){
39
+ return $this->setName($value);
40
+ }
41
+
42
+ protected function _optionToHtml($option, $selected=false){
43
+ $selectedHtml = $selected ? ' selected="selected"' : '';
44
+ if ($this->getIsRenderToJsTemplate() === true){
45
+ $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}';
46
+ }
47
+ $html = '<option value="'.$this->htmlEscape($option['value']).'"'.$selectedHtml.'>'.$this->escapeHtml($this->jsQuoteEscape($option['label'])).'</option>';
48
+
49
+ return $html;
50
+ }
51
+
52
+ public function calcOptionHash($optionValue){
53
+ return sprintf('%u', crc32($this->getName() . $this->getId() . $optionValue));
54
+ }
55
+
56
+ }
app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Product/Recommend/Attribute.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Adminhtml_Form_Field_Product_Recommend_Attribute extends Mage_Core_Block_Html_Select
19
+ {
20
+
21
+ protected function _getAttributes(){
22
+ if (!$this->hasData('attributes')){
23
+ $attributes = Mage::getModel('superbrecommend/system_config_source_product_recommend_attribute')->toOptionArray();
24
+ $this->setData('attributes', $attributes);
25
+ }
26
+ return $this->_getData('attributes');
27
+ }
28
+
29
+ public function _toHtml(){
30
+ if (!$this->getOptions()){
31
+ foreach($this->_getAttributes() as $attribute){
32
+ $this->addOption($attribute['value'], $this->quoteEscape($attribute['label']));
33
+ }
34
+ }
35
+ return parent::_toHtml();
36
+ }
37
+
38
+ public function setInputName($value){
39
+ return $this->setName($value);
40
+ }
41
+
42
+ protected function _optionToHtml($option, $selected=false){
43
+ $selectedHtml = $selected ? ' selected="selected"' : '';
44
+ if ($this->getIsRenderToJsTemplate() === true){
45
+ $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}';
46
+ }
47
+ $html = '<option value="'.$this->htmlEscape($option['value']).'"'.$selectedHtml.'>'.$this->escapeHtml($this->jsQuoteEscape($option['label'])).'</option>';
48
+
49
+ return $html;
50
+ }
51
+
52
+ public function calcOptionHash($optionValue){
53
+ return sprintf('%u', crc32($this->getName() . $this->getId() . $optionValue));
54
+ }
55
+
56
+ }
app/code/community/Superb/Recommend/Block/Adminhtml/Form/Field/Status.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Adminhtml_Form_Field_Status extends Mage_Core_Block_Html_Select
19
+ {
20
+ public function _toHtml(){
21
+ if (!$this->getOptions()){
22
+ foreach(Mage::getModel('adminhtml/system_config_source_enabledisable')->toOptionArray() as $panel){
23
+ $this->addOption($panel['value'], $this->quoteEscape($panel['label']));
24
+ }
25
+ }
26
+ return parent::_toHtml();
27
+ }
28
+
29
+ public function setInputName($value){
30
+ return $this->setName($value);
31
+ }
32
+
33
+ public function getExtraParams(){
34
+ return 'style="width:80px"';
35
+ }
36
+
37
+ public function getClass(){
38
+ return 'input-text required-entry';
39
+ }
40
+
41
+ protected function _optionToHtml($option, $selected=false){
42
+ $selectedHtml = $selected ? ' selected="selected"' : '';
43
+ if ($this->getIsRenderToJsTemplate() === true){
44
+ $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}';
45
+ }
46
+ $html = '<option value="'.$this->htmlEscape($option['value']).'"'.$selectedHtml.'>'.$this->escapeHtml($this->jsQuoteEscape($option['label'])).'</option>';
47
+
48
+ return $html;
49
+ }
50
+
51
+ public function calcOptionHash($optionValue){
52
+ return sprintf('%u', crc32($this->getName() . $this->getId() . $optionValue));
53
+ }
54
+
55
+ }
app/code/community/Superb/Recommend/Block/Adminhtml/System/Config/Form/Field/Array/Customer/Attributes.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Adminhtml_System_Config_Form_Field_Array_Customer_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
19
+ {
20
+
21
+ public function __construct(){
22
+ $this->addColumn('recommend_attribute', array(
23
+ 'label' => Mage::helper('superbrecommend')->__('Recommend attribute').'<em class="required">*</em>',
24
+ 'style' => 'width:150px',
25
+ 'class' => 'input-text required-entry',
26
+ 'renderer' => $this->_getRecommendAttributeRenderer()
27
+ ));
28
+ $this->addColumn('magento_attribute', array(
29
+ 'label' => Mage::helper('superbrecommend')->__('Magento attribute').'<em class="required">*</em>',
30
+ 'style' => 'width:150px',
31
+ 'class' => 'input-text required-entry',
32
+ 'renderer' => $this->_getMagentoAttributeRenderer()
33
+ ));
34
+ $this->_addAfter = false;
35
+ $this->_addButtonLabel = Mage::helper('superbrecommend')->__('Add attribute');
36
+
37
+ parent::__construct();
38
+ }
39
+
40
+ protected function _getRecommendAttributeRenderer(){
41
+ $attribute = Mage::app()->getLayout()->createBlock('superbrecommend/adminhtml_form_field_customer_recommend_attribute');
42
+ $attribute->setIsRenderToJsTemplate(true);
43
+ return $attribute;
44
+
45
+ }
46
+
47
+ protected function _getMagentoAttributeRenderer(){
48
+ $attribute = Mage::app()->getLayout()->createBlock('superbrecommend/adminhtml_form_field_customer_attribute');
49
+ $attribute->setIsRenderToJsTemplate(true);
50
+ return $attribute;
51
+
52
+ }
53
+
54
+ public function getArrayRows(){
55
+ $rows = parent::getArrayRows();
56
+ foreach ($rows as $row){
57
+ foreach ($row->getData() as $key => $value){
58
+ if (!isset($this->_columns[$key]))
59
+ continue;
60
+
61
+ $column = $this->_columns[$key];
62
+
63
+ // Add hashed template tag with selected value
64
+ if ($column['renderer'] instanceof Mage_Core_Block_Html_Select){
65
+ $row->setData(sprintf('option_extra_attr_%s', $column['renderer']->calcOptionHash($value)), 'selected="selected"');
66
+ }
67
+ }
68
+ }
69
+ return $rows;
70
+ }
71
+ }
app/code/community/Superb/Recommend/Block/Adminhtml/System/Config/Form/Field/Array/Product/Attributes.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Adminhtml_System_Config_Form_Field_Array_Product_Attributes extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
19
+ {
20
+
21
+ public function __construct(){
22
+ $this->addColumn('recommend_attribute', array(
23
+ 'label' => Mage::helper('superbrecommend')->__('Recommend attribute').'<em class="required">*</em>',
24
+ 'style' => 'width:150px',
25
+ 'class' => 'input-text required-entry',
26
+ 'renderer' => $this->_getRecommendAttributeRenderer()
27
+ ));
28
+ $this->addColumn('magento_attribute', array(
29
+ 'label' => Mage::helper('superbrecommend')->__('Magento attribute').'<em class="required">*</em>',
30
+ 'style' => 'width:150px',
31
+ 'class' => 'input-text required-entry',
32
+ 'renderer' => $this->_getMagentoAttributeRenderer()
33
+ ));
34
+ $this->_addAfter = false;
35
+ $this->_addButtonLabel = Mage::helper('superbrecommend')->__('Add attribute');
36
+
37
+ parent::__construct();
38
+ }
39
+
40
+ protected function _getRecommendAttributeRenderer(){
41
+ $attribute = Mage::app()->getLayout()->createBlock('superbrecommend/adminhtml_form_field_product_recommend_attribute');
42
+ $attribute->setIsRenderToJsTemplate(true);
43
+ return $attribute;
44
+
45
+ }
46
+
47
+ protected function _getMagentoAttributeRenderer(){
48
+ $attribute = Mage::app()->getLayout()->createBlock('superbrecommend/adminhtml_form_field_product_attribute');
49
+ $attribute->setIsRenderToJsTemplate(true);
50
+ return $attribute;
51
+
52
+ }
53
+
54
+ public function getArrayRows(){
55
+ $rows = parent::getArrayRows();
56
+ foreach ($rows as $row){
57
+ foreach ($row->getData() as $key => $value){
58
+ if (!isset($this->_columns[$key]))
59
+ continue;
60
+
61
+ $column = $this->_columns[$key];
62
+
63
+ // Add hashed template tag with selected value
64
+ if ($column['renderer'] instanceof Mage_Core_Block_Html_Select){
65
+ $row->setData(sprintf('option_extra_attr_%s', $column['renderer']->calcOptionHash($value)), 'selected="selected"');
66
+ }
67
+ }
68
+ }
69
+ return $rows;
70
+ }
71
+ }
app/code/community/Superb/Recommend/Block/Block.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Block extends Mage_Core_Block_Template
19
+ {
20
+ protected function _construct()
21
+ {
22
+ $this->setTemplate('recommend_tracker/block.phtml');
23
+ }
24
+
25
+ public function getTrackingData()
26
+ {
27
+ $data = $this->helper('superbrecommend')->getTrackingData();
28
+ //Mage::log(Mage::helper('core/url')->getCurrentUrl(),null,'superbrecommend.log');
29
+ //Mage::log($data,null,'superbrecommend.log');
30
+ if (Mage::getSingleton('customer/session')->isLoggedIn())
31
+ {
32
+ $data = (is_array($data)?$data:array());
33
+ array_unshift($data,array("setCustomerId",Mage::getSingleton('customer/session')->getCustomerId()));
34
+ }
35
+ return $data;
36
+ }
37
+
38
+ public function setSuccessPage()
39
+ {
40
+ $data = $this->helper('superbrecommend')->processOrderSuccess();
41
+ //Mage::log($data,null,'superbrecommend.log');
42
+ $this->helper('superbrecommend')->setTrackingData($data);
43
+
44
+ $data = $this->helper('superbrecommend')->getCartStatusData(Mage::getSingleton('checkout/cart'));
45
+ //Mage::log($data,null,'superbrecommend.log');
46
+ $this->helper('superbrecommend')->setTrackingData($data);
47
+ }
48
+
49
+ public function setCheckoutPage()
50
+ {
51
+ $data = $this->helper('superbrecommend')->processCheckoutPage();
52
+ //Mage::log($data,null,'superbrecommend.log');
53
+ $this->helper('superbrecommend')->setTrackingData($data);
54
+ }
55
+
56
+ public function checkLayerPage()
57
+ {
58
+ if (Mage::getSingleton('catalog/layer')!==false)
59
+ {
60
+ if (count(Mage::getSingleton('catalog/layer')->getState()->getFilters()))
61
+ $this->helper('superbrecommend')->setTrackingData(array('disableRecommendationPanels'),true);
62
+ }
63
+ }
64
+
65
+ public function getCachedHtml()
66
+ {
67
+ echo '';
68
+ }
69
+
70
+ /**
71
+ * Retrieve cookie value
72
+ *
73
+ * @param string $cookieName
74
+ * @param mixed $defaultValue
75
+ * @return string
76
+ */
77
+ protected function _getCookieValue($cookieName, $defaultValue = null)
78
+ {
79
+ return (array_key_exists($cookieName, $_COOKIE) ? $_COOKIE[$cookieName] : $defaultValue);
80
+ }
81
+
82
+ /**
83
+ * Check whether the block can be displayed
84
+ *
85
+ * @return bool
86
+ */
87
+ public function canDisplay()
88
+ {
89
+ return Mage::helper('superbrecommend')->isEnabled();
90
+ }
91
+
92
+ /**
93
+ * Output content, if allowed
94
+ *
95
+ * @return string
96
+ */
97
+ protected function _toHtml()
98
+ {
99
+ if (!$this->canDisplay()) {
100
+ return '';
101
+ }
102
+ return parent::_toHtml();
103
+ }
104
+ }
app/code/community/Superb/Recommend/Block/Cart/Block.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Cart_Block extends Superb_Recommend_Block_Block
19
+ {
20
+ }
app/code/community/Superb/Recommend/Block/Panel.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Panel extends Mage_Core_Block_Template
19
+ {
20
+ protected $_panelId = null;
21
+
22
+ protected function _construct()
23
+ {
24
+ $this->setTemplate('recommend_tracker/panel.phtml');
25
+ }
26
+
27
+ public function setRecommendPanelId($panelId)
28
+ {
29
+ $this->_panelId = $panelId;
30
+ return $this;
31
+ }
32
+
33
+ public function getRecommendPanelId()
34
+ {
35
+ return $this->_panelId;
36
+ }
37
+ }
app/code/community/Superb/Recommend/Block/Slot.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Slot extends Mage_Core_Block_Template
19
+ {
20
+ const CALLBACK_FUNCTION_NAME = '__%|CALLBACK_FUNCTION_NAME|%__';
21
+ protected function _construct()
22
+ {
23
+ $this->setTemplate('recommend_tracker/slot.phtml');
24
+ }
25
+
26
+ public function getOptions()
27
+ {
28
+ $options = array();
29
+ if ($this->getSlotPosition()!==false)
30
+ $options['slotPosition'] = $this->getSlotPosition();
31
+ if ($this->getPageType()!==false)
32
+ $options['pageType'] = $this->getPageType();
33
+ if ($this->getPageTypePosition()!==false)
34
+ $options['pageTypePosition'] = $this->getPageTypePosition();
35
+ if ($this->getDefaultPanelId()!==false)
36
+ $options['defaultPanelId'] = $this->getDefaultPanelId();
37
+ if (!is_null($this->getCallback()))
38
+ $options['callback'] = self::CALLBACK_FUNCTION_NAME.$this->getCallback().self::CALLBACK_FUNCTION_NAME;
39
+ return $options;
40
+ }
41
+
42
+ public function getJsonOptions()
43
+ {
44
+ return str_replace(
45
+ array(
46
+ '"'.self::CALLBACK_FUNCTION_NAME,
47
+ self::CALLBACK_FUNCTION_NAME.'"'
48
+ ),
49
+ '',
50
+ json_encode($this->getOptions())
51
+ );
52
+ }
53
+ }
app/code/community/Superb/Recommend/Block/Static/Block.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_Static_Block extends Mage_Core_Block_Template
19
+ {
20
+ protected function _construct()
21
+ {
22
+ $this->setTemplate('recommend_tracker/static.phtml');
23
+ }
24
+
25
+ public function getTrackingData()
26
+ {
27
+ $data = $this->helper('superbrecommend')->getTrackingData(true,true);
28
+ //Mage::log(Mage::helper('core/url')->getCurrentUrl(),null,'superbrecommend.log');
29
+ //Mage::log($data,null,'superbrecommend.log');
30
+ return $data;
31
+ }
32
+
33
+ /**
34
+ * Check whether the block can be displayed
35
+ *
36
+ * @return bool
37
+ */
38
+ public function canDisplay()
39
+ {
40
+ return Mage::helper('superbrecommend')->isEnabled();
41
+ }
42
+
43
+ /**
44
+ * Output content, if allowed
45
+ *
46
+ * @return string
47
+ */
48
+ protected function _toHtml()
49
+ {
50
+ if (!$this->canDisplay()) {
51
+ return '';
52
+ }
53
+ return parent::_toHtml();
54
+ }
55
+ }
app/code/community/Superb/Recommend/Block/System/Config/Form/Field/Advanced.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_System_Config_Form_Field_Advanced
19
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
20
+ {
21
+ public function render(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ return Mage::helper('superbrecommend')->getIsAdvancedModeEnabled()?parent::render($element):'';
24
+ }
25
+ }
app/code/community/Superb/Recommend/Block/System/Config/Form/Fieldset/Advanced.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Block_System_Config_Form_Fieldset_Advanced
19
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
20
+ {
21
+ public function render(Varien_Data_Form_Element_Abstract $element)
22
+ {
23
+ return Mage::helper('superbrecommend')->getIsAdvancedModeEnabled()?parent::render($element):'';
24
+ }
25
+ }
app/code/community/Superb/Recommend/Helper/Admin.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Helper_Admin extends Mage_Core_Helper_Data
19
+ {
20
+ static protected $_slotSystemConfigSaveData = array();
21
+ static protected $_slotsData = array();
22
+ static protected $_panelsData = array();
23
+ static protected $_productAttributesData = array();
24
+ static protected $_customerAttributesData = array();
25
+ static protected $_systemConfigStoreId = -1;
26
+
27
+ public function setSaveSlotSystemConfig($slotId, $data)
28
+ {
29
+ self::$_slotSystemConfigSaveData[$slotId] = $data;
30
+ }
31
+
32
+ public function getSaveSlotSystemConfig()
33
+ {
34
+ return self::$_slotSystemConfigSaveData;
35
+ }
36
+
37
+ public function getSlotsData($storeId = null)
38
+ {
39
+ if (!isset(self::$_slotsData[$storeId]))
40
+ {
41
+ self::$_slotsData[$storeId] = Mage::helper('superbrecommend/api')->getSlotsData($storeId);
42
+ }
43
+ return self::$_slotsData[$storeId];
44
+ }
45
+
46
+ public function getPanelsListData($storeId = null)
47
+ {
48
+ if (!isset(self::$_panelsData[$storeId]))
49
+ {
50
+ self::$_panelsData[$storeId] = Mage::helper('superbrecommend/api')->getPanelsListData($storeId);
51
+ }
52
+ return self::$_panelsData[$storeId];
53
+ }
54
+
55
+ public function getProductAttributesListData($storeId = null)
56
+ {
57
+ if (!isset(self::$_productAttributesData[$storeId]))
58
+ {
59
+ self::$_productAttributesData[$storeId] = Mage::helper('superbrecommend/api')->getProductAttributesListData($storeId);
60
+ }
61
+ return self::$_productAttributesData[$storeId];
62
+ }
63
+
64
+ public function getCustomerAttributesListData($storeId = null)
65
+ {
66
+ if (!isset(self::$_customerAttributesData[$storeId]))
67
+ {
68
+ self::$_customerAttributesData[$storeId] = Mage::helper('superbrecommend/api')->getCustomerAttributesListData($storeId);
69
+ }
70
+ return self::$_customerAttributesData[$storeId];
71
+ }
72
+
73
+ public function getSystemConfigStoreId()
74
+ {
75
+ if (self::$_systemConfigStoreId==-1)
76
+ {
77
+ if (strlen($this->getRequest()->getParam('store')))
78
+ self::$_systemConfigStoreId = $this->getRequest()->getParam('store');
79
+ elseif (strlen($this->getRequest()->getParam('website')))
80
+ self::$_systemConfigStoreId = Mage::getModel('core/website')->load($this->getRequest()->getParam('website'))->getDefaultStore()->getId();
81
+ else
82
+ self::$_systemConfigStoreId = null;
83
+ }
84
+ return self::$_systemConfigStoreId;
85
+ }
86
+
87
+ /**
88
+ * Retrieve request object
89
+ *
90
+ * @return Mage_Core_Controller_Request_Http
91
+ * @throws Exception
92
+ */
93
+ public function getRequest()
94
+ {
95
+ $controller = Mage::app()->getFrontController();
96
+ if ($controller) {
97
+ $this->_request = $controller->getRequest();
98
+ } else {
99
+ throw new Exception(Mage::helper('core')->__("Can't retrieve request object"));
100
+ }
101
+ return $this->_request;
102
+ }
103
+
104
+ public function isSingleMode()
105
+ {
106
+ return Mage::getStoreConfig(Superb_Recommend_Helper_Api::XML_PATH_TRACKING_ACCOUNT_ID,$this->getSystemConfigStoreId())==Mage::getStoreConfig(Superb_Recommend_Helper_Api::XML_PATH_TRACKING_ACCOUNT_ID);
107
+ }
108
+
109
+ public function isStoreMode()
110
+ {
111
+ return strlen($this->getRequest()->getParam('store'));
112
+ }
113
+ }
app/code/community/Superb/Recommend/Helper/Api.php ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Helper_Api extends Mage_Core_Helper_Data
19
+ {
20
+ const XML_PATH_ENABLED = 'superbrecommend/general_settings/enabled';
21
+ const XML_PATH_TRACKING_ACCOUNT_ID = 'superbrecommend/general_settings/account_id';
22
+ const XML_PATH_API_URL = 'superbrecommend/general_settings/api_url';
23
+ const XML_PATH_API_USERNAME = 'superbrecommend/api_settings/username';
24
+ const XML_PATH_API_KEY = 'superbrecommend/general_settings/api_key';
25
+ const XML_PATH_API_ACCESS_TOKEN = 'superbrecommend/general_settings/api_access_token';
26
+ const XML_PATH_API_SHOW_OUT_OF_STOCK_PRODUCTS = 'superbrecommend/panels/show_out_of_stock_products';
27
+
28
+ protected $_tokenData = array();
29
+
30
+ protected function _getGetTokenUrl($storeId = null)
31
+ {
32
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/authenticate';
33
+ }
34
+
35
+ protected function _getUpdateAccountUrl($storeId = null)
36
+ {
37
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/update';
38
+ }
39
+
40
+ protected function _getUploadProductsDataUrl($storeId = null)
41
+ {
42
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/products/update';
43
+ }
44
+
45
+ protected function _getGetProductsPageviewsDataUrl($storeId = null)
46
+ {
47
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/products/pageviews';
48
+ }
49
+
50
+ protected function _getGetSlotsPageTypesDataUrl($storeId = null)
51
+ {
52
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/pagetypes';
53
+ }
54
+
55
+ protected function _getGetPanelsListDataUrl($storeId = null)
56
+ {
57
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/panels/search';
58
+ }
59
+
60
+ protected function _getGetProductAttributesListDataUrl($storeId = null)
61
+ {
62
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/productattributes/search';
63
+ }
64
+
65
+ protected function _getGetCustomerAttributesListDataUrl($storeId = null)
66
+ {
67
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/customerattributes/search';
68
+ }
69
+
70
+ protected function _getUpdateSlotsUrl($storeId = null)
71
+ {
72
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/slots/update';
73
+ }
74
+
75
+ protected function _getGetSlotsDataUrl($storeId = null)
76
+ {
77
+ return Mage::getStoreConfig(self::XML_PATH_API_URL,$storeId).'v1/'.urlencode(Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID,$storeId)).'/slots';
78
+ }
79
+
80
+ protected function _getAccessToken($storeId = null)
81
+ {
82
+ if (!isset($this->_tokenData[$storeId]) || (is_array($this->_tokenData[$storeId]) && !isset($this->_tokenData[$storeId]['token'])) || (is_array($this->_tokenData[$storeId]) && isset($this->_tokenData[$storeId]['expires_date']) && (time()>$this->_tokenData[$storeId]['expires_date'])))
83
+ {
84
+ $ch = curl_init();
85
+ $data_string = json_encode(array('key'=>Mage::helper('core')->decrypt(Mage::getStoreConfig(self::XML_PATH_API_KEY,$storeId))));
86
+ curl_setopt($ch, CURLOPT_URL, $this->_getGetTokenUrl($storeId));
87
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
88
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
89
+ $headers = array();
90
+ $headers[] = 'Content-Type: application/json';
91
+ $headers[] = 'Content-Length: ' . strlen($data_string);
92
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
93
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
94
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
95
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
96
+ try {
97
+ $responseBody = curl_exec($ch);
98
+ $tokenData = @json_decode($responseBody,true);
99
+ if (isset($tokenData['success']) && $tokenData['success']==true)
100
+ {
101
+ $this->_tokenData[$storeId] = $tokenData['token'];
102
+ }
103
+ } catch (Exception $e) {
104
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
105
+ }
106
+ }
107
+ if (isset($this->_tokenData[$storeId]) && is_array($this->_tokenData[$storeId]) && isset($this->_tokenData[$storeId]['token']))
108
+ {
109
+ return $this->_tokenData[$storeId]['token'];
110
+ }
111
+ }
112
+
113
+ public function uploadProductsData($products,$storeId = null)
114
+ {
115
+ $ch = curl_init();
116
+ $data_string = json_encode(array('products'=>$products));
117
+ curl_setopt($ch, CURLOPT_URL, $this->_getUploadProductsDataUrl($storeId));
118
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
119
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
120
+ $headers = array();
121
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
122
+ $headers[] = 'Content-Type: application/json';
123
+ $headers[] = 'Content-Length: ' . strlen($data_string);
124
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
125
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
126
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
127
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
128
+ try {
129
+ $responseBody = curl_exec($ch);
130
+ Mage::log($responseBody,null,'recommend-upload-products-data.log');
131
+ } catch (Exception $e) {
132
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
133
+ }
134
+ }
135
+
136
+ public function getProductsPageviewsData($hours,$storeId = null)
137
+ {
138
+ $ch = curl_init();
139
+ $data_string = json_encode(array('hours'=>$hours));
140
+ curl_setopt($ch, CURLOPT_URL, $this->_getGetProductsPageviewsDataUrl($storeId));
141
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
142
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
143
+ $headers = array();
144
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
145
+ $headers[] = 'Content-Type: application/json';
146
+ $headers[] = 'Content-Length: ' . strlen($data_string);
147
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
148
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
149
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
150
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
151
+ try {
152
+ $responseBody = curl_exec($ch);
153
+ Mage::log($responseBody,null,'recommend-get-products-pageviews-data.log');
154
+ $response = json_decode($responseBody,true);
155
+ if (isset($response['success']) && $response['success']==true && isset($response['products']) && is_array($response['products']))
156
+ {
157
+ $productsData = $response['products'];
158
+ return $productsData;
159
+ }
160
+ } catch (Exception $e) {
161
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
162
+ }
163
+ }
164
+
165
+ public function getSlotsPageTypesData($storeId = null)
166
+ {
167
+ $ch = curl_init();
168
+ curl_setopt($ch, CURLOPT_URL, $this->_getGetSlotsPageTypesDataUrl($storeId));
169
+ $headers = array();
170
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
171
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
172
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
173
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
174
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
175
+ try {
176
+ $responseBody = curl_exec($ch);
177
+ Mage::log($responseBody,null,'recommend-get-slots-page-types-data.log');
178
+ $response = json_decode($responseBody,true);
179
+ if (isset($response['success']) && $response['success']==true && isset($response['results']) && is_array($response['results']))
180
+ {
181
+ $slotsPageTypesData = $response['results'];
182
+ return $slotsPageTypesData;
183
+ }
184
+ } catch (Exception $e) {
185
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
186
+ }
187
+ }
188
+
189
+ public function getSlotsData($storeId = null)
190
+ {
191
+ $ch = curl_init();
192
+ curl_setopt($ch, CURLOPT_URL, $this->_getGetSlotsDataUrl($storeId));
193
+ $headers = array();
194
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
195
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
196
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
197
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
198
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
199
+ try {
200
+ $responseBody = curl_exec($ch);
201
+ Mage::log($responseBody,null,'recommend-get-slots-data.log');
202
+ $response = json_decode($responseBody,true);
203
+ if (isset($response['success']) && $response['success']==true && isset($response['results']) && is_array($response['results']))
204
+ {
205
+ $slotsData = $response['results'];
206
+ return $slotsData;
207
+ }
208
+ } catch (Exception $e) {
209
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
210
+ }
211
+ }
212
+
213
+ public function updateSlots($slotsData,$storeId = null)
214
+ {
215
+ $ch = curl_init();
216
+ $data_string = json_encode(array('slots'=>$slotsData));
217
+ curl_setopt($ch, CURLOPT_URL, $this->_getUpdateSlotsUrl($storeId));
218
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
219
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
220
+ $headers = array();
221
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
222
+ $headers[] = 'Content-Type: application/json';
223
+ $headers[] = 'Content-Length: ' . strlen($data_string);
224
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
225
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
226
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
227
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
228
+ try {
229
+ $responseBody = curl_exec($ch);
230
+ Mage::log($responseBody,null,'recommend-update-slots.log');
231
+ $response = json_decode($responseBody,true);
232
+ if (isset($response['success']) && $response['success']==true)
233
+ return true;
234
+ } catch (Exception $e) {
235
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
236
+ }
237
+ }
238
+
239
+ public function getPanelsListData($storeId = null)
240
+ {
241
+ $ch = curl_init();
242
+ curl_setopt($ch, CURLOPT_URL, $this->_getGetPanelsListDataUrl($storeId));
243
+ $headers = array();
244
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
245
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
246
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
247
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
248
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
249
+ try {
250
+ $responseBody = curl_exec($ch);
251
+ Mage::log($responseBody,null,'recommend-get-panels-list-data.log');
252
+ $response = json_decode($responseBody,true);
253
+ if (isset($response['success']) && $response['success']==true && isset($response['results']) && is_array($response['results']))
254
+ {
255
+ $panelsData = $response['results'];
256
+ return $panelsData;
257
+ }
258
+ } catch (Exception $e) {
259
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
260
+ }
261
+ }
262
+
263
+ public function getProductAttributesListData($storeId = null)
264
+ {
265
+ $ch = curl_init();
266
+ curl_setopt($ch, CURLOPT_URL, $this->_getGetProductAttributesListDataUrl($storeId));
267
+ $headers = array();
268
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
269
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
270
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
271
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
272
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
273
+ try {
274
+ $responseBody = curl_exec($ch);
275
+ Mage::log($responseBody,null,'recommend-get-product-attributes-list-data.log');
276
+ $response = json_decode($responseBody,true);
277
+ if (isset($response['success']) && $response['success']==true && isset($response['results']) && is_array($response['results']))
278
+ {
279
+ $panelsData = $response['results'];
280
+ return $panelsData;
281
+ }
282
+ } catch (Exception $e) {
283
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
284
+ }
285
+ }
286
+
287
+ public function getCustomerAttributesListData($storeId = null)
288
+ {
289
+ $ch = curl_init();
290
+ curl_setopt($ch, CURLOPT_URL, $this->_getGetCustomerAttributesListDataUrl($storeId));
291
+ $headers = array();
292
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
293
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
294
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
295
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
296
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
297
+ try {
298
+ $responseBody = curl_exec($ch);
299
+ Mage::log($responseBody,null,'recommend-get-customer-attributes-list-data.log');
300
+ $response = json_decode($responseBody,true);
301
+ if (isset($response['success']) && $response['success']==true && isset($response['results']) && is_array($response['results']))
302
+ {
303
+ $panelsData = $response['results'];
304
+ return $panelsData;
305
+ }
306
+ } catch (Exception $e) {
307
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
308
+ }
309
+ }
310
+
311
+ public function updateAccount($storeId = null)
312
+ {
313
+ $ch = curl_init();
314
+ $data_string = json_encode(array('currency'=>Mage::app()->getStore($storeId)->getBaseCurrencyCode(),'platform'=>'magento','platform_version'=>Mage::getVersion()));
315
+ curl_setopt($ch, CURLOPT_URL, $this->_getUpdateAccountUrl($storeId));
316
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
317
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
318
+ $headers = array();
319
+ $headers[] = 'X-Auth-Token: '.$this->_getAccessToken($storeId);
320
+ $headers[] = 'Content-Type: application/json';
321
+ $headers[] = 'Content-Length: ' . strlen($data_string);
322
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
323
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
324
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
325
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
326
+ try {
327
+ $responseBody = curl_exec($ch);
328
+ Mage::log($responseBody,null,'recommend-update-account.log');
329
+ $response = json_decode($responseBody,true);
330
+ if (isset($response['success']) && $response['success']==true)
331
+ return true;
332
+ elseif (isset($response['error']) && $response['error']==true && isset($response['error_message']) && $response['error_message']=='Base currency can not be changed after build.')
333
+ {
334
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Once you have posted transactions and accounts using the base currency, you cannot change the base currency.'));
335
+ return false;
336
+ }
337
+ elseif (isset($response['error']) && isset($response['error_message']) && $response['error_message']=='Access denied')
338
+ {
339
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('API not connected. Check Account Id and API key.'));
340
+ return false;
341
+ }
342
+ } catch (Exception $e) {
343
+ Mage::log($e->getMessage()."\n".$e->getTraceAsString(),null,'recommend-api.log');
344
+ }
345
+ }
346
+
347
+ public function getShowOutOfStockProduct(){
348
+ return (bool) Mage::getStoreConfig(self::XML_PATH_API_SHOW_OUT_OF_STOCK_PRODUCTS);
349
+ }
350
+ }
app/code/community/Superb/Recommend/Helper/Data.php ADDED
@@ -0,0 +1,629 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Helper_Data extends Mage_Core_Helper_Data
19
+ {
20
+ const COOKIE_RECOMMENDTRACKER = 'RECOMMENDTRACKER';
21
+
22
+ const XML_PATH_ENABLED = 'superbrecommend/general_settings/enabled';
23
+ const XML_PATH_TRACKING_ACCOUNT_ID = 'superbrecommend/general_settings/account_id';
24
+ const XML_PATH_TRACKING_URL = 'superbrecommend/general_settings/server_url';
25
+ const XML_PATH_TRACKING_URL_SECURE = 'superbrecommend/general_settings/server_secure_url';
26
+ const XML_PATH_DASHBOARD_ENABLED = 'superbrecommend/general_settings/dashboard';
27
+ const XML_PATH_TRACKING_PRODUCT_ATTRIBUTES = 'superbrecommend/general_settings/product_attributes';
28
+ const XML_PATH_TRACKING_CUSTOMER_ATTRIBUTES = 'superbrecommend/general_settings/customer_attributes';
29
+ const XML_PATH_ADVANCED = 'superbrecommend/general_settings/advanced';
30
+ const XML_PATH_TRACKING_MEDIA_THUMB_SOURCE = 'superbrecommend/panels/media_thumb_source';
31
+ const XML_PATH_TRACKING_MEDIA_THUMB_WIDTH = 'superbrecommend/panels/media_thumb_width';
32
+ const XML_PATH_TRACKING_MEDIA_THUMB_HEIGHT = 'superbrecommend/panels/media_thumb_height';
33
+ const XML_PATH_DATA_CRON_ENABLED = 'superbrecommend/data_cron/enabled';
34
+ const XML_PATH_STATUS_CRON_ENABLED = 'superbrecommend/status_cron/enabled';
35
+
36
+ static protected $_staticData;
37
+
38
+ protected $_childProductLoaded;
39
+
40
+ protected function _getSession()
41
+ {
42
+ return Mage::getModel('superbrecommend/session');
43
+ }
44
+
45
+ /**
46
+ * Retrieve cookie object
47
+ *
48
+ * @return Mage_Core_Model_Cookie
49
+ */
50
+ public function _getCookie()
51
+ {
52
+ return Mage::getSingleton('core/cookie');
53
+ }
54
+
55
+ public function getIsAdvancedModeEnabled()
56
+ {
57
+ return (bool)Mage::getStoreConfig(self::XML_PATH_ADVANCED);
58
+ }
59
+
60
+ public function getThumbSource()
61
+ {
62
+ return Mage::getStoreConfig(self::XML_PATH_TRACKING_MEDIA_THUMB_SOURCE);
63
+ }
64
+
65
+ public function getThumbWidth()
66
+ {
67
+ $width = Mage::getStoreConfig(self::XML_PATH_TRACKING_MEDIA_THUMB_WIDTH);
68
+ return empty($width)?null:$width;
69
+ }
70
+
71
+ public function getThumbHeight()
72
+ {
73
+ $height = Mage::getStoreConfig(self::XML_PATH_TRACKING_MEDIA_THUMB_HEIGHT);
74
+ return empty($height)?null:$height;
75
+ }
76
+
77
+ protected function _generateTrackingData($data)
78
+ {
79
+ return $data;
80
+ }
81
+
82
+ public function normalizeName($name)
83
+ {
84
+ return trim(preg_replace('/\s+/', ' ', $name));
85
+ }
86
+
87
+ public function isEnabled($storeId=null)
88
+ {
89
+ return Mage::getStoreConfig( self::XML_PATH_ENABLED, $storeId );
90
+ }
91
+
92
+ public function isDashboardEnabled()
93
+ {
94
+ return Mage::getStoreConfig( self::XML_PATH_DASHBOARD_ENABLED );
95
+ }
96
+
97
+ public function isDataCronEnabled($storeId=null)
98
+ {
99
+ return Mage::getStoreConfig( self::XML_PATH_DATA_CRON_ENABLED, $storeId );
100
+ }
101
+
102
+ public function isStatusCronEnabled($storeId=null)
103
+ {
104
+ return Mage::getStoreConfig( self::XML_PATH_STATUS_CRON_ENABLED, $storeId );
105
+ }
106
+
107
+ public function getAccountId()
108
+ {
109
+ return Mage::getStoreConfig(self::XML_PATH_TRACKING_ACCOUNT_ID);
110
+ }
111
+
112
+ public function getApiUrl()
113
+ {
114
+ if (Mage::app()->getStore()->isCurrentlySecure())
115
+ return Mage::getStoreConfig(self::XML_PATH_TRACKING_URL_SECURE);
116
+ else
117
+ return Mage::getStoreConfig(self::XML_PATH_TRACKING_URL);
118
+ }
119
+
120
+ public function getApiJsUrl()
121
+ {
122
+ if (Mage::app()->getStore()->isCurrentlySecure())
123
+ return Mage::getStoreConfig(self::XML_PATH_TRACKING_URL_SECURE).'trackerv12.js';
124
+ else
125
+ return Mage::getStoreConfig(self::XML_PATH_TRACKING_URL).'trackerv12.js';
126
+ }
127
+
128
+ public function getCustomerRegistrationConfirmData($customer=null)
129
+ {
130
+ if (is_null($customer))
131
+ $customer = Mage::helper('customer')->getCustomer();
132
+ $subscription = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer);
133
+ $data = array(
134
+ 'type' => 'customer-registration',
135
+ 'title' => $customer->getPrefix(),
136
+ 'firstname' => $customer->getFirstname(),
137
+ 'lastname' => $customer->getLastname(),
138
+ 'email' => $customer->getEmail(),
139
+ 'email_subscribed' => $subscription->isSubscribed() ? 'yes' : 'no'
140
+ );
141
+ $data = array(
142
+ 'setEcommerceData',
143
+ $data
144
+ );
145
+ return $this->_generateTrackingData($data);
146
+ }
147
+
148
+ public function getCustomerUpdateDetailsData($customer=null)
149
+ {
150
+ if (is_null($customer))
151
+ $customer = Mage::helper('customer')->getCustomer();
152
+ $subscription = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer);
153
+ $data = array(
154
+ 'type' => 'customer-update',
155
+ 'title' => $customer->getPrefix(),
156
+ 'firstname' => $customer->getFirstname(),
157
+ 'lastname' => $customer->getLastname(),
158
+ 'email' => $customer->getEmail(),
159
+ 'email_subscribed' => $subscription->isSubscribed() ? 'yes' : 'no',
160
+ 'mobile' => $customer->getPrimaryBillingAddress() && $customer->getPrimaryBillingAddress()->getId() ? $customer->getPrimaryBillingAddress()->getTelephone():'',
161
+ );
162
+ $data = array(
163
+ 'setEcommerceData',
164
+ $data
165
+ );
166
+ return $this->_generateTrackingData($data);
167
+ }
168
+
169
+ public function getCustomerLoginData($customer=null)
170
+ {
171
+ if (is_null($customer))
172
+ $customer = Mage::helper('customer')->getCustomer();
173
+ $subscription = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer);
174
+ $data = array(
175
+ 'type' => 'login',
176
+ 'email' => $customer->getEmail(),
177
+ 'customerId' => $customer->getId(),
178
+ 'title' => $customer->getPrefix(),
179
+ 'firstname' => $customer->getFirstname(),
180
+ 'lastname' => $customer->getLastname(),
181
+ 'email' => $customer->getEmail(),
182
+ 'email_subscribed' => $subscription->isSubscribed() ? 'yes' : 'no',
183
+ 'mobile' => $customer->getPrimaryBillingAddress() && $customer->getPrimaryBillingAddress()->getId() ? $customer->getPrimaryBillingAddress()->getTelephone():'',
184
+ );
185
+ $data = array(
186
+ 'setEcommerceData',
187
+ $data
188
+ );
189
+ return $this->_generateTrackingData($data);
190
+ }
191
+
192
+ public function getCustomerCustomData($customer=null)
193
+ {
194
+ if (is_null($customer))
195
+ $customer = Mage::helper('customer')->getCustomer();
196
+
197
+ $data = array();
198
+ $eavConfig = Mage::getSingleton('eav/config');
199
+ foreach ($this->getCustomerUpdateAttributes() as $row)
200
+ {
201
+ $attribute = $eavConfig->getAttribute('customer', $row['magento_attribute']);
202
+ if ($attribute && $attribute->getId())
203
+ {
204
+ $_attributeText = $customer->getAttributeText($attribute->getAttributeCode());
205
+ $data[] = $this->_generateTrackingData(array(
206
+ 'setCustomerCustomVar',
207
+ $row['recommend_attribute'],
208
+ empty($_attributeText)?$customer->getData($attribute->getAttributeCode()):$customer->getAttributeText($attribute->getAttributeCode())
209
+ ));
210
+ }
211
+ }
212
+ return $data;
213
+ }
214
+
215
+ protected function getCategoryPathName($_category)
216
+ {
217
+ if (is_null($_category))
218
+ $_category = Mage::registry('current_category');
219
+
220
+ $categoriesPath = array();
221
+ if ($_category) {
222
+ $pathInStore = $_category->getPathInStore();
223
+ $pathIds = array_reverse(explode(',', $pathInStore));
224
+
225
+ $categories = $_category->getParentCategories();
226
+
227
+ // add category path breadcrumb
228
+ foreach ($pathIds as $categoryId) {
229
+ if (isset($categories[$categoryId]) && $categories[$categoryId]->getName()) {
230
+ $categoriesPath[] = $this->normalizeName($categories[$categoryId]->getName());
231
+ }
232
+ }
233
+ }
234
+ return implode(DS,$categoriesPath);
235
+ }
236
+
237
+ public function getProductUpdateAttributes()
238
+ {
239
+ $attributes = unserialize((string)Mage::getStoreConfig(self::XML_PATH_TRACKING_PRODUCT_ATTRIBUTES));
240
+ return $attributes;
241
+ }
242
+
243
+ public function getCustomerUpdateAttributes()
244
+ {
245
+ $attributes = unserialize((string)Mage::getStoreConfig(self::XML_PATH_TRACKING_CUSTOMER_ATTRIBUTES));
246
+ return $attributes;
247
+ }
248
+
249
+ public function getProductViewData($_product=null,$_currentCategory=null)
250
+ {
251
+ if (is_null($_currentCategory))
252
+ $_currentCategory = Mage::registry('current_category');
253
+
254
+ if (is_null($_product))
255
+ $_product = Mage::registry('current_product');
256
+
257
+ $categories = array();
258
+ foreach ($_product->getCategoryCollection() as $_category) {
259
+ $categoryPathName = $this->getCategoryPathName($_category);
260
+ if (!empty($categoryPathName)) $categories[] = $this->normalizeName($categoryPathName);
261
+ }
262
+
263
+ $additionalAttributes = array();
264
+ $eavConfig = Mage::getSingleton('eav/config');
265
+ foreach ($this->getProductUpdateAttributes() as $row)
266
+ {
267
+ $attribute = $eavConfig->getAttribute('catalog_product', $row['magento_attribute']);
268
+ if ($attribute && $attribute->getId())
269
+ {
270
+ $_attributeText = $_product->getAttributeText($attribute->getAttributeCode());
271
+ $additionalAttributes[$row['recommend_attribute']] = empty($_attributeText)?$_product->getData($attribute->getAttributeCode()):$_product->getAttributeText($attribute->getAttributeCode());
272
+ if (is_array($additionalAttributes[$row['recommend_attribute']]))
273
+ {
274
+ $additionalAttributes[$row['recommend_attribute']] = implode(', ',$additionalAttributes[$row['recommend_attribute']]);
275
+ }
276
+ }
277
+ }
278
+
279
+ if ($_product->getTypeId()=='bundle')
280
+ {
281
+ $_priceModel = $_product->getPriceModel();
282
+ list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($_product, null, true, false);
283
+ $_finalPrice = $_minimalPriceInclTax;
284
+ $_price = $_minimalPriceInclTax;
285
+ }
286
+ else
287
+ {
288
+ $_price = $_product->getPrice();
289
+ $_finalPrice = $_product->getFinalPrice();
290
+ }
291
+ $imageUrl = (string)Mage::helper('catalog/image')->init($_product, $this->getThumbSource())->resize($this->getThumbWidth(), $this->getThumbHeight());
292
+ $secureImageUrl = str_replace(Mage::getBaseUrl('media',false),Mage::getBaseUrl('media',true),$imageUrl);
293
+ $data = array(
294
+ 'setEcommerceData',
295
+ array(
296
+ 'type' => 'product-view',
297
+ 'name' => $this->normalizeName($_product->getName()),
298
+ 'sku' => $_product->getSku(),
299
+ 'image' => $imageUrl,
300
+ 'secure_image' => $secureImageUrl,
301
+ 'url' => $_product->getUrlModel()->getUrl($_product, array('_ignore_category'=>true)),
302
+ 'categories' => $categories,
303
+ 'price' => Mage::helper('core')->currency($_finalPrice,false,false),
304
+ 'original_price' => Mage::helper('core')->currency($_price,false,false),
305
+ 'additional_attributes' => $additionalAttributes
306
+ )
307
+ );
308
+ if (is_object($_currentCategory))
309
+ $data[1]['current_category'] = $this->normalizeName($this->getCategoryPathName($_currentCategory));
310
+ return $this->_generateTrackingData($data);
311
+ }
312
+
313
+ public function getCategoryViewData($_category=null)
314
+ {
315
+ if (is_null($_category))
316
+ $_category = Mage::registry('current_category');
317
+
318
+ $data = array(
319
+ 'setEcommerceData',
320
+ array(
321
+ 'type' => 'category-view',
322
+ 'name' => $this->normalizeName($this->getCategoryPathName($_category)),
323
+ 'url' => Mage::helper('core/url')->getCurrentUrl()
324
+ )
325
+ );
326
+ return $this->_generateTrackingData($data);
327
+ }
328
+
329
+ protected function getLoadedChildProduct($item){
330
+ $product = $this->getChildProduct($item);
331
+ if (is_null($this->_childProductLoaded) || $this->_childProductLoaded->getId() != $product->getId()){
332
+ $this->_childProductLoaded = $product->load($product->getId());
333
+ }
334
+ return $this->_childProductLoaded;
335
+ }
336
+
337
+ /**
338
+ * Get item configurable child product
339
+ *
340
+ * @return Mage_Catalog_Model_Product
341
+ */
342
+ public function getChildProduct($item)
343
+ {
344
+ if ($option = $item->getOptionByCode('simple_product')) {
345
+ return $option->getProduct();
346
+ }
347
+ return null;
348
+ }
349
+
350
+ /**
351
+ * Get product thumbnail image
352
+ *
353
+ * @return Mage_Catalog_Model_Product_Image
354
+ */
355
+ protected function getCartItemThumbnail($item)
356
+ {
357
+ $product = $this->getChildProduct($item);
358
+
359
+ if (!$product || !$product->getData('thumbnail')
360
+ || ($product->getData('thumbnail') == 'no_selection')
361
+ /*|| (Mage::getStoreConfig(self::CONFIGURABLE_PRODUCT_IMAGE) == self::USE_PARENT_IMAGE)*/){
362
+ $product = $item->getProduct();
363
+ }
364
+ return Mage::helper('catalog/image')->init($product, 'thumbnail');
365
+ }
366
+
367
+ public function getCartStatusData($_cart=null)
368
+ {
369
+ if (is_null($_cart))
370
+ $_cart = Mage::getSingleton('checkout/cart');
371
+ $_items = $_cart->getQuote()->getAllVisibleItems();
372
+ $data = array(
373
+ 'type' => 'cart-update',
374
+ 'grand-total' => sprintf('%01.2f',$_cart->getQuote()->getGrandTotal()),
375
+ 'total-qty' => (int)$_cart->getSummaryQty(),
376
+ 'products' => array()
377
+ );
378
+ foreach($_items as $_item)
379
+ {
380
+ $itemData = array();
381
+ $itemData['product-name'] = $this->normalizeName($_item->getProduct()->getName());
382
+ $itemData['product-sku'] = $_item->getProduct()->getData('sku');
383
+ $itemData['product-image'] = (string)$this->getCartItemThumbnail($_item)->resize($this->getThumbWidth(), $this->getThumbHeight());
384
+ $productUrl = '';
385
+ if ($_item->getRedirectUrl())
386
+ {
387
+ $productUrl = $_item->getRedirectUrl();
388
+ }
389
+ else
390
+ {
391
+ $product = $_item->getProduct();
392
+ $option = $_item->getOptionByCode('product_type');
393
+ if ($option) {
394
+ $product = $option->getProduct();
395
+ }
396
+ $productUrl = $product->getUrlModel()->getUrl($product);
397
+ }
398
+ $itemData['product-url'] = $productUrl;
399
+
400
+ $options = array();
401
+ if ($optionIds = $_item->getOptionByCode('option_ids')) {
402
+ $options = array();
403
+ foreach (explode(',', $optionIds->getValue()) as $optionId) {
404
+ if ($option = $_item->getProduct()->getOptionById($optionId)) {
405
+
406
+ $quoteItemOption = $_item->getOptionByCode('option_' . $option->getId());
407
+
408
+ $group = $option->groupFactory($option->getType())
409
+ ->setOption($option)
410
+ ->setQuoteItemOption($quoteItemOption);
411
+
412
+ $options[] = array(
413
+ 'label' => $option->getTitle(),
414
+ 'value' => $group->getFormattedOptionValue($quoteItemOption->getValue()),
415
+ 'print_value' => $group->getPrintableOptionValue($quoteItemOption->getValue()),
416
+ 'option_id' => $option->getId(),
417
+ 'option_type' => $option->getType(),
418
+ 'custom_view' => $group->isCustomizedView()
419
+ );
420
+ }
421
+ }
422
+ }
423
+ if ($addOptions = $_item->getOptionByCode('additional_options')) {
424
+ $options = array_merge($options, unserialize($addOptions->getValue()));
425
+ }
426
+
427
+ $attributes = array();
428
+ if ($_item->getProduct()->getTypeId()==Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE)
429
+ {
430
+ $attributes = $_item->getProduct()->getTypeInstance(true)
431
+ ->getSelectedAttributesInfo($_item->getProduct());
432
+ }
433
+ $options = array_merge($attributes, $options);
434
+ $_options = array();
435
+ foreach($options as $_option)
436
+ {
437
+ $_options[] = $_option['value'];
438
+ }
439
+ $itemData['product-attribute'] = implode(',',$_options);
440
+ $itemData['product-qty'] = $_item->getQty()*1;
441
+ $itemData['product-price'] = sprintf('%01.2f',Mage::helper('checkout')->getPriceInclTax($_item));
442
+ $itemData['product-total-val'] = sprintf('%01.2f',Mage::helper('checkout')->getSubtotalInclTax($_item));
443
+ $data['products'][] = $itemData;
444
+ }
445
+ $data = array(
446
+ 'setEcommerceData',
447
+ $data
448
+ );
449
+ return $this->_generateTrackingData($data);
450
+ }
451
+
452
+ public function getWishlistUpdatedData()
453
+ {
454
+ $_wishlist = Mage::helper('wishlist')->getWishlist();
455
+ $_items = $_wishlist->getItemCollection();
456
+ $data = array(
457
+ 'type' => 'wishlist-update',
458
+ 'products' => array()
459
+ );
460
+ foreach($_items as $_item)
461
+ {
462
+ $itemData = array();
463
+ $itemData['product-name'] = $this->normalizeName($_item->getProduct()->getName());
464
+ $buyRequest = $_item->getBuyRequest();
465
+ if (is_object($buyRequest)) {
466
+ $config = $buyRequest->getSuperProductConfig();
467
+ if ($config && !empty($config['product_id'])) {
468
+ $product = Mage::getModel('catalog/product')
469
+ ->setStoreId(Mage::app()->getStore()->getStoreId())
470
+ ->load($config['product_id']);
471
+ $_item->setProduct($product);
472
+ }
473
+ }
474
+
475
+ $itemData['product-sku'] = $_item->getProduct()->getSku();
476
+ $itemData['product-image'] = (string)Mage::helper('catalog/image')->init($_item->getProduct(), $this->getThumbSource())->resize($this->getThumbWidth(), $this->getThumbHeight());
477
+ $productUrl = '';
478
+ $productUrl = $_item->getProduct()->getUrlModel()->getUrl($_item->getProduct());
479
+ $itemData['product-url'] = $productUrl;
480
+ $itemData['product-price'] = sprintf('%01.2f',$_item->getProduct()->getFinalPrice());
481
+ $date = Mage::app()->getLocale()->storeDate('', $_item->getAddedAt(), true);
482
+ $itemData['product-date-Added'] = $date->toString('dd.MM.YYYY');
483
+ $data['products'][] = $itemData;
484
+ }
485
+ $data = array(
486
+ 'setEcommerceData',
487
+ $data
488
+ );
489
+ return $this->_generateTrackingData($data);
490
+ }
491
+
492
+ public function getCustomerUnsubscribeData($email)
493
+ {
494
+ $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email);
495
+ $data = array(
496
+ 'type' => 'unsubscribe',
497
+ 'email' => $email,
498
+ 'customerId'=> $customer && $customer->getId()?$customer->getId():''
499
+ );
500
+ $data = array(
501
+ 'setEcommerceData',
502
+ $data
503
+ );
504
+ return $this->_generateTrackingData($data);
505
+ }
506
+
507
+ public function getCustomerSubscribeData($email)
508
+ {
509
+ $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email);
510
+ $data = array(
511
+ 'type' => 'subscribe',
512
+ 'email' => $email
513
+ );
514
+ $data = array(
515
+ 'setEcommerceData',
516
+ $data
517
+ );
518
+ return $this->_generateTrackingData($data);
519
+ }
520
+
521
+ public function processOrderSuccess()
522
+ {
523
+ $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
524
+ $_items = $order->getItemsCollection();
525
+ $data = array(
526
+ 'type' => 'sale',
527
+ 'sale-qty' => '',
528
+ 'email' => $order->getCustomerEmail(),
529
+ 'firstname' => $order->getCustomerFirstname(),
530
+ 'lastname' => $order->getCustomerLastname(),
531
+ 'sale-grand-total' => $order->getBaseGrandTotal(),
532
+ 'sale-tax' => $order->getBaseTaxAmount(),
533
+ 'sale-delivery' => $order->getBaseShippingAmount(),
534
+ 'sale-ref' => $order->getIncrementId(),
535
+ 'sale-currency' => $order->getBaseCurrencyCode()
536
+ );
537
+ $_qtyOrdered = 0;
538
+ foreach($_items as $_item)
539
+ {
540
+ if (!$_item->getHasChildren() && !$_item->getParentItem())
541
+ {
542
+ $_qtyOrdered += $_item->getQtyOrdered();
543
+ $itemData = array();
544
+ $itemData['sale-product-name'] = $this->normalizeName($_item->getName());
545
+ $itemData['sale-product-sku'] = $_item->getProductOptionByCode('recommend-product-view-sku');
546
+ $itemData['sale-product-qty'] = $_item->getQtyOrdered();
547
+ $itemData['sale-product-val'] = sprintf('%.2f', $_item->getBasePriceInclTax());
548
+ $data['products'][] = $itemData;
549
+ }
550
+ elseif ($_item->getParentItem())
551
+ {
552
+ $_qtyOrdered += $_item->getQtyOrdered();
553
+ $itemData = array();
554
+ $itemData['sale-product-name'] = $this->normalizeName($_item->getName());
555
+ $itemData['sale-product-sku'] = $_item->getParentItem()->getProductOptionByCode('recommend-product-view-sku');
556
+ $itemData['sale-product-qty'] = $_item->getParentItem()->getQtyOrdered();
557
+ $itemData['sale-product-val'] = sprintf('%.2f', $_item->getParentItem()->getBasePriceInclTax());
558
+ $data['products'][] = $itemData;
559
+ }
560
+ }
561
+ $data['sale-qty'] = $_qtyOrdered;
562
+ $data = array(
563
+ 'setEcommerceData',
564
+ $data
565
+ );
566
+ return $this->_generateTrackingData($data);
567
+ }
568
+
569
+ public function processCheckoutPage()
570
+ {
571
+ $data = array(
572
+ 'type' => 'checkout-view',
573
+ );
574
+ $data = array(
575
+ 'setEcommerceData',
576
+ $data
577
+ );
578
+ return $this->_generateTrackingData($data);
579
+ }
580
+
581
+ public function setTrackingData($record,$static=false)
582
+ {
583
+ if ($static)
584
+ $data = $this->getStaticTrackingData();
585
+ else
586
+ $data = $this->_getSession()->getTrackingData();
587
+ if (is_array($record))
588
+ $data[] = $record;
589
+ else
590
+ $data = array($record);
591
+ if ($static)
592
+ $this->setStaticTrackingData($data);
593
+ else
594
+ {
595
+ $this->_getSession()->setTrackingData($data);
596
+ $this->_getCookie()->set(self::COOKIE_RECOMMENDTRACKER, '1');
597
+ }
598
+ }
599
+
600
+ public function getTrackingData($clear=true,$static=false)
601
+ {
602
+ if ($static)
603
+ $data = $this->getStaticTrackingData();
604
+ else
605
+ $data = $this->_getSession()->getTrackingData();
606
+ if ($clear)
607
+ {
608
+ if ($static)
609
+ $this->setStaticTrackingData(array());
610
+ else
611
+ $this->_getSession()->setTrackingData(array());
612
+ }
613
+ return $data;
614
+ }
615
+
616
+ public function getStaticTrackingData()
617
+ {
618
+ if (!is_array(self::$_staticData)){
619
+ return array();
620
+ }
621
+ return self::$_staticData;
622
+ }
623
+
624
+ public function setStaticTrackingData($data)
625
+ {
626
+ self::$_staticData = $data;
627
+ return $this;
628
+ }
629
+ }
app/code/community/Superb/Recommend/Model/Observer.php ADDED
@@ -0,0 +1,548 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_Observer
19
+ {
20
+ CONST LIMIT_STEP = 1000;
21
+
22
+ /**
23
+ * Track after customer register
24
+ *
25
+ */
26
+ public function customerRegisterAndUpdate($observer)
27
+ {
28
+ $helper = Mage::helper('superbrecommend');
29
+ if (!$helper->isEnabled()) {
30
+ return $this;
31
+ }
32
+ /* @var $customer Mage_Customer_Model_Customer */
33
+ $customer = $observer->getEvent()->getCustomer();
34
+ if ($customer->isObjectNew()) {
35
+ try {
36
+ $data = $helper->getCustomerRegistrationConfirmData($customer);
37
+ $helper->setTrackingData($data);
38
+ } catch (Exception $e) {
39
+ Mage::logException($e);
40
+ }
41
+ }
42
+ else {
43
+ try {
44
+ $data = $helper->getCustomerUpdateDetailsData($customer);
45
+ $helper->setTrackingData($data);
46
+ } catch (Exception $e) {
47
+ Mage::logException($e);
48
+ }
49
+ }
50
+ return $this;
51
+ }
52
+
53
+ public function customerLogin()
54
+ {
55
+ $helper = Mage::helper('superbrecommend');
56
+ if (!$helper->isEnabled()) {
57
+ return $this;
58
+ }
59
+ try {
60
+ $data = $helper->getCustomerLoginData();
61
+ $helper->setTrackingData($data);
62
+ $data = $helper->getCustomerCustomData();
63
+ if (count($data))
64
+ {
65
+ foreach($data as $row)
66
+ {
67
+ $helper->setTrackingData($row);
68
+ }
69
+ }
70
+ } catch (Exception $e) {
71
+ Mage::logException($e);
72
+ }
73
+ }
74
+
75
+ public function productView($observer)
76
+ {
77
+ $helper = Mage::helper('superbrecommend');
78
+ if (!$helper->isEnabled()) {
79
+ return $this;
80
+ }
81
+ $product = $observer->getEvent()->getProduct();
82
+ try {
83
+ $data = $helper->getProductViewData($product);
84
+ $helper->setTrackingData($data,true);
85
+ } catch (Exception $e) {
86
+ Mage::logException($e);
87
+ }
88
+ return $this;
89
+ }
90
+
91
+ public function categoryView($observer)
92
+ {
93
+ $helper = Mage::helper('superbrecommend');
94
+ if (!$helper->isEnabled()) {
95
+ return $this;
96
+ }
97
+ $category = $observer->getEvent()->getCategory();
98
+ try {
99
+ $data = $helper->getCategoryViewData($category);
100
+ $helper->setTrackingData($data,true);
101
+ } catch (Exception $e) {
102
+ Mage::logException($e);
103
+ }
104
+ return $this;
105
+ }
106
+
107
+ public function cartSave($observer)
108
+ {
109
+ $helper = Mage::helper('superbrecommend');
110
+ if (!$helper->isEnabled()) {
111
+ return $this;
112
+ }
113
+ /* @var $cart Mage_Checkout_Model_Cart */
114
+ $cart = $observer->getEvent()->getCart();
115
+ try {
116
+ $data = $helper->getCartStatusData($cart);
117
+ $helper->setTrackingData($data);
118
+ } catch (Exception $e) {
119
+ Mage::logException($e);
120
+ }
121
+ return $this;
122
+ }
123
+
124
+ public function subscriberSubscribed($observer)
125
+ {
126
+ $helper = Mage::helper('superbrecommend');
127
+ if (!$helper->isEnabled()) {
128
+ return $this;
129
+ }
130
+ $_subscriber = $observer->getEvent()->getSubscriber();
131
+ try {
132
+ $data = $helper->getCustomerSubscribeData($_subscriber->getEmail());
133
+ $helper->setTrackingData($data);
134
+ } catch (Exception $e) {
135
+ Mage::logException($e);
136
+ }
137
+ return $this;
138
+ }
139
+
140
+ public function subscriberUnsubscribed($observer)
141
+ {
142
+ $helper = Mage::helper('superbrecommend');
143
+ if (!$helper->isEnabled()) {
144
+ return $this;
145
+ }
146
+ $_subscriber = $observer->getEvent()->getSubscriber();
147
+ try {
148
+ $data = $helper->getCustomerUnsubscribeData($_subscriber->getEmail());
149
+ $helper->setTrackingData($data);
150
+ } catch (Exception $e) {
151
+ Mage::logException($e);
152
+ }
153
+ return $this;
154
+ }
155
+
156
+ public function wishlistUpdated($observer)
157
+ {
158
+ $helper = Mage::helper('superbrecommend');
159
+ if (!$helper->isEnabled()) {
160
+ return $this;
161
+ }
162
+ try {
163
+ $data = $helper->getWishlistUpdatedData();
164
+ $helper->setTrackingData($data);
165
+ } catch (Exception $e) {
166
+ Mage::logException($e);
167
+ }
168
+ return $this;
169
+ }
170
+
171
+ public function checkSubscription($observer)
172
+ {
173
+ $helper = Mage::helper('superbrecommend');
174
+ if (!$helper->isEnabled()) {
175
+ return $this;
176
+ }
177
+ $subscriber = $observer->getEvent()->getSubscriber();
178
+
179
+ if (($subscriber->getOrigData('subscriber_status') != $subscriber->getData('subscriber_status')))
180
+ {
181
+ if ($subscriber->getData('subscriber_status')==Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
182
+ {
183
+ try {
184
+ $data = $helper->getCustomerUnsubscribeData($subscriber->getData('subscriber_email'));
185
+ $helper->setTrackingData($data);
186
+ } catch (Exception $e) {
187
+ Mage::logException($e);
188
+ }
189
+ }
190
+ if ($subscriber->getData('subscriber_status')==Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
191
+ {
192
+ try {
193
+ $data = $helper->getCustomerSubscribeData($subscriber->getData('subscriber_email'));
194
+ $helper->setTrackingData($data);
195
+ } catch (Exception $e) {
196
+ Mage::logException($e);
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ public function deleteSubscription($observer)
203
+ {
204
+ $helper = Mage::helper('superbrecommend');
205
+ if (!$helper->isEnabled()) {
206
+ return $this;
207
+ }
208
+ $subscriber = $observer->getEvent()->getSubscriber();
209
+
210
+ if ($subscriber->getData('subscriber_status')==Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
211
+ {
212
+ try {
213
+ $data = $helper->getCustomerUnsubscribeData($subscriber->getData('subscriber_email'));
214
+ $helper->setTrackingData($data);
215
+ } catch (Exception $e) {
216
+ Mage::logException($e);
217
+ }
218
+ }
219
+ }
220
+
221
+ public function convertQuoteItemToOrderItem($observer)
222
+ {
223
+ $helper = Mage::helper('superbrecommend');
224
+ if (!$helper->isEnabled()) {
225
+ return $this;
226
+ }
227
+ $item = $observer->getEvent()->getItem();
228
+ $orderItem = $observer->getEvent()->getOrderItem();
229
+ $productOptions = $orderItem->getProductOptions();
230
+ $productOptions['recommend-product-view-sku'] = $item->getProduct()->getData('sku');
231
+ $orderItem->setProductOptions($productOptions);
232
+ }
233
+
234
+ public function updateProductsData(Mage_Cron_Model_Schedule $schedule)
235
+ {
236
+ $helper = Mage::helper('superbrecommend');
237
+ if (!$helper->isEnabled()) {
238
+ return $this;
239
+ }
240
+ $helper = Mage::helper('superbrecommend');
241
+ if (!$helper->isDataCronEnabled()) {
242
+ return $this;
243
+ }
244
+ $apiHelper = Mage::helper('superbrecommend/api');
245
+ $products = array();
246
+
247
+ Mage::app()->setCurrentStore('admin');
248
+ $storesByAccounts = array();
249
+ foreach (Mage::app()->getStores() as $store)
250
+ {
251
+ if (!$helper->isEnabled($store->getId()))
252
+ continue;
253
+ $accountId = Mage::getStoreConfig(Superb_Recommend_Helper_Api::XML_PATH_TRACKING_ACCOUNT_ID,$store->getId());
254
+ if (!isset($storesByAccounts[$accountId]))
255
+ $storesByAccounts[$accountId] = array();
256
+ $storesByAccounts[$accountId][] = $store->getId();
257
+ }
258
+ foreach (Mage::app()->getStores() as $store)
259
+ {
260
+ if (!$helper->isEnabled($store->getId()))
261
+ continue;
262
+ $accountId = Mage::getStoreConfig(Superb_Recommend_Helper_Api::XML_PATH_TRACKING_ACCOUNT_ID,$store->getId());
263
+ Mage::app()->setCurrentStore($store);
264
+ Mage::unregister('_resource_singleton/catalog/product_flat');
265
+ $currencies = array();
266
+ $codes = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
267
+ if (is_array($codes)) {
268
+ $rates = Mage::getModel('directory/currency')->getCurrencyRates(
269
+ Mage::app()->getStore()->getBaseCurrency(),
270
+ $codes
271
+ );
272
+
273
+ foreach ($codes as $code) {
274
+ if (isset($rates[$code])) {
275
+ $currencies[$code] = Mage::getModel('directory/currency')->load($code);
276
+ }
277
+ elseif($code==Mage::app()->getStore()->getBaseCurrency()->getCode())
278
+ {
279
+ $currencies[$code] = Mage::getModel('directory/currency')->load($code);
280
+ }
281
+ }
282
+ }
283
+
284
+ $_attributes = array();
285
+
286
+ foreach ($helper->getProductUpdateAttributes() as $row)
287
+ {
288
+ $_attributes[] = $row['magento_attribute'];
289
+ }
290
+ $eavConfig = Mage::getSingleton('eav/config');
291
+ $collection = Mage::getResourceModel('catalog/product_collection')->setStore($store)->setStoreId($store->getStoreId());
292
+ foreach($_attributes as $_attributeCode)
293
+ {
294
+ $attribute = $eavConfig->getAttribute('catalog_product', $_attributeCode);
295
+ if ((int)$attribute->getData('used_in_product_listing'))
296
+ $collection->addAttributeToSelect($_attributeCode);
297
+ else
298
+ $collection->joinAttribute(
299
+ $_attributeCode,
300
+ 'catalog_product/'.$_attributeCode,
301
+ 'entity_id',
302
+ null,
303
+ 'left',
304
+ $store->getId()
305
+ );
306
+ }
307
+ $collection
308
+ ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
309
+ ->addMinimalPrice()
310
+ ->addFinalPrice()
311
+ ->addTaxPercents()
312
+ ->addStoreFilter($store)
313
+ ->addUrlRewrite();
314
+
315
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
316
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
317
+ if (!$apiHelper->getShowOutOfStockProduct($store->getStoreId())) {
318
+ Mage::getSingleton('cataloginventory/stock_status')->addIsInStockFilterToCollection($collection);
319
+ }
320
+
321
+ $isEmpty = false;
322
+ $offset = 0;
323
+ while (!$isEmpty) {
324
+ $productCol = clone $collection;
325
+ $productCol->getSelect()->limit(self::LIMIT_STEP, $offset);
326
+
327
+ $isEmpty = true;
328
+ foreach($productCol as $product)
329
+ {
330
+ $isEmpty = false;
331
+ $offset++;
332
+ if (!isset($products[$accountId]))
333
+ $products[$accountId] = array();
334
+ if (isset($products[$accountId][$product->getSku()]))
335
+ {
336
+ $finalPrice = $products[$accountId][$product->getSku()]['price'];
337
+ $price = $products[$accountId][$product->getSku()]['original_price'];
338
+ }
339
+ else
340
+ {
341
+ $finalPrice = array();
342
+ $price = array();
343
+ }
344
+
345
+ foreach($currencies as $code => $currency)
346
+ {
347
+ if ($product->getTypeId()=='bundle')
348
+ {
349
+ if (!isset($finalPrice[$code]) || !isset($price[$code]))
350
+ {
351
+ $_priceModel = $product->getPriceModel();
352
+ list($_minimalPriceInclTax, $_maximalPriceInclTax) = $_priceModel->getTotalPrices($product, null, true, false);
353
+ $finalPrice[$code] = $store->getBaseCurrency()->convert($_minimalPriceInclTax, $currency);
354
+ $price[$code] = $store->getBaseCurrency()->convert($_minimalPriceInclTax, $currency);
355
+ }
356
+ }
357
+ else
358
+ {
359
+ if (!isset($finalPrice[$code]))
360
+ $finalPrice[$code] = $store->getBaseCurrency()->convert($product->getFinalPrice(), $currency);
361
+ if (!isset($price[$code]))
362
+ $price[$code] = $store->getBaseCurrency()->convert($product->getPrice(), $currency);
363
+ }
364
+ }
365
+
366
+ $additionalAttributes = array();
367
+ $eavConfig = Mage::getSingleton('eav/config');
368
+ foreach ($helper->getProductUpdateAttributes() as $row)
369
+ {
370
+ $attribute = $eavConfig->getAttribute('catalog_product', $row['magento_attribute']);
371
+ if ($attribute && $attribute->getId())
372
+ {
373
+ $_attributeText = $product->getAttributeText($attribute->getAttributeCode());
374
+ $additionalAttributes[$row['recommend_attribute']] = empty($_attributeText)?$product->getData($attribute->getAttributeCode()):$product->getAttributeText($attribute->getAttributeCode());
375
+ if (is_array($additionalAttributes[$row['recommend_attribute']]))
376
+ {
377
+ $additionalAttributes[$row['recommend_attribute']] = implode(', ',$additionalAttributes[$row['recommend_attribute']]);
378
+ }
379
+ }
380
+ }
381
+
382
+ $products[$accountId][$product->getSku()] = array('sku'=>$product->getSku(),'status'=>'online','url'=>$product->getProductUrl(),'price'=>$finalPrice,'original_price'=>$price,'additional_attributes' => $additionalAttributes);
383
+ }
384
+ }
385
+ }
386
+ Mage::app()->setCurrentStore('admin');
387
+ Mage::unregister('_resource_singleton/catalog/product_flat');
388
+ foreach($products as $accountId => $productsData)
389
+ {
390
+ $apiHelper->uploadProductsData(array_values($productsData),$storesByAccounts[$accountId][0]);
391
+ }
392
+ }
393
+
394
+ public function updateProductsStatus(Mage_Cron_Model_Schedule $schedule)
395
+ {
396
+ $helper = Mage::helper('superbrecommend');
397
+ if (!$helper->isEnabled()) {
398
+ return $this;
399
+ }
400
+ $helper = Mage::helper('superbrecommend');
401
+ if (!$helper->isStatusCronEnabled()) {
402
+ return $this;
403
+ }
404
+ $apiHelper = Mage::helper('superbrecommend/api');
405
+ $products = array();
406
+ Mage::app()->setCurrentStore('admin');
407
+ $storesByAccounts = array();
408
+ foreach (Mage::app()->getStores() as $store)
409
+ {
410
+ if (!$helper->isEnabled($store->getId()))
411
+ continue;
412
+ $accountId = Mage::getStoreConfig(Superb_Recommend_Helper_Api::XML_PATH_TRACKING_ACCOUNT_ID,$store->getId());
413
+ if (!isset($storesByAccounts[$accountId]))
414
+ $storesByAccounts[$accountId] = array();
415
+ $storesByAccounts[$accountId][] = $store->getId();
416
+ }
417
+ foreach (Mage::app()->getStores() as $store)
418
+ {
419
+ if (!$helper->isEnabled($store->getId()))
420
+ continue;
421
+ $accountId = Mage::getStoreConfig(Superb_Recommend_Helper_Api::XML_PATH_TRACKING_ACCOUNT_ID,$store->getId());
422
+ Mage::app()->setCurrentStore($store);
423
+ Mage::unregister('_resource_singleton/catalog/product_flat');
424
+ $collection = Mage::getResourceModel('catalog/product_collection')->setStore($store)->setStoreId($store->getStoreId());
425
+ $collection
426
+ ->addAttributeToSelect('sku')
427
+ ->addMinimalPrice()
428
+ ->addFinalPrice()
429
+ ->addTaxPercents()
430
+ ->addStoreFilter($store);
431
+
432
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
433
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
434
+ if (!$apiHelper->getShowOutOfStockProduct($store->getStoreId())) {
435
+ Mage::getSingleton('cataloginventory/stock_status')->addIsInStockFilterToCollection($collection);
436
+ }
437
+
438
+ $isEmpty = false;
439
+ $offset = 0;
440
+ while (!$isEmpty) {
441
+ $productCol = clone $collection;
442
+ $productCol->getSelect()->limit(self::LIMIT_STEP, $offset);
443
+
444
+ $isEmpty = true;
445
+ foreach($productCol as $product)
446
+ {
447
+ $isEmpty = false;
448
+ $offset++;
449
+
450
+ if (!isset($products[$accountId]))
451
+ $products[$accountId] = array();
452
+ $products[$accountId][$product->getSku()] = array('sku'=>$product->getSku(),'status'=>'online');
453
+ }
454
+ }
455
+ }
456
+ Mage::app()->setCurrentStore('admin');
457
+ Mage::unregister('_resource_singleton/catalog/product_flat');
458
+ foreach($products as $accountId => $productsData)
459
+ {
460
+ $apiHelper->uploadProductsData(array_values($productsData),$storesByAccounts[$accountId][0]);
461
+ }
462
+ }
463
+
464
+ protected function _sortData($a, $b)
465
+ {
466
+ if (isset($a['position']))
467
+ $aPosition = (int)$a['position'];
468
+ else
469
+ $aPosition = 0;
470
+ if (isset($b['position']))
471
+ $bPosition = (int)$b['position'];
472
+ else
473
+ $bPosition = 0;
474
+ if ($aPosition == $bPosition) {
475
+ return 0;
476
+ }
477
+ return ($aPosition < $bPosition) ? -1 : 1;
478
+ }
479
+
480
+ public function initSystemConfig(Varien_Event_Observer $observer)
481
+ {
482
+ $storeId = Mage::helper('superbrecommend/admin')->getSystemConfigStoreId();
483
+
484
+ $config = $observer->getEvent()->getConfig();
485
+
486
+ $slotsPageTypesData = Mage::helper('superbrecommend/api')->getSlotsPageTypesData($storeId);
487
+ uasort($slotsPageTypesData, array($this,'_sortData'));
488
+ $slotsData = Mage::helper('superbrecommend/admin')->getSlotsData($storeId);
489
+ uasort($slotsData, array($this,'_sortData'));
490
+ $slotsDataByPageTypeId = array();
491
+ foreach($slotsData as $slotData)
492
+ {
493
+ if (!isset($slotsDataByPageTypeId[$slotData['page_type_id']]))
494
+ $slotsDataByPageTypeId[$slotData['page_type_id']] = array();
495
+ $slotsDataByPageTypeId[$slotData['page_type_id']][] = $slotData;
496
+ }
497
+ unset($slotsData);
498
+
499
+ $i = 0;
500
+ if (is_array($slotsPageTypesData))
501
+ {
502
+ foreach($slotsPageTypesData as $slotsPageTypeData)
503
+ {
504
+ if (isset($slotsDataByPageTypeId[$slotsPageTypeData['id']]))
505
+ {
506
+ $first = true;
507
+ foreach($slotsDataByPageTypeId[$slotsPageTypeData['id']] as $slotData)
508
+ {
509
+ $slotsByPageTypesXml = '
510
+ <page_type_'.$slotsPageTypeData['id'].'_'.$slotData['id'].' translate="label comment">
511
+ <label>'.($first?$slotsPageTypeData['title']:'').'</label>
512
+ <frontend_type>select</frontend_type>
513
+ <source_model>superbrecommend/system_config_source_panel</source_model>
514
+ <backend_model>superbrecommend/system_config_backend_slot</backend_model>
515
+ <sort_order>'.++$i.'</sort_order>
516
+ <show_in_default>'.((int)Mage::helper('superbrecommend/admin')->isSingleMode()).'</show_in_default>
517
+ <show_in_website>'.((int)!Mage::helper('superbrecommend/admin')->isStoreMode()).'</show_in_website>
518
+ <show_in_store>1</show_in_store>
519
+ </page_type_'.$slotsPageTypeData['id'].'_'.$slotData['id'].'>
520
+ ';
521
+ $config->getNode('sections/superbrecommend/groups/panels/fields')->appendChild(new Mage_Core_Model_Config_Element($slotsByPageTypesXml));
522
+ $first = false;
523
+ }
524
+ }
525
+ }
526
+ }
527
+ return $this;
528
+ }
529
+
530
+ public function saveSystemConfig(Varien_Event_Observer $observer)
531
+ {
532
+ $storeId = Mage::helper('superbrecommend/admin')->getSystemConfigStoreId();
533
+
534
+ $config = $observer->getEvent()->getConfig();
535
+
536
+ $panelsBySlotsData = Mage::helper('superbrecommend/admin')->getSaveSlotSystemConfig();
537
+ $slotsData = array();
538
+ foreach($panelsBySlotsData as $slotId=>$panelId)
539
+ {
540
+ $slotsData[] = array('id'=>$slotId,'panel_id'=>$panelId);
541
+ }
542
+ Mage::helper('superbrecommend/api')->updateSlots($slotsData,$storeId);
543
+
544
+ Mage::helper('superbrecommend/api')->updateAccount($storeId);
545
+
546
+ return $this;
547
+ }
548
+ }
app/code/community/Superb/Recommend/Model/Pagecache/Container/Block.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_Pagecache_Container_Block extends Enterprise_PageCache_Model_Container_Abstract
19
+ {
20
+ /**
21
+ * Get identifier from cookies
22
+ *
23
+ * @return string
24
+ */
25
+ protected function _getIdentifier()
26
+ {
27
+ $cacheId = $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER, '')
28
+ .(defined('Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER_LOGGED_IN') ?
29
+ '_'.$this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER_LOGGED_IN, '')
30
+ :'');
31
+ return $cacheId;
32
+ }
33
+
34
+ protected function _isNewTrackingRecived()
35
+ {
36
+ return ($this->_getCookieValue(Superb_Recommend_Helper_Data::COOKIE_RECOMMENDTRACKER) ? true : false);
37
+ }
38
+
39
+ /**
40
+ * Get cache identifier
41
+ *
42
+ * @return string
43
+ */
44
+ protected function _getCacheId()
45
+ {
46
+ return $this->_isNewTrackingRecived()?false:'CONTAINER_RECOMMENDTRACKER_' . md5($this->_placeholder->getAttribute('cache_id') . $this->_getIdentifier());
47
+ }
48
+
49
+ public function applyWithoutApp(&$content)
50
+ {
51
+ if ($this->_isNewTrackingRecived()) {
52
+ return false;
53
+ }
54
+ return parent::applyWithoutApp($content);
55
+ }
56
+
57
+ /**
58
+ * Render block content
59
+ *
60
+ * @return string
61
+ */
62
+ protected function _renderBlock()
63
+ {
64
+ Mage::getSingleton('core/cookie')->delete(Superb_Recommend_Helper_Data::COOKIE_RECOMMENDTRACKER);
65
+
66
+ $block = $this->_placeholder->getAttribute('block');
67
+ $block = new $block;
68
+
69
+ return $block->toHtml();
70
+ }
71
+ }
app/code/community/Superb/Recommend/Model/Session.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_Session extends Mage_Core_Model_Session_Abstract
19
+ {
20
+ public function __construct()
21
+ {
22
+ $this->init('superbrecommend');
23
+ }
24
+ }
app/code/community/Superb/Recommend/Model/System/Config/Backend/Data/Cron.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Backend_Data_Cron extends Mage_Core_Model_Config_Data
19
+ {
20
+ const CRON_STRING_PATH = 'crontab/jobs/superbrecommend_update_products_data/schedule/cron_expr';
21
+ const CRON_MODEL_PATH = 'crontab/jobs/superbrecommend_update_products_data/run/model';
22
+
23
+ protected $_cronExprToFrequncy = array(
24
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_EVERY_5_MINUTES=>'*/5 * * * *',
25
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_HOURLY=>'1 * * * *',
26
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_EVERY_3_HOURS=>'1 */3 * * *',
27
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_DAILY=>'1 5 * * *'
28
+ );
29
+
30
+ /**
31
+ * Cron settings after save
32
+ *
33
+ */
34
+ protected function _afterSave()
35
+ {
36
+ $frequncy = $this->getData('groups/data_cron/fields/frequency/value');
37
+
38
+ $cronExprString = $this->_cronExprToFrequncy[$frequncy];
39
+ try {
40
+ Mage::getModel('core/config_data')
41
+ ->load(self::CRON_STRING_PATH, 'path')
42
+ ->setValue($cronExprString)
43
+ ->setPath(self::CRON_STRING_PATH)
44
+ ->save();
45
+
46
+ Mage::getModel('core/config_data')
47
+ ->load(self::CRON_MODEL_PATH, 'path')
48
+ ->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH))
49
+ ->setPath(self::CRON_MODEL_PATH)
50
+ ->save();
51
+ }
52
+ catch (Exception $e) {
53
+ Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.'));
54
+ }
55
+ }
56
+ }
app/code/community/Superb/Recommend/Model/System/Config/Backend/Date.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Backend_Date extends Mage_Core_Model_Config_Data
19
+ {
20
+ protected function _beforeSave()
21
+ {
22
+ $value = (string)$this->getValue();
23
+ try {
24
+ $value = $this->formatDate($value);
25
+ } catch (Exception $e) {
26
+ throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid date'));
27
+ }
28
+
29
+ $this->setValue($value);
30
+ }
31
+ public function formatDate($date)
32
+ {
33
+ if (empty($date)) {
34
+ return null;
35
+ }
36
+ // unix timestamp given - simply instantiate date object
37
+ if (preg_match('/^[0-9]+$/', $date)) {
38
+ $date = new Zend_Date((int)$date);
39
+ }
40
+ // international format
41
+ else if (preg_match('#^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?$#', $date)) {
42
+ $zendDate = new Zend_Date();
43
+ $date = $zendDate->setIso($date);
44
+ }
45
+ // parse this date in current locale, do not apply GMT offset
46
+ else {
47
+ $date = Mage::app()->getLocale()->date($date,
48
+ Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
49
+ null, false
50
+ );
51
+ }
52
+ return $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
53
+ }
54
+ }
app/code/community/Superb/Recommend/Model/System/Config/Backend/Slot.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Backend_Slot extends Mage_Core_Model_Config_Data
19
+ {
20
+ protected function _afterLoad()
21
+ {
22
+ $storeId = Mage::helper('superbrecommend/admin')->getSystemConfigStoreId();
23
+ list($pageTypeId,$slotId) = explode('_',str_replace('superbrecommend/panels/page_type_','',$this->getData('path')));
24
+ $slotsData = Mage::helper('superbrecommend/admin')->getSlotsData($storeId);
25
+ if (is_array($slotsData))
26
+ {
27
+ $value = array();
28
+ foreach($slotsData as $slotData)
29
+ {
30
+ if ($slotData['id']==$slotId)
31
+ {
32
+ $value = $slotData['panel_id'];
33
+ }
34
+ }
35
+ $this->setValue($value);
36
+ }
37
+ }
38
+
39
+ protected function _beforeSave()
40
+ {
41
+ list($pageTypeId,$slotId) = explode('_',str_replace('superbrecommend/panels/page_type_','',$this->getData('path')));
42
+ $value = $this->getValue();
43
+ Mage::helper('superbrecommend/admin')->setSaveSlotSystemConfig($slotId,$value);
44
+ $this->setValue(null);
45
+ }
46
+ }
app/code/community/Superb/Recommend/Model/System/Config/Backend/Status/Cron.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Backend_Status_Cron extends Mage_Core_Model_Config_Data
19
+ {
20
+ const CRON_STRING_PATH = 'crontab/jobs/superbrecommend_update_products_status/schedule/cron_expr';
21
+ const CRON_MODEL_PATH = 'crontab/jobs/superbrecommend_update_products_status/run/model';
22
+
23
+ protected $_cronExprToFrequncy = array(
24
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_EVERY_5_MINUTES=>'*/5 * * * *',
25
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_HOURLY=>'1 * * * *',
26
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_EVERY_3_HOURS=>'1 */3 * * *',
27
+ Superb_Recommend_Model_System_Config_Source_Cron_Frequency::CRON_DAILY=>'1 5 * * *'
28
+ );
29
+
30
+ /**
31
+ * Cron settings after save
32
+ *
33
+ */
34
+ protected function _afterSave()
35
+ {
36
+ $frequncy = $this->getData('groups/status_cron/fields/frequency/value');
37
+
38
+ $cronExprString = $this->_cronExprToFrequncy[$frequncy];
39
+ try {
40
+ Mage::getModel('core/config_data')
41
+ ->load(self::CRON_STRING_PATH, 'path')
42
+ ->setValue($cronExprString)
43
+ ->setPath(self::CRON_STRING_PATH)
44
+ ->save();
45
+
46
+ Mage::getModel('core/config_data')
47
+ ->load(self::CRON_MODEL_PATH, 'path')
48
+ ->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH))
49
+ ->setPath(self::CRON_MODEL_PATH)
50
+ ->save();
51
+ }
52
+ catch (Exception $e) {
53
+ Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.'));
54
+ }
55
+ }
56
+ }
app/code/community/Superb/Recommend/Model/System/Config/Source/Cron/Frequency.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Source_Cron_Frequency
19
+ {
20
+
21
+ protected static $_options;
22
+
23
+ const CRON_EVERY_5_MINUTES = 'every5minutes';
24
+ const CRON_HOURLY = 'hourly';
25
+ const CRON_EVERY_3_HOURS = 'every3hours';
26
+ const CRON_DAILY = 'daily';
27
+
28
+ public function toOptionArray()
29
+ {
30
+ if (!self::$_options) {
31
+ self::$_options = array(
32
+ array(
33
+ 'label' => Mage::helper('cron')->__('Every 5 minutes'),
34
+ 'value' => self::CRON_EVERY_5_MINUTES,
35
+ ),
36
+ array(
37
+ 'label' => Mage::helper('cron')->__('Hourly'),
38
+ 'value' => self::CRON_HOURLY,
39
+ ),
40
+ array(
41
+ 'label' => Mage::helper('cron')->__('Every 3 hours'),
42
+ 'value' => self::CRON_EVERY_3_HOURS,
43
+ ),
44
+ array(
45
+ 'label' => Mage::helper('cron')->__('Daily'),
46
+ 'value' => self::CRON_DAILY,
47
+ ),
48
+ );
49
+ }
50
+ return self::$_options;
51
+ }
52
+
53
+ }
app/code/community/Superb/Recommend/Model/System/Config/Source/Customer/Attribute.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Source_Customer_Attribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
19
+ {
20
+
21
+ protected $_options;
22
+
23
+ public function toOptionArray(){
24
+ if (is_null($this->_options)){
25
+ $type = Mage::getModel('eav/entity_type')->loadByCode('customer');
26
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
27
+ ->addStoreLabel(0)
28
+ ->setEntityTypeFilter($type);
29
+
30
+ $this->_options = array(array(
31
+ 'value' => '',
32
+ 'label' => '',
33
+ ));
34
+ foreach ($attributes as $attribute){
35
+ if ($attribute->getStoreLabel()){
36
+ $this->_options[] = array(
37
+ 'value' => $attribute->getAttributeCode(),
38
+ 'label' => $attribute->getStoreLabel()
39
+ );
40
+ }
41
+ }
42
+ sort($this->_options);
43
+ }
44
+ return $this->_options;
45
+ }
46
+
47
+ public function getAllOptions(){
48
+ return $this->toOptionArray();
49
+ }
50
+ }
51
+
52
+
53
+
app/code/community/Superb/Recommend/Model/System/Config/Source/Customer/Recommend/Attribute.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Source_Customer_Recommend_Attribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
19
+ {
20
+ protected $_options;
21
+
22
+ public function toOptionArray(){
23
+ if (is_null($this->_options)){
24
+ $storeId = Mage::helper('superbrecommend/admin')->getSystemConfigStoreId();
25
+ $customerAttributesData = Mage::helper('superbrecommend/admin')->getCustomerAttributesListData($storeId);
26
+ $this->_options[] = array('value'=>'','label'=>'');
27
+ if (is_array($customerAttributesData))
28
+ {
29
+ foreach($customerAttributesData as $customerAttributeData)
30
+ {
31
+ $this->_options[] = array('value'=>$customerAttributeData['code'],'label'=>$customerAttributeData['title']);
32
+ }
33
+ }
34
+ }
35
+ return $this->_options;
36
+ }
37
+
38
+ public function getAllOptions(){
39
+ return $this->toOptionArray();
40
+ }
41
+ }
app/code/community/Superb/Recommend/Model/System/Config/Source/Panel.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Source_Panel extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
19
+ {
20
+
21
+ protected $_options;
22
+
23
+ public function toOptionArray(){
24
+ if (is_null($this->_options)){
25
+ $storeId = Mage::helper('superbrecommend/admin')->getSystemConfigStoreId();
26
+ $panelsData = Mage::helper('superbrecommend/admin')->getPanelsListData($storeId);
27
+ if (is_array($panelsData))
28
+ {
29
+ $this->_options[] = array('value'=>'','label'=>'');
30
+ foreach($panelsData as $panelData)
31
+ {
32
+ $this->_options[] = array('value'=>$panelData['id'],'label'=>$panelData['title']);
33
+ }
34
+ }
35
+ }
36
+ return $this->_options;
37
+ }
38
+
39
+ public function getAllOptions(){
40
+ return $this->toOptionArray();
41
+ }
42
+ }
app/code/community/Superb/Recommend/Model/System/Config/Source/Product/Attribute.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Source_Product_Attribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
19
+ {
20
+
21
+ protected $_options;
22
+
23
+ public function toOptionArray(){
24
+ if (is_null($this->_options)){
25
+ $type = Mage::getModel('eav/entity_type')->loadByCode('catalog_product');
26
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
27
+ ->addStoreLabel(0)
28
+ ->setEntityTypeFilter($type);
29
+
30
+ $this->_options = array(array(
31
+ 'value' => '',
32
+ 'label' => '',
33
+ ));
34
+ foreach ($attributes as $attribute){
35
+ if ($attribute->getStoreLabel()){
36
+ $this->_options[] = array(
37
+ 'value' => $attribute->getAttributeCode(),
38
+ 'label' => $attribute->getStoreLabel()
39
+ );
40
+ }
41
+ }
42
+ sort($this->_options);
43
+ }
44
+ return $this->_options;
45
+ }
46
+
47
+ public function getAllOptions(){
48
+ return $this->toOptionArray();
49
+ }
50
+ }
51
+
52
+
53
+
app/code/community/Superb/Recommend/Model/System/Config/Source/Product/Recommend/Attribute.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Source_Product_Recommend_Attribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
19
+ {
20
+ protected $_options;
21
+
22
+ public function toOptionArray(){
23
+ if (is_null($this->_options)){
24
+ $storeId = Mage::helper('superbrecommend/admin')->getSystemConfigStoreId();
25
+ $productAttributesData = Mage::helper('superbrecommend/admin')->getProductAttributesListData($storeId);
26
+ $this->_options[] = array('value'=>'','label'=>'');
27
+ if (is_array($productAttributesData))
28
+ {
29
+ foreach($productAttributesData as $productAttributeData)
30
+ {
31
+ $this->_options[] = array('value'=>$productAttributeData['code'],'label'=>$productAttributeData['title']);
32
+ }
33
+ }
34
+ }
35
+ return $this->_options;
36
+ }
37
+
38
+ public function getAllOptions(){
39
+ return $this->toOptionArray();
40
+ }
41
+ }
app/code/community/Superb/Recommend/Model/System/Config/Source/Thumbnail.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Superb_Recommend_Model_System_Config_Source_Thumbnail extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
19
+ {
20
+
21
+ protected $_options;
22
+
23
+ public function toOptionArray(){
24
+ if (is_null($this->_options)){
25
+ $type = Mage::getModel('eav/entity_type')->loadByCode('catalog_product');
26
+ $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
27
+ ->addStoreLabel(0)
28
+ ->setEntityTypeFilter($type);
29
+
30
+ foreach ($attributes as $attribute){
31
+ if ($attribute->getStoreLabel() && $attribute->getFrontend()->getInputType()=='media_image'){
32
+ $this->_options[] = array(
33
+ 'value' => $attribute->getAttributeCode(),
34
+ 'label' => $attribute->getStoreLabel()
35
+ );
36
+ }
37
+ }
38
+ sort($this->_options);
39
+ }
40
+ return $this->_options;
41
+ }
42
+
43
+ public function getAllOptions(){
44
+ return $this->toOptionArray();
45
+ }
46
+ }
47
+
48
+
49
+
app/code/community/Superb/Recommend/etc/adminhtml.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Superb_Recommend
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Open Software License (OSL 3.0), a
8
+ copy of which is available through the world-wide-web at this URL:
9
+ http://opensource.org/licenses/osl-3.0.php
10
+
11
+ @category Superb
12
+ @package Superb_Recommend
13
+ @author Superb <hello@wearesuperb.com>
14
+ @copyright Copyright (c) 2015 Superb Media Limited
15
+ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ -->
17
+ <config>
18
+ <acl>
19
+ <resources>
20
+ <admin>
21
+ <children>
22
+ <system>
23
+ <children>
24
+ <config>
25
+ <children>
26
+ <superbrecommend translate="title" module="superbrecommend">
27
+ <title>Superb Recommend Section</title>
28
+ </superbrecommend>
29
+ </children>
30
+ </config>
31
+ </children>
32
+ </system>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ </config>
app/code/community/Superb/Recommend/etc/cache.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Superb_Recommend
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Open Software License (OSL 3.0), a
8
+ copy of which is available through the world-wide-web at this URL:
9
+ http://opensource.org/licenses/osl-3.0.php
10
+
11
+ @category Superb
12
+ @package Superb_Recommend
13
+ @author Superb <hello@wearesuperb.com>
14
+ @copyright Copyright (c) 2015 Superb Media Limited
15
+ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ -->
17
+ <config>
18
+ <placeholders>
19
+ <superbrecommend>
20
+ <block>superbrecommend/block</block>
21
+ <placeholder>RECOMMENDTRACKER_BLOCK</placeholder>
22
+ <container>Superb_Recommend_Model_Pagecache_Container_Block</container>
23
+ <!--cache_lifetime>86400</cache_lifetime-->
24
+ </superbrecommend>
25
+ </placeholders>
26
+ </config>
app/code/community/Superb/Recommend/etc/config.xml ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Superb_Recommend
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Open Software License (OSL 3.0), a
8
+ copy of which is available through the world-wide-web at this URL:
9
+ http://opensource.org/licenses/osl-3.0.php
10
+
11
+ @category Superb
12
+ @package Superb_Recommend
13
+ @author Superb <hello@wearesuperb.com>
14
+ @copyright Copyright (c) 2015 Superb Media Limited
15
+ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ -->
17
+ <config>
18
+ <modules>
19
+ <Superb_Recommend>
20
+ <version>0.0.10</version>
21
+ </Superb_Recommend>
22
+ </modules>
23
+ <global>
24
+ <models>
25
+ <superbrecommend>
26
+ <class>Superb_Recommend_Model</class>
27
+ </superbrecommend>
28
+ </models>
29
+ <helpers>
30
+ <superbrecommend><class>Superb_Recommend_Helper</class></superbrecommend>
31
+ </helpers>
32
+ <blocks>
33
+ <superbrecommend><class>Superb_Recommend_Block</class></superbrecommend>
34
+ </blocks>
35
+ <events>
36
+ <adminhtml_init_system_config>
37
+ <observers>
38
+ <superbrecommend>
39
+ <class>superbrecommend/observer</class>
40
+ <method>initSystemConfig</method>
41
+ </superbrecommend>
42
+ </observers>
43
+ </adminhtml_init_system_config>
44
+ <admin_system_config_changed_section_superbrecommend>
45
+ <observers>
46
+ <superbrecommend>
47
+ <class>superbrecommend/observer</class>
48
+ <method>saveSystemConfig</method>
49
+ </superbrecommend>
50
+ </observers>
51
+ </admin_system_config_changed_section_superbrecommend>
52
+ </events>
53
+ </global>
54
+ <frontend>
55
+ <layout>
56
+ <updates>
57
+ <superbrecommend>
58
+ <file>superbrecommend.xml</file>
59
+ </superbrecommend>
60
+ </updates>
61
+ </layout>
62
+ <events>
63
+ <customer_save_after>
64
+ <observers>
65
+ <superbrecommend>
66
+ <class>superbrecommend/observer</class>
67
+ <method>customerRegisterAndUpdate</method>
68
+ </superbrecommend>
69
+ </observers>
70
+ </customer_save_after>
71
+ <customer_login>
72
+ <observers>
73
+ <superbrecommend>
74
+ <class>superbrecommend/observer</class>
75
+ <method>customerLogin</method>
76
+ </superbrecommend>
77
+ </observers>
78
+ </customer_login>
79
+ <catalog_controller_product_view>
80
+ <observers>
81
+ <superbrecommend>
82
+ <class>superbrecommend/observer</class>
83
+ <method>productView</method>
84
+ </superbrecommend>
85
+ </observers>
86
+ </catalog_controller_product_view>
87
+ <catalog_controller_category_init_after>
88
+ <observers>
89
+ <superbrecommend>
90
+ <class>superbrecommend/observer</class>
91
+ <method>categoryView</method>
92
+ </superbrecommend>
93
+ </observers>
94
+ </catalog_controller_category_init_after>
95
+ <checkout_cart_save_after>
96
+ <observers>
97
+ <superbrecommend>
98
+ <class>superbrecommend/observer</class>
99
+ <method>cartSave</method>
100
+ </superbrecommend>
101
+ </observers>
102
+ </checkout_cart_save_after>
103
+ <wishlist_items_renewed>
104
+ <observers>
105
+ <superbrecommend>
106
+ <class>superbrecommend/observer</class>
107
+ <method>wishlistUpdated</method>
108
+ </superbrecommend>
109
+ </observers>
110
+ </wishlist_items_renewed>
111
+ <newsletter_subscriber_save_before>
112
+ <observers>
113
+ <superbrecommend>
114
+ <type>singleton</type>
115
+ <class>superbrecommend/observer</class>
116
+ <method>checkSubscription</method>
117
+ </superbrecommend>
118
+ </observers>
119
+ </newsletter_subscriber_save_before>
120
+ <newsletter_subscriber_delete_after>
121
+ <observers>
122
+ <superbrecommend>
123
+ <type>singleton</type>
124
+ <class>superbrecommend/observer</class>
125
+ <method>deleteSubscription</method>
126
+ </superbrecommend>
127
+ </observers>
128
+ </newsletter_subscriber_delete_after>
129
+ <sales_convert_quote_item_to_order_item>
130
+ <observers>
131
+ <superbrecommend>
132
+ <type>singleton</type>
133
+ <class>superbrecommend/observer</class>
134
+ <method>convertQuoteItemToOrderItem</method>
135
+ </superbrecommend>
136
+ </observers>
137
+ </sales_convert_quote_item_to_order_item>
138
+ </events>
139
+ </frontend>
140
+ <default>
141
+ <superbrecommend>
142
+ <general_settings>
143
+ <server_url>http://tracking.recommend.pro/</server_url>
144
+ <server_secure_url>https://tracking.recommend.pro/</server_secure_url>
145
+ <api_url>https://api.recommend.pro/</api_url>
146
+ <advanced>0</advanced>
147
+ </general_settings>
148
+ <panels>
149
+ <media_thumb_source>small_image</media_thumb_source>
150
+ <media_thumb_width>300</media_thumb_width>
151
+ </panels>
152
+ <status_cron>
153
+ <enabled>1</enabled>
154
+ <frequency>every5minutes</frequency>
155
+ </status_cron>
156
+ <data_cron>
157
+ <enabled>1</enabled>
158
+ <frequency>daily</frequency>
159
+ </data_cron>
160
+ </superbrecommend>
161
+ </default>
162
+ <crontab>
163
+ <jobs>
164
+ <superbrecommend_update_products_data>
165
+ <schedule><cron_expr>1 5 * * *</cron_expr></schedule>
166
+ <run>
167
+ <model>superbrecommend/observer::updateProductsData</model>
168
+ </run>
169
+ </superbrecommend_update_products_data>
170
+ <superbrecommend_update_products_status>
171
+ <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
172
+ <run>
173
+ <model>superbrecommend/observer::updateProductsStatus</model>
174
+ </run>
175
+ </superbrecommend_update_products_status>
176
+ </jobs>
177
+ </crontab>
178
+ </config>
app/code/community/Superb/Recommend/etc/system.xml ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Superb_Recommend
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Open Software License (OSL 3.0), a
8
+ copy of which is available through the world-wide-web at this URL:
9
+ http://opensource.org/licenses/osl-3.0.php
10
+
11
+ @category Superb
12
+ @package Superb_Recommend
13
+ @author Superb <hello@wearesuperb.com>
14
+ @copyright Copyright (c) 2015 Superb Media Limited
15
+ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ -->
17
+ <config>
18
+ <tabs>
19
+ <superbrecommend translate="label" module="customer">
20
+ <label>RECOMMEND</label>
21
+ <sort_order>210</sort_order>
22
+ </superbrecommend>
23
+ </tabs>
24
+ <sections>
25
+ <superbrecommend translate="label" module="superbrecommend">
26
+ <label>Recommendations</label>
27
+ <tab>superbrecommend</tab>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>100</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <groups>
34
+ <general_settings translate="label">
35
+ <label>General Settings</label>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>10</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ <fields>
42
+ <enabled translate="label">
43
+ <label>Enabled</label>
44
+ <frontend_type>select</frontend_type>
45
+ <source_model>adminhtml/system_config_source_yesno</source_model>
46
+ <sort_order>10</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </enabled>
51
+ <account_id translate="label">
52
+ <label>Account Id</label>
53
+ <frontend_type>text</frontend_type>
54
+ <sort_order>20</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </account_id>
59
+ <server_url translate="label">
60
+ <label>Server URL</label>
61
+ <frontend_type>text</frontend_type>
62
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
63
+ <sort_order>30</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ </server_url>
68
+ <server_secure_url translate="label">
69
+ <label>Server Secure URL</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>40</sort_order>
72
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
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
+ </server_secure_url>
77
+ <api_url translate="label">
78
+ <label>API URL</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>50</sort_order>
81
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
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
+ </api_url>
86
+ <api_key translate="label">
87
+ <label>API Key</label>
88
+ <frontend_type>obscure</frontend_type>
89
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
90
+ <sort_order>60</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </api_key>
95
+ <product_attributes translate="label comment">
96
+ <label>Additional product attributes</label>
97
+ <frontend_model>superbrecommend/adminhtml_system_config_form_field_array_product_attributes</frontend_model>
98
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
99
+ <sort_order>80</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ <comment><![CDATA[Attributes to track on product view page.]]></comment>
104
+ </product_attributes>
105
+ <customer_attributes translate="label comment">
106
+ <label>Additional customer attributes</label>
107
+ <frontend_model>superbrecommend/adminhtml_system_config_form_field_array_customer_attributes</frontend_model>
108
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
109
+ <sort_order>90</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
+ <comment><![CDATA[Attributes to track on customer login.]]></comment>
114
+ </customer_attributes>
115
+ <!-- advanced translate="label">
116
+ <label>Advanced mode</label>
117
+ <frontend_type>select</frontend_type>
118
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
119
+ <sort_order>100</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>0</show_in_store>
123
+ </advanced -->
124
+ </fields>
125
+ </general_settings>
126
+ <panels translate="label">
127
+ <label>Recommendation Panels</label>
128
+ <frontend_type>text</frontend_type>
129
+ <sort_order>20</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ <fields>
134
+ <show_out_of_stock_products translate="label">
135
+ <label>Show out of stock products</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <sort_order>110</sort_order>
139
+ <!-- frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model -->
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
+ </show_out_of_stock_products>
144
+ <media_thumb_source translate="label">
145
+ <label>Thumbnail source</label>
146
+ <frontend_type>select</frontend_type>
147
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
148
+ <source_model>superbrecommend/system_config_source_thumbnail</source_model>
149
+ <sort_order>120</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>1</show_in_store>
153
+ </media_thumb_source>
154
+ <media_thumb_width translate="label">
155
+ <label>Thumbnail width</label>
156
+ <comment><![CDATA[in pixels.]]></comment>
157
+ <frontend_type>text</frontend_type>
158
+ <sort_order>130</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </media_thumb_width>
163
+ <media_thumb_height translate="label">
164
+ <label>Thumbnail height</label>
165
+ <comment><![CDATA[in pixels.]]></comment>
166
+ <frontend_type>text</frontend_type>
167
+ <sort_order>140</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </media_thumb_height>
172
+ </fields>
173
+ </panels>
174
+ <status_cron>
175
+ <label>Updating products status</label>
176
+ <frontend_type>text</frontend_type>
177
+ <frontend_model>superbrecommend/system_config_form_fieldset_advanced</frontend_model>
178
+ <sort_order>60</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>0</show_in_website>
181
+ <show_in_store>0</show_in_store>
182
+ <fields>
183
+ <enabled translate="label">
184
+ <label>Enabled</label>
185
+ <frontend_type>select</frontend_type>
186
+ <source_model>adminhtml/system_config_source_yesno</source_model>
187
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
188
+ <sort_order>10</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>0</show_in_website>
191
+ <show_in_store>0</show_in_store>
192
+ </enabled>
193
+ <frequency translate="label">
194
+ <label>Frequency</label>
195
+ <frontend_type>select</frontend_type>
196
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
197
+ <source_model>superbrecommend/system_config_source_cron_frequency</source_model>
198
+ <backend_model>superbrecommend/system_config_backend_status_cron</backend_model>
199
+ <sort_order>20</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>0</show_in_website>
202
+ <show_in_store>0</show_in_store>
203
+ </frequency>
204
+ </fields>
205
+ </status_cron>
206
+ <data_cron>
207
+ <label>Updating products data</label>
208
+ <frontend_type>text</frontend_type>
209
+ <frontend_model>superbrecommend/system_config_form_fieldset_advanced</frontend_model>
210
+ <sort_order>70</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>0</show_in_website>
213
+ <show_in_store>0</show_in_store>
214
+ <fields>
215
+ <enabled translate="label">
216
+ <label>Enabled</label>
217
+ <frontend_type>select</frontend_type>
218
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
219
+ <source_model>adminhtml/system_config_source_yesno</source_model>
220
+ <sort_order>10</sort_order>
221
+ <show_in_default>1</show_in_default>
222
+ <show_in_website>0</show_in_website>
223
+ <show_in_store>0</show_in_store>
224
+ </enabled>
225
+ <frequency translate="label">
226
+ <label>Frequency</label>
227
+ <frontend_type>select</frontend_type>
228
+ <frontend_model>superbrecommend/system_config_form_field_advanced</frontend_model>
229
+ <source_model>superbrecommend/system_config_source_cron_frequency</source_model>
230
+ <backend_model>superbrecommend/system_config_backend_data_cron</backend_model>
231
+ <sort_order>20</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>0</show_in_website>
234
+ <show_in_store>0</show_in_store>
235
+ </frequency>
236
+ </fields>
237
+ </data_cron>
238
+ </groups>
239
+ </superbrecommend>
240
+ </sections>
241
+ </config>
app/design/frontend/base/default/layout/superbrecommend.xml ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Superb_Recommend
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Open Software License (OSL 3.0), a
8
+ copy of which is available through the world-wide-web at this URL:
9
+ http://opensource.org/licenses/osl-3.0.php
10
+
11
+ @category Superb
12
+ @package Superb_Recommend
13
+ @author Superb <hello@wearesuperb.com>
14
+ @copyright Copyright (c) 2015 Superb Media Limited
15
+ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ -->
17
+ <layout>
18
+ <default>
19
+ <reference name="head">
20
+ <block type="superbrecommend/static_block" name="recommend_tracker_static" after="-" >
21
+ <block type="superbrecommend/block" name="recommend_tracker" after="-" />
22
+ </block>
23
+ </reference>
24
+ <reference name="before_body_end">
25
+ <block type="core/template" name="recommend_tracker_static_force" after="-" >
26
+ <action method="setTemplate"><template>recommend_tracker/force.phtml</template></action>
27
+ </block>
28
+ </reference>
29
+ </default>
30
+
31
+ <j2tajaxcheckout_index_index>
32
+ <block type="superbrecommend/static_block" name="recommend_tracker_static_cart" after="-" >
33
+ <block type="superbrecommend/cart_block" name="recommend_tracker_cart" after="-" />
34
+ </block>
35
+ </j2tajaxcheckout_index_index>
36
+
37
+ <j2tajaxcheckout_index_lastadded>
38
+ <block type="superbrecommend/static_block" name="recommend_tracker_static_cart" after="-" >
39
+ <block type="superbrecommend/cart_block" name="recommend_tracker_cart" after="-" />
40
+ </block>
41
+ </j2tajaxcheckout_index_lastadded>
42
+
43
+ <checkout_onepage_success translate="label">
44
+ <reference name="recommend_tracker">
45
+ <action method="setSuccessPage"></action>
46
+ </reference>
47
+ </checkout_onepage_success>
48
+
49
+ <checkout_onepage_index translate="label">
50
+ <reference name="recommend_tracker">
51
+ <action method="setCheckoutPage"></action>
52
+ </reference>
53
+ </checkout_onepage_index>
54
+
55
+ <cms_index_index>
56
+ <reference name="content">
57
+ <block type="superbrecommend/slot" name="superbrecommend-homepage-slot-1">
58
+ <action method="setSlotId"><slot_id>homepage-slot-1</slot_id></action>
59
+ <action method="setSlotPosition"><position>10</position></action>
60
+ <action method="setPageType"><page_type>Homepage</page_type></action>
61
+ <action method="setPageTypePosition"><page_type_position>10</page_type_position></action>
62
+ <action method="setDefaultPanelId"><panel_id>home-dont-forget-these</panel_id></action>
63
+ </block>
64
+ <block type="superbrecommend/slot" name="superbrecommend-homepage-slot-2">
65
+ <action method="setSlotId"><slot_id>homepage-slot-2</slot_id></action>
66
+ <action method="setSlotPosition"><position>20</position></action>
67
+ <action method="setPageType"><page_type>Homepage</page_type></action>
68
+ <action method="setPageTypePosition"><page_type_position>10</page_type_position></action>
69
+ <action method="setDefaultPanelId"><panel_id>home-most-popular</panel_id></action>
70
+ </block>
71
+ </reference>
72
+ </cms_index_index>
73
+
74
+ <catalog_category_default>
75
+ <reference name="footer.before">
76
+ <block type="core/template" name="superbrecommend-product-listing-page-container">
77
+ <action method="setTemplate"><template>recommend_tracker/colmain.phtml</template></action>
78
+ <block type="superbrecommend/slot" name="superbrecommend-product-listing-slot-1">
79
+ <action method="setSlotId"><slot_id>product-listing-slot-1</slot_id></action>
80
+ <action method="setSlotPosition"><position>10</position></action>
81
+ <action method="setPageType"><page_type>Product listing</page_type></action>
82
+ <action method="setPageTypePosition"><page_type_position>30</page_type_position></action>
83
+ <action method="setDefaultPanelId"><panel_id>category-most-popular</panel_id></action>
84
+ </block>
85
+ </block>
86
+ </reference>
87
+ </catalog_category_default>
88
+
89
+ <catalog_category_layered>
90
+ <reference name="footer.before">
91
+ <block type="core/template" name="superbrecommend-product-listing-page-container">
92
+ <action method="setTemplate"><template>recommend_tracker/colmain.phtml</template></action>
93
+ <block type="superbrecommend/slot" name="superbrecommend-product-listing-slot-1">
94
+ <action method="setSlotId"><slot_id>product-listing-slot-1</slot_id></action>
95
+ <action method="setSlotPosition"><position>10</position></action>
96
+ <action method="setPageType"><page_type>Product listing</page_type></action>
97
+ <action method="setPageTypePosition"><page_type_position>30</page_type_position></action>
98
+ <action method="setDefaultPanelId"><panel_id>category-most-popular</panel_id></action>
99
+ </block>
100
+ </block>
101
+ </reference>
102
+ </catalog_category_layered>
103
+
104
+ <catalog_product_view>
105
+ <reference name="footer.before">
106
+ <block type="core/template" name="superbrecommend-product-detail-page-container">
107
+ <action method="setTemplate"><template>recommend_tracker/colmain.phtml</template></action>
108
+ <block type="superbrecommend/slot" name="superbrecommend-product-detail-slot-1">
109
+ <action method="setSlotId"><slot_id>product-detail-slot-1</slot_id></action>
110
+ <action method="setSlotPosition"><position>10</position></action>
111
+ <action method="setPageType"><page_type>Product detail</page_type></action>
112
+ <action method="setPageTypePosition"><page_type_position>40</page_type_position></action>
113
+ <action method="setDefaultPanelId"><panel_id>product-customers-also-viewed</panel_id></action>
114
+ </block>
115
+ </block>
116
+ </reference>
117
+ </catalog_product_view>
118
+
119
+ <checkout_cart_index>
120
+ <reference name="footer.before">
121
+ <block type="core/template" name="superbrecommend-shopping-bag-page-container">
122
+ <action method="setTemplate"><template>recommend_tracker/colmain.phtml</template></action>
123
+ <block type="superbrecommend/slot" name="superbrecommend-shopping-bag-slot-1">
124
+ <action method="setSlotId"><slot_id>shopping-bag-slot-1</slot_id></action>
125
+ <action method="setSlotPosition"><position>10</position></action>
126
+ <action method="setPageType"><page_type>Shopping bag</page_type></action>
127
+ <action method="setPageTypePosition"><page_type_position>50</page_type_position></action>
128
+ <action method="setDefaultPanelId"><panel_id>shopping-bag-people-also-bought</panel_id></action>
129
+ </block>
130
+ </block>
131
+ </reference>
132
+ </checkout_cart_index>
133
+ <!-- 404 -->
134
+ <cms_index_noroute>
135
+ <reference name="content">
136
+ <block type="superbrecommend/slot" name="superbrecommend-error-404-slot-1">
137
+ <action method="setSlotId"><slot_id>error-404-slot-1</slot_id></action>
138
+ <action method="setSlotPosition"><position>10</position></action>
139
+ <action method="setPageType"><page_type>Error 404</page_type></action>
140
+ <action method="setPageTypePosition"><page_type_position>70</page_type_position></action>
141
+ <action method="setDefaultPanelId"><panel_id>error-404-why-not-try-these</panel_id></action>
142
+ </block>
143
+ </reference>
144
+ </cms_index_noroute>
145
+ </layout>
app/design/frontend/base/default/template/recommend_tracker/block.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ ?>
18
+ <!-- {dynamic tags -->
19
+ <script type="text/javascript">
20
+ //<![CDATA[
21
+ <?php $data = $this->getTrackingData();?>
22
+ <?php if (is_array($data)):?><?php foreach ($data as $record): if (is_array($record) && count($record)):?>
23
+ _taq.push(<?php echo json_encode($record);?>);
24
+ <?php endif; endforeach; endif; ?>
25
+ //]]>
26
+ </script>
27
+ <!-- dynamic tags} -->
app/design/frontend/base/default/template/recommend_tracker/colmain.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ ?>
18
+ <style type="text/css">
19
+ /* Reset the .std styles */
20
+ .std ul.products-grid li {
21
+ list-style: none;
22
+ margin-left: 0;
23
+ }
24
+ .std ul.products-grid li .product-info {
25
+ padding-bottom: 0 !important;
26
+ min-height: 0 !important;
27
+ }
28
+ .widget-new-products h2 {
29
+ text-align: center;
30
+ }
31
+ </style>
32
+ <div class="main-container col1-layout">
33
+ <div class="main">
34
+ <div class="col-main">
35
+ <?php echo $this->getChildHtml(); ?>
36
+ </div>
37
+ </div>
38
+ </div>
app/design/frontend/base/default/template/recommend_tracker/force.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ ?>
18
+ <script type="text/javascript">
19
+ //<![CDATA[
20
+ var _taq = _taq || [];
21
+ _taq.push(["forceRecommendationLoad"]);
22
+ //]]>
23
+ </script>
app/design/frontend/base/default/template/recommend_tracker/panel.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ ?>
18
+ <div id=<?php echo json_encode($this->getRecommendPanelId());?>></div>
19
+ <script type="text/javascript">
20
+ //<![CDATA[
21
+ var _taq = _taq || [];
22
+ _taq.push(["loadRecommendationPanelToId",<?php echo json_encode($this->getRecommendPanelId());?>]);
23
+ //]]>
24
+ </script>
app/design/frontend/base/default/template/recommend_tracker/slot.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ ?>
18
+ <div id=<?php echo json_encode($this->getSlotId());?>></div>
19
+ <script type="text/javascript">
20
+ //<![CDATA[
21
+ var _taq = _taq || [];
22
+ _taq.push(["loadRecommendationSlotToId",<?php echo json_encode($this->getSlotId());?><?php echo is_array($this->getOptions())&&count($this->getOptions())?",".$this->getJsonOptions():'';?>]);
23
+ //]]>
24
+ </script>
app/design/frontend/base/default/template/recommend_tracker/static.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Superb_Recommend
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0), a
8
+ * copy of which is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Superb
12
+ * @package Superb_Recommend
13
+ * @author Superb <hello@wearesuperb.com>
14
+ * @copyright Copyright (c) 2015 Superb Media Limited
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ ?>
18
+ <?php $helper = Mage::helper('superbrecommend'); ?>
19
+ <script type="text/javascript">
20
+ //<![CDATA[
21
+ (function(){
22
+ var tracker = document.createElement('script'); tracker.type = 'text/javascript'; tracker.async = true;tracker.src = <?php echo json_encode($helper->getApiJsUrl());?>;
23
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tracker, s);
24
+ })();
25
+ var _taq = _taq || [];
26
+ _taq.push(["setAccountId", <?php echo json_encode($helper->getAccountId());?>] ,["setTrackerUrl",<?php echo json_encode($helper->getApiUrl());?>], ["setCurrentCurrencyCode",<?php echo json_encode(Mage::app()->getStore()->getCurrentCurrencyCode());?>], ["setCurrentStoreCode",<?php echo json_encode(Mage::app()->getStore()->getCode());?>]);
27
+ <?php $data = $this->getTrackingData();?>
28
+ <?php if (is_array($data)):?><?php foreach ($data as $record): if (is_array($record) && count($record)):?>
29
+ _taq.push(<?php echo json_encode($record);?>);
30
+ <?php endif; endforeach; endif; ?>
31
+ //]]>
32
+ </script>
33
+ <?php echo $this->getChildHtml('recommend_tracker'); echo $this->getChildHtml('recommend_tracker_cart'); ?>
34
+ <script type="text/javascript">
35
+ //<![CDATA[
36
+ _taq.push(["trackPageview"]);
37
+ //]]>
38
+ </script>
app/etc/modules/Superb_Recommend.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Superb_Recommend
4
+
5
+ NOTICE OF LICENSE
6
+
7
+ This source file is subject to the Open Software License (OSL 3.0), a
8
+ copy of which is available through the world-wide-web at this URL:
9
+ http://opensource.org/licenses/osl-3.0.php
10
+
11
+ @category Superb
12
+ @package Superb_Recommend
13
+ @author Superb <hello@wearesuperb.com>
14
+ @copyright Copyright (c) 2015 Superb Media Limited
15
+ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ -->
17
+ <config>
18
+ <modules>
19
+ <Superb_Recommend>
20
+ <active>true</active>
21
+ <codePool>community</codePool>
22
+ </Superb_Recommend>
23
+ </modules>
24
+ </config>
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Superb_Recommend</name>
4
+ <version>0.0.10</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Increase your revenue, drive conversions and transform your eCommerce site today with Recommend, our easy to use retail personalisation platform. Deliver highly personalised, targeted content directly to your users for a fraction of the cost of any other similar software on the market.</summary>
10
+ <description>Focus on your customers and forget the tech with Recommend. We&#x2019;ve developed Recommend especially for your eCommerce site on Magento, which guarantees you much simpler integration than any other personalisation software out there. Just download and install Recommend to optimise your site straight away. https://recommend.pro/</description>
11
+ <notes>Get Started:&#xD;
12
+ Go to http://recommend.pro and register&#xD;
13
+ &#xD;
14
+ see https://github.com/wearesuperb/recommend-magento-module</notes>
15
+ <authors><author><name>Superb</name><user>superb</user><email>hello@wearesuperb.com</email></author></authors>
16
+ <date>2016-04-06</date>
17
+ <time>20:16:45</time>
18
+ <contents><target name="magecommunity"><dir name="Superb"><dir name="Recommend"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><dir name="Field"><dir name="Customer"><file name="Attribute.php" hash="9c5da2bbc40b9db7e7b151a00ff9d8da"/><dir name="Recommend"><file name="Attribute.php" hash="6f8896ae7623588501bb8bf2ab12d35e"/></dir></dir><dir name="Product"><file name="Attribute.php" hash="b1d53570651694bb85cdbc11e3b22309"/><dir name="Recommend"><file name="Attribute.php" hash="d242a97206580fdb41d26169edee5ced"/></dir></dir><file name="Status.php" hash="2727e9f8864d9654d1a175e1c793c7d7"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Array"><dir name="Customer"><file name="Attributes.php" hash="7df16299d0f3e52a13650c0ecc5a3b43"/></dir><dir name="Product"><file name="Attributes.php" hash="7f26409d0eeb8109f724338a06ce8434"/></dir></dir></dir></dir></dir></dir></dir><file name="Block.php" hash="ff052141332a90d0adfd298020711bc2"/><dir name="Cart"><file name="Block.php" hash="b71a7041a6e1cb748df7ac5b63988b0f"/></dir><file name="Panel.php" hash="050d4c61ed940a00db226762fa173323"/><file name="Slot.php" hash="7ee408fb3e3753b96bd43f21e45dde97"/><dir name="Static"><file name="Block.php" hash="db4a9fe8608b73c57a71092ee403d386"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Advanced.php" hash="6a51e0a2dfd7db7ba952b94d9153030e"/></dir><dir name="Fieldset"><file name="Advanced.php" hash="63ad653d6dad42f47df40c69d24ed54f"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Admin.php" hash="4615433dc5da0d26d3e462889f72e95e"/><file name="Api.php" hash="5a0f556d019f59171002a39bdd24e9c1"/><file name="Data.php" hash="7397b37db9b8f5bc90af3c0c97c0e865"/></dir><dir name="Model"><file name="Observer.php" hash="3f9ee5364866e29c96d1beaf8a20e0f9"/><dir name="Pagecache"><dir name="Container"><file name="Block.php" hash="123de46d82ad29187c37640d21fb4a5d"/></dir></dir><file name="Session.php" hash="3240e4b3413b978fdf822cd6170cddbe"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Data"><file name="Cron.php" hash="0b47f3055ef0a410b5b40978c274fc6c"/></dir><file name="Date.php" hash="464ebb83b284bd0065507b83cc705705"/><file name="Slot.php" hash="a18a7d96547cdb083ab0588f1d5e4c58"/><dir name="Status"><file name="Cron.php" hash="3abba5807720e13f74a8b1bc040426d6"/></dir></dir><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="459994ca7373379e556bbe6129e39af2"/></dir><dir name="Customer"><file name="Attribute.php" hash="a6ee529121fba6bd59828dba16e87f68"/><dir name="Recommend"><file name="Attribute.php" hash="cde0f9d92d8fce1fe901ef928c58d396"/></dir></dir><file name="Panel.php" hash="412b1921de17f516ae235d59db09ae50"/><dir name="Product"><file name="Attribute.php" hash="7c066ee870e2dc2d8a9ef65a329cb03a"/><dir name="Recommend"><file name="Attribute.php" hash="e1a4983dd880e3f26ac0557a33bd8444"/></dir></dir><file name="Thumbnail.php" hash="c21f60b9529ccd9b0c6ccc6dac2f5d65"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c24ed259480330235043d4eea24f2a7e"/><file name="cache.xml" hash="4c32cbc94c139bdb7897ddfd64b9249a"/><file name="config.xml" hash="7767694515cb470d5a998026460f8703"/><file name="system.xml" hash="0ae66a25aedeb0a5e2c989a7393ea3c6"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="recommend_tracker"><file name="block.phtml" hash="d465fc93112f84a95ee85506a231a225"/><file name="colmain.phtml" hash="50c5a7a08d0c4416e69c93340ac3da06"/><file name="force.phtml" hash="12f5263fe8342b3a67a012ef99d59819"/><file name="panel.phtml" hash="15459d2cd1e76af1d4f418723c3d6cf5"/><file name="slot.phtml" hash="63b5147993a4f24436f61120f3e66f2d"/><file name="static.phtml" hash="db39b5d03a2745e44e8d12c76b97ebf8"/></dir></dir><dir name="layout"><file name="superbrecommend.xml" hash="a5857a743dbfbaab8c959f4b47b2328a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Superb_Recommend.xml" hash="2661b38cf144595500caa6f2434b603b"/></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
21
+ </package>