Brainsins_Recommender - Version 2.0.4

Version Notes

Fixed issues in catalog feed generation for multi-store data

Download this release

Release Info

Developer BrainSINS
Extension Brainsins_Recommender
Version 2.0.4
Comparing to
See all releases


Code changes from version 2.0.0 to 2.0.4

Files changed (75) hide show
  1. app/code/community/Brainsins/Recommender/.DS_Store +0 -0
  2. app/code/community/Brainsins/Recommender/Block/.DS_Store +0 -0
  3. app/code/community/Brainsins/Recommender/Block/Adminhtml/.DS_Store +0 -0
  4. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/.DS_Store +0 -0
  5. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/.DS_Store +0 -0
  6. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/.DS_Store +0 -0
  7. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Cart.php +27 -5
  8. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Category.php +27 -5
  9. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Checkout.php +26 -4
  10. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Home.php +42 -18
  11. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Product.php +27 -5
  12. app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Show.php +44 -0
  13. app/code/community/Brainsins/Recommender/Block/Recommendations.php +33 -0
  14. app/code/community/Brainsins/Recommender/Helper/Data.php +592 -404
  15. app/code/community/Brainsins/Recommender/Helper/sendBrainsinsWS.log +1 -19
  16. app/code/community/Brainsins/Recommender/Model/Adminhtml/System/Config/Source/{ApiMode.php → Apimode.php} +0 -0
  17. app/code/community/Brainsins/Recommender/Model/Brainsins.php +28 -0
  18. app/code/community/Brainsins/Recommender/Model/Cron.php +10 -10
  19. app/code/community/Brainsins/Recommender/Model/Observer.php +62 -55
  20. app/code/community/Brainsins/Recommender/Model/Recommendation.php +186 -0
  21. app/code/community/Brainsins/Recommender/controllers/CartController.php +9 -1
  22. app/code/community/Brainsins/Recommender/controllers/FeedsController.php +390 -37
  23. app/code/community/Brainsins/Recommender/controllers/LoginController.php +85 -0
  24. app/code/community/Brainsins/Recommender/controllers/RecommendationController.php +36 -0
  25. app/code/community/Brainsins/Recommender/controllers/TrackingController.php +275 -0
  26. app/code/community/Brainsins/Recommender/etc/config.xml +124 -101
  27. app/code/community/Brainsins/Recommender/etc/system.xml +70 -72
  28. app/code/community/Cm/RedisSession/Model/Session.php +0 -731
  29. app/code/community/Cm/RedisSession/etc/config.xml +0 -16
  30. app/code/community/Phoenix/Moneybookers/Block/Form.php +0 -93
  31. app/code/community/Phoenix/Moneybookers/Block/Info.php +0 -51
  32. app/code/community/Phoenix/Moneybookers/Block/Jsinit.php +0 -49
  33. app/code/community/Phoenix/Moneybookers/Block/Payment.php +0 -39
  34. app/code/community/Phoenix/Moneybookers/Block/Placeform.php +0 -67
  35. app/code/community/Phoenix/Moneybookers/Block/Redirect.php +0 -30
  36. app/code/community/Phoenix/Moneybookers/Helper/Data.php +0 -130
  37. app/code/community/Phoenix/Moneybookers/Model/Abstract.php +0 -208
  38. app/code/community/Phoenix/Moneybookers/Model/Acc.php +0 -27
  39. app/code/community/Phoenix/Moneybookers/Model/Csi.php +0 -27
  40. app/code/community/Phoenix/Moneybookers/Model/Did.php +0 -27
  41. app/code/community/Phoenix/Moneybookers/Model/Dnk.php +0 -27
  42. app/code/community/Phoenix/Moneybookers/Model/Ebt.php +0 -27
  43. app/code/community/Phoenix/Moneybookers/Model/Ent.php +0 -27
  44. app/code/community/Phoenix/Moneybookers/Model/Event.php +0 -270
  45. app/code/community/Phoenix/Moneybookers/Model/Gcb.php +0 -27
  46. app/code/community/Phoenix/Moneybookers/Model/Gir.php +0 -27
  47. app/code/community/Phoenix/Moneybookers/Model/Idl.php +0 -27
  48. app/code/community/Phoenix/Moneybookers/Model/Lsr.php +0 -27
  49. app/code/community/Phoenix/Moneybookers/Model/Mae.php +0 -27
  50. app/code/community/Phoenix/Moneybookers/Model/Npy.php +0 -27
  51. app/code/community/Phoenix/Moneybookers/Model/Obt.php +0 -27
  52. app/code/community/Phoenix/Moneybookers/Model/Pli.php +0 -27
  53. app/code/community/Phoenix/Moneybookers/Model/Psp.php +0 -27
  54. app/code/community/Phoenix/Moneybookers/Model/Pwy.php +0 -27
  55. app/code/community/Phoenix/Moneybookers/Model/Sft.php +0 -27
  56. app/code/community/Phoenix/Moneybookers/Model/So2.php +0 -27
  57. app/code/community/Phoenix/Moneybookers/Model/Wlt.php +0 -28
  58. app/code/community/Phoenix/Moneybookers/controllers/MoneybookersController.php +0 -87
  59. app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php +0 -146
  60. app/code/community/Phoenix/Moneybookers/etc/config.xml +0 -306
  61. app/code/community/Phoenix/Moneybookers/etc/system.xml +0 -1201
  62. app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/install-1.6.0.0.php +0 -22
  63. app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/mysql4-upgrade-1.2-1.2.0.1.php +0 -41
  64. app/design/adminhtml/default/default/layout/brainsins_recommender.xml +36 -0
  65. app/design/adminhtml/default/default/template/brainsins/recommender/help.phtml +34 -0
  66. app/design/frontend/base/default/layout/brainsins_recommender.xml +34 -0
  67. app/{code/community → design/frontend/base/default/template/brainsins/recommender}/.DS_Store +0 -0
  68. app/design/frontend/base/default/template/brainsins/recommender/js.phtml +414 -0
  69. app/design/frontend/base/default/template/brainsins/recommender/sample.phtml +43 -0
  70. app/etc/modules/Brainsins_Recommender.xml +33 -0
  71. app/locale/en_US/Brainsins_Recommender.csv +0 -0
  72. app/locale/es_ES/Brainsins_Recommender.csv +0 -0
  73. package.xml +5 -5
  74. skin/adminhtml/default/default/brainsins/recommender/css/brainsins_recommender.css +17 -6
  75. skin/adminhtml/default/default/brainsins/recommender/js/brainsins_recommender.js +15 -7
app/code/community/Brainsins/Recommender/.DS_Store ADDED
Binary file
app/code/community/Brainsins/Recommender/Block/.DS_Store ADDED
Binary file
app/code/community/Brainsins/Recommender/Block/Adminhtml/.DS_Store ADDED
Binary file
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/.DS_Store ADDED
Binary file
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/.DS_Store ADDED
Binary file
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/.DS_Store ADDED
Binary file
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Cart.php CHANGED
@@ -53,11 +53,22 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ca
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
- if($this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex) != '')
57
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex));
58
- else
59
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
60
- $html .= '<div style="height: 2px;"></div>';
 
 
 
 
 
 
 
 
 
 
 
61
  if($this->_getValue('custom_div_cart/'.$rowIndex) != '')
62
  $class = 'custom-select-after-before-hide';
63
  else
@@ -139,6 +150,17 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ca
139
  return $this->_removeRowButtonHtml;
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
142
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
143
  {
144
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('3');
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
+
57
+ // if($this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex) != '')
58
+ // $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex));
59
+ // else
60
+ // $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
61
+
62
+ if($this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex) != '')
63
+ {
64
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, $this->getElement()->getData('value/'.'recommender_name_cart/'.$rowIndex));
65
+ }
66
+ else
67
+ {
68
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, '');
69
+ }
70
+
71
+ $html .= '<div style="height: 2px;"></div>';
72
  if($this->_getValue('custom_div_cart/'.$rowIndex) != '')
73
  $class = 'custom-select-after-before-hide';
74
  else
150
  return $this->_removeRowButtonHtml;
151
  }
152
 
153
+ protected function _getRecommenderIdInputBox($rowIndex, $value) {
154
+ $name = $this->getElement()->getName().'[recommender_name_cart][]';
155
+ $id = '[recommender_name_cart]['.$rowIndex.']';
156
+
157
+ $html = "<div class='brainsins-recommenders-first-line'>";
158
+ $html .= '<label for="' . $name . '" class="brainsins-recommenders-first-line-first-item">Recommender Id: </label>';
159
+ $html .= '<input name="' . $name . '" id="' . $id . '" type="text" value="' . $value .'" class="brainsins-recommenders-first-line-second-item">';
160
+ $html .= "</div>";
161
+ return $html;
162
+ }
163
+
164
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
165
  {
166
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('3');
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Category.php CHANGED
@@ -53,11 +53,22 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ca
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
- if($this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex) != '')
57
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex));
58
- else
59
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
60
- $html .= '<div style="height: 2px;"></div>';
 
 
 
 
 
 
 
 
 
 
 
61
  if($this->_getValue('custom_div_c/'.$rowIndex) != '')
62
  $class = 'custom-select-after-before-hide';
63
  else
@@ -139,6 +150,17 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ca
139
  return $this->_removeRowButtonHtml;
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
142
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
143
  {
144
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('1');
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
+
57
+ // if($this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex) != '')
58
+ // $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex));
59
+ // else
60
+ // $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
61
+
62
+ if($this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex) != '')
63
+ {
64
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, $this->getElement()->getData('value/'.'recommender_name_c/'.$rowIndex));
65
+ }
66
+ else
67
+ {
68
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, '');
69
+ }
70
+
71
+ $html .= '<div style="height: 2px;"></div>';
72
  if($this->_getValue('custom_div_c/'.$rowIndex) != '')
73
  $class = 'custom-select-after-before-hide';
74
  else
150
  return $this->_removeRowButtonHtml;
151
  }
152
 
153
+ protected function _getRecommenderIdInputBox($rowIndex, $value) {
154
+ $name = $this->getElement()->getName().'[recommender_name_c][]';
155
+ $id = '[recommender_name_c]['.$rowIndex.']';
156
+
157
+ $html = "<div class='brainsins-recommenders-first-line'>";
158
+ $html .= '<label for="' . $name . '" class="brainsins-recommenders-first-line-first-item">Recommender Id: </label>';
159
+ $html .= '<input name="' . $name . '" id="' . $id . '" type="text" value="' . $value .'" class="brainsins-recommenders-first-line-second-item">';
160
+ $html .= "</div>";
161
+ return $html;
162
+ }
163
+
164
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
165
  {
166
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('1');
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Checkout.php CHANGED
@@ -53,13 +53,24 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ch
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_check/'.$rowIndex));
57
- $html .= '<div style="height: 2px;"></div>';
58
- if($this->_getValue('custom_div_check/'.$rowIndex) != '')
 
 
 
 
 
 
 
 
 
 
 
59
  $class = 'custom-select-after-before-hide';
60
  else
61
  $class = 'custom-select-after-before';
62
- $html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before_check/'.$rowIndex), 'recommender_after_before_check', $class);
63
  $html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position_check/'.$rowIndex));
64
  $html .= '<p class="custom-p">';
65
  $html .= '<span class="custom-div"';
@@ -133,6 +144,17 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ch
133
  return $this->_removeRowButtonHtml;
134
  }
135
 
 
 
 
 
 
 
 
 
 
 
 
136
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
137
  {
138
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('4');
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
+ //$html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_check/'.$rowIndex));
57
+
58
+
59
+ if($this->getElement()->getData('value/'.'recommender_name_check/'.$rowIndex) != '')
60
+ {
61
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, $this->getElement()->getData('value/'.'recommender_name_check/'.$rowIndex));
62
+ }
63
+ else
64
+ {
65
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, '');
66
+ }
67
+
68
+ $html .= '<div style="height: 2px;"></div>';
69
+ if($this->_getValue('custom_div_check/'.$rowIndex) != '')
70
  $class = 'custom-select-after-before-hide';
71
  else
72
  $class = 'custom-select-after-before';
73
+ $html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before_check/'.$rowIndex), 'recommender_after_before_check', $class);
74
  $html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position_check/'.$rowIndex));
75
  $html .= '<p class="custom-p">';
76
  $html .= '<span class="custom-div"';
144
  return $this->_removeRowButtonHtml;
145
  }
146
 
147
+ protected function _getRecommenderIdInputBox($rowIndex, $value) {
148
+ $name = $this->getElement()->getName().'[recommender_name_check][]';
149
+ $id = '[recommender_name_check]['.$rowIndex.']';
150
+
151
+ $html = "<div class='brainsins-recommenders-first-line'>";
152
+ $html .= '<label for="' . $name . '" class="brainsins-recommenders-first-line-first-item">Recommender Id: </label>';
153
+ $html .= '<input name="' . $name . '" id="' . $id . '" type="text" value="' . $value .'" class="brainsins-recommenders-first-line-second-item">';
154
+ $html .= "</div>";
155
+ return $html;
156
+ }
157
+
158
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
159
  {
160
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('4');
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Home.php CHANGED
@@ -42,7 +42,7 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
42
  $html .= $this->_getRowTemplateHtml($i);
43
  }
44
  }
45
- $html .= '</ul>';
46
  $html .= $this->_getAddRowButtonHtml('brainsins_recommender_recommenders_container_home',
47
  'brainsins_recommender_recommenders_home_template', Mage::helper('brainsins_recommender')->__('Add new recommender'));
48
 
@@ -52,21 +52,34 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
52
  protected function _getRowTemplateHtml($rowIndex = 0)
53
  {
54
  $html = '<li>';
55
- $html .= '<div style="margin:5px 0 10px;">';
56
- if($this->getElement()->getData('value/'.'recommender_name/'.$rowIndex) != '')
57
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name/'.$rowIndex));
58
- else
59
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
60
- $html .= '<div style="height: 2px;"></div>';
 
 
 
 
 
 
 
 
61
  if($this->_getValue('custom_div/'.$rowIndex) != '')
62
  $class = 'custom-select-after-before-hide';
63
  else
64
  $class = 'custom-select-after-before';
65
  $html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before/'.$rowIndex), 'recommender_after_before', $class);
66
- if($this->getElement()->getData('value/'.'recommender_position/'.$rowIndex) != '')
 
 
67
  $html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position/'.$rowIndex));
68
  else
69
  $html .= $this->_getPositionsHtmlSelect($rowIndex, 'content');
 
 
 
70
  $html .= '<p class="custom-p">';
71
  $html .= '<span class="custom-div"';
72
  if($this->_getValue('custom_div/'.$rowIndex) == '')
@@ -104,12 +117,12 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
104
  {
105
  return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
106
  }
107
-
108
  protected function _getRadioSelected($key, $value)
109
  {
110
  return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
111
  }
112
-
113
  protected function _getAddRowButtonHtml($container, $template, $title='Add')
114
  {
115
  if (!isset($this->_addRowButtonHtml[$container]))
@@ -124,7 +137,7 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
124
  }
125
  return $this->_addRowButtonHtml[$container];
126
  }
127
-
128
  protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
129
  {
130
  if (!$this->_removeRowButtonHtml)
@@ -140,12 +153,23 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
140
  return $this->_removeRowButtonHtml;
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
143
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
144
  {
145
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('1');
146
 
147
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
148
- ->setName($this->getElement()->getName().'[recommender_name][]"'.$this->_getDisabled())
149
  ->setId('[recommender_name]['.$rowIndex.']')
150
  ->setTitle(Mage::helper('brainsins_recommender')->__('Recommender name'))
151
  ->setValue($default_value)
@@ -154,13 +178,13 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
154
 
155
  return $select->getHtml();
156
  }
157
-
158
  protected function _getPositionsHtmlSelect($rowIndex, $default_value = '')
159
  {
160
  $positions = Mage::helper('brainsins_recommender')->getPositions('1');
161
 
162
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
163
- ->setName($this->getElement()->getName().'[recommender_position][]"'.$this->_getDisabled())
164
  ->setId('[recommender_position]['.$rowIndex.']')
165
  ->setTitle(Mage::helper('brainsins_recommender')->__('Recommender position'))
166
  ->setValue($default_value)
@@ -170,7 +194,7 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
170
 
171
  return $select->getHtml();
172
  }
173
-
174
  protected function _getBeforeAfterHtmlSelect($rowIndex, $default_value = '', $default_id = '', $class)
175
  {
176
  $positions = array();
@@ -178,7 +202,7 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
178
  $positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
179
 
180
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
181
- ->setName($this->getElement()->getName().'[recommender_after_before][]"'.$this->_getDisabled())
182
  ->setId('[recommender_after_before]['.$rowIndex.']')
183
  ->setValue($default_value)
184
  ->setClass($class);
@@ -186,7 +210,7 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
186
 
187
  return $select->getHtml();
188
  }
189
-
190
  protected function _getCustomDivPositionsHtmlSelect($rowIndex, $default_value = '', $id, $class = '')
191
  {
192
  $positions = array();
@@ -197,7 +221,7 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Ho
197
  $positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
198
 
199
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
200
- ->setName($this->getElement()->getName().'['.$id.'][]"'.$this->_getDisabled())
201
  ->setId('['.$id.']['.$rowIndex.']')
202
  ->setValue($default_value)
203
  ->setClass($class);
42
  $html .= $this->_getRowTemplateHtml($i);
43
  }
44
  }
45
+ $html .= "</ul>";
46
  $html .= $this->_getAddRowButtonHtml('brainsins_recommender_recommenders_container_home',
47
  'brainsins_recommender_recommenders_home_template', Mage::helper('brainsins_recommender')->__('Add new recommender'));
48
 
52
  protected function _getRowTemplateHtml($rowIndex = 0)
53
  {
54
  $html = '<li>';
55
+ $html .= '<div style="margin:5px 0 10px;">';
56
+
57
+ if($this->getElement()->getData('value/'.'recommender_name/'.$rowIndex) != '')
58
+ {
59
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, $this->getElement()->getData('value/'.'recommender_name/'.$rowIndex));
60
+ }
61
+ else
62
+ {
63
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, '');
64
+ }
65
+
66
+ // $html.="<br/>";
67
+
68
+
69
  if($this->_getValue('custom_div/'.$rowIndex) != '')
70
  $class = 'custom-select-after-before-hide';
71
  else
72
  $class = 'custom-select-after-before';
73
  $html .= $this->_getBeforeAfterHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_after_before/'.$rowIndex), 'recommender_after_before', $class);
74
+
75
+
76
+ if($this->getElement()->getData('value/'.'recommender_position/'.$rowIndex) != '')
77
  $html .= $this->_getPositionsHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_position/'.$rowIndex));
78
  else
79
  $html .= $this->_getPositionsHtmlSelect($rowIndex, 'content');
80
+
81
+
82
+
83
  $html .= '<p class="custom-p">';
84
  $html .= '<span class="custom-div"';
85
  if($this->_getValue('custom_div/'.$rowIndex) == '')
117
  {
118
  return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
119
  }
120
+
121
  protected function _getRadioSelected($key, $value)
122
  {
123
  return $this->getElement()->getData('value/' . $key) == $value ? 'checked="yes"' : '';
124
  }
125
+
126
  protected function _getAddRowButtonHtml($container, $template, $title='Add')
127
  {
128
  if (!isset($this->_addRowButtonHtml[$container]))
137
  }
138
  return $this->_addRowButtonHtml[$container];
139
  }
140
+
141
  protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete')
142
  {
143
  if (!$this->_removeRowButtonHtml)
153
  return $this->_removeRowButtonHtml;
154
  }
155
 
156
+ protected function _getRecommenderIdInputBox($rowIndex, $value) {
157
+ $name = $this->getElement()->getName().'[recommender_name][]';
158
+ $id = '[recommender_name]['.$rowIndex.']';
159
+
160
+ $html = "<div class='brainsins-recommenders-first-line'>";
161
+ $html .= '<label for="' . $name . '" class="brainsins-recommenders-first-line-first-item">Recommender Id: </label>';
162
+ $html .= '<input name="' . $name . '" id="' . $id . '" type="text" value="' . $value .'" class="brainsins-recommenders-first-line-second-item">';
163
+ $html .= "</div>";
164
+ return $html;
165
+ }
166
+
167
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
168
  {
169
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('1');
170
 
171
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
172
+ ->setName($this->getElement()->getName().'[recommender_name][]'.$this->_getDisabled())
173
  ->setId('[recommender_name]['.$rowIndex.']')
174
  ->setTitle(Mage::helper('brainsins_recommender')->__('Recommender name'))
175
  ->setValue($default_value)
178
 
179
  return $select->getHtml();
180
  }
181
+
182
  protected function _getPositionsHtmlSelect($rowIndex, $default_value = '')
183
  {
184
  $positions = Mage::helper('brainsins_recommender')->getPositions('1');
185
 
186
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
187
+ ->setName($this->getElement()->getName().'[recommender_position][]'.$this->_getDisabled())
188
  ->setId('[recommender_position]['.$rowIndex.']')
189
  ->setTitle(Mage::helper('brainsins_recommender')->__('Recommender position'))
190
  ->setValue($default_value)
194
 
195
  return $select->getHtml();
196
  }
197
+
198
  protected function _getBeforeAfterHtmlSelect($rowIndex, $default_value = '', $default_id = '', $class)
199
  {
200
  $positions = array();
202
  $positions[] = array('value' => 'before', 'label' => Mage::helper('brainsins_recommender')->__('Before'));
203
 
204
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
205
+ ->setName($this->getElement()->getName().'[recommender_after_before][]'.$this->_getDisabled())
206
  ->setId('[recommender_after_before]['.$rowIndex.']')
207
  ->setValue($default_value)
208
  ->setClass($class);
210
 
211
  return $select->getHtml();
212
  }
213
+
214
  protected function _getCustomDivPositionsHtmlSelect($rowIndex, $default_value = '', $id, $class = '')
215
  {
216
  $positions = array();
221
  $positions[] = array('value' => 'after', 'label' => Mage::helper('brainsins_recommender')->__('After'));
222
 
223
  $tmp = Mage::app()->getLayout()->createBlock('core/html_select')
224
+ ->setName($this->getElement()->getName().'['.$id.'][]'.$this->_getDisabled())
225
  ->setId('['.$id.']['.$rowIndex.']')
226
  ->setValue($default_value)
227
  ->setClass($class);
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Product.php CHANGED
@@ -53,11 +53,22 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Pr
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
- if($this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex) != '')
57
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex));
58
- else
59
- $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
60
- $html .= '<div style="height: 2px;"></div>';
 
 
 
 
 
 
 
 
 
 
 
61
  if($this->_getValue('custom_div_p/'.$rowIndex) != '')
62
  $class = 'custom-select-after-before-hide';
63
  else
@@ -140,6 +151,17 @@ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Pr
140
  return $this->_removeRowButtonHtml;
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
143
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
144
  {
145
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('2');
53
  {
54
  $html = '<li>';
55
  $html .= '<div style="margin:5px 0 10px;">';
56
+
57
+ // if($this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex) != '')
58
+ // $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, $this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex));
59
+ // else
60
+ // $html .= $this->_getRecommenderNamesHtmlSelect($rowIndex, '');
61
+
62
+ if($this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex) != '')
63
+ {
64
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, $this->getElement()->getData('value/'.'recommender_name_p/'.$rowIndex));
65
+ }
66
+ else
67
+ {
68
+ $html .= $this->_getRecommenderIdInputBox($rowIndex, '');
69
+ }
70
+
71
+ $html .= '<div style="height: 2px;"></div>';
72
  if($this->_getValue('custom_div_p/'.$rowIndex) != '')
73
  $class = 'custom-select-after-before-hide';
74
  else
151
  return $this->_removeRowButtonHtml;
152
  }
153
 
154
+ protected function _getRecommenderIdInputBox($rowIndex, $value) {
155
+ $name = $this->getElement()->getName().'[recommender_name_p][]';
156
+ $id = '[recommender_name_p]['.$rowIndex.']';
157
+
158
+ $html = "<div class='brainsins-recommenders-first-line'>";
159
+ $html .= '<label for="' . $name . '" class="brainsins-recommenders-first-line-first-item">Recommender Id: </label>';
160
+ $html .= '<input name="' . $name . '" id="' . $id . '" type="text" value="' . $value .'" class="brainsins-recommenders-first-line-second-item">';
161
+ $html .= "</div>";
162
+ return $html;
163
+ }
164
+
165
  protected function _getRecommenderNamesHtmlSelect($rowIndex, $default_value = '')
166
  {
167
  $recommenders = Mage::helper('brainsins_recommender')->getRecommenders('2');
app/code/community/Brainsins/Recommender/Block/Adminhtml/System/Config/Source/Recommenders/Show.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ */
24
+
25
+ class Brainsins_Recommender_Block_Adminhtml_System_Config_Source_Recommenders_Show extends Mage_Adminhtml_Block_System_Config_Form_Field
26
+ {
27
+ /**
28
+ * Return element html
29
+ *
30
+ * @param Varien_Data_Form_Element_Abstract $element
31
+ * @return string
32
+ */
33
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
34
+ {
35
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
36
+ ->setData(array(
37
+ 'id' => 'bs_recommender_list_button',
38
+ 'label' => $this->helper('adminhtml')->__('See available recommenders'),
39
+ 'onclick' => 'showRecommenderList()'
40
+ ));
41
+
42
+ return $button->toHtml();
43
+ }
44
+ }
app/code/community/Brainsins/Recommender/Block/Recommendations.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Brainsins_Recommender_Block_Recommendations extends Mage_Catalog_Block_Product_Abstract {
3
+
4
+ public function getRecommendations() {
5
+ $model = Mage::getSingleton("brainsins_recommender/recommendation");
6
+ return $model->__get("recommendations");
7
+ }
8
+
9
+ public function getIdRecommendation($url) {
10
+ $model = Mage::getSingleton("brainsins_recommender/recommendation");
11
+ return $model->getIdRecommendation($url);
12
+ }
13
+
14
+ public function getIdPrevPage($url) {
15
+ $model = Mage::getSingleton("brainsins_recommender/recommendation");
16
+ return $model->getPrevPage($url);
17
+ //return $model->__get("idPrevPage");
18
+ }
19
+
20
+ public function getOnclick($id, $url) {
21
+ return "bsTrackProductClicked('$id','" . $this->getIdRecommendation($id) . "','" . $this->getIdPrevPage($id) . "','$url');return false;";
22
+ }
23
+
24
+ public function getFirstAlborithmCode() {
25
+ $model = Mage::getSingleton("brainsins_recommender/recommendation");
26
+ return " <-" . $model->__get("altorithm");
27
+ }
28
+
29
+ public function isFiltered() {
30
+ $model = Mage::getSingleton("brainsins_recommender/recommendation");
31
+ return $model->__get("filtered") === true;
32
+ }
33
+ }
app/code/community/Brainsins/Recommender/Helper/Data.php CHANGED
@@ -20,7 +20,7 @@
20
  * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
  *
22
  * Please do not hesitate to contact us at info@brainsins.com
23
- */
24
 
25
  /**
26
  * ID BRAINSINS PAGE
@@ -35,19 +35,19 @@
35
 
36
  class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
37
  {
38
- protected static $_api_url = 'http://durotar.api.brainsins.com/RecSinsAPI/api/';
39
- protected static $_pages = 'home,product,category,cart,checkout'; //-->Not needed yet
40
-
41
  public static function getApiUrl() {
42
  $apiMode = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_advanced/api_mode', Mage::app()->getStore()->getStoreId());
43
  if ($apiMode == "1") {
44
  return 'http://api.brainsins.com/RecSinsAPI/api/';
45
  } else {
46
- return 'http://durotar.api.brainsins.com/RecSinsAPI/api/';
47
  }
48
-
49
  }
50
-
51
  public function getRecommenders($page)
52
  {
53
  $recommenders = array();
@@ -59,7 +59,7 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
59
  return array('value' => '', 'label' => $msg_not_available);
60
 
61
  $response = @file_get_contents(self::getApiUrl()."recommender/retrieve.xml?token=".$bskey);
62
-
63
  if ($response !== false)
64
  {
65
  $xmlData = simplexml_load_string($response);
@@ -74,62 +74,62 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
74
  }
75
  else
76
  $recommenders[0] = array('value' => '', 'label' => $msg_not_available);
77
-
78
  return $recommenders;
79
  }
80
 
81
  public function getPositions($page)
82
  {
83
  $positions = array();
84
- $positions[] = array('value' => '', 'label' => Mage::helper('brainsins_recommender')->__('------------- Recommender position -------------'));
85
 
86
  switch ($page) {
87
  case '1':
88
  $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
89
  $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
90
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
91
- $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
92
- $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
93
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
94
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
95
  $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
96
- $positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
97
  $positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
98
  $positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
99
  $positions[] = array('value' => 'cart_sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Cart sidebar'));
100
- $positions[] = array('value' => 'catalog.compare.sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Product compare sidebar'));
101
- $positions[] = array('value' => 'left.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Left column recently viewed'));
102
- $positions[] = array('value' => 'right.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Right column recently viewed'));
103
  break;
104
  case '2':
105
- $positions[] = array('value' => 'product.info', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
106
- $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
107
- $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
108
- $positions[] = array('value' => 'description', 'label' => Mage::helper('brainsins_recommender')->__('Product description'));
109
- $positions[] = array('value' => 'additional', 'label' => Mage::helper('brainsins_recommender')->__('Product attributes'));
110
  $positions[] = array('value' => 'product_options', 'label' => Mage::helper('brainsins_recommender')->__('Product options'));
111
  $positions[] = array('value' => 'prices', 'label' => Mage::helper('brainsins_recommender')->__('Product prices'));
112
- $positions[] = array('value' => 'product_additional_data', 'label' => Mage::helper('brainsins_recommender')->__('Product additional information'));
113
- $positions[] = array('value' => 'upsell_products', 'label' => Mage::helper('brainsins_recommender')->__('Upsell products'));
114
  $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
115
- $positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
116
- $positions[] = array('value' => 'catalog.product.related', 'label' => Mage::helper('brainsins_recommender')->__('Related products'));
117
- $positions[] = array('value' => 'media', 'label' => Mage::helper('brainsins_recommender')->__('Product media gallery'));
118
- $positions[] = array('value' => 'product_tag_list', 'label' => Mage::helper('brainsins_recommender')->__('Product tag list'));
119
- $positions[] = array('value' => 'extrahint', 'label' => Mage::helper('brainsins_recommender')->__('Product extra hint'));
120
- $positions[] = array('value' => 'product.info.addtocart', 'label' => Mage::helper('brainsins_recommender')->__('Product add to cart'));
121
- $positions[] = array('value' => 'product.info.addto', 'label' => Mage::helper('brainsins_recommender')->__('Product other "add to" options'));
122
- $positions[] = array('value' => 'cart_sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Cart sidebar'));
123
- $positions[] = array('value' => 'catalog.compare.sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Product compare sidebar'));
124
- $positions[] = array('value' => 'left.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Left column recently viewed'));
125
- $positions[] = array('value' => 'right.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Right column recently viewed'));
126
  $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
127
  $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
128
  $positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
129
  $positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
130
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
131
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
132
- break;
133
  case '3':
134
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
135
  $positions[] = array('value' => 'crosssell', 'label' => Mage::helper('brainsins_recommender')->__('Cross sell area'));
@@ -145,11 +145,11 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
145
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
146
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
147
  break;
148
- /*
149
- case '4':
150
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
151
- $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
152
- $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
153
  $positions[] = array('value' => 'checkout.progress', 'label' => Mage::helper('brainsins_recommender')->__('Checkout progress'));
154
  $positions[] = array('value' => 'login', 'label' => Mage::helper('brainsins_recommender')->__('Login'));
155
  $positions[] = array('value' => 'billing', 'label' => Mage::helper('brainsins_recommender')->__('Billing information'));
@@ -170,27 +170,27 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
170
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
171
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
172
  break;
173
- */
174
- case '4':
175
- $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
176
- $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
177
- $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
178
- $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
179
- $positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
180
- $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
181
- $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
182
- $positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
183
- $positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
184
- $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
185
- $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
186
- break;
187
  case '7':
188
  $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
189
  $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
190
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
191
  $positions[] = array('value' => 'product_list', 'label' => Mage::helper('brainsins_recommender')->__('Product list'));
192
- $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
193
- $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
194
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
195
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
196
  $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
@@ -206,51 +206,51 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
206
  return $positions;
207
  }
208
 
209
- public function getConfiguration($page, $store = null)
210
- {
211
- if($store == null)
212
- $store = Mage::app()->getStore()->getStoreId();
213
- $jSonRecommendersConfig = '';
214
- $config = array();
215
- if($page == 'all')
216
- {
217
- $pages = explode(',', self::$_pages);
218
- foreach ($pages as $key => $_page)
219
- {
220
- $jSonRecommendersConfig = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_recommenders_'.$_page.'/recommenders_'.$_page, $store);
221
- $arrayDatas = unserialize($jSonRecommendersConfig);
222
- foreach ($arrayDatas as $key => $arrayData) {
223
- foreach ($arrayData as $key => $data) {
224
- $config[$key][] = $data;
225
- }
226
- }
227
- }
228
- }
229
  else
230
- {
231
- $jSonRecommendersConfig = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_recommenders_'.$page.'/recommenders_'.$page, $store);
232
- $arrayDatas = unserialize($jSonRecommendersConfig);
233
- $config = array();
234
- foreach ($arrayDatas as $key => $arrayData) {
235
- foreach ($arrayData as $key => $data) {
236
- $config[$key][] = $data;
237
- }
238
- }
239
- }
240
-
241
- return $this->_cleanEmpties($config);
242
- }
243
-
244
- public function getRecommendersJs($recommenders)
245
- {
246
- $recommenders_js = '';
247
- if($recommenders && count($recommenders) > 0)
248
  {
249
- $recommenders_js .= ',
250
- recommenders: [';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  foreach ($recommenders as $key => $_value)
252
  {
253
- if($_value[0] == '' || $_value[0] == '-')
254
  continue;
255
  if($_value[4] != '')
256
  {
@@ -262,21 +262,22 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
262
  $_position = 'replace';
263
  }
264
  $recommenders_js .= "
265
- {
266
- recommenderId: ".$_value[0].",
 
267
  location: '".$_location."',
268
- position: '".$_position."'
269
- },
270
- ";
271
  }
272
- $recommenders_js .= ']';
273
  }
274
- return $recommenders_js;
275
- }
276
-
277
- protected function _cleanEmpties($data)
278
- {
279
- $cleanedData = array();
280
  foreach ($data as $key => $value) {
281
  if($value[0] == '')
282
  continue;
@@ -284,246 +285,265 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
284
  $cleanedData[] = $value;
285
  }
286
 
287
- return array_map('unserialize', array_unique(array_map('serialize', $cleanedData)));
288
- }
289
-
290
- public function getProductsFeed($key = '')
291
- {
292
- if($key == '')
293
- $key = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key');
294
- $include_oos_products = Mage::getStoreConfig('brainsins_recommender_options/product_feed/include_oos_products', Mage::app()->getStore()->getStoreId());
295
- $tax_included = Mage::getStoreConfig('brainsins_recommender_options/product_feed/tax_included', Mage::app()->getStore()->getStoreId());
296
- $special_price = Mage::getStoreConfig('brainsins_recommender_options/product_feed/special_price', Mage::app()->getStore()->getStoreId());
297
- $desc_attribute = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_description_attribute', Mage::app()->getStore()->getStoreId());
298
-
299
- $pDomBrain = new DOMDocument('1.0','UTF-8');
300
- $pDomBrain->formatOutput = true;
301
- $pDomBrain->xmlStandalone = true;
302
-
303
- $pRecsins = $pDomBrain->createElement('recsins');
304
- $pRecsins->setAttribute('version', '0.1');
305
- $pDomBrain->appendChild($pRecsins);
306
-
307
- $pEntities = $pDomBrain->createElement('entities');
308
- $pRecsins->appendChild($pEntities);
309
-
310
- $rows = 0;
311
-
312
- $languages = $this->_getStores($key);
313
- $currencies = $this->_getCurrencies($key);
314
- // $products = Mage::getResourceModel('catalog/product_collection')
315
- // ->getCollection()
316
- // ->addAttributeToSelect('entity_id')
317
- // ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
318
- // ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
319
- // ->addAttributeToSort('entity_id','asc'); //Tablas EAV
320
- $products = Mage::getModel('catalog/product')
321
- ->getCollection()
322
- ->addAttributeToSelect('entity_id')
323
- ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
324
- ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
325
- ->addAttributeToSort('entity_id','asc'); //Tablas flat
326
-
327
- if(!$desc_attribute || $desc_attribute == '')
328
- $desc_attribute = 'description';
329
-
330
- foreach ($products as $key => $entity)
331
- {
332
- $product = Mage::getModel('catalog/product')->load($entity->getId());
333
- if(Mage::app()->getRequest()->getControllerName() != 'feeds')
334
- {
335
- $offline_stock_status = Mage::getModel('cataloginventory/stock_item') ->loadByProduct($product)->getIsInStock();
336
- if($include_oos_products == '0' && $offline_stock_status == '0')
337
- continue;
338
- }
339
- else
340
- {
341
- if($include_oos_products == '0' && !$product->isSaleable())
342
- continue;
343
- }
344
- $pEntity = $pDomBrain->createElement('entity');
345
- $pEntity->setAttribute('name', 'product');
346
- $pEntities->appendChild($pEntity);
347
-
348
- $pIDProd = $pDomBrain->createElement('property');
349
- $pIDProd->setAttribute('name', 'idProduct');
350
- $cdata = $pDomBrain->createTextNode($product->getId());
351
- $pIDProd->appendChild($cdata);
352
- $pEntity->appendChild($pIDProd);
353
-
354
- $pMPName = $pDomBrain->createElement('multi_property');
355
- $pMPName->setAttribute('name', 'name');
356
-
357
- $pMPDesc = $pDomBrain->createElement('multi_property');
358
- $pMPDesc->setAttribute('name', 'description');
359
-
360
- $pMPUrl = $pDomBrain->createElement('multi_property');
361
- $pMPUrl->setAttribute('name', 'url');
362
-
363
- foreach ($languages as $store_id => $lang_code) {
364
- $product_lang = Mage::getModel('catalog/product')
365
- ->setStoreId($store_id)
366
- ->load($product->getId());
367
- //$lang_code = explode('_', $lang_code);
368
- $pLangName = $pDomBrain->createElement('property');
369
- $pLangName->setAttribute('lang', $lang_code);
370
- $cdata = $pDomBrain->createCDATASection($product_lang->getName());
371
- $pLangName->appendChild($cdata);
372
- $pMPName->appendChild($pLangName);
373
-
374
- $pLangDesc = $pDomBrain->createElement('property');
375
- $pLangDesc->setAttribute('lang', $lang_code);
376
- $cdata = $pDomBrain->createCDATASection(Mage::getResourceModel('catalog/product')
377
- ->getAttributeRawValue($product_lang->getId(), $desc_attribute, $store_id));
378
- $pLangDesc->appendChild($cdata);
379
- $pMPDesc->appendChild($pLangDesc);
380
-
381
- $pLangLink = $pDomBrain->createElement('property');
382
- $pLangLink->setAttribute('lang', $lang_code);
383
- $product_link = preg_replace("/[\?&]?___store=[^\?&]*/", "", $product_lang->getProductUrl());
384
- $cdata = $pDomBrain->createCDATASection($product_link);
385
- $pLangLink->appendChild($cdata);
386
- $pMPUrl->appendChild($pLangLink);
387
- }
388
- $pEntity->appendChild($pMPName);
389
- $pEntity->appendChild($pMPDesc);
390
- $pEntity->appendChild($pMPUrl);
391
-
392
- $pPrice = $pDomBrain->createElement('property');
393
- $pPrice->setAttribute('name', 'price');
394
-
395
- if($tax_included == '1' && $special_price == '1')
396
- $product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, false);
397
- elseif($tax_included == '1' && $special_price == '0')
398
- $product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, false);
399
- if($tax_included == '0' && $special_price == '1')
400
- $product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, true);
401
- elseif($tax_included == '0' && $special_price == '0')
402
- $product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, true);
403
-
404
- if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
405
- {
406
- if($tax_included == '1' && $special_price == '1')
407
- $product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
408
- elseif($tax_included == '1' && $special_price == '0')
409
- $product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
410
- if($tax_included == '0' && $special_price == '1')
411
- $product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
412
- elseif($tax_included == '0' && $special_price == '0')
413
- $product_price = Mage::helper('tax')->getPrice($product, $this->_getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
414
- }
415
 
416
- $cdata = $pDomBrain->createTextNode(number_format($product_price, 2, '.', ''));
417
- $pPrice->appendChild($cdata);
418
- $pEntity->appendChild($pPrice);
419
 
420
- if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  {
422
- $product_final_price = $this->_getBundlePrice($product, 'min', 1);
423
- $product_regular_price = $this->_getBundlePrice($product, 'min', 1);
424
- }
425
- else
426
- {
427
- $product_final_price = $product->getFinalPrice();
428
- $product_regular_price = $product->getPrice();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  }
 
 
430
 
431
- try
432
- {
433
- $pMPCur = $pDomBrain->createElement('multi_property');
434
- $pMPCur->setAttribute('name', 'multiprice');
435
-
436
- foreach ($currencies as $k => $curr){
437
- $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
438
- $targetCurrency = Mage::getModel('directory/currency')->load($curr);
439
- $pPrice = $pDomBrain->createElement('property');
440
- $pPrice->setAttribute('currency', $curr);
441
- $price_converted = number_format(Mage::helper('directory')->currencyConvert($product_final_price, $baseCurrency, $targetCurrency), 2, '.', '');
442
- $cdata = $pDomBrain->createTextNode($price_converted);
443
- $pPrice->appendChild($cdata);
444
- $pMPCur->appendChild($pPrice);
445
- }
446
- $pEntity->appendChild($pMPCur);
447
- unset($targetCurrency);
448
-
449
- $pOPCur = $pDomBrain->createElement('multi_property');
450
- $pOPCur->setAttribute('name', 'originalPrice');
451
-
452
- foreach ($currencies as $k => $curr){
453
- $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
454
- $targetCurrency = Mage::getModel('directory/currency')->load($curr);
455
- $pPrice = $pDomBrain->createElement('property');
456
- $pPrice->setAttribute('currency', $curr);
457
- $price_converted = number_format(Mage::helper('directory')->currencyConvert($product_regular_price, $baseCurrency, $targetCurrency), 2, '.', '');
458
- $cdata = $pDomBrain->createTextNode($price_converted);
459
- $pPrice->appendChild($cdata);
460
- $pOPCur->appendChild($pPrice);
461
- }
462
- $pEntity->appendChild($pOPCur);
463
- unset($targetCurrency);
464
- }
465
- catch(Exception $e)
466
- {
467
- Mage::throwException(Mage::helper('brainsins_recommender')->__('ERROR IN CURRENCY CONVERT. ALL CURRENCY RATES ARE DEFINED?'));
468
- }
469
-
470
- $imageUrl;
471
-
472
- $image_width = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_width', Mage::app()->getStore()->getStoreId());
473
- $image_height = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_height', Mage::app()->getStore()->getStoreId());
474
-
475
- if (!$image_width || $image_width == "" || $image_width == "0" || !is_numeric($image_width)) {
476
- $image_width = null;
477
- }
478
-
479
- if (!$image_height || $image_height == "" || $image_height == "0" || !is_numeric($image_height)) {
480
- $image_height = null;
481
- }
482
-
483
-
484
- if (!$image_width && !$image_height) {
485
- $imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
486
- } else {
487
- $imageUrl = (string) Mage::helper('catalog/image')->init($product, "image")->resize($image_width, $image_height);
488
- }
489
-
490
- // $url = (string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width, $height);
491
-
492
-
493
-
494
- //$imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
495
- $pImage = $pDomBrain->createElement('property');
496
- $pImage->setAttribute('name', 'imageUrl');
497
- $cdata = $pDomBrain->createCDATASection($imageUrl);
498
- $pImage->appendChild($cdata);
499
- $pEntity->appendChild($pImage);
500
-
501
- $pCategory = $pDomBrain->createElement('property');
502
- $pCategory->setAttribute('name', 'categories');
503
- $cdata = $pDomBrain->createTextNode(implode(",", $product->getCategoryIds()));
504
- $pCategory->appendChild($cdata);
505
- $pEntity->appendChild($pCategory);
506
-
507
- $rows++;
508
- $image = null;
509
- unset($image);
510
-
511
- $imageObj = null;
512
- unset($imageObj);
513
-
514
- unset($product);
515
- }
516
- $feed = $pDomBrain->saveXML();
517
- $products = null;unset($products);unset($pDomBrain);
518
-
519
- return $feed;
520
- }
521
 
522
  public function updateCartInBrainsins($cart, $special = false)
523
  {
524
  if (!is_object($cart))
525
  return;
526
 
 
 
 
 
 
 
527
  $ruta = "order/trackOrder.xml?";
528
  $url = self::getApiUrl().$ruta."token=".Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
529
 
@@ -551,40 +571,169 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
551
  $pOrder->appendChild($pProducts);
552
 
553
  if($special)
554
- $items = $cart->getAllItems();
555
  else
556
  $items = $cart->getItems();
 
 
 
 
557
 
558
- foreach ($items as $item) {
559
- if($item->getType() == 'simple')
560
- return;
561
- $pProduct = $cartXML->createElement('product');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
 
563
- $pIdProduct = $cartXML->createElement('idProduct', $item->getProductId());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  $pProduct->appendChild($pIdProduct);
565
 
566
- $pPrice = $cartXML->createElement('price', number_format($item->getPriceInclTax(), 2, '.', ''));
567
- $pProduct->appendChild($pPrice);
568
 
569
- $pQuantity = $cartXML->createElement('quantity', $item->getQty());
570
  $pProduct->appendChild($pQuantity);
571
 
572
  $pProducts->appendChild($pProduct);
 
 
 
 
 
 
 
 
 
 
 
573
  }
574
 
575
  $content = $cartXML->saveXML($cartXML->documentElement);
576
- return $this->_sendBrainsinsWS($url, $content);
 
 
 
577
  }
578
 
579
- protected function _sendBrainsinsWS($url, $content = null)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  {
 
 
 
 
581
  if(function_exists('curl_init')) {
582
  $ch = curl_init($url);
583
  //$logfh = fopen(dirname(__FILE__) . "/sendBrainsinsWS.log", 'a+');
584
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
585
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
586
- curl_setopt($ch, CURLOPT_POST, 1);
587
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
 
 
 
588
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
589
  curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
590
  curl_setopt($ch, CURLOPT_VERBOSE, true);
@@ -593,79 +742,118 @@ class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
593
  $response = curl_exec($ch);
594
  curl_close($ch);
595
  //fclose($logfh);
 
596
  } else {
597
  $opts = array('http' =>
598
- array(
599
  'method' => 'POST',
600
  'header' => 'Content-type: text/xml',
601
  'content' => $content
602
- )
603
  );
604
  $context = stream_context_create($opts);
605
  $response = file_get_contents($url, false, $context);
606
  }
 
607
  return $response;
608
  }
609
 
610
  protected function _getUser()
611
  {
612
- if (isset($_COOKIE['ul']) && $_COOKIE['ul'] == 1)
613
- return $_COOKIE['uId'];
614
- elseif (isset($_COOKIE['ul']) && $_COOKIE['ul'] == 0)
615
- return $_COOKIE['coId'];
616
  else
617
  return;
618
  }
619
 
620
- protected function _getStores($key)
621
- {
622
- $stores = Mage::app()->getStores();
623
- $store_ids = array();
624
- foreach ($stores as $k => $store)
625
- {
626
- $_storeId = $store->getStoreId();
627
- $bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', $_storeId);
628
- if($key == $bskey)
629
- {
630
- //$store_ids[$_storeId] = Mage::getStoreConfig('general/locale/code', $_storeId);
631
- $store_ids[$_storeId] = $store->getCode();
632
- }
633
- }
634
-
635
- /*
636
- $website = Mage::app()->getWebsite($website_id);
637
- foreach ($website->getGroups() as $group)
638
- {
639
- $stores = $group->getStores();
640
- foreach ($stores as $store)
641
- {
642
- if($store->getIsActive())
643
- $store_ids[Mage::getStoreConfig('general/locale/code', $store->getId())] = $store->getId();
644
- }
645
- }
646
- */
647
- return $store_ids;
648
- }
649
-
650
- protected function _getCurrencies($key)
651
- {
652
- $stores = Mage::app()->getStores();
653
- $currencies_ids = array();
654
- foreach ($stores as $k => $store)
655
- {
656
- $_storeId = $store->getStoreId();
657
- $bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', $_storeId);
658
- if($key == $bskey)
659
- {
660
-
661
- $currencies_ids[$_storeId] = Mage::app()->getStore($_storeId)->getCurrentCurrencyCode();
662
- }
663
- }
664
- return $currencies_ids;
665
- }
666
-
667
- protected function _getBundlePrice($_product, $return_type, $tax)
668
  {
669
  return Mage::getModel('bundle/product_price')->getTotalPrices($_product, $return_type, $tax);
670
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
  }
20
  * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
  *
22
  * Please do not hesitate to contact us at info@brainsins.com
23
+ */
24
 
25
  /**
26
  * ID BRAINSINS PAGE
35
 
36
  class Brainsins_Recommender_Helper_Data extends Mage_Core_Helper_Abstract
37
  {
38
+ protected static $_api_url = 'http://durotar-api.brainsins.com/RecSinsAPI/api/';
39
+ protected static $_pages = 'home,product,category,cart,checkout'; //-->Not needed yet
40
+
41
  public static function getApiUrl() {
42
  $apiMode = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_advanced/api_mode', Mage::app()->getStore()->getStoreId());
43
  if ($apiMode == "1") {
44
  return 'http://api.brainsins.com/RecSinsAPI/api/';
45
  } else {
46
+ return 'http://durotar-api.brainsins.com/RecSinsAPI/api/';
47
  }
48
+
49
  }
50
+
51
  public function getRecommenders($page)
52
  {
53
  $recommenders = array();
59
  return array('value' => '', 'label' => $msg_not_available);
60
 
61
  $response = @file_get_contents(self::getApiUrl()."recommender/retrieve.xml?token=".$bskey);
62
+
63
  if ($response !== false)
64
  {
65
  $xmlData = simplexml_load_string($response);
74
  }
75
  else
76
  $recommenders[0] = array('value' => '', 'label' => $msg_not_available);
77
+
78
  return $recommenders;
79
  }
80
 
81
  public function getPositions($page)
82
  {
83
  $positions = array();
84
+ $positions[] = array('value' => '', 'label' => Mage::helper('brainsins_recommender')->__('--- Recommender position ---'));
85
 
86
  switch ($page) {
87
  case '1':
88
  $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
89
  $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
90
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
91
+ $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
92
+ $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
93
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
94
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
95
  $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
96
+ $positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('--- Other positions ---'));
97
  $positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
98
  $positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
99
  $positions[] = array('value' => 'cart_sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Cart sidebar'));
100
+ $positions[] = array('value' => 'catalog.compare.sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Product compare sidebar'));
101
+ $positions[] = array('value' => 'left.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Left column recently viewed'));
102
+ $positions[] = array('value' => 'right.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Right column recently viewed'));
103
  break;
104
  case '2':
105
+ $positions[] = array('value' => 'product.info', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
106
+ $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
107
+ $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
108
+ $positions[] = array('value' => 'description', 'label' => Mage::helper('brainsins_recommender')->__('Product description'));
109
+ $positions[] = array('value' => 'additional', 'label' => Mage::helper('brainsins_recommender')->__('Product attributes'));
110
  $positions[] = array('value' => 'product_options', 'label' => Mage::helper('brainsins_recommender')->__('Product options'));
111
  $positions[] = array('value' => 'prices', 'label' => Mage::helper('brainsins_recommender')->__('Product prices'));
112
+ $positions[] = array('value' => 'product_additional_data', 'label' => Mage::helper('brainsins_recommender')->__('Product additional information'));
113
+ $positions[] = array('value' => 'upsell_products', 'label' => Mage::helper('brainsins_recommender')->__('Upsell products'));
114
  $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
115
+ $positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
116
+ $positions[] = array('value' => 'catalog.product.related', 'label' => Mage::helper('brainsins_recommender')->__('Related products'));
117
+ $positions[] = array('value' => 'media', 'label' => Mage::helper('brainsins_recommender')->__('Product media gallery'));
118
+ $positions[] = array('value' => 'product_tag_list', 'label' => Mage::helper('brainsins_recommender')->__('Product tag list'));
119
+ $positions[] = array('value' => 'extrahint', 'label' => Mage::helper('brainsins_recommender')->__('Product extra hint'));
120
+ $positions[] = array('value' => 'product.info.addtocart', 'label' => Mage::helper('brainsins_recommender')->__('Product add to cart'));
121
+ $positions[] = array('value' => 'product.info.addto', 'label' => Mage::helper('brainsins_recommender')->__('Product other "add to" options'));
122
+ $positions[] = array('value' => 'cart_sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Cart sidebar'));
123
+ $positions[] = array('value' => 'catalog.compare.sidebar', 'label' => Mage::helper('brainsins_recommender')->__('Product compare sidebar'));
124
+ $positions[] = array('value' => 'left.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Left column recently viewed'));
125
+ $positions[] = array('value' => 'right.reports.product.viewed', 'label' => Mage::helper('brainsins_recommender')->__('Right column recently viewed'));
126
  $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
127
  $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
128
  $positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
129
  $positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
130
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
131
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
132
+ break;
133
  case '3':
134
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
135
  $positions[] = array('value' => 'crosssell', 'label' => Mage::helper('brainsins_recommender')->__('Cross sell area'));
145
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
146
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
147
  break;
148
+ /*
149
+ case '4':
150
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
151
+ $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
152
+ $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
153
  $positions[] = array('value' => 'checkout.progress', 'label' => Mage::helper('brainsins_recommender')->__('Checkout progress'));
154
  $positions[] = array('value' => 'login', 'label' => Mage::helper('brainsins_recommender')->__('Login'));
155
  $positions[] = array('value' => 'billing', 'label' => Mage::helper('brainsins_recommender')->__('Billing information'));
170
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
171
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
172
  break;
173
+ */
174
+ case '4':
175
+ $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
176
+ $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
177
+ $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
178
+ $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
179
+ $positions[] = array('value' => '-', 'label' => Mage::helper('brainsins_recommender')->__('------------- Other positions -------------'));
180
+ $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
181
+ $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
182
+ $positions[] = array('value' => 'catalog.topnav', 'label' => Mage::helper('brainsins_recommender')->__('Navigation bar'));
183
+ $positions[] = array('value' => 'breadcrumbs', 'label' => Mage::helper('brainsins_recommender')->__('Breadcrumb'));
184
+ $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
185
+ $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
186
+ break;
187
  case '7':
188
  $positions[] = array('value' => 'after_body_start', 'label' => Mage::helper('brainsins_recommender')->__('Top'));
189
  $positions[] = array('value' => 'header', 'label' => Mage::helper('brainsins_recommender')->__('Header'));
190
  $positions[] = array('value' => 'content', 'label' => Mage::helper('brainsins_recommender')->__('Main content'));
191
  $positions[] = array('value' => 'product_list', 'label' => Mage::helper('brainsins_recommender')->__('Product list'));
192
+ $positions[] = array('value' => 'right', 'label' => Mage::helper('brainsins_recommender')->__('Right column'));
193
+ $positions[] = array('value' => 'left', 'label' => Mage::helper('brainsins_recommender')->__('Left column'));
194
  $positions[] = array('value' => 'footer', 'label' => Mage::helper('brainsins_recommender')->__('Footer'));
195
  $positions[] = array('value' => 'before_body_end', 'label' => Mage::helper('brainsins_recommender')->__('Bottom'));
196
  $positions[] = array('value' => 'custom', 'label' => Mage::helper('brainsins_recommender')->__('Custom position'));
206
  return $positions;
207
  }
208
 
209
+ public function getConfiguration($page, $store = null)
210
+ {
211
+ if($store == null)
212
+ $store = Mage::app()->getStore()->getStoreId();
213
+ $jSonRecommendersConfig = '';
214
+ $config = array();
215
+ if($page == 'all')
216
+ {
217
+ $pages = explode(',', self::$_pages);
218
+ foreach ($pages as $key => $_page)
219
+ {
220
+ $jSonRecommendersConfig = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_recommenders_'.$_page.'/recommenders_'.$_page, $store);
221
+ $arrayDatas = unserialize($jSonRecommendersConfig);
222
+ foreach ($arrayDatas as $key => $arrayData) {
223
+ foreach ($arrayData as $key => $data) {
224
+ $config[$key][] = $data;
225
+ }
226
+ }
227
+ }
228
+ }
229
  else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  {
231
+ $jSonRecommendersConfig = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_recommenders_'.$page.'/recommenders_'.$page, $store);
232
+ $arrayDatas = unserialize($jSonRecommendersConfig);
233
+ $config = array();
234
+ foreach ($arrayDatas as $key => $arrayData) {
235
+ foreach ($arrayData as $key => $data) {
236
+ $config[$key][] = $data;
237
+ }
238
+ }
239
+ }
240
+
241
+ return $this->_cleanEmpties($config);
242
+ }
243
+
244
+ public function getRecommendersJs($recommenders)
245
+ {
246
+ $recommenders_js = '';
247
+ if($recommenders && count($recommenders) > 0)
248
+ {
249
+ $recommenders_js .= ',
250
+ recommenders: [';
251
  foreach ($recommenders as $key => $_value)
252
  {
253
+ if($_value[0] == '' || !is_numeric($_value[0]))
254
  continue;
255
  if($_value[4] != '')
256
  {
262
  $_position = 'replace';
263
  }
264
  $recommenders_js .= "
265
+ {
266
+ recommenderId: ".$_value[0].",
267
+ detailsLevel : 'high',
268
  location: '".$_location."',
269
+ position: '".$_position."'
270
+ },
271
+ ";
272
  }
273
+ $recommenders_js .= ']';
274
  }
275
+ return $recommenders_js;
276
+ }
277
+
278
+ protected function _cleanEmpties($data)
279
+ {
280
+ $cleanedData = array();
281
  foreach ($data as $key => $value) {
282
  if($value[0] == '')
283
  continue;
285
  $cleanedData[] = $value;
286
  }
287
 
288
+ return array_map('unserialize', array_unique(array_map('serialize', $cleanedData)));
289
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
 
291
+ public function getProductsFeed($key = '')
292
+ {
 
293
 
294
+ try {
295
+
296
+ if($key == '')
297
+ $key = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key');
298
+ $include_oos_products = Mage::getStoreConfig('brainsins_recommender_options/product_feed/include_oos_products', Mage::app()->getStore()->getStoreId());
299
+ $tax_included = Mage::getStoreConfig('brainsins_recommender_options/product_feed/tax_included', Mage::app()->getStore()->getStoreId());
300
+ $special_price = Mage::getStoreConfig('brainsins_recommender_options/product_feed/special_price', Mage::app()->getStore()->getStoreId());
301
+ $desc_attribute = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_description_attribute', Mage::app()->getStore()->getStoreId());
302
+
303
+ $pDomBrain = new DOMDocument('1.0','UTF-8');
304
+ $pDomBrain->formatOutput = true;
305
+ $pDomBrain->xmlStandalone = true;
306
+
307
+ $pRecsins = $pDomBrain->createElement('recsins');
308
+ $pRecsins->setAttribute('version', '0.1');
309
+ $pDomBrain->appendChild($pRecsins);
310
+
311
+ $pEntities = $pDomBrain->createElement('entities');
312
+ $pRecsins->appendChild($pEntities);
313
+
314
+ $rows = 0;
315
+
316
+ $languages = $this->getStores($key);
317
+ $currencies = $this->getCurrencies($key);
318
+ // $products = Mage::getResourceModel('catalog/product_collection')
319
+ // ->getCollection()
320
+ // ->addAttributeToSelect('entity_id')
321
+ // ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
322
+ // ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
323
+ // ->addAttributeToSort('entity_id','asc'); //Tablas EAV
324
+ $products = Mage::getModel('catalog/product')
325
+ ->getCollection()
326
+ ->addAttributeToSelect('entity_id')
327
+ ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
328
+ ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
329
+ ->addAttributeToSort('entity_id','asc'); //Tablas flat
330
+
331
+ if(!$desc_attribute || $desc_attribute == '')
332
+ $desc_attribute = 'description';
333
+
334
+ foreach ($products as $key => $entity)
335
  {
336
+ try {
337
+ $product = Mage::getModel('catalog/product')->load($entity->getId());
338
+ if(Mage::app()->getRequest()->getControllerName() != 'feeds')
339
+ {
340
+ $offline_stock_status = Mage::getModel('cataloginventory/stock_item') ->loadByProduct($product)->getIsInStock();
341
+ if($include_oos_products == '0' && $offline_stock_status == '0')
342
+ continue;
343
+ }
344
+ else
345
+ {
346
+ if($include_oos_products == '0' && !$product->isSaleable())
347
+ continue;
348
+ }
349
+ $pEntity = $pDomBrain->createElement('entity');
350
+ $pEntity->setAttribute('name', 'product');
351
+ $pEntities->appendChild($pEntity);
352
+
353
+ $pIDProd = $pDomBrain->createElement('property');
354
+ $pIDProd->setAttribute('name', 'idProduct');
355
+ $cdata = $pDomBrain->createTextNode($product->getId());
356
+ $pIDProd->appendChild($cdata);
357
+ $pEntity->appendChild($pIDProd);
358
+
359
+ $pMPName = $pDomBrain->createElement('multi_property');
360
+ $pMPName->setAttribute('name', 'name');
361
+
362
+ $pMPDesc = $pDomBrain->createElement('multi_property');
363
+ $pMPDesc->setAttribute('name', 'description');
364
+
365
+ $pMPUrl = $pDomBrain->createElement('multi_property');
366
+ $pMPUrl->setAttribute('name', 'url');
367
+
368
+ foreach ($languages as $store_id => $lang_code) {
369
+ $product_lang = Mage::getModel('catalog/product')
370
+ ->setStoreId($store_id)
371
+ ->load($product->getId());
372
+ //$lang_code = explode('_', $lang_code);
373
+ $pLangName = $pDomBrain->createElement('property');
374
+ $pLangName->setAttribute('lang', $lang_code);
375
+ $cdata = $pDomBrain->createCDATASection($product_lang->getName());
376
+ $pLangName->appendChild($cdata);
377
+ $pMPName->appendChild($pLangName);
378
+
379
+ $pLangDesc = $pDomBrain->createElement('property');
380
+ $pLangDesc->setAttribute('lang', $lang_code);
381
+ $cdata = $pDomBrain->createCDATASection(Mage::getResourceModel('catalog/product')
382
+ ->getAttributeRawValue($product_lang->getId(), $desc_attribute, $store_id));
383
+ $pLangDesc->appendChild($cdata);
384
+ $pMPDesc->appendChild($pLangDesc);
385
+
386
+ $pLangLink = $pDomBrain->createElement('property');
387
+ $pLangLink->setAttribute('lang', $lang_code);
388
+ $product_link = preg_replace("/[\?&]?___store=[^\?&]*/", "", $product_lang->getProductUrl());
389
+ $cdata = $pDomBrain->createCDATASection($product_link);
390
+ $pLangLink->appendChild($cdata);
391
+ $pMPUrl->appendChild($pLangLink);
392
+ }
393
+ $pEntity->appendChild($pMPName);
394
+ $pEntity->appendChild($pMPDesc);
395
+ $pEntity->appendChild($pMPUrl);
396
+
397
+ $pPrice = $pDomBrain->createElement('property');
398
+ $pPrice->setAttribute('name', 'price');
399
+
400
+ if($tax_included == '1' && $special_price == '1')
401
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, false);
402
+ elseif($tax_included == '1' && $special_price == '0')
403
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, false);
404
+ if($tax_included == '0' && $special_price == '1')
405
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, true);
406
+ elseif($tax_included == '0' && $special_price == '0')
407
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, true);
408
+
409
+ if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
410
+ {
411
+ if($tax_included == '1' && $special_price == '1')
412
+ $product_price = Mage::helper('tax')->getPrice($product, $this->getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
413
+ elseif($tax_included == '1' && $special_price == '0')
414
+ $product_price = Mage::helper('tax')->getPrice($product, $this->getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
415
+ if($tax_included == '0' && $special_price == '1')
416
+ $product_price = Mage::helper('tax')->getPrice($product, $this->getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
417
+ elseif($tax_included == '0' && $special_price == '0')
418
+ $product_price = Mage::helper('tax')->getPrice($product, $this->getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
419
+ }
420
+
421
+ $cdata = $pDomBrain->createTextNode(number_format($product_price, 2, '.', ''));
422
+ $pPrice->appendChild($cdata);
423
+ $pEntity->appendChild($pPrice);
424
+
425
+ if($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE)
426
+ {
427
+ $product_final_price = $this->getBundlePrice($product, 'min', 1);
428
+ $product_regular_price = $this->getBundlePrice($product, 'min', 1);
429
+ }
430
+ else
431
+ {
432
+ $product_final_price = $product->getFinalPrice();
433
+ $product_regular_price = $product->getPrice();
434
+ }
435
+
436
+ try
437
+ {
438
+ $pMPCur = $pDomBrain->createElement('multi_property');
439
+ $pMPCur->setAttribute('name', 'multiprice');
440
+
441
+ foreach ($currencies as $k => $curr){
442
+ $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
443
+ $targetCurrency = Mage::getModel('directory/currency')->load($curr);
444
+ $pPrice = $pDomBrain->createElement('property');
445
+ $pPrice->setAttribute('currency', $curr);
446
+ $price_converted = number_format(Mage::helper('directory')->currencyConvert($product_final_price, $baseCurrency, $targetCurrency), 2, '.', '');
447
+ $cdata = $pDomBrain->createTextNode($price_converted);
448
+ $pPrice->appendChild($cdata);
449
+ $pMPCur->appendChild($pPrice);
450
+ }
451
+ $pEntity->appendChild($pMPCur);
452
+ unset($targetCurrency);
453
+
454
+ $pOPCur = $pDomBrain->createElement('multi_property');
455
+ $pOPCur->setAttribute('name', 'originalPrice');
456
+
457
+ foreach ($currencies as $k => $curr){
458
+ $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
459
+ $targetCurrency = Mage::getModel('directory/currency')->load($curr);
460
+ $pPrice = $pDomBrain->createElement('property');
461
+ $pPrice->setAttribute('currency', $curr);
462
+ $price_converted = number_format(Mage::helper('directory')->currencyConvert($product_regular_price, $baseCurrency, $targetCurrency), 2, '.', '');
463
+ $cdata = $pDomBrain->createTextNode($price_converted);
464
+ $pPrice->appendChild($cdata);
465
+ $pOPCur->appendChild($pPrice);
466
+ }
467
+ $pEntity->appendChild($pOPCur);
468
+ unset($targetCurrency);
469
+ }
470
+ catch(Exception $e)
471
+ {
472
+ Mage::throwException(Mage::helper('brainsins_recommender')->__('ERROR IN CURRENCY CONVERT. ALL CURRENCY RATES ARE DEFINED?'));
473
+ }
474
+
475
+ $imageUrl = null;
476
+
477
+ $image_width = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_width', Mage::app()->getStore()->getStoreId());
478
+ $image_height = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_height', Mage::app()->getStore()->getStoreId());
479
+
480
+ if (!$image_width || $image_width == "" || $image_width == "0" || !is_numeric($image_width)) {
481
+ $image_width = null;
482
+ }
483
+
484
+ if (!$image_height || $image_height == "" || $image_height == "0" || !is_numeric($image_height)) {
485
+ $image_height = null;
486
+ }
487
+
488
+
489
+ if (!$image_width && !$image_height) {
490
+ $imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
491
+ } else {
492
+ $imageUrl = (string) Mage::helper('catalog/image')->init($product, "image")->resize($image_width, $image_height);
493
+ }
494
+
495
+ // $url = (string) Mage::helper('catalog/image')->init($product, "small_image")->resize($width, $height);
496
+
497
+
498
+
499
+ //$imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
500
+ $pImage = $pDomBrain->createElement('property');
501
+ $pImage->setAttribute('name', 'imageUrl');
502
+ $cdata = $pDomBrain->createCDATASection($imageUrl);
503
+ $pImage->appendChild($cdata);
504
+ $pEntity->appendChild($pImage);
505
+
506
+ $pCategory = $pDomBrain->createElement('property');
507
+ $pCategory->setAttribute('name', 'categories');
508
+ $cdata = $pDomBrain->createTextNode(implode(",", $product->getCategoryIds()));
509
+ $pCategory->appendChild($cdata);
510
+ $pEntity->appendChild($pCategory);
511
+
512
+ $rows++;
513
+ $image = null;
514
+ unset($image);
515
+
516
+ $imageObj = null;
517
+ unset($imageObj);
518
+
519
+ unset($product);
520
+ } catch (Exception $e2) {
521
+ $pEntity = $pDomBrain->createElement('entity-error');
522
+ $pEntity->setAttribute('name', 'product-error');
523
+ $pEntities->appendChild($pEntity);
524
+ }
525
  }
526
+ $feed = $pDomBrain->saveXML();
527
+ $products = null;unset($products);unset($pDomBrain);
528
 
529
+ } catch (Exception $e3) {
530
+ return $e3;
531
+ }
532
+
533
+ return $feed;
534
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
 
536
  public function updateCartInBrainsins($cart, $special = false)
537
  {
538
  if (!is_object($cart))
539
  return;
540
 
541
+ $cartId = $cart->getId();
542
+
543
+ if (!$cartId) {
544
+ return;
545
+ }
546
+
547
  $ruta = "order/trackOrder.xml?";
548
  $url = self::getApiUrl().$ruta."token=".Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
549
 
571
  $pOrder->appendChild($pProducts);
572
 
573
  if($special)
574
+ $items = $cart->getAllVisibleItems();
575
  else
576
  $items = $cart->getItems();
577
+
578
+ $cartItems = Array();
579
+
580
+ foreach($items as $item) {
581
 
582
+ $cartItem = Array();
583
+
584
+ $price = $item->getPriceInclTax();
585
+
586
+ if ($item->getParentItem()) {
587
+ $item = $item->getParentItem();
588
+ }
589
+
590
+ $id = $item->getProductId();
591
+
592
+ // if ($item->getParentItemId() && $item->getParentItemId() != "") {
593
+ // //Mage::log($item->getProduct()->getSuperProduct()->getId());
594
+ // $id = $item->getParentItem()->getProductId();
595
+ // }
596
+
597
+ $qty = $item->getQty();
598
+
599
+ //get parent if exists -> ensure not single products that belong to configurable exist
600
+ $configurable_product_model = Mage::getModel('catalog/product_type_configurable');
601
+ $parentIdArray = $configurable_product_model->getParentIdsByChild($id);
602
+
603
+
604
+ if (count($parentIdArray) > 0) {
605
+ $id = $parentIdArray[0];
606
+ }
607
 
608
+
609
+ // Mage::log("-----");
610
+ // Mage::log($item->getProductId());
611
+ // Mage::log("type : " . $item->getProductType());
612
+ // Mage::log($item->getProduct()->getName());
613
+ // Mage::log("parent : " . ($item->getParentItem() ? $item->getParentItem()->getProductId() : "-"));
614
+ // Mage::log("qty is " . $qty);
615
+ // Mage::log("-----");
616
+
617
+ $cartItem["id"] = $id;
618
+ $cartItem["qty"] = $qty;
619
+ $cartItem["price"] = $price;
620
+
621
+ $cartItems[] = $cartItem;
622
+
623
+ //if (array_key_exists($id, $cartItems)) {
624
+ // $cartItems[$id] = $cartItems[$id] + $qty;
625
+ //} else {
626
+ // $cartItems[$id] = $qty;
627
+ //}
628
+ }
629
+
630
+ //Mage::log($cartItems);
631
+
632
+ foreach ($cartItems as $cartItem) {
633
+ $pProduct = $cartXML->createElement('product');
634
+
635
+ $pIdProduct = $cartXML->createElement('idProduct', $cartItem["id"]);
636
  $pProduct->appendChild($pIdProduct);
637
 
638
+ $pPrice = $cartXML->createElement('price', number_format($cartItem["price"], 2, '.', ''));
639
+ $pProduct->appendChild($pPrice);
640
 
641
+ $pQuantity = $cartXML->createElement('quantity', $cartItem["qty"]);
642
  $pProduct->appendChild($pQuantity);
643
 
644
  $pProducts->appendChild($pProduct);
645
+ $cartId .= ":".$id.":".$qty;
646
+ }
647
+
648
+
649
+
650
+ $lastTrackedCart = Mage::getSingleton('core/session')->getBrainsinsLastCartTracked();
651
+ // Mage::log($cartId);
652
+ if ($cartId == $lastTrackedCart) {
653
+ return;
654
+ } else {
655
+ Mage::getSingleton('core/session')->setBrainsinsLastCartTracked($cartId);
656
  }
657
 
658
  $content = $cartXML->saveXML($cartXML->documentElement);
659
+ // Mage::log($content);
660
+ $result = $this->_sendBrainsinsWS($url, $content);
661
+ // Mage::log($result);
662
+ return $result;
663
  }
664
 
665
+ public function onEndCheckout($order) {
666
+ $idsMultipleArray = Mage::getSingleton('core/session')->getOrderIds(true);
667
+ $firstElement = true;
668
+ $total = 0;
669
+
670
+ $ruta = "purchase/close?";
671
+ $url = self::getApiUrl().$ruta."token=".Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
672
+
673
+ if ($idsMultipleArray && is_array($idsMultipleArray)) {
674
+ foreach ($idsMultipleArray as $id) {
675
+ $order = Mage::getModel('sales/order')->loadByIncrementId($id);
676
+ $total += $order->getBaseSubtotalInclTax();
677
+ }
678
+ } else {
679
+ $total = $order->getBaseSubtotalInclTax();
680
+ }
681
+
682
+ $email = $order->getCustomerEmail();
683
+ $url .= "&email=$email&amount=$total";
684
+
685
+ if (array_key_exists("bsCoId", $_COOKIE)) {
686
+ $coId = $_COOKIE['bsCoId'];
687
+ if ($coId) {
688
+ $url .= "&cookieId=$coId";
689
+ }
690
+ }
691
+
692
+ $result = $this->_sendBrainsinsWS($url);
693
+
694
+ return $result;
695
+ }
696
+
697
+ public function onPayment($order) {
698
+ $idsMultipleArray = Mage::getSingleton('core/session')->getOrderIds(true);
699
+ $firstElement = true;
700
+ $total = 0;
701
+
702
+ $ruta = "purchase/payment.json?";
703
+ $url = self::getApiUrl().$ruta."token=".Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
704
+
705
+ if ($idsMultipleArray && is_array($idsMultipleArray)) {
706
+ foreach ($idsMultipleArray as $id) {
707
+ $order = Mage::getModel('sales/order')->loadByIncrementId($id);
708
+ $total += $order->getBaseSubtotalInclTax();
709
+ }
710
+ } else {
711
+ $total = $order->getBaseSubtotalInclTax();
712
+ }
713
+
714
+ $email = $order->getCustomerEmail();
715
+ $url .= "&email=$email&amount=$total";
716
+ $result = $this->_sendBrainsinsWS($url);
717
+
718
+ return $result;
719
+ }
720
+
721
+ protected function _sendBrainsinsWS($url, $content = "", $contentType = "application/xml", $post = true)
722
  {
723
+ // Mage::log(" === WS ==============================");
724
+ // Mage::log("url : " . $url);
725
+ // Mage::log("content : " . $content);
726
+
727
  if(function_exists('curl_init')) {
728
  $ch = curl_init($url);
729
  //$logfh = fopen(dirname(__FILE__) . "/sendBrainsinsWS.log", 'a+');
730
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
731
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
732
+
733
+ if ($post) {
734
+ curl_setopt($ch, CURLOPT_POST, 1);
735
+ }
736
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: ' . $contentType));
737
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
738
  curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
739
  curl_setopt($ch, CURLOPT_VERBOSE, true);
742
  $response = curl_exec($ch);
743
  curl_close($ch);
744
  //fclose($logfh);
745
+ // Mage::log($response);
746
  } else {
747
  $opts = array('http' =>
748
+ array(
749
  'method' => 'POST',
750
  'header' => 'Content-type: text/xml',
751
  'content' => $content
752
+ )
753
  );
754
  $context = stream_context_create($opts);
755
  $response = file_get_contents($url, false, $context);
756
  }
757
+
758
  return $response;
759
  }
760
 
761
  protected function _getUser()
762
  {
763
+ if (isset($_COOKIE['bsUl']) && $_COOKIE['bsUl'] == 1)
764
+ return $_COOKIE['bsUId'];
765
+ elseif (isset($_COOKIE['bsUl']) && $_COOKIE['bsUl'] == 0)
766
+ return $_COOKIE['bsCoId'];
767
  else
768
  return;
769
  }
770
 
771
+ public function getStores($key)
772
+ {
773
+ $stores = Mage::app()->getStores();
774
+ $store_ids = array();
775
+ foreach ($stores as $k => $store)
776
+ {
777
+ $_storeId = $store->getStoreId();
778
+ $bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', $_storeId);
779
+ if($key == $bskey)
780
+ {
781
+ //$store_ids[$_storeId] = Mage::getStoreConfig('general/locale/code', $_storeId);
782
+ $store_ids[$_storeId] = $store->getCode();
783
+ }
784
+ }
785
+
786
+ /*
787
+ $website = Mage::app()->getWebsite($website_id);
788
+ foreach ($website->getGroups() as $group)
789
+ {
790
+ $stores = $group->getStores();
791
+ foreach ($stores as $store)
792
+ {
793
+ if($store->getIsActive())
794
+ $store_ids[Mage::getStoreConfig('general/locale/code', $store->getId())] = $store->getId();
795
+ }
796
+ }
797
+ */
798
+ return $store_ids;
799
+ }
800
+
801
+ protected function getCurrencies($key)
802
+ {
803
+ $stores = Mage::app()->getStores();
804
+ $currencies_ids = array();
805
+ foreach ($stores as $k => $store)
806
+ {
807
+ $_storeId = $store->getStoreId();
808
+ $bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', $_storeId);
809
+ if($key == $bskey)
810
+ {
811
+
812
+ $currencies_ids[$_storeId] = Mage::app()->getStore($_storeId)->getCurrentCurrencyCode();
813
+ }
814
+ }
815
+ return $currencies_ids;
816
+ }
817
+
818
+ public function getBundlePrice($_product, $return_type, $tax)
819
  {
820
  return Mage::getModel('bundle/product_price')->getTotalPrices($_product, $return_type, $tax);
821
  }
822
+
823
+ public function getProductImage($product, $width = false, $height = false) {
824
+ $imageUrl = null;
825
+ $image_width = null;
826
+ $image_height = null;
827
+
828
+ if (!$width) {
829
+ $image_width = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_width', Mage::app()->getStore()->getStoreId());
830
+ } else {
831
+ $image_width = $width;
832
+ }
833
+
834
+ if (!$height) {
835
+ $image_height = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_height', Mage::app()->getStore()->getStoreId());
836
+ } else {
837
+ $image_height = $height;
838
+ }
839
+
840
+ if (!$image_width || $image_width == "" || $image_width == "0" || !is_numeric($image_width)) {
841
+ $image_width = null;
842
+ }
843
+
844
+ if (!$image_height || $image_height == "" || $image_height == "0" || !is_numeric($image_height)) {
845
+ $image_height = null;
846
+ }
847
+
848
+
849
+ if (!$image_width && !$image_height) {
850
+ $imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
851
+ } else {
852
+ $imageUrl = (string) Mage::helper('catalog/image')->init($product, "image")->resize($image_width, $image_height);
853
+ }
854
+
855
+ return $imageUrl;
856
+ }
857
+
858
+
859
  }
app/code/community/Brainsins/Recommender/Helper/sendBrainsinsWS.log CHANGED
@@ -1,19 +1 @@
1
- <recsins version="0.1"><orders><order><idBuyer>2000000000009</idBuyer><idCurrency>EUR</idCurrency><products><product><idProduct>134</idProduct><price>17.55</price><quantity>1</quantity></product></products></order></orders></recsins>* About to connect() to api.brainsins.com port 80 (#0)
2
- * Trying 46.137.183.197... * connected
3
- * Connected to api.brainsins.com (46.137.183.197) port 80 (#0)
4
- > POST /RecSinsAPI/api/order/trackOrder.xml?token=BS-0887432703-1 HTTP/1.1
5
- Host: api.brainsins.com
6
- Accept: */*
7
- Content-Type: application/xml
8
- Content-Length: 233
9
-
10
- < HTTP/1.1 200 OK
11
- < Content-Type: application/xml
12
- < Date: Thu, 03 Apr 2014 14:22:36 GMT
13
- < Server: GlassFish Server Open Source Edition 3.1.1
14
- < X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.1 Java/Sun Microsystems Inc./1.6)
15
- < Content-Length: 129
16
- < Connection: keep-alive
17
- <
18
- * Connection #0 to host api.brainsins.com left intact
19
- * Closing connection #0
1
+ <recsins version="0.1"><orders><order><idBuyer>1000000000042</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>163</idProduct><quantity>2</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>1000000000042</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>163</idProduct><price>2748.98</price><quantity>1</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>1000000000042</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>163</idProduct><price>2748.98</price><quantity>1</quantity></product><product><idProduct>108</idProduct><price>89.99</price><quantity>1</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>1000000000042</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>163</idProduct><price>2748.98</price><quantity>1</quantity></product><product><idProduct>108</idProduct><price>89.99</price><quantity>1</quantity></product><product><idProduct>108</idProduct><price>89.99</price><quantity>1</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>1000000000042</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>163</idProduct><price>2748.98</price><quantity>1</quantity></product><product><idProduct>108</idProduct><price>89.99</price><quantity>2</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>1000000000042</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>163</idProduct><price>2748.98</price><quantity>1</quantity></product><product><idProduct>108</idProduct><price>89.99</price><quantity>2</quantity></product><product><idProduct>108</idProduct><price>89.99</price><quantity>1</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>2000000000000</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>119</idProduct><price>15.00</price><quantity>2</quantity></product><product><idProduct>46</idProduct><price>161.94</price><quantity>2</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>2000000000000</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>108</idProduct><price>89.99</price><quantity>1</quantity></product><product><idProduct>108</idProduct><price>0.00</price><quantity>1</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>2000000000000</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>108</idProduct><price>89.99</price><quantity>1</quantity></product></products></order></orders></recsins><recsins version="0.1"><orders><order><idBuyer>2000000000000</idBuyer><idCurrency>USD</idCurrency><products><product><idProduct>119</idProduct><price>15.00</price><quantity>2</quantity></product><product><idProduct>46</idProduct><price>161.94</price><quantity>2</quantity></product><product><idProduct>108</idProduct><price>89.99</price><quantity>1</quantity></product></products></order></orders></recsins>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Brainsins/Recommender/Model/Adminhtml/System/Config/Source/{ApiMode.php → Apimode.php} RENAMED
File without changes
app/code/community/Brainsins/Recommender/Model/Brainsins.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ */
24
+
25
+ class Brainsins_Recommender_Model_Brainsins extends Mage_Core_Model_Abstract
26
+ {
27
+
28
+ }
app/code/community/Brainsins/Recommender/Model/Cron.php CHANGED
@@ -40,15 +40,15 @@ class Brainsins_Recommender_Model_Cron
40
 
41
  protected function _productsFeed($bskey)
42
  {
43
- $feed = Mage::helper('brainsins_recommender')->getProductsFeed($bskey);
44
- $io = new Varien_Io_File();
45
- $path = Mage::getBaseDir('media') . DS . 'brainsins_feeds' . DS;
46
- $file = $path . DS . $bskey . '.xml';
47
- $io->setAllowCreateFolders(true);
48
- $io->open(array('path' => $path));
49
- $io->streamOpen($file, 'w+');
50
- $io->streamLock(true);
51
- $io->streamWrite($feed);
52
- $io->streamClose();
53
  }
54
  }
40
 
41
  protected function _productsFeed($bskey)
42
  {
43
+ // $feed = Mage::helper('brainsins_recommender')->getProductsFeed($bskey);
44
+ // $io = new Varien_Io_File();
45
+ // $path = Mage::getBaseDir('media') . DS . 'brainsins_feeds' . DS;
46
+ // $file = $path . DS . $bskey . '.xml';
47
+ // $io->setAllowCreateFolders(true);
48
+ // $io->open(array('path' => $path));
49
+ // $io->streamOpen($file, 'w+');
50
+ // $io->streamLock(true);
51
+ // $io->streamWrite($feed);
52
+ // $io->streamClose();
53
  }
54
  }
app/code/community/Brainsins/Recommender/Model/Observer.php CHANGED
@@ -42,64 +42,52 @@ class Brainsins_Recommender_Model_Observer extends Mage_Core_Model_Abstract
42
  }
43
  public function insertBlock($observer)
44
  {
45
- if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()))
46
- return;
47
 
48
- $_recommenders = array();
49
- $_alias = $observer->getBlock()->getBlockAlias();
50
 
51
- //HOME PAGE RECOMMENDERS
52
- if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'index/index')
53
- $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('home', Mage::app()->getStore()->getStoreId());
54
 
55
- //PRODUCT PAGE RECOMMENDERS
56
- if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'product/view')
57
- $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('product', Mage::app()->getStore()->getStoreId());
58
 
59
- //CATEGORY PAGE RECOMMENDERS
60
- if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'category/view')
61
- $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('category', Mage::app()->getStore()->getStoreId());
62
-
63
- //CART PAGE RECOMMENDERS
64
- if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'cart/index')
65
- $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('cart', Mage::app()->getStore()->getStoreId());
66
 
67
- //THANK YOU PAGE RECOMMENDERS
68
- if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'onepage/success')
69
- $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('checkout', Mage::app()->getStore()->getStoreId());
70
 
71
- foreach ($_recommenders as $key => $_value)
72
- {
73
- if ($_alias == $_value[2] && $_value[2] != '')
74
- {
75
- $_before = '';
76
- $_after = '';
77
- $_recommender = $_value[0];
78
- $_position = $_value[1];
79
- $_block = $_value[2];
80
- $_custom_div_position = $_value[3];
81
- $_custom_div = $_value[4];
82
- $_content = $observer->getTransport()->getHtml();
83
- if($_position == 'before')
84
- {
85
- $_before = $this->_getBrainsinsRecommenderHtml($_recommender);
86
- $observer->getTransport()->setHtml($_before.$_content);
87
- }
88
- elseif($_position == 'after')
89
- {
90
- $_after = $this->_getBrainsinsRecommenderHtml($_recommender);
91
- $observer->getTransport()->setHtml($_content.$_after);
92
- }
93
- }
94
- }
95
- }
96
 
97
- public function onCartUpdate($observer)
98
- {
99
- if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
100
- return;
101
- Mage::helper('brainsins_recommender')->updateCartInBrainsins($observer->getCart());
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  public function updateCart($observer)
105
  {
@@ -114,7 +102,7 @@ class Brainsins_Recommender_Model_Observer extends Mage_Core_Model_Abstract
114
  return;
115
  $customer = $observer->getCustomer();
116
  if (!$observer->getCustomer()->getOrigData()) {
117
- Mage::getSingleton('core/cookie')->set('brainsins_register', $customer->getId(), time()+86400, '/');
118
  }
119
  }
120
 
@@ -123,7 +111,8 @@ class Brainsins_Recommender_Model_Observer extends Mage_Core_Model_Abstract
123
  if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
124
  return;
125
  $customer = $observer->getCustomer();
126
- Mage::getSingleton('core/cookie')->set('brainsins_login', $customer->getId(), time()+86400, '/');
 
127
  }
128
 
129
  public function customerLogout($observer)
@@ -131,7 +120,7 @@ class Brainsins_Recommender_Model_Observer extends Mage_Core_Model_Abstract
131
  if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
132
  return;
133
  $customer = $observer->getCustomer();
134
- Mage::getSingleton('core/cookie')->set('brainsins_logout', $customer->getId(), time()+86400, '/');
135
  }
136
 
137
  public function subscribedToNewsletter($observer)
@@ -143,9 +132,27 @@ class Brainsins_Recommender_Model_Observer extends Mage_Core_Model_Abstract
143
  $statusChange = $subscriber->getIsStatusChanged();
144
  if ($statusChange)
145
  {
146
- Mage::getSingleton('core/cookie')->set('brainsins_news', $subscriber->getCustomerId(), time()+86400, '/');
147
  }
148
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  protected function _isApiRequest()
151
  {
42
  }
43
  public function insertBlock($observer)
44
  {
45
+ if (!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()))
46
+ return;
47
 
48
+ $_recommenders = array();
49
+ $_alias = $observer->getBlock()->getBlockAlias();
50
 
51
+ //HOME PAGE RECOMMENDERS
52
+ if (Mage::app()->getRequest()->getControllerName() . '/' . Mage::app()->getRequest()->getActionName() == 'index/index')
53
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('home', Mage::app()->getStore()->getStoreId());
54
 
55
+ //PRODUCT PAGE RECOMMENDERS
56
+ if (Mage::app()->getRequest()->getControllerName() . '/' . Mage::app()->getRequest()->getActionName() == 'product/view')
57
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('product', Mage::app()->getStore()->getStoreId());
58
 
59
+ //CATEGORY PAGE RECOMMENDERS
60
+ if (Mage::app()->getRequest()->getControllerName() . '/' . Mage::app()->getRequest()->getActionName() == 'category/view')
61
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('category', Mage::app()->getStore()->getStoreId());
 
 
 
 
62
 
63
+ //CART PAGE RECOMMENDERS
64
+ if (Mage::app()->getRequest()->getControllerName() . '/' . Mage::app()->getRequest()->getActionName() == 'cart/index')
65
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('cart', Mage::app()->getStore()->getStoreId());
66
 
67
+ //THANK YOU PAGE RECOMMENDERS
68
+ if (Mage::app()->getRequest()->getControllerName() . '/' . Mage::app()->getRequest()->getActionName() == 'onepage/success')
69
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('checkout', Mage::app()->getStore()->getStoreId());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
+ foreach ($_recommenders as $key => $_value) {
72
+ if ($_alias == $_value[2] && $_value[2] != '') {
73
+ $_before = '';
74
+ $_after = '';
75
+ $_recommender = $_value[0];
76
+ $_position = $_value[1];
77
+ $_block = $_value[2];
78
+ $_custom_div_position = $_value[3];
79
+ $_custom_div = $_value[4];
80
+ $_content = $observer->getTransport()->getHtml();
81
+ if ($_position == 'before') {
82
+ $_before = $this->_getBrainsinsRecommenderHtml($_recommender);
83
+ $observer->getTransport()->setHtml($_before . $_content);
84
+ } elseif ($_position == 'after') {
85
+ $_after = $this->_getBrainsinsRecommenderHtml($_recommender);
86
+ $observer->getTransport()->setHtml($_content . $_after);
87
+ }
88
+ }
89
+ }
90
+ }
91
 
92
  public function updateCart($observer)
93
  {
102
  return;
103
  $customer = $observer->getCustomer();
104
  if (!$observer->getCustomer()->getOrigData()) {
105
+ Mage::getSingleton('core/cookie')->set('brainsins_register', $customer->getId(), time()+86400, '/', null, null, false);
106
  }
107
  }
108
 
111
  if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
112
  return;
113
  $customer = $observer->getCustomer();
114
+ Mage::getSingleton('core/cookie')->set('brainsins_login', $customer->getId(), time()+86400, '/', null, null, false);
115
+
116
  }
117
 
118
  public function customerLogout($observer)
120
  if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
121
  return;
122
  $customer = $observer->getCustomer();
123
+ Mage::getSingleton('core/cookie')->set('brainsins_logout', $customer->getId(), time()+86400, '/', null, null, false);
124
  }
125
 
126
  public function subscribedToNewsletter($observer)
132
  $statusChange = $subscriber->getIsStatusChanged();
133
  if ($statusChange)
134
  {
135
+ Mage::getSingleton('core/cookie')->set('brainsins_news', $subscriber->getCustomerId(), time()+86400, '/', null, null, false);
136
  }
137
  }
138
+
139
+ public function onEndCheckout($observer) {
140
+ try {
141
+ if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
142
+ return;
143
+ Mage::helper('brainsins_recommender')->onEndCheckout($observer->getEvent()->getPayment()->getOrder());
144
+ } catch (Exception $e) {
145
+ }
146
+ }
147
+
148
+ public function onPayment($observer) {
149
+ try {
150
+ if(!Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()) || $this->_isApiRequest())
151
+ return;
152
+ Mage::helper('brainsins_recommender')->onPayment($observer->getEvent()->getInvoice()->getOrder());
153
+ } catch (Exception $e) {
154
+ }
155
+ }
156
 
157
  protected function _isApiRequest()
158
  {
app/code/community/Brainsins/Recommender/Model/Recommendation.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Brainsins_Recommender_Model_Recommendation extends Mage_Core_Model_Abstract {
3
+
4
+ private static $_patternRecId = '/idRecommendation=(.*)&/';
5
+ private static $_patternPrevPage = '/idPrevPage=(\d*)/';
6
+
7
+ private $recommended = Array();
8
+
9
+ protected function _construct() {
10
+ parent::_construct();
11
+ $this->_init('brainsins_recommender/recommendation');
12
+
13
+ $key = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
14
+
15
+
16
+ if ($this->dev) {
17
+ $this->server = "dev-api.brainsins.com";
18
+ } else {
19
+ $this->server = "api.brainsins.com";
20
+ }
21
+ }
22
+
23
+ public function getIdRecommendation($id) {
24
+
25
+ if (!array_key_exists($id, $this->recommended)) {
26
+ return "";
27
+ }
28
+
29
+ $url = $this->recommended[$id];
30
+
31
+ $matches = null;
32
+ preg_match(self::$_patternRecId, $url, $matches, PREG_OFFSET_CAPTURE);
33
+ if (count($matches) > 1) {
34
+ $match = $matches[1];
35
+ if (count($match > 0)) {
36
+ return $match[0];
37
+ }
38
+ }
39
+
40
+ return "";
41
+ }
42
+
43
+ public function getPrevPage($id) {
44
+
45
+ if (!array_key_exists($id, $this->recommended)) {
46
+ return "";
47
+ }
48
+
49
+ $url = $this->recommended[$id];
50
+
51
+ $matches = null;
52
+ preg_match(self::$_patternPrevPage, $url, $matches, PREG_OFFSET_CAPTURE);
53
+ if (count($matches) > 1) {
54
+ $match = $matches[1];
55
+ if (count($match > 0)) {
56
+ return $match[0];
57
+ }
58
+ }
59
+
60
+ return "";
61
+ }
62
+
63
+ public function getRequestUrl($recommenderId, $productId, $userId, $lang, $divName, $filterCategories, $filterLevel, $detailsLevel, $maxResults) {
64
+
65
+ $enabled = Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId());
66
+
67
+ if (!$enabled) {
68
+ return "";
69
+ }
70
+
71
+ $_apiMode = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_advanced/api_mode', Mage::app()->getStore()->getStoreId());
72
+
73
+ $key = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
74
+ if (!isset($key) || !$key || $key == '') {
75
+ return "";
76
+ }
77
+
78
+ $url = "http://recommender.brainsins.com/recommender.php";
79
+
80
+ $url .= "?token=" . $key;
81
+ $url .= "&userId=" . $userId;
82
+
83
+ $url .= "&recId=" . $recommenderId;
84
+
85
+ if (isset($productId) && $productId != "") {
86
+ $url .= "&prodId=" . $productId;
87
+ }
88
+
89
+ if (isset($lang) && $lang != "") {
90
+ $url .= "&lang=" . $lang;
91
+ }
92
+
93
+ if ($divName) $url .= "&dN=" . $divName;
94
+ if (isset($filterLevel) && $filterLevel != "" ) {
95
+ $url .= "&filter=" . $filterLevel;
96
+ } else {
97
+ //default is all
98
+ $url .= "&filter=all";
99
+ }
100
+
101
+ if (isset($filterCategories) && $filterCategories != "") {
102
+ $url .= "&cat=" . $filterCategories;
103
+ }
104
+
105
+ if (isset($detailsLevel) && $detailsLevel != "") {
106
+ $url .= "&details=$detailsLevel";
107
+ }
108
+
109
+ if (isset($maxResults) && $maxResults != "") {
110
+ $url .= "&nr=" . $maxResults;
111
+ }
112
+
113
+ return $url;
114
+ }
115
+
116
+ public function requestRecommendations($recommenderId, $productId, $userId, $lang, $divName, $filterCategories, $filterLevel, $detailsLevel, $maxResults) {
117
+
118
+ $key = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId());
119
+
120
+ $url = $this->getRequestUrl($recommenderId, $productId, $userId, $lang, $divName, $filterCategories, $filterLevel, $detailsLevel, $maxResults);
121
+
122
+ $curl = curl_init();
123
+ curl_setopt($curl, CURLOPT_URL, $url);
124
+ $timeout = 2;
125
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
126
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
127
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/plain", "Accept: text/plain"));
128
+ $result = curl_exec($curl);
129
+ curl_close($curl);
130
+
131
+ $productList = array();
132
+
133
+ $json = json_decode($result, true);
134
+
135
+ $data = $json["data"];
136
+ $count = $data['count'];
137
+
138
+ if ($count == "0") {
139
+ return;
140
+ }
141
+
142
+ $list = array();
143
+
144
+ if (is_array($data) && array_key_exists('list', $data)) {
145
+ $list = $data['list'];
146
+ } else if (is_array($json) && array_key_exists('list', $json)) {
147
+ $list = $json['list'];
148
+ }
149
+
150
+ if ($count == "1" && array_key_exists("id", $list)) {
151
+ $aux = $list;
152
+ $list = array();
153
+ $list[] = $aux;
154
+ }
155
+
156
+ $recommendations = array();
157
+ $idRecommendation = null;
158
+ $idPrevPage = null;
159
+
160
+ foreach($list as $item) {
161
+ $id = $item["id"];
162
+ $url = $item["url"];
163
+ $recommendations[] = $id;
164
+ $this->recommended[$id] = $url;
165
+ }
166
+
167
+ $this->__set("filtered", false);
168
+
169
+ if ($count > 0) {
170
+ $algorithm = $list[0]["algorithm"];
171
+ $this->__set("altorithm", $algorithm);
172
+
173
+ if ($filterCategories != null && $filterCategories != "") {
174
+ $categories = $list[0]["categories"];
175
+ if (strpos($categories, $filterCategories) !== false) {
176
+ $this->__set("filtered", true);
177
+ }
178
+ }
179
+ }
180
+
181
+ $this->__set("recommendations", $recommendations);
182
+ $this->__set("idRecommendation", $idRecommendation);
183
+ $this->__set("idPrevPage", $idPrevPage);
184
+
185
+ }
186
+ }
app/code/community/Brainsins/Recommender/controllers/CartController.php CHANGED
@@ -88,9 +88,15 @@ class Brainsins_Recommender_CartController extends Mage_Core_Controller_Front_Ac
88
  $cart->save();
89
  Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
90
 
91
- $this->_redirect('checkout/cart/');
92
  }
93
  }
 
 
 
 
 
 
94
 
95
  protected function _checkIfProductExistsInCart($id_product, $products)
96
  {
@@ -148,4 +154,6 @@ class Brainsins_Recommender_CartController extends Mage_Core_Controller_Front_Ac
148
  }
149
  return false;
150
  }
 
 
151
  }
88
  $cart->save();
89
  Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
90
 
91
+ $this->_redirect('checkout/cart/', array('_query' => $this->getRequest()->getParams()));
92
  }
93
  }
94
+
95
+ public function addAction($product, $qty) {
96
+ $params = $this->getRequest()->getParams();
97
+ $params['form_key'] = Mage::getSingleton('core/session')->getFormKey();
98
+ $this->_redirect('checkout/cart/add', $params);
99
+ }
100
 
101
  protected function _checkIfProductExistsInCart($id_product, $products)
102
  {
154
  }
155
  return false;
156
  }
157
+
158
+
159
  }
app/code/community/Brainsins/Recommender/controllers/FeedsController.php CHANGED
@@ -1,37 +1,390 @@
1
- <?php
2
- /**
3
- * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
- * personalized product recommendations into a Magento Store.
5
- * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
- *
7
- * This file is part of BrainSINS' Magento Extension.
8
- *
9
- * BrainSINS' Magento Extension is free software: you can redistribute it
10
- * and/or modify it under the terms of the GNU General Public License
11
- * as published by the Free Software Foundation, either version 3 of the
12
- * License, or (at your option) any later version.
13
- *
14
- * Foobar is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
- *
22
- * Please do not hesitate to contact us at info@brainsins.com
23
- */
24
-
25
- class Brainsins_Recommender_FeedsController extends Mage_Core_Controller_Front_Action
26
- {
27
- public function productsAction()
28
- {
29
- $key_param = $this->getRequest()->getParam('key');
30
- if(!$key_param || !isset($key_param))
31
- {
32
- echo '[INVALID PARAMETERS]';die;
33
- }
34
- $feed = Mage::helper('brainsins_recommender')->getProductsFeed($key_param);
35
- $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/xml')->setBody($feed);
36
- }
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ */
24
+ error_reporting(E_ALL);
25
+ ini_set('display_errors', 1);
26
+
27
+ class Brainsins_Recommender_FeedsController extends Mage_Core_Controller_Front_Action
28
+ {
29
+ public function productsAction()
30
+ {
31
+ $key_param = $this->getRequest()->getParam('key');
32
+ if (!$key_param || !isset ($key_param)) {
33
+ echo '[INVALID PARAMETERS]';
34
+ die ();
35
+ }
36
+ $feed = Mage::helper('brainsins_recommender')->getProductsFeed($key_param);
37
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/xml')->setBody($feed);
38
+ }
39
+
40
+ public function productCountAction()
41
+ {
42
+ $result = Array();
43
+ $result ["count"] = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('entity_id')->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)->getSize();
44
+ $output = json_encode($result);
45
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
46
+ }
47
+
48
+ public function productListAction()
49
+ {
50
+ $numPage = $this->getRequest()->getParam('numPage');
51
+ $pageSize = $this->getRequest()->getParam('pageSize');
52
+ $debug = $this->getRequest()->getParam('debug');
53
+ $oosParam = $this->getRequest()->getParam('oos');
54
+ $width = $this->getRequest()->getParam('img_width');
55
+ $height = $this->getRequest()->getParam('img_height');
56
+
57
+ $products = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('entity_id')->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)->addAttributeToSort('entity_id', 'asc')->setPage($numPage, $pageSize);
58
+
59
+ $include_oos_products = false;
60
+
61
+ if ($oosParam === null) {
62
+ $include_oos_products = true && Mage::getStoreConfig('brainsins_recommender_options/product_feed/include_oos_products', Mage::app()->getStore()->getStoreId());
63
+ } else {
64
+ $include_oos_products = $oosParam && true;
65
+ }
66
+
67
+ $result = Array();
68
+ foreach ($products as $product) {
69
+ $id = $product->getId();
70
+ $product_info = $this->_getProduct($id, $debug, $include_oos_products, $width, $height);
71
+ if ($product_info) {
72
+ $result [] = $product_info;
73
+ }
74
+ }
75
+
76
+ $output = json_encode($result);
77
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
78
+ }
79
+
80
+ private function _getProduct($productId, $debug = false, $include_oos_products = false, $width = false, $height = false)
81
+ {
82
+ $tax_included = Mage::getStoreConfig('brainsins_recommender_options/product_feed/tax_included', Mage::app()->getStore()->getStoreId());
83
+ $special_price = Mage::getStoreConfig('brainsins_recommender_options/product_feed/special_price', Mage::app()->getStore()->getStoreId());
84
+
85
+ $storeList = $this->_getStoreList();
86
+ $currencies = $this->_getCurrencyCodes();
87
+ $product = Mage::getModel('catalog/product');
88
+ $product->load($productId);
89
+
90
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getIsInStock();
91
+
92
+ // check product stock
93
+ if (!$include_oos_products && !$stock) {
94
+ return null;
95
+ }
96
+
97
+ $result = Array();
98
+
99
+ // just to have id as first field
100
+ $result ["id"] = "";
101
+
102
+ $result ["stock"] = $stock ? "1" : "0";
103
+
104
+ // define multiproperties
105
+ $result ["names"] = Array();
106
+ $result ["urls"] = Array();
107
+ $result ["prices"] = Array();
108
+
109
+ foreach ($product->getStoreIds() as $storeId) {
110
+ $storeProduct = Mage::getModel('catalog/product');
111
+ $storeProduct->setStoreId($storeId);
112
+ $storeProduct->load($productId);
113
+ $storeCode = $storeList [$storeId];
114
+ // NAMES -----
115
+ $result ["names"] [$storeCode] = $storeProduct->getName();
116
+ $result ["urls"] [$storeCode] = preg_replace("/[\?&]?___store=[^\?&]*/", "", $storeProduct->getProductUrl());
117
+ }
118
+
119
+ // IMAGE URL -----
120
+ $imageUrl = Mage::helper('brainsins_recommender')->getProductImage($product, $width, $height);
121
+
122
+ // $image_width = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_width', Mage::app()->getStore()->getStoreId());
123
+ // $image_height = Mage::getStoreConfig('brainsins_recommender_options/product_feed/product_image_resize_height', Mage::app()->getStore()->getStoreId());
124
+
125
+ // if (!$image_width || $image_width == "" || $image_width == "0" || !is_numeric($image_width)) {
126
+ // $image_width = null;
127
+ // }
128
+
129
+ // if (!$image_height || $image_height == "" || $image_height == "0" || !is_numeric($image_height)) {
130
+ // $image_height = null;
131
+ // }
132
+
133
+ // if (!$image_width && !$image_height) {
134
+ // $imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
135
+ // } else {
136
+ // $imageUrl = (string) Mage::helper('catalog/image')->init($product, "image")->resize($image_width, $image_height);
137
+ // }
138
+
139
+ $result ["imageUrl"] = $imageUrl;
140
+
141
+ // URL ---
142
+
143
+ $url = preg_replace("/[\?&]?___store=[^\?&]*/", "", $product->getProductUrl());
144
+ $result ["url"] = $url;
145
+
146
+ // PRICES -----
147
+
148
+ $product_price = 0.0;
149
+
150
+ if ($tax_included == '1' && $special_price == '1') {
151
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, false);
152
+ } elseif ($tax_included == '1' && $special_price == '0') {
153
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, false);
154
+ }
155
+
156
+ if ($tax_included == '0' && $special_price == '1') {
157
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true, null, null, null, null, true);
158
+ } elseif ($tax_included == '0' && $special_price == '0') {
159
+ $product_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), true, null, null, null, null, true);
160
+ }
161
+
162
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
163
+ if ($tax_included == '1' && $special_price == '1') {
164
+ $product_price = Mage::helper('tax')->getPrice($product, Mage::helper('brainsins_recommender')->getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
165
+ } elseif ($tax_included == '1' && $special_price == '0') {
166
+ $product_price = Mage::helper('tax')->getPrice($product, Mage::helper('brainsins_recommender')->getBundlePrice($product, 'min', 1), true, null, null, null, null, false);
167
+ }
168
+ if ($tax_included == '0' && $special_price == '1') {
169
+ $product_price = Mage::helper('tax')->getPrice($product, Mage::helper('brainsins_recommender')->getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
170
+ } elseif ($tax_included == '0' && $special_price == '0') {
171
+ $product_price = Mage::helper('tax')->getPrice($product, Mage::helper('brainsins_recommender')->getBundlePrice($product, 'min', 0), true, null, null, null, null, true);
172
+ }
173
+ }
174
+
175
+ if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
176
+ $product_final_price = Mage::helper('brainsins_recommender')->getBundlePrice($product, 'min', 1);
177
+ $product_regular_price = Mage::helper('brainsins_recommender')->getBundlePrice($product, 'min', 1);
178
+ } else {
179
+ $product_final_price = $product->getFinalPrice();
180
+ $product_regular_price = $product->getPrice();
181
+ }
182
+
183
+ $result ["price"] = number_format($product_price, 2, '.', '');
184
+ $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
185
+
186
+ foreach ($currencies as $curr) {
187
+
188
+ try {
189
+ $targetCurrency = Mage::getModel('directory/currency')->load($curr);
190
+ if ($targetCurrency) {
191
+ $targetcurrency = $targetCurrency->getCode();
192
+ } else {
193
+ continue;
194
+ }
195
+
196
+ if ($baseCurrency == $targetCurrency) {
197
+ $result ["prices"] [$targetCurrency] = $product_final_price;
198
+ continue;
199
+ }
200
+
201
+ $price_converted = number_format(Mage::helper('directory')->currencyConvert($product_final_price, $baseCurrency, $targetCurrency), 2, '.', '');
202
+ $result ["prices"] [$curr] = $price_converted;
203
+ } catch (Exception $e) {
204
+ }
205
+ }
206
+
207
+ // easy stuff
208
+ $result ["id"] = $product->getId();
209
+ $result ["sku"] = $product->getSku();
210
+ $result ["categories"] = $product->getCategoryIds();
211
+
212
+ if ($debug) {
213
+ $info = Array();
214
+ foreach ($product->getAttributes() as $attribute) {
215
+ $attributeCode = $attribute->getAttributeCode();
216
+ $info [$attributeCode] = $product->getData($attributeCode);
217
+ }
218
+ $result ["debug"] = $info;
219
+ }
220
+
221
+ return $result;
222
+ }
223
+
224
+ public function productAction()
225
+ {
226
+ $id = $this->getRequest()->getParam('id');
227
+ $debug = $this->getRequest()->getParam('debug');
228
+ $oosParam = $this->getREquest()->getParam('oos');
229
+
230
+ $include_oos_products = false;
231
+
232
+ if ($oosParam === null) {
233
+ $include_oos_products = true && Mage::getStoreConfig('brainsins_recommender_options/product_feed/include_oos_products', Mage::app()->getStore()->getStoreId());
234
+ } else {
235
+ $include_oos_products = $oosParam && true;
236
+ }
237
+
238
+ $result = $this->_getProduct($id, $debug, $include_oos_products);
239
+ $output = json_encode($result);
240
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
241
+ }
242
+
243
+ private function _getCurrencyCodes()
244
+ {
245
+ $stores = Mage::app()->getStore()->getCollection();
246
+ $result = array();
247
+ foreach ($stores as $store) {
248
+ $currencies = $store->getAvailableCurrencyCodes(true);
249
+ foreach ($currencies as $currency) {
250
+ if (!in_array($currency, $result)) {
251
+ $result [] = $currency;
252
+ }
253
+ }
254
+ }
255
+
256
+ return $result;
257
+ }
258
+
259
+ private function _getAttributeOptions($id) {
260
+ $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($id);
261
+ $attributeOptions = $attribute ->getSource()->getAllOptions(false);
262
+ return $attributeOptions;
263
+ }
264
+
265
+ private function _getAttributeInfo($id) {
266
+
267
+ }
268
+
269
+ public function attributeListAction()
270
+ {
271
+ $ids = Mage::getResourceModel('eav/entity_attribute_collection')->getAllIds();
272
+
273
+ $attributes = Array();
274
+
275
+ foreach($ids as $id) {
276
+ $attributeInfo = Mage::getModel('catalog/resource_eav_attribute')->load($id);
277
+ $options = $attributeInfo ->getSource()->getAllOptions(false);
278
+ $attribute = Array();
279
+ $attribute['id'] = $id;
280
+ $attribute['label'] = $attributeInfo->getData("attribute_code");
281
+ $attribute['options'] = $options;
282
+ $attributes[]=$attribute;
283
+ }
284
+
285
+ $output = json_encode($attributes);
286
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
287
+ }
288
+
289
+ public function attributeAction()
290
+ {
291
+ $id = $this->getRequest()->getParam('id');
292
+ $name = $this->getRequest()->getParam('name');
293
+
294
+ $attributeInfo = null;
295
+
296
+ if ($name != null && $name != "") {
297
+ $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter($name)->getFirstItem();
298
+ $id = $attributeInfo->getAttributeId();
299
+ } else {
300
+ $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')->getItemById($id);
301
+ }
302
+
303
+ // $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')->getItemById($id);
304
+
305
+ $options = $this->_getAttributeOptions($id);
306
+ $attribute = Array();
307
+ $attribute['id'] = $id;
308
+ $attribute['label'] = $attributeInfo->getData("attribute_code");
309
+ $attribute['options'] = $options;
310
+ $attributes[]=$attribute;
311
+
312
+ $output = json_encode($attributes);
313
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
314
+
315
+ }
316
+
317
+ public function currencyListAction()
318
+ {
319
+ $result = $this->_getCurrencyCodes();
320
+
321
+ $output = json_encode($result);
322
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
323
+ }
324
+
325
+ private function _getStoreList()
326
+ {
327
+ $stores = Mage::app()->getStore()->getCollection();
328
+ $result = array();
329
+ foreach ($stores as $store) {
330
+ $result [$store->getId()] = $store->getCode();
331
+ }
332
+ return $result;
333
+ }
334
+
335
+ public function storeListAction()
336
+ {
337
+ $result = $this->_getStoreList();
338
+
339
+ $output = json_encode($result);
340
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
341
+ }
342
+
343
+ public function categoriesAction()
344
+ {
345
+ $result = array();
346
+ $allcats = Mage::getModel('catalog/category')->getCollection();
347
+ $storeList = $this->_getStoreList();
348
+ foreach ($allcats as $category) {
349
+ $category->load($category->getId());
350
+ $catInfo = Array();
351
+
352
+ $catInfo ["id"] = $category->getId();
353
+
354
+ $catInfo ["parent_id"] = $category->getParentId();
355
+
356
+ $catInfo ["names"] = Array();
357
+
358
+ foreach ($category->getStoreIds() as $storeId) {
359
+ if (!$storeId) {
360
+ continue;
361
+ }
362
+ $storeCat = Mage::getModel('catalog/category')->setStore($storeId)->load($category->getId());
363
+
364
+ $storeCatInfo = Array();
365
+ $storeCode = $storeList [$storeId];
366
+ $catInfo ["names"] [$storeCode] = $storeCat->getName();
367
+ }
368
+
369
+ $result [$category->getId()] = $catInfo;
370
+ }
371
+ $output = json_encode($result);
372
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
373
+ }
374
+
375
+ // getParentId()
376
+ public function categoryTreeAction()
377
+ {
378
+ $categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->addAttributeToFilter('level', 2);
379
+
380
+ $result = Array();
381
+
382
+ foreach ($categories as $category) {
383
+ $id = $category->getId();
384
+ $name = $category->getName();
385
+ }
386
+
387
+ $output = json_encode($result);
388
+ $this->getResponse()->clearHeaders()->setHeader('Content-Type', 'application/json')->setBody($output);
389
+ }
390
+ }
app/code/community/Brainsins/Recommender/controllers/LoginController.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ */
24
+
25
+ class Brainsins_Recommender_LoginController extends Mage_Core_Controller_Front_Action
26
+ {
27
+ public function loginAction() {
28
+
29
+ $bsEnabled = Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId());
30
+ $autologinEnabled = Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_autologin/enabled', Mage::app()->getStore()->getStoreId());
31
+ $autologinSecret = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_autologin/secret', Mage::app()->getStore()->getStoreId());
32
+
33
+ $email = $this->getRequest()->getParam('email');
34
+ $token = $this->getRequest()->getParam('token');
35
+
36
+ $redirect = $this->getRequest()->getParam('redirect');
37
+ if (!$redirect) {
38
+ $redirect = "";
39
+ }
40
+
41
+ if (!$bsEnabled || !$autologinEnabled || !$autologinSecret || $autologinSecret == "") {
42
+ $this->_redirect($redirect);
43
+ return;
44
+ }
45
+
46
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
47
+ $loggedCustomer = Mage::helper('customer')->getCustomer();
48
+ $loggedEmail = $loggedCustomer->getEmail();
49
+
50
+ if($loggedEmail == $email) {
51
+ // this customer is already logged in
52
+ $this->_redirect($redirect);
53
+ return;
54
+ }
55
+ }
56
+
57
+ $validation = md5($email . $autologinSecret) === $token;
58
+
59
+ if (!$validation) {
60
+ $this->_redirect($redirect);
61
+ return;
62
+ }
63
+
64
+ $customer = Mage::getModel("customer/customer");
65
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
66
+ $customer->loadByEmail($email);
67
+
68
+ if($customer->getId() ) {
69
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
70
+ Mage::getSingleton('customer/session')->logOut();
71
+ $this->_redirect('*/*/login', array('_query' => $this->getRequest()->getParams()));
72
+ return;
73
+ }
74
+ Mage::getSingleton('core/cookie')->set('brainsins_logout', '0', time()+86400, '/', null, null, false);
75
+ Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
76
+ $quote = Mage::getModel('sales/quote')->loadByCustomer($customer);
77
+ if (count($quote->getAllItems()) == 0) {
78
+ $redirect = "";
79
+ }
80
+ }
81
+
82
+ $this->_redirect($redirect);
83
+ }
84
+
85
+ }
app/code/community/Brainsins/Recommender/controllers/RecommendationController.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Brainsins_Recommender_RecommendationController extends Mage_Core_Controller_Front_Action {
4
+
5
+ public function recommendationsAction() {
6
+
7
+
8
+
9
+ $template = $this->getRequest()->getParam("template");
10
+ $recommenderId = $this->getRequest()->getParam("recommenderId");
11
+ $userId = $this->getRequest()->getParam("userId");
12
+ $productId = $this->getRequest()->getParam("productId");
13
+ $lang= $this->getRequest()->getParam("lang");
14
+ $divName = $this->getRequest()->getParam("divName");
15
+ $filterCategories = $this->getRequest()->getParam("filterCategories");
16
+ $filterLevel = $this->getRequest()->getParam("filterLevel");
17
+ $detailsLevel = $this->getRequest()->getParam("detailsLevel");
18
+ $numRecs = $this->getRequest()->getParam("numRecs");
19
+ $maxResults = $this->getRequest()->getParam("maxResults");
20
+ $debug = $this->getRequest()->getParam("debug") == "1";
21
+
22
+ $model = Mage::getSingleton("brainsins_recommender/recommendation");
23
+ if ($debug) {
24
+ $url = $model->getRequestUrl($recommenderId, $productId, $userId, $lang, $divName, $filterCategories, $filterLevel, $detailsLevel, $maxResults);
25
+ $html = "<a href='$url'>$url</a>";
26
+ $this->getResponse()->setBody($html);
27
+ return;
28
+ }
29
+
30
+ $model->requestRecommendations($recommenderId, $productId, $userId, $lang, $divName, $filterCategories, $filterLevel, $detailsLevel, $maxResults);
31
+ $recommendationsBlock = $this->getLayout()
32
+ ->createBlock('brainsins_recommender/recommendations');
33
+ $recommendationsBlock->setTemplate($template);
34
+ $this->getResponse()->setBody($recommendationsBlock->toHtml());
35
+ }
36
+ }
app/code/community/Brainsins/Recommender/controllers/TrackingController.php ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ */
24
+
25
+ class Brainsins_Recommender_TrackingController extends Mage_Core_Controller_Front_Action
26
+ {
27
+ public function bdataAction()
28
+ {
29
+ try {
30
+
31
+ $bdata = $this->getRequest()->getParam('bdata');
32
+ if (!$bdata || $bdata == "") {
33
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody("{}");
34
+ return;
35
+ }
36
+ $bdata = json_decode($bdata, true);
37
+
38
+ if (!$bdata) {
39
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody("{}");
40
+ return;
41
+ }
42
+ $bdata = $this->_completeBdata($bdata);
43
+ $response = json_encode($bdata);
44
+
45
+ } catch (Exception $e) {
46
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody($this->getRequest()->getParam('bdata'));
47
+ return;
48
+ }
49
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody($response);
50
+ }
51
+
52
+ public function checkOrderAction() {
53
+
54
+ $email = $this->getRequest()->getParam('email');
55
+ $hours = $this->getRequest()->getParam('hours');
56
+
57
+ if (!$email || $email == "") {
58
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody('{"status":"error"}');
59
+ return;
60
+ }
61
+
62
+ if (!$hours || $hours == "") {
63
+ $hours = 72;
64
+ }
65
+
66
+ $customer = Mage::getModel("customer/customer");
67
+ $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
68
+ $customer->loadByEmail($email);
69
+ $id = $customer->getId();
70
+ if ($id !== null) {
71
+
72
+ $orders = Mage::getResourceModel('sales/order_collection')
73
+ ->addFieldToSelect('*')
74
+ ->addFieldToFilter('customer_id', $id)
75
+ ->addAttributeToSort('created_at', 'DESC')
76
+ ->setPageSize(1);
77
+
78
+ $order = $orders->getFirstItem();
79
+
80
+ if ($order->getId() !== null) {
81
+ $now = new Zend_Date();
82
+ $now->sub($hours, Zend_Date::HOUR);
83
+ $date = $order->getCreatedAtStoreDate();
84
+
85
+ if ($date->compare($now) == -1) {
86
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody('{"status":"ok"}');
87
+ return;
88
+ } else {
89
+ // date is in range
90
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody('{"status":"wait"}');
91
+ return;
92
+ }
93
+
94
+ } else {
95
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody('{"status":"ok"}');
96
+ return;
97
+ }
98
+
99
+ } else {
100
+ $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody('{"status":"error"}');
101
+ return;
102
+ }
103
+
104
+ }
105
+
106
+ private function _completeBdata($bdata) {
107
+
108
+ $bs_register = Mage::getSingleton('core/cookie')->get('brainsins_register');
109
+ $bs_login = Mage::getSingleton('core/cookie')->get('brainsins_login');
110
+ $bs_logout = Mage::getSingleton('core/cookie')->get('brainsins_logout');
111
+ $bs_news = Mage::getSingleton('core/cookie')->get('brainsins_news');
112
+ $email_tracking = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/email_tracking', Mage::app()->getStore()->getStoreId());
113
+
114
+ // $bdata["brainsins_register"] = $bs_register;
115
+ // $bdata["brainsins_login"] = $bs_login;
116
+ // $bdata["brainsins_logout"] = $bs_logout;
117
+ // $bdata["brainsins_news"] = $bs_news;
118
+
119
+ Mage::getSingleton('core/cookie')->delete('brainsins_news');
120
+ Mage::getSingleton('core/cookie')->set('brainsins_register', '0', time()+86400, '/', null, null, false);
121
+ Mage::getSingleton('core/cookie')->set('brainsins_login', '0', time()+86400, '/', null, null, false);
122
+ Mage::getSingleton('core/cookie')->set('brainsins_logout', '0', time()+86400, '/', null, null, false);
123
+ Mage::getSingleton('core/cookie')->set('brainsins_news', '0', time()+86400, '/', null, null, false);
124
+
125
+
126
+ if($bs_register && $bs_register != '0')
127
+ {
128
+ if($email_tracking == '1')
129
+ {
130
+ $customer_id = $bs_register;
131
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
132
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
133
+ if($subscriber->getId() && $subscriber->getSubscriberStatus() == '1')
134
+ {
135
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
136
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
137
+ // BrainSINSData.userNewsletter = 1;
138
+ // BrainSINSData.login = 1;';
139
+ $bdata['userEmail'] = $customer->getEmail();
140
+ $bdata['userNewsletter'] = 1;
141
+ $bdata['login'] = 1;
142
+ }
143
+ else
144
+ {
145
+ Mage::getSingleton('core/cookie')->delete('brainsins_register');
146
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
147
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
148
+ // BrainSINSData.userNewsletter = 0;
149
+ // BrainSINSData.login = 1;';
150
+ $bdata['userEmail'] = $customer->getEmail();
151
+ $bdata['userNewsletter'] = 0;
152
+ $bdata['login'] = 1;
153
+ }
154
+
155
+ unset($customer);unset($subscriber);
156
+ }
157
+ elseif($email_tracking == '2')
158
+ {
159
+ $customer_id = $bs_register;
160
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
161
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
162
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
163
+ // BrainSINSData.userNewsletter = 0;
164
+ // BrainSINSData.login = 1;';
165
+ $bdata['userEmail'] = $customer->getEmail();
166
+ $bdata['userNewsletter'] = 0;
167
+ $bdata['login'] = 1;
168
+ }
169
+ elseif($email_tracking == '0')
170
+ {
171
+ $customer_id = $bs_register;
172
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
173
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
174
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
175
+ // BrainSINSData.userNewsletter = 0;
176
+ // BrainSINSData.login = 1;';
177
+ $bdata['userEmail'] = $customer->getEmail();
178
+ $bdata['userNewsletter'] = 0;
179
+ $bdata['login'] = 1;
180
+ }
181
+ unset($customer);
182
+ }
183
+ if($bs_login && $bs_login != '0' && (!$bs_register || $bs_register == '0'))
184
+ {
185
+ if($email_tracking == '1')
186
+ {
187
+ $customer_id = $bs_login;
188
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
189
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
190
+ if($subscriber->getId() && $subscriber->getSubscriberStatus() == '1')
191
+ {
192
+ Mage::getSingleton('core/cookie')->delete('brainsins_login');
193
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
194
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
195
+ // BrainSINSData.userNewsletter = 1;
196
+ // BrainSINSData.login = 1;';
197
+ $bdata['userEmail'] = $customer->getEmail();
198
+ $bdata['userNewsletter'] = 1;
199
+ $bdata['login'] = 1;
200
+ }
201
+ else
202
+ {
203
+ Mage::getSingleton('core/cookie')->delete('brainsins_login');
204
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
205
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
206
+ // BrainSINSData.userNewsletter = 0;
207
+ // BrainSINSData.login = 1;';
208
+ $bdata['userEmail'] = $customer->getEmail();
209
+ $bdata['userNewsletter'] = 0;
210
+ $bdata['login'] = 1;
211
+ }
212
+ unset($customer);unset($subscriber);
213
+ }
214
+ elseif($email_tracking == '2')
215
+ {
216
+ $customer_id = $bs_login;
217
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
218
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
219
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
220
+ // BrainSINSData.userNewsletter = 1;
221
+ // BrainSINSData.login = 1;';
222
+ $bdata['userEmail'] = $customer->getEmail();
223
+ $bdata['userNewsletter'] = 1;
224
+ $bdata['login'] = 1;
225
+ }
226
+ elseif($email_tracking == '0')
227
+ {
228
+ $customer_id = $bs_login;
229
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
230
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
231
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
232
+ // BrainSINSData.userNewsletter = 0;
233
+ // BrainSINSData.login = 1;';
234
+ $bdata['userEmail'] = $customer->getEmail();
235
+ $bdata['userNewsletter'] = 1;
236
+ $bdata['login'] = 1;
237
+ }
238
+ unset($customer);
239
+ }
240
+
241
+ if($bs_logout && $bs_logout != '0' && (!$bs_register || $bs_register == '0'))
242
+ {
243
+ // echo 'BrainSINSData.logout = 1;';
244
+ $bdata['logout'] = 1;
245
+ }
246
+
247
+ if($bs_news && $bs_news != '0' && (!$bs_register || $bs_register == '0'))
248
+ {
249
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_news');
250
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
251
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
252
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
253
+ if($subscriber->getSubscriberStatus() == '3')
254
+ {
255
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
256
+ // BrainSINSData.userNewsletter = 0;
257
+ // BrainSINSData.login = 1;';
258
+ $bdata['userEmail'] = $customer->getEmail();
259
+ $bdata['userNewsletter'] = 0;
260
+ $bdata['login'] = 1;
261
+ }
262
+ elseif($subscriber->getSubscriberStatus() == '1') {
263
+ // echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
264
+ // BrainSINSData.userNewsletter = 1;
265
+ // BrainSINSData.login = 1;';
266
+ $bdata['userEmail'] = $customer->getEmail();
267
+ $bdata['userNewsletter'] = 1;
268
+ $bdata['login'] = 1;
269
+ }
270
+ unset($customer);unset($subscriber);
271
+ }
272
+
273
+ return $bdata;
274
+ }
275
+ }
app/code/community/Brainsins/Recommender/etc/config.xml CHANGED
@@ -1,30 +1,21 @@
1
  <?xml version="1.0"?>
2
- <!--
3
- * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
- * personalized product recommendations into a Magento Store.
5
- * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
- *
7
- * This file is part of BrainSINS' Magento Extension.
8
- *
9
- * BrainSINS' Magento Extension is free software: you can redistribute it
10
- * and/or modify it under the terms of the GNU General Public License
11
- * as published by the Free Software Foundation, either version 3 of the
12
- * License, or (at your option) any later version.
13
- *
14
- * Foobar is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
- *
22
- * Please do not hesitate to contact us at info@brainsins.com
23
- -->
24
  <config>
25
  <modules>
26
  <Brainsins_Recommender>
27
- <version>2.0.0</version>
28
  </Brainsins_Recommender>
29
  </modules>
30
  <global>
@@ -58,6 +49,17 @@
58
  </connection>
59
  </brainsins_recommender_read>
60
  </resources>
 
 
 
 
 
 
 
 
 
 
 
61
  </global>
62
  <frontend>
63
  <routers>
@@ -86,78 +88,94 @@
86
  </brainsins_recommender>
87
  </observers>
88
  </core_block_abstract_to_html_after>
89
- <customer_save_after>
90
- <observers>
91
- <brainsins_recommender>
92
- <type>model</type>
93
- <class>brainsins_recommender/observer</class>
94
- <method>customerRegister</method>
95
- </brainsins_recommender>
96
- </observers>
97
- </customer_save_after>
98
- <customer_login>
99
- <observers>
100
- <brainsins_recommender>
101
- <type>model</type>
102
- <class>brainsins_recommender/observer</class>
103
- <method>customerLogin</method>
104
- </brainsins_recommender>
105
- </observers>
106
- </customer_login>
107
- <customer_logout>
108
- <observers>
109
- <brainsins_recommender>
110
- <type>model</type>
111
- <class>brainsins_recommender/observer</class>
112
- <method>customerLogout</method>
113
- </brainsins_recommender>
114
- </observers>
115
- </customer_logout>
116
- <newsletter_subscriber_save_commit_after>
117
- <observers>
118
- <brainsins_recommender>
119
- <class>brainsins_recommender/observer</class>
120
- <method>subscribedToNewsletter</method>
121
- </brainsins_recommender>
122
- </observers>
123
- </newsletter_subscriber_save_commit_after>
124
- <checkout_cart_update_items_after>
125
- <observers>
126
- <brainsins_recommender>
127
- <class>brainsins_recommender/observer</class>
128
- <method>onCartUpdate</method>
129
- </brainsins_recommender>
130
- </observers>
131
- </checkout_cart_update_items_after>
132
- <controller_action_postdispatch>
133
- <observers>
134
- <brainsins_recommender>
135
- <type>singleton</type>
136
- <class>brainsins_recommender/observer</class>
137
- <method>updateCartEvent</method>
138
- </brainsins_recommender>
139
- </observers>
140
- </controller_action_postdispatch>
141
- <checkout_update_cart_after>
142
- <observers>
143
- <brainsins_recommender>
144
- <type>singleton</type>
145
- <class>brainsins_recommender/observer</class>
146
- <method>updateCart</method>
147
- </brainsins_recommender>
148
- </observers>
149
- </checkout_update_cart_after>
150
- <!--
151
- <checkout_cart_save_after>
152
- <observers>
153
- <brainsins_recommender>
154
- <type>singleton</type>
155
- <class>brainsins_recommender/observer</class>
156
- <method>updateCart</method>
157
- </brainsins_recommender>
158
- </observers>
159
- </checkout_cart_save_after>
160
- -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  </events>
162
  </frontend>
163
  <admin>
@@ -177,6 +195,7 @@
177
  </brainsins_recommender>
178
  </updates>
179
  </layout>
 
180
  </admin>
181
  <adminhtml>
182
  <translate>
@@ -200,12 +219,12 @@
200
  <config>
201
  <children>
202
  <brainsins_recommender_options>
203
- <title>Brainsins Recommender Options</title>
204
- <sort_order>100</sort_order>
205
  </brainsins_recommender_options>
206
  <brainsins_recommender_dashboard>
207
- <title>Brainsins Recommender Dashboard</title>
208
- <sort_order>101</sort_order>
209
  </brainsins_recommender_dashboard>
210
  </children>
211
  </config>
@@ -233,15 +252,19 @@
233
  <cron_enabled>1</cron_enabled>
234
  <cron_time>02,00,00</cron_time>
235
  </brainsins_recommender_feed>
 
 
 
 
236
  </brainsins_recommender_options>
237
  </default>
238
  <crontab>
239
  <jobs>
240
- <brainsins_recommender_feeds_cron>
241
  <run>
242
  <model>brainsins_recommender/cron::generateOfflineFeeds</model>
243
  </run>
244
- </brainsins_recommender_feeds_cron>
245
  </jobs>
246
  </crontab>
247
  </config>
1
  <?xml version="1.0"?>
2
+ <!-- * BrainSINS' Magento Extension allows to integrate the BrainSINS * personalized
3
+ product recommendations into a Magento Store. * Copyright (c) 2014 Social
4
+ Gaming Platform S.R.L. * * This file is part of BrainSINS' Magento Extension.
5
+ * * BrainSINS' Magento Extension is free software: you can redistribute it
6
+ * and/or modify it under the terms of the GNU General Public License * as
7
+ published by the Free Software Foundation, either version 3 of the * License,
8
+ or (at your option) any later version. * * Foobar is distributed in the hope
9
+ that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied
10
+ warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ * GNU General Public License for more details. * * You should have received
12
+ a copy of the GNU General Public License * along with Foobar. If not, see
13
+ <http://www.gnu.org/licenses/>. * * Please do not hesitate to contact us
14
+ at info@brainsins.com -->
 
 
 
 
 
 
 
 
 
15
  <config>
16
  <modules>
17
  <Brainsins_Recommender>
18
+ <version>2.0.4</version>
19
  </Brainsins_Recommender>
20
  </modules>
21
  <global>
49
  </connection>
50
  </brainsins_recommender_read>
51
  </resources>
52
+ <events>
53
+ <sales_order_invoice_save_after>
54
+ <observers>
55
+ <brainsins_recommender>
56
+ <type>model</type>
57
+ <class>brainsins_recommender/observer</class>
58
+ <method>onPayment</method>
59
+ </brainsins_recommender>
60
+ </observers>
61
+ </sales_order_invoice_save_after>
62
+ </events>
63
  </global>
64
  <frontend>
65
  <routers>
88
  </brainsins_recommender>
89
  </observers>
90
  </core_block_abstract_to_html_after>
91
+ <customer_save_after>
92
+ <observers>
93
+ <brainsins_recommender>
94
+ <type>model</type>
95
+ <class>brainsins_recommender/observer</class>
96
+ <method>customerRegister</method>
97
+ </brainsins_recommender>
98
+ </observers>
99
+ </customer_save_after>
100
+ <customer_login>
101
+ <observers>
102
+ <brainsins_recommender>
103
+ <type>model</type>
104
+ <class>brainsins_recommender/observer</class>
105
+ <method>customerLogin</method>
106
+ </brainsins_recommender>
107
+ </observers>
108
+ </customer_login>
109
+ <customer_logout>
110
+ <observers>
111
+ <brainsins_recommender>
112
+ <type>model</type>
113
+ <class>brainsins_recommender/observer</class>
114
+ <method>customerLogout</method>
115
+ </brainsins_recommender>
116
+ </observers>
117
+ </customer_logout>
118
+ <newsletter_subscriber_save_commit_after>
119
+ <observers>
120
+ <brainsins_recommender>
121
+ <class>brainsins_recommender/observer</class>
122
+ <method>subscribedToNewsletter</method>
123
+ </brainsins_recommender>
124
+ </observers>
125
+ </newsletter_subscriber_save_commit_after>
126
+ <controller_action_postdispatch>
127
+ <observers>
128
+ <brainsins_recommender>
129
+ <type>singleton</type>
130
+ <class>brainsins_recommender/observer</class>
131
+ <method>updateCartEvent</method>
132
+ </brainsins_recommender>
133
+ </observers>
134
+ </controller_action_postdispatch>
135
+ <checkout_cart_update_items_after>
136
+ <observers>
137
+ <brainsins_recommender>
138
+ <class>brainsins_recommender/observer</class>
139
+ <method>updateCart</method>
140
+ </brainsins_recommender>
141
+ </observers>
142
+ </checkout_cart_update_items_after>
143
+ <checkout_update_cart_after>
144
+ <observers>
145
+ <brainsins_recommender>
146
+ <type>singleton</type>
147
+ <class>brainsins_recommender/observer</class>
148
+ <method>updateCart</method>
149
+ </brainsins_recommender>
150
+ </observers>
151
+ </checkout_update_cart_after>
152
+ <sales_quote_save_after>
153
+ <observers>
154
+ <brainsins_recommender>
155
+ <type>singleton</type>
156
+ <class>brainsins_recommender/observer</class>
157
+ <method>updateCart</method>
158
+ </brainsins_recommender>
159
+ </observers>
160
+ </sales_quote_save_after>
161
+ <checkout_cart_save_after>
162
+ <observers>
163
+ <brainsins_recommender>
164
+ <type>singleton</type>
165
+ <class>brainsins_recommender/observer</class>
166
+ <method>updateCart</method>
167
+ </brainsins_recommender>
168
+ </observers>
169
+ </checkout_cart_save_after>
170
+ <sales_order_payment_place_end>
171
+ <observers>
172
+ <brainsins_recommender>
173
+ <type>model</type>
174
+ <class>brainsins_recommender/observer</class>
175
+ <method>onEndCheckout</method>
176
+ </brainsins_recommender>
177
+ </observers>
178
+ </sales_order_payment_place_end>
179
  </events>
180
  </frontend>
181
  <admin>
195
  </brainsins_recommender>
196
  </updates>
197
  </layout>
198
+
199
  </admin>
200
  <adminhtml>
201
  <translate>
219
  <config>
220
  <children>
221
  <brainsins_recommender_options>
222
+ <title>Brainsins Recommender Options</title>
223
+ <sort_order>100</sort_order>
224
  </brainsins_recommender_options>
225
  <brainsins_recommender_dashboard>
226
+ <title>Brainsins Recommender Dashboard</title>
227
+ <sort_order>101</sort_order>
228
  </brainsins_recommender_dashboard>
229
  </children>
230
  </config>
252
  <cron_enabled>1</cron_enabled>
253
  <cron_time>02,00,00</cron_time>
254
  </brainsins_recommender_feed>
255
+ <brainsins_recommender_advanced>
256
+ <ajax_tracking>0</ajax_tracking>
257
+ <custom_script>0</custom_script>
258
+ </brainsins_recommender_advanced>
259
  </brainsins_recommender_options>
260
  </default>
261
  <crontab>
262
  <jobs>
263
+ <brainsins_recommender_feeds_cron>
264
  <run>
265
  <model>brainsins_recommender/cron::generateOfflineFeeds</model>
266
  </run>
267
+ </brainsins_recommender_feeds_cron>
268
  </jobs>
269
  </crontab>
270
  </config>
app/code/community/Brainsins/Recommender/etc/system.xml CHANGED
@@ -27,7 +27,7 @@
27
  <label>Configuration</label>
28
  <tab>brainsins_recommender_tab</tab>
29
  <frontend_type>text</frontend_type>
30
- <sort_order>1</sort_order>
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
33
  <show_in_store>1</show_in_store>
@@ -101,6 +101,18 @@
101
  <show_in_website>1</show_in_website>
102
  <show_in_store>1</show_in_store>
103
  <fields>
 
 
 
 
 
 
 
 
 
 
 
 
104
  <brainsins_recommender_recommenders_home
105
  type="group" tranlate="label comment">
106
  <label>Home page recommenders</label>
@@ -258,45 +270,6 @@
258
  <show_in_website>1</show_in_website>
259
  <show_in_store>1</show_in_store>
260
  <fields>
261
- <cron_enabled translate="label comment">
262
- <label>Enable feeds auto generation</label>
263
- <comment>Enable or disable the scheduled feed generation.
264
- </comment>
265
- <frontend_type>select</frontend_type>
266
- <sort_order>10</sort_order>
267
- <show_in_default>1</show_in_default>
268
- <show_in_website>0</show_in_website>
269
- <show_in_store>0</show_in_store>
270
- <source_model>adminhtml/system_config_source_yesno</source_model>
271
- </cron_enabled>
272
- <cron_time translate="label comment">
273
- <label>Start Time</label>
274
- <comment></comment>
275
- <frontend_type>time</frontend_type>
276
- <sort_order>20</sort_order>
277
- <show_in_default>1</show_in_default>
278
- <show_in_website>0</show_in_website>
279
- <show_in_store>0</show_in_store>
280
- <depends>
281
- <cron_enabled>1</cron_enabled>
282
- </depends>
283
- </cron_time>
284
- <cron_frequency translate="label comment">
285
- <label>Frequency</label>
286
- <comment></comment>
287
- <frontend_type>select</frontend_type>
288
- <source_model>adminhtml/system_config_source_cron_frequency
289
- </source_model>
290
- <backend_model>brainsins_recommender/adminhtml_system_config_backend_cron
291
- </backend_model>
292
- <sort_order>30</sort_order>
293
- <show_in_default>1</show_in_default>
294
- <show_in_website>0</show_in_website>
295
- <show_in_store>0</show_in_store>
296
- <depends>
297
- <cron_enabled>1</cron_enabled>
298
- </depends>
299
- </cron_frequency>
300
  <product_feed type="group" tranlate="label comment">
301
  <label>Products feed</label>
302
  <comment></comment>
@@ -305,9 +278,6 @@
305
  <show_in_default>1</show_in_default>
306
  <show_in_website>1</show_in_website>
307
  <show_in_store>1</show_in_store>
308
- <depends>
309
- <cron_enabled>1</cron_enabled>
310
- </depends>
311
  <fields>
312
  <include_oos_products translate="label comment">
313
  <label>Include out of stock products</label>
@@ -374,44 +344,52 @@
374
  <show_in_website>1</show_in_website>
375
  <show_in_store>1</show_in_store>
376
  </product_image_resize_height>
377
- <offline_feed translate="label comment">
378
- <label>Offline feed</label>
379
- <comment></comment>
380
- <frontend_model>brainsins_recommender/adminhtml_system_config_source_feeds_productOffline
381
- </frontend_model>
382
- <sort_order>50</sort_order>
383
- <show_in_default>1</show_in_default>
384
- <show_in_website>1</show_in_website>
385
- <show_in_store>1</show_in_store>
386
- </offline_feed>
387
- <online_feed translate="label comment">
388
- <label>Online feed</label>
389
- <comment></comment>
390
- <frontend_model>brainsins_recommender/adminhtml_system_config_source_feeds_productOnline
391
- </frontend_model>
392
- <sort_order>60</sort_order>
393
- <show_in_default>1</show_in_default>
394
- <show_in_website>1</show_in_website>
395
- <show_in_store>1</show_in_store>
396
- </online_feed>
397
  </fields>
398
  </product_feed>
399
- <!-- <cronjob_expression tranlate="label comment"> <label>Programacin
400
- sincronizacin stock</label> <comment>Frecuencia de la sincronizacin del stock.
401
- Introducir expresin Cron (p.e. "0 * * * *" para cada hora en punto).</comment>
402
- <frontend_type>text</frontend_type> <backend_model>ecommbits_eral/adminhtml_system_config_backend_cron</backend_model>
403
- <sort_order>20</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website>
404
- <show_in_store>0</show_in_store> <depends> <cron_enabled>1</cron_enabled>
405
- </depends> </cronjob_expression> -->
406
  </fields>
407
  </brainsins_recommender_feed>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  <brainsins_recommender_advanced
409
  translate="label comment" module="brainsins_recommender">
410
  <label>Advanced Configuration</label>
411
  <comment>Do not modify these values unless required by BrainSINS
412
  </comment>
413
  <frontend_type>text</frontend_type>
414
- <sort_order>40</sort_order>
415
  <show_in_default>1</show_in_default>
416
  <show_in_website>1</show_in_website>
417
  <show_in_store>1</show_in_store>
@@ -426,6 +404,26 @@
426
  <show_in_store>1</show_in_store>
427
  <source_model>brainsins_recommender/adminhtml_system_config_source_apimode</source_model>
428
  </api_mode>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  </fields>
430
  </brainsins_recommender_advanced>
431
  </groups>
@@ -435,7 +433,7 @@
435
  <label>Dashboard</label>
436
  <tab>brainsins_recommender_tab</tab>
437
  <frontend_type>text</frontend_type>
438
- <sort_order>2</sort_order>
439
  <show_in_default>1</show_in_default>
440
  <show_in_website>1</show_in_website>
441
  <show_in_store>1</show_in_store>
27
  <label>Configuration</label>
28
  <tab>brainsins_recommender_tab</tab>
29
  <frontend_type>text</frontend_type>
30
+ <sort_order>100</sort_order>
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
33
  <show_in_store>1</show_in_store>
101
  <show_in_website>1</show_in_website>
102
  <show_in_store>1</show_in_store>
103
  <fields>
104
+ <brainsins_recommender_recommenders_link>
105
+ <label>Check available recommenders </label>
106
+ <help_link>https://analytics.brainsins.com/optimization/recommenderslist
107
+ </help_link>
108
+ <comment></comment>
109
+ <frontend_type>button</frontend_type>
110
+ <frontend_model>brainsins_recommender/adminhtml_system_config_source_recommenders_show</frontend_model>
111
+ <sort_order>5</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </brainsins_recommender_recommenders_link>
116
  <brainsins_recommender_recommenders_home
117
  type="group" tranlate="label comment">
118
  <label>Home page recommenders</label>
270
  <show_in_website>1</show_in_website>
271
  <show_in_store>1</show_in_store>
272
  <fields>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  <product_feed type="group" tranlate="label comment">
274
  <label>Products feed</label>
275
  <comment></comment>
278
  <show_in_default>1</show_in_default>
279
  <show_in_website>1</show_in_website>
280
  <show_in_store>1</show_in_store>
 
 
 
281
  <fields>
282
  <include_oos_products translate="label comment">
283
  <label>Include out of stock products</label>
344
  <show_in_website>1</show_in_website>
345
  <show_in_store>1</show_in_store>
346
  </product_image_resize_height>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  </fields>
348
  </product_feed>
 
 
 
 
 
 
 
349
  </fields>
350
  </brainsins_recommender_feed>
351
+ <brainsins_recommender_autologin
352
+ translate="label comment" module="brainsins_recommender">
353
+ <label>Autologin Configuration</label>
354
+ <comment>Activate to allow autologin on email retargeting actions</comment>
355
+ <frontend_type>text</frontend_type>
356
+ <sort_order>50</sort_order>
357
+ <show_in_default>1</show_in_default>
358
+ <show_in_website>1</show_in_website>
359
+ <show_in_store>1</show_in_store>
360
+ <fields>
361
+ <enabled translate="label comment">
362
+ <label>Enabled</label>
363
+ <comment>Enable or disable the autologin feature</comment>
364
+ <frontend_type>select</frontend_type>
365
+ <sort_order>10</sort_order>
366
+ <show_in_default>1</show_in_default>
367
+ <show_in_website>1</show_in_website>
368
+ <show_in_store>1</show_in_store>
369
+ <source_model>adminhtml/system_config_source_yesno</source_model>
370
+ </enabled>
371
+ <secret translate="label comment">
372
+ <label>Autologin Secret KEY</label>
373
+ <comment>Secret autologin password.
374
+ Place the same password here than in BrainSINS analytics tool email editor</comment>
375
+ <frontend_type>text</frontend_type>
376
+ <sort_order>20</sort_order>
377
+ <show_in_default>1</show_in_default>
378
+ <show_in_website>1</show_in_website>
379
+ <show_in_store>1</show_in_store>
380
+ <depends>
381
+ <enabled>1</enabled>
382
+ </depends>
383
+ </secret>
384
+ </fields>
385
+ </brainsins_recommender_autologin>
386
  <brainsins_recommender_advanced
387
  translate="label comment" module="brainsins_recommender">
388
  <label>Advanced Configuration</label>
389
  <comment>Do not modify these values unless required by BrainSINS
390
  </comment>
391
  <frontend_type>text</frontend_type>
392
+ <sort_order>60</sort_order>
393
  <show_in_default>1</show_in_default>
394
  <show_in_website>1</show_in_website>
395
  <show_in_store>1</show_in_store>
404
  <show_in_store>1</show_in_store>
405
  <source_model>brainsins_recommender/adminhtml_system_config_source_apimode</source_model>
406
  </api_mode>
407
+ <ajax_tracking translate="label comment">
408
+ <label>use Ajax for tracking generation</label>
409
+ <comment>Default value is NO</comment>
410
+ <frontend_type>select</frontend_type>
411
+ <sort_order>11</sort_order>
412
+ <show_in_default>1</show_in_default>
413
+ <show_in_website>1</show_in_website>
414
+ <show_in_store>1</show_in_store>
415
+ <source_model>adminhtml/system_config_source_yesno</source_model>
416
+ </ajax_tracking>
417
+ <custom_script translate="label comment">
418
+ <label>use custom tracking script</label>
419
+ <comment>Default value is NO</comment>
420
+ <frontend_type>select</frontend_type>
421
+ <sort_order>12</sort_order>
422
+ <show_in_default>1</show_in_default>
423
+ <show_in_website>1</show_in_website>
424
+ <show_in_store>1</show_in_store>
425
+ <source_model>adminhtml/system_config_source_yesno</source_model>
426
+ </custom_script>
427
  </fields>
428
  </brainsins_recommender_advanced>
429
  </groups>
433
  <label>Dashboard</label>
434
  <tab>brainsins_recommender_tab</tab>
435
  <frontend_type>text</frontend_type>
436
+ <sort_order>101</sort_order>
437
  <show_in_default>1</show_in_default>
438
  <show_in_website>1</show_in_website>
439
  <show_in_store>1</show_in_store>
app/code/community/Cm/RedisSession/Model/Session.php DELETED
@@ -1,731 +0,0 @@
1
- <?php
2
- /**
3
- * Redis session handler with optimistic locking.
4
- *
5
- * Features:
6
- * - Falls back to mysql handler if it can't connect to redis. Mysql handler falls back to file handler.
7
- * - When a session's data exceeds the compression threshold the session data will be compressed.
8
- * - Compression libraries supported are 'gzip', 'lzf' and 'snappy'. Lzf and Snappy are much faster than gzip.
9
- * - Compression can be enabled, disabled, or reconfigured on the fly with no loss of session data.
10
- * - Expiration is handled by Redis. No garbage collection needed.
11
- * - Logs when sessions are not written due to not having or losing their lock.
12
- * - Limits the number of concurrent lock requests before a 503 error is returned.
13
- *
14
- * Locking Algorithm Properties:
15
- * - Only one process may get a write lock on a session.
16
- * - A process may lose it's lock if another process breaks it, in which case the session will not be written.
17
- * - The lock may be broken after BREAK_AFTER seconds and the process that gets the lock is indeterminate.
18
- * - Only MAX_CONCURRENCY processes may be waiting for a lock for the same session or else a 503 error is returned.
19
- * - Detects crashed processes to prevent session deadlocks (Linux only).
20
- * - Detects inactive waiting processes to prevent false-positives in concurrency throttling.
21
- *
22
- */
23
- class Cm_RedisSession_Model_Session extends Mage_Core_Model_Mysql4_Session
24
- {
25
- const BREAK_MODULO = 5; /* The lock will only be broken one of of this many tries to prevent multiple processes breaking the same lock */
26
- const FAIL_AFTER = 15; /* Try to break lock for at most this many seconds */
27
- const DETECT_ZOMBIES = 10; /* Try to detect zombies every this many seconds */
28
- const MAX_LIFETIME = 2592000; /* Redis backend limit */
29
- const SESSION_PREFIX = 'sess_';
30
- const LOG_FILE = 'redis_session.log';
31
-
32
- /* Bots get shorter session lifetimes */
33
- const BOT_REGEX = '/^alexa|^blitz\.io|bot|^browsermob|crawl|^curl|^facebookexternalhit|feed|google web preview|^ia_archiver|^java|jakarta|^load impact|^magespeedtest|monitor|nagios|^pinterest|postrank|slurp|spider|uptime|yandex/i';
34
-
35
- const XML_PATH_HOST = 'global/redis_session/host';
36
- const XML_PATH_PORT = 'global/redis_session/port';
37
- const XML_PATH_PASS = 'global/redis_session/password';
38
- const XML_PATH_TIMEOUT = 'global/redis_session/timeout';
39
- const XML_PATH_PERSISTENT = 'global/redis_session/persistent';
40
- const XML_PATH_DB = 'global/redis_session/db';
41
- const XML_PATH_COMPRESSION_THRESHOLD = 'global/redis_session/compression_threshold';
42
- const XML_PATH_COMPRESSION_LIB = 'global/redis_session/compression_lib';
43
- const XML_PATH_LOG_LEVEL = 'global/redis_session/log_level';
44
- const XML_PATH_MAX_CONCURRENCY = 'global/redis_session/max_concurrency';
45
- const XML_PATH_BREAK_AFTER = 'global/redis_session/break_after_%s';
46
- const XML_PATH_BOT_LIFETIME = 'global/redis_session/bot_lifetime';
47
-
48
- const DEFAULT_TIMEOUT = 2.5;
49
- const DEFAULT_COMPRESSION_THRESHOLD = 2048;
50
- const DEFAULT_COMPRESSION_LIB = 'gzip';
51
- const DEFAULT_LOG_LEVEL = 1;
52
- const DEFAULT_MAX_CONCURRENCY = 6; /* The maximum number of concurrent lock waiters per session */
53
- const DEFAULT_BREAK_AFTER = 30; /* Try to break the lock after this many seconds */
54
- const DEFAULT_BOT_LIFETIME = 7200; /* The session lifetime for bots - shorter to prevent bots from wasting backend storage */
55
-
56
- /** @var bool */
57
- protected $_useRedis;
58
-
59
- /** @var Credis_Client */
60
- protected $_redis;
61
-
62
- /** @var int */
63
- protected $_dbNum;
64
-
65
- protected $_compressionThreshold;
66
- protected $_compressionLib;
67
- protected $_logLevel;
68
- protected $_maxConcurrency;
69
- protected $_breakAfter;
70
- protected $_botLifetime;
71
- protected $_isBot = FALSE;
72
- protected $_hasLock;
73
- protected $_sessionWritten; // avoid infinite loops
74
- protected $_timeStart; // re-usable for timing instrumentation
75
-
76
- static public $failedLockAttempts = 0; // for debug or informational purposes
77
-
78
- public function __construct()
79
- {
80
- $this->_timeStart = microtime(true);
81
- $host = (string) (Mage::getConfig()->getNode(self::XML_PATH_HOST) ?: '127.0.0.1');
82
- $port = (int) (Mage::getConfig()->getNode(self::XML_PATH_PORT) ?: '6379');
83
- $pass = (string) (Mage::getConfig()->getNode(self::XML_PATH_PASS) ?: '');
84
- $timeout = (float) (Mage::getConfig()->getNode(self::XML_PATH_TIMEOUT) ?: self::DEFAULT_TIMEOUT);
85
- $persistent = (string) (Mage::getConfig()->getNode(self::XML_PATH_PERSISTENT) ?: '');
86
- $this->_dbNum = (int) (Mage::getConfig()->getNode(self::XML_PATH_DB) ?: 0);
87
- $this->_compressionThreshold = (int) (Mage::getConfig()->getNode(self::XML_PATH_COMPRESSION_THRESHOLD) ?: self::DEFAULT_COMPRESSION_THRESHOLD);
88
- $this->_compressionLib = (string) (Mage::getConfig()->getNode(self::XML_PATH_COMPRESSION_LIB) ?: self::DEFAULT_COMPRESSION_LIB);
89
- $this->_logLevel = (int) (Mage::getConfig()->getNode(self::XML_PATH_LOG_LEVEL) ?: self::DEFAULT_LOG_LEVEL);
90
- $this->_maxConcurrency = (int) (Mage::getConfig()->getNode(self::XML_PATH_MAX_CONCURRENCY) ?: self::DEFAULT_MAX_CONCURRENCY);
91
- $this->_breakAfter = (int) (Mage::getConfig()->getNode(sprintf(self::XML_PATH_BREAK_AFTER, session_name())) ?: self::DEFAULT_BREAK_AFTER);
92
- $this->_botLifetime = (int) (Mage::getConfig()->getNode(self::XML_PATH_BOT_LIFETIME) ?: self::DEFAULT_BOT_LIFETIME);
93
- if ($this->_botLifetime) {
94
- $userAgent = empty($_SERVER['HTTP_USER_AGENT']) ? FALSE : $_SERVER['HTTP_USER_AGENT'];
95
- $this->_isBot = ! $userAgent || preg_match(self::BOT_REGEX, $userAgent);
96
- }
97
- $this->_redis = new Credis_Client($host, $port, $timeout, $persistent);
98
- if (!empty($pass)) {
99
- $this->_redis->auth($pass) or Zend_Cache::throwException('Unable to authenticate with the redis server.');
100
- }
101
- $this->_redis->setCloseOnDestruct(FALSE); // Destructor order cannot be predicted
102
- $this->_useRedis = TRUE;
103
- if ($this->_logLevel >= 7) {
104
- Mage::log(
105
- sprintf(
106
- "%s: %s initialized for connection to %s:%s after %.5f seconds",
107
- $this->_getPid(),
108
- get_class($this),
109
- $host,
110
- $port,
111
- (microtime(true) - $this->_timeStart)
112
- ),
113
- Zend_Log::DEBUG, self::LOG_FILE
114
- );
115
- if ($this->_isBot) {
116
- Mage::log(
117
- sprintf(
118
- "%s: Bot detected for user agent: %s",
119
- $this->_getPid(),
120
- $userAgent
121
- ),
122
- Zend_Log::DEBUG, self::LOG_FILE
123
- );
124
- }
125
- }
126
- }
127
-
128
- /**
129
- * Check DB connection
130
- *
131
- * @return bool
132
- */
133
- public function hasConnection()
134
- {
135
- if( ! $this->_useRedis) return parent::hasConnection();
136
-
137
- try {
138
- $this->_redis->connect();
139
- if ($this->_logLevel >= 7) {
140
- Mage::log(
141
- sprintf("%s: Connected to Redis",
142
- $this->_getPid()
143
- ),
144
- Zend_Log::DEBUG, self::LOG_FILE
145
- );
146
- // reset timer
147
- $this->_timeStart = microtime(true);
148
- }
149
- return TRUE;
150
- }
151
- catch (Exception $e) {
152
- Mage::logException($e);
153
- $this->_redis = NULL;
154
- if ($this->_logLevel >= 0) {
155
- Mage::log(
156
- sprintf(
157
- "%s: Unable to connect to Redis; falling back to MySQL handler",
158
- $this->_getPid()
159
- ),
160
- Zend_Log::EMERG, self::LOG_FILE
161
- );
162
- }
163
-
164
- // Fall-back to MySQL handler. If this fails, the file handler will be used.
165
- $this->_useRedis = FALSE;
166
- parent::__construct();
167
- return parent::hasConnection();
168
- }
169
- }
170
-
171
- /**
172
- * Fetch session data
173
- *
174
- * @param string $sessionId
175
- * @return string
176
- */
177
- public function read($sessionId)
178
- {
179
- if ( ! $this->_useRedis) return parent::read($sessionId);
180
-
181
- // Get lock on session. Increment the "lock" field and if the new value is 1, we have the lock.
182
- // If the new value is a multiple of BREAK_MODULO then we are breaking the lock.
183
- $sessionId = self::SESSION_PREFIX.$sessionId;
184
- $tries = $waiting = $lock = 0;
185
- $detectZombies = FALSE;
186
- if ($this->_logLevel >= 7) {
187
- Mage::log(
188
- sprintf(
189
- "%s: Attempting read lock on ID %s",
190
- $this->_getPid(),
191
- $sessionId
192
- ),
193
- Zend_Log::DEBUG, self::LOG_FILE
194
- );
195
- // reset timer
196
- $this->_timeStart = microtime(true);
197
- }
198
- if($this->_dbNum) $this->_redis->select($this->_dbNum);
199
- while(1)
200
- {
201
- // Increment lock value for this session and retrieve the new value
202
- $oldLock = $lock;
203
- $lock = $this->_redis->hIncrBy($sessionId, 'lock', 1);
204
-
205
- // If we got the lock, update with our pid and reset lock and expiration
206
- if ($lock == 1 || ($tries >= $this->_breakAfter && $lock % self::BREAK_MODULO == 0)) {
207
- $setData = array(
208
- 'pid' => $this->_getPid(),
209
- 'lock' => 1,
210
- );
211
-
212
- // Save request data in session so if a lock is broken we can know which page it was for debugging
213
- if ($this->_logLevel >= 6)
214
- {
215
- $additionalDetails = sprintf(
216
- "(%s attempts)",
217
- $tries
218
- );
219
- if ($this->_logLevel >= 7)
220
- {
221
- $additionalDetails = sprintf(
222
- "after %.5f seconds ",
223
- (microtime(true) - $this->_timeStart),
224
- $tries
225
- ) . $additionalDetails;
226
- }
227
- if (empty($_SERVER['REQUEST_METHOD'])) {
228
- $setData['req'] = $_SERVER['SCRIPT_NAME'];
229
- } else {
230
- $setData['req'] = "{$_SERVER['REQUEST_METHOD']} {$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
231
- }
232
- if ($lock != 1) {
233
- Mage::log(
234
- sprintf("%s: Successfully broke lock for ID %s %s. Lock: %s, BREAK_MODULO: %s\nLast request of broken lock: %s",
235
- $this->_getPid(),
236
- $sessionId,
237
- $additionalDetails,
238
- $lock,
239
- self::BREAK_MODULO,
240
- $this->_redis->hGet($sessionId, 'req')
241
- ),
242
- Zend_Log::INFO, self::LOG_FILE
243
- );
244
- }
245
- }
246
- $this->_redis->pipeline()
247
- ->hMSet($sessionId, $setData)
248
- ->expire($sessionId, min($this->getLifeTime(), self::MAX_LIFETIME))
249
- ->exec();
250
- $this->_hasLock = TRUE;
251
- break;
252
- }
253
-
254
- // Otherwise, add to "wait" counter and continue
255
- else if ( ! $waiting) {
256
- $i = 0;
257
- do {
258
- $waiting = $this->_redis->hIncrBy($sessionId, 'wait', 1);
259
- if ($this->_logLevel >= 7) {
260
- Mage::log(
261
- sprintf(
262
- "%s: Waiting for lock on ID %s (%s tries, %s waiting, %.5f seconds elapsed)",
263
- $this->_getPid(),
264
- $sessionId,
265
- $tries,
266
- $waiting,
267
- (microtime(true) - $this->_timeStart)
268
- ),
269
- Zend_Log::DEBUG, self::LOG_FILE
270
- );
271
- }
272
- } while (++$i < $this->_maxConcurrency && $waiting < 1);
273
- }
274
-
275
- // Handle overloaded sessions
276
- else {
277
- // Detect broken sessions (e.g. caused by fatal errors)
278
- if ($detectZombies) {
279
- $detectZombies = FALSE;
280
- if ( $lock > $oldLock // lock shouldn't be less than old lock (another process broke the lock)
281
- && $lock + 1 < $oldLock + $waiting // lock should be old+waiting, otherwise there must be a dead process
282
- ) {
283
- // Reset session to fresh state
284
- if ($this->_logLevel >= 6)
285
- {
286
- Mage::log(
287
- sprintf("%s: Detected zombie waiter after %.5f seconds for ID %s (%s waiting)\n %s (%s - %s)",
288
- $this->_getPid(),
289
- (microtime(true) - $this->_timeStart),
290
- $sessionId, $waiting,
291
- Mage::app()->getRequest()->getRequestUri(), Mage::app()->getRequest()->getClientIp(), Mage::app()->getRequest()->getHeader('User-Agent')
292
- ),
293
- Zend_Log::INFO, self::LOG_FILE
294
- );
295
- }
296
- $waiting = $this->_redis->hIncrBy($sessionId, 'wait', -1);
297
- continue;
298
- }
299
- }
300
-
301
- // Limit concurrent lock waiters to prevent server resource hogging
302
- if ($waiting >= $this->_maxConcurrency) {
303
- // Overloaded sessions get 503 errors
304
- $this->_redis->hIncrBy($sessionId, 'wait', -1);
305
- $this->_sessionWritten = TRUE; // Prevent session from getting written
306
- $writes = $this->_redis->hGet($sessionId, 'writes');
307
- if ($this->_logLevel >= 4)
308
- {
309
- Mage::log(
310
- sprintf("%s: Session concurrency exceeded for ID %s; displaying HTTP 503 (%s waiting, %s total requests)\n %s (%s - %s)",
311
- $this->_getPid(),
312
- $sessionId, $waiting, $writes,
313
- Mage::app()->getRequest()->getRequestUri(), Mage::app()->getRequest()->getClientIp(), Mage::app()->getRequest()->getHeader('User-Agent')
314
- ),
315
- Zend_Log::WARN, self::LOG_FILE
316
- );
317
- }
318
- require_once(Mage::getBaseDir() . DS . 'errors' . DS . '503.php');
319
- exit;
320
- }
321
- }
322
-
323
- $tries++;
324
-
325
- // Detect dead waiters
326
- if ($tries == 1 /* TODO - $tries % 10 == 0 ? */) {
327
- $detectZombies = TRUE;
328
- // TODO: allow configuration of sleep period?
329
- usleep(1500000); // 1.5 seconds
330
- }
331
- // Detect dead processes every 10 seconds
332
- if ($tries % self::DETECT_ZOMBIES == 0) {
333
- if ($this->_logLevel >= 7) {
334
- Mage::log(
335
- sprintf(
336
- "%s: Checking for zombies after %.5f seconds of waiting...",
337
- $this->_getPid(),
338
- (microtime(true) - $this->_timeStart)
339
- ),
340
- Zend_Log::DEBUG, self::LOG_FILE
341
- );
342
- }
343
- $pid = $this->_redis->hGet($sessionId, 'pid');
344
- if ($pid && ! $this->_pidExists($pid)) {
345
- // Allow a live process to get the lock
346
- $this->_redis->hSet($sessionId, 'lock', 0);
347
- if ($this->_logLevel >= 6)
348
- {
349
- Mage::log(
350
- sprintf("%s: Detected zombie process (%s) for %s (%s waiting)\n %s (%s - %s)",
351
- $this->_getPid(),
352
- $pid, $sessionId, $waiting,
353
- Mage::app()->getRequest()->getRequestUri(),
354
- Mage::app()->getRequest()->getClientIp(),
355
- Mage::app()->getRequest()->getHeader('User-Agent')
356
- ),
357
- Zend_Log::INFO, self::LOG_FILE
358
- );
359
- }
360
- continue;
361
- }
362
- }
363
- // Timeout
364
- if ($tries >= $this->_breakAfter+self::FAIL_AFTER) {
365
- $this->_hasLock = FALSE;
366
- if ($this->_logLevel >= 5) {
367
- $additionalDetails = sprintf(
368
- "(%s attempts)",
369
- $tries
370
- );
371
- if ($this->_logLevel >= 7)
372
- {
373
- $additionalDetails = sprintf(
374
- "after %.5f seconds ",
375
- (microtime(true) - $this->_timeStart),
376
- $tries
377
- ) . $additionalDetails;
378
- }
379
- Mage::log(
380
- sprintf(
381
- "%s: Giving up on read lock for ID %s %s",
382
- $this->_getPid(),
383
- $sessionId,
384
- $additionalDetails
385
- ),
386
- Zend_Log::NOTICE, self::LOG_FILE
387
- );
388
- }
389
- break;
390
- }
391
- else {
392
- // TODO: configurable wait period?
393
- sleep(1);
394
- }
395
- }
396
- self::$failedLockAttempts = $tries;
397
-
398
- // This process is no longer waiting for a lock
399
- if ($tries > 0) {
400
- $this->_redis->hIncrBy($sessionId, 'wait', -1);
401
- }
402
-
403
- // Session can be read even if it was not locked by this pid!
404
- $sessionData = $this->_redis->hGet($sessionId, 'data');
405
- if ($this->_logLevel >= 7) {
406
- Mage::log(
407
- sprintf(
408
- "%s: Data read for ID %s after %.5f seconds",
409
- $this->_getPid(),
410
- $sessionId,
411
- (microtime(true) - $this->_timeStart)
412
- ),
413
- Zend_Log::DEBUG, self::LOG_FILE
414
- );
415
- }
416
- return $sessionData ? $this->_decodeData($sessionData) : '';
417
- }
418
-
419
- /**
420
- * Update session
421
- *
422
- * @param string $sessionId
423
- * @param string $sessionData
424
- * @return boolean
425
- */
426
- public function write($sessionId, $sessionData)
427
- {
428
- if ( ! $this->_useRedis) return parent::write($sessionId, $sessionData);
429
- if ($this->_sessionWritten) {
430
- if ($this->_logLevel >= 7) {
431
- Mage::log(
432
- sprintf(
433
- "%s: Repeated session write detected; skipping for ID %s",
434
- $this->_getPid(),
435
- $sessionId
436
- ),
437
- Zend_Log::DEBUG, self::LOG_FILE
438
- );
439
- }
440
- return TRUE;
441
- }
442
- $this->_sessionWritten = TRUE;
443
- if ($this->_logLevel >= 7) {
444
- Mage::log(
445
- sprintf(
446
- "%s: Attempting write to ID %s",
447
- $this->_getPid(),
448
- $sessionId
449
- ),
450
- Zend_Log::DEBUG, self::LOG_FILE
451
- );
452
- // reset timer
453
- $this->_timeStart = microtime(true);
454
- }
455
-
456
- // Do not overwrite the session if it is locked by another pid
457
- try {
458
- if($this->_dbNum) $this->_redis->select($this->_dbNum); // Prevent conflicts with other connections?
459
- $pid = $this->_redis->hGet('sess_'.$sessionId, 'pid'); // PHP Fatal errors cause self::SESSION_PREFIX to not work..
460
- if ( ! $pid || $pid == $this->_getPid()) {
461
- if ($this->_logLevel >= 7) {
462
- Mage::log(
463
- sprintf(
464
- "%s: Write lock obtained on ID %s",
465
- $this->_getPid(),
466
- $sessionId
467
- ),
468
- Zend_Log::DEBUG, self::LOG_FILE
469
- );
470
- }
471
- $this->_writeRawSession($sessionId, $sessionData, $this->getLifeTime());
472
- if ($this->_logLevel >= 7) {
473
- Mage::log(
474
- sprintf(
475
- "%s: Data written to ID %s after %.5f seconds",
476
- $this->_getPid(),
477
- $sessionId,
478
- (microtime(true) - $this->_timeStart)
479
- ),
480
- Zend_Log::DEBUG, self::LOG_FILE
481
- );
482
- }
483
- }
484
- else {
485
- if ($this->_logLevel >= 4) {
486
- if ($this->_hasLock) {
487
- Mage::log(
488
- sprintf("%s: Unable to write session after %.5f seconds, another process took the lock for ID %s",
489
- $this->_getPid(),
490
- (microtime(true) - $this->_timeStart),
491
- $sessionId
492
- ),
493
- Zend_Log::WARN,
494
- self::LOG_FILE
495
- );
496
- } else {
497
- Mage::log(
498
- sprintf("%s: Unable to write session after %.5f seconds, unable to acquire lock on ID %s",
499
- $this->_getPid(),
500
- (microtime(true) - $this->_timeStart),
501
- $sessionId
502
- ),
503
- Zend_Log::WARN,
504
- self::LOG_FILE
505
- );
506
- }
507
- }
508
- }
509
- }
510
- catch(Exception $e) {
511
- if (class_exists('Mage', false)) {
512
- Mage::logException($e);
513
- } else {
514
- error_log("$e");
515
- }
516
- return FALSE;
517
- }
518
- return TRUE;
519
- }
520
-
521
- /**
522
- * Destroy session
523
- *
524
- * @param string $sessionId
525
- * @return boolean
526
- */
527
- public function destroy($sessionId)
528
- {
529
- if ( ! $this->_useRedis) return parent::destroy($sessionId);
530
-
531
- if ($this->_logLevel >= 7) {
532
- Mage::log(
533
- sprintf(
534
- "%s: Destroying ID %s",
535
- $this->_getPid(),
536
- $sessionId
537
- ),
538
- Zend_Log::DEBUG, self::LOG_FILE
539
- );
540
- }
541
- $this->_redis->pipeline();
542
- if($this->_dbNum) $this->_redis->select($this->_dbNum);
543
- $this->_redis->del(self::SESSION_PREFIX.$sessionId);
544
- $this->_redis->exec();
545
- return TRUE;
546
- }
547
-
548
- /**
549
- * Overridden to prevent calling getLifeTime at shutdown
550
- *
551
- * @return bool
552
- */
553
- public function close()
554
- {
555
- if ( ! $this->_useRedis) return parent::close();
556
- if ($this->_logLevel >= 7) {
557
- Mage::log(
558
- sprintf(
559
- "%s: Closing connection",
560
- $this->_getPid()
561
- ),
562
- Zend_Log::DEBUG, self::LOG_FILE
563
- );
564
- }
565
- if ($this->_redis) $this->_redis->close();
566
- return TRUE;
567
- }
568
-
569
- /**
570
- * Garbage collection
571
- *
572
- * @param int $maxLifeTime ignored
573
- * @return boolean
574
- */
575
- public function gc($maxLifeTime)
576
- {
577
- if ( ! $this->_useRedis) return parent::gc($maxLifeTime);
578
- return TRUE;
579
- }
580
-
581
- /**
582
- * @return int|mixed
583
- */
584
- public function getLifeTime()
585
- {
586
- if ($this->_isBot) {
587
- return min(parent::getLifeTime(), $this->_botLifetime);
588
- }
589
- return parent::getLifeTime();
590
- }
591
-
592
- /**
593
- * Public for testing purposes only.
594
- *
595
- * @param string $data
596
- * @return string
597
- */
598
- public function _encodeData($data)
599
- {
600
- $originalDataSize = strlen($data);
601
- if ($this->_compressionThreshold > 0 && $this->_compressionLib != 'none' && $originalDataSize >= $this->_compressionThreshold) {
602
- if ($this->_logLevel >= 7) {
603
- Mage::log(
604
- sprintf(
605
- "%s: Compressing %s bytes with %s",
606
- $this->_getPid(),
607
- $originalDataSize,
608
- $this->_compressionLib
609
- ),
610
- Zend_Log::DEBUG, self::LOG_FILE
611
- );
612
- // reset timer
613
- $this->_timeStart = microtime(true);
614
- }
615
- switch($this->_compressionLib) {
616
- case 'snappy': $data = snappy_compress($data); break;
617
- case 'lzf': $data = lzf_compress($data); break;
618
- case 'gzip': $data = gzcompress($data, 1); break;
619
- }
620
- if($data) {
621
- $data = ':'.substr($this->_compressionLib,0,2).':'.$data;
622
- if ($this->_logLevel >= 7) {
623
- Mage::log(
624
- sprintf(
625
- "%s: Data compressed by %.1f percent in %.5f seconds",
626
- $this->_getPid(),
627
- ($originalDataSize == 0 ? 0 : (100 - (strlen($data) / $originalDataSize * 100))),
628
- (microtime(true) - $this->_timeStart)
629
- ),
630
- Zend_Log::DEBUG, self::LOG_FILE
631
- );
632
- }
633
- } else if ($this->_logLevel >= 4) {
634
- Mage::log(
635
- sprintf("%s: Could not compress session data using %s",
636
- $this->_getPid(),
637
- $this->_compressionLib
638
- ),
639
- Zend_Log::WARN,
640
- self::LOG_FILE
641
- );
642
- }
643
- }
644
- return $data;
645
- }
646
-
647
- /**
648
- * Public for testing purposes only.
649
- *
650
- * @param string $data
651
- * @return string
652
- */
653
- public function _decodeData($data)
654
- {
655
- switch (substr($data,0,4)) {
656
- // asking the data which library it uses allows for transparent changes of libraries
657
- case ':sn:': return snappy_uncompress(substr($data,4));
658
- case ':lz:': return lzf_decompress(substr($data,4));
659
- case ':gz:': return gzuncompress(substr($data,4));
660
- }
661
- return $data;
662
- }
663
-
664
- /**
665
- * Public for testing/import purposes only.
666
- *
667
- * @param $id
668
- * @param $data
669
- * @param $lifetime
670
- * @throws Exception
671
- */
672
- public function _writeRawSession($id, $data, $lifetime)
673
- {
674
- if ( ! $this->_useRedis) {
675
- throw new Exception('Not connected to redis!');
676
- }
677
-
678
- $sessionId = 'sess_' . $id;
679
- $this->_redis->pipeline()
680
- ->select($this->_dbNum)
681
- ->hMSet($sessionId, array(
682
- 'data' => $this->_encodeData($data),
683
- 'lock' => 0, // 0 so that next lock attempt will get 1
684
- ))
685
- ->hIncrBy($sessionId, 'writes', 1) // For informational purposes only
686
- ->expire($sessionId, min($lifetime, 2592000))
687
- ->exec();
688
- }
689
-
690
- /**
691
- * @param string $id
692
- * @return array
693
- * @throws Exception
694
- */
695
- public function _inspectSession($id)
696
- {
697
- if ( ! $this->_useRedis) {
698
- throw new Exception('Not connected to redis!');
699
- }
700
-
701
- $sessionId = 'sess_' . $id;
702
- $this->_redis->select($this->_dbNum);
703
- $data = $this->_redis->hGetAll($sessionId);
704
- if ($data && isset($data['data'])) {
705
- $data['data'] = $this->_decodeData($data['data']);
706
- }
707
- return $data;
708
- }
709
-
710
- /**
711
- * @return string
712
- */
713
- public function _getPid()
714
- {
715
- return gethostname().'|'.getmypid();
716
- }
717
-
718
- /**
719
- * @param $pid
720
- * @return bool
721
- */
722
- public function _pidExists($pid)
723
- {
724
- list($host,$pid) = explode('|', $pid);
725
- if (PHP_OS != 'Linux' || $host != gethostname()) {
726
- return TRUE;
727
- }
728
- return @file_exists('/proc/'.$pid);
729
- }
730
-
731
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Cm/RedisSession/etc/config.xml DELETED
@@ -1,16 +0,0 @@
1
- <config>
2
- <modules>
3
- <Cm_RedisSession>
4
- <version>0.2</version>
5
- </Cm_RedisSession>
6
- </modules>
7
- <global>
8
- <models>
9
- <core_mysql4>
10
- <rewrite>
11
- <session>Cm_RedisSession_Model_Session</session>
12
- </rewrite>
13
- </core_mysql4>
14
- </models>
15
- </global>
16
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Block/Form.php DELETED
@@ -1,93 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Block_Form extends Mage_Payment_Block_Form
21
- {
22
- /**
23
- * Available locales for content URL generation
24
- *
25
- * @var array
26
- */
27
- protected $_supportedInfoLocales = array('de');
28
-
29
- /**
30
- * Default locale for content URL generation
31
- *
32
- * @var string
33
- */
34
- protected $_defaultInfoLocale = 'en';
35
-
36
- /**
37
- * Constructor. Set template.
38
- */
39
- protected function _construct()
40
- {
41
- parent::_construct();
42
- $this->setTemplate('moneybookers/form.phtml');
43
- }
44
-
45
- /**
46
- * Return payment logo image src
47
- *
48
- * @param string $payment Payment Code
49
- * @return string|bool
50
- */
51
- public function getPaymentImageSrc($payment)
52
- {
53
- if ($payment == 'moneybookers_obt') {
54
- $payment .= '_'.$this->getInfoLocale();
55
- }
56
-
57
- $imageFilename = Mage::getDesign()
58
- ->getFilename('images' . DS . 'moneybookers' . DS . $payment, array('_type' => 'skin'));
59
-
60
- if (file_exists($imageFilename . '.png')) {
61
- return $this->getSkinUrl('images/moneybookers/' . $payment . '.png');
62
- } else if (file_exists($imageFilename . '.gif')) {
63
- return $this->getSkinUrl('images/moneybookers/' . $payment . '.gif');
64
- }
65
-
66
- return false;
67
- }
68
-
69
- /**
70
- * Return supported locale for information text
71
- *
72
- * @return string
73
- */
74
- public function getInfoLocale()
75
- {
76
- $locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
77
- if (!in_array($locale, $this->_supportedInfoLocales)) {
78
- $locale = $this->_defaultInfoLocale;
79
- }
80
- return $locale;
81
- }
82
-
83
- /**
84
- * Return info URL for eWallet payment
85
- *
86
- * @return string
87
- */
88
- public function getWltInfoUrl()
89
- {
90
- $locale = substr(Mage::app()->getLocale()->getLocaleCode(), 0 ,2);
91
- return 'http://www.moneybookers.com/app/?l=' . strtoupper($locale);
92
- }
93
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Block/Info.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Block_Info extends Mage_Payment_Block_Info
21
- {
22
- /**
23
- * Constructor. Set template.
24
- */
25
- protected function _construct()
26
- {
27
- parent::_construct();
28
- $this->setTemplate('moneybookers/info.phtml');
29
- }
30
-
31
- /**
32
- * Returns code of payment method
33
- *
34
- * @return string
35
- */
36
- public function getMethodCode()
37
- {
38
- return $this->getInfo()->getMethodInstance()->getCode();
39
- }
40
-
41
- /**
42
- * Build PDF content of info block
43
- *
44
- * @return string
45
- */
46
- public function toPdf()
47
- {
48
- $this->setTemplate('moneybookers/pdf/info.phtml');
49
- return $this->toHtml();
50
- }
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Block/Jsinit.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Block_Jsinit extends Mage_Adminhtml_Block_Template
21
- {
22
- /**
23
- * Include JS in head if section is moneybookers
24
- */
25
- protected function _prepareLayout()
26
- {
27
- $section = $this->getAction()->getRequest()->getParam('section', false);
28
- if ($section == 'moneybookers') {
29
- $this->getLayout()
30
- ->getBlock('head')
31
- ->addJs('mage/adminhtml/moneybookers.js');
32
- }
33
- parent::_prepareLayout();
34
- }
35
-
36
- /**
37
- * Print init JS script into body
38
- * @return string
39
- */
40
- protected function _toHtml()
41
- {
42
- $section = $this->getAction()->getRequest()->getParam('section', false);
43
- if ($section == 'moneybookers') {
44
- return parent::_toHtml();
45
- } else {
46
- return '';
47
- }
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Block/Payment.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Block_Payment extends Mage_Core_Block_Template
21
- {
22
- /**
23
- * Return Payment logo src
24
- *
25
- * @return string
26
- */
27
- public function getMoneybookersLogoSrc()
28
- {
29
- $locale = Mage::getModel('moneybookers/acc')->getLocale();
30
- $logoFilename = Mage::getDesign()
31
- ->getFilename('images' . DS . 'moneybookers' . DS . 'banner_120_' . $locale . '.gif', array('_type' => 'skin'));
32
-
33
- if (file_exists($logoFilename)) {
34
- return $this->getSkinUrl('images/moneybookers/banner_120_'.$locale.'.gif');
35
- }
36
-
37
- return $this->getSkinUrl('images/moneybookers/banner_120_int.gif');
38
- }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Block/Placeform.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Block_Placeform extends Mage_Core_Block_Template
21
- {
22
- /**
23
- * Return checkout session instance
24
- *
25
- * @return Mage_Checkout_Model_Session
26
- */
27
- protected function _getCheckout()
28
- {
29
- return Mage::getSingleton('checkout/session');
30
- }
31
-
32
- /**
33
- * Return order instance
34
- *
35
- * @return Mage_Sales_Model_Order|null
36
- */
37
- protected function _getOrder()
38
- {
39
- if ($this->getOrder()) {
40
- return $this->getOrder();
41
- } elseif ($orderIncrementId = $this->_getCheckout()->getLastRealOrderId()) {
42
- return Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
43
- } else {
44
- return null;
45
- }
46
- }
47
-
48
- /**
49
- * Get Form data by using ogone payment api
50
- *
51
- * @return array
52
- */
53
- public function getFormData()
54
- {
55
- return $this->_getOrder()->getPayment()->getMethodInstance()->getFormFields();
56
- }
57
-
58
- /**
59
- * Getting gateway url
60
- *
61
- * @return string
62
- */
63
- public function getFormAction()
64
- {
65
- return $this->_getOrder()->getPayment()->getMethodInstance()->getUrl();
66
- }
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Block/Redirect.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Block_Redirect extends Mage_Core_Block_Template
21
- {
22
- /**
23
- * Constructor. Set template.
24
- */
25
- protected function _construct()
26
- {
27
- parent::_construct();
28
- $this->setTemplate('moneybookers/redirect.phtml');
29
- }
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Helper/Data.php DELETED
@@ -1,130 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Helper_Data extends Mage_Payment_Helper_Data
21
- {
22
- const XML_PATH_EMAIL = 'moneybookers/settings/moneybookers_email';
23
- const XML_PATH_CUSTOMER_ID = 'moneybookers/settings/customer_id';
24
- const XML_PATH_SECRET_KEY = 'moneybookers/settings/secret_key';
25
-
26
- /**
27
- * Internal parameters for validation
28
- */
29
- protected $_moneybookersServer = 'https://www.moneybookers.com';
30
- protected $_checkEmailUrl = '/app/email_check.pl';
31
- protected $_checkEmailCustId = '6999315';
32
- protected $_checkEmailPassword = 'a4ce5a98a8950c04a3d34a2e2cb8c89f';
33
- protected $_checkSecretUrl = '/app/secret_word_check.pl';
34
- protected $_activationEmailTo = 'ecommerce@moneybookers.com';
35
- protected $_activationEmailSubject = 'Magento Moneybookers Activation';
36
- protected $_moneybookersMasterCustId = '7283403';
37
- protected $_moneybookersMasterSecretHash = 'c18524b6b1082653039078a4700367f0';
38
-
39
- /**
40
- * Send activation Email to Moneybookers
41
- */
42
- public function activateEmail()
43
- {
44
- $storeId = Mage::app()->getStore()->getId();
45
-
46
- $translate = Mage::getSingleton('core/translate');
47
- /* @var $translate Mage_Core_Model_Translate */
48
- $translate->setTranslateInline(false);
49
-
50
- Mage::getModel('core/email_template')
51
- ->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
52
- ->sendTransactional(
53
- 'moneybookers_activateemail',
54
- Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId),
55
- $this->_activationEmailTo,
56
- null,
57
- array(
58
- 'subject' => $this->_activationEmailSubject,
59
- 'email_addr' => Mage::getStoreConfig(self::XML_PATH_EMAIL),
60
- 'url' => Mage::getBaseUrl(),
61
- 'customer_id' => Mage::getStoreConfig(self::XML_PATH_CUSTOMER_ID),
62
- 'language' => Mage::getModel('core/locale')->getDefaultLocale()
63
- )
64
- );
65
-
66
- $translate->setTranslateInline(true);
67
- }
68
-
69
- /**
70
- * Check if email is registered at Moneybookers
71
- *
72
- * @param array $params
73
- * @return array
74
- */
75
- public function checkEmailRequest(Array $params) {
76
- $response = null;
77
- try {
78
- $response = $this->_getHttpsPage($this->_moneybookersServer . $this->_checkEmailUrl, array(
79
- 'email' => $params['email'],
80
- 'cust_id' => $this->_checkEmailCustId,
81
- 'password' => $this->_checkEmailPassword)
82
- );
83
- } catch (Exception $e) {
84
- Mage::log($e->getMessage());
85
- return null;
86
- }
87
- return $response;
88
- }
89
-
90
- /**
91
- * Check if entered secret is valid
92
- * @param array $params
93
- * @return array
94
- */
95
- public function checkSecretRequest(Array $params)
96
- {
97
- $response = null;
98
- try {
99
- $response = $this->_getHttpsPage($this->_moneybookersServer . $this->_checkSecretUrl, array(
100
- 'email' => $params['email'],
101
- 'secret' => md5(md5($params['secret']) . $this->_moneybookersMasterSecretHash),
102
- 'cust_id' => $this->_moneybookersMasterCustId)
103
- );
104
- } catch (Exception $e) {
105
- Mage::log($e->getMessage());
106
- return null;
107
- }
108
- return $response;
109
- }
110
-
111
- /**
112
- * Reading a page via HTTPS and returning its content.
113
- */
114
- protected function _getHttpsPage($host, $parameter)
115
- {
116
- $client = new Varien_Http_Client();
117
- $client->setUri($host)
118
- ->setConfig(array('timeout' => 30))
119
- ->setHeaders('accept-encoding', '')
120
- ->setParameterGet($parameter)
121
- ->setMethod(Zend_Http_Client::GET);
122
- $request = $client->request();
123
- // Workaround for pseudo chunked messages which are yet too short, so
124
- // only an exception is is thrown instead of returning raw body
125
- if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $request->getRawBody(), $m))
126
- return $request->getRawBody();
127
-
128
- return $request->getBody();
129
- }
130
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Abstract.php DELETED
@@ -1,208 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- abstract class Phoenix_Moneybookers_Model_Abstract extends Mage_Payment_Model_Method_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_abstract';
26
-
27
- protected $_formBlockType = 'moneybookers/form';
28
- protected $_infoBlockType = 'moneybookers/info';
29
-
30
- /**
31
- * Availability options
32
- */
33
- protected $_isGateway = true;
34
- protected $_canAuthorize = true;
35
- protected $_canCapture = true;
36
- protected $_canCapturePartial = false;
37
- protected $_canRefund = false;
38
- protected $_canVoid = false;
39
- protected $_canUseInternal = false;
40
- protected $_canUseCheckout = true;
41
- protected $_canUseForMultishipping = false;
42
-
43
- protected $_paymentMethod = 'abstract';
44
- protected $_defaultLocale = 'en';
45
- protected $_supportedLocales = array('cn', 'cz', 'da', 'en', 'es', 'fi', 'de', 'fr', 'gr', 'it', 'nl', 'ro', 'ru', 'pl', 'sv', 'tr');
46
- protected $_hidelogin = '1';
47
-
48
- protected $_order;
49
-
50
- /**
51
- * Get order model
52
- *
53
- * @return Mage_Sales_Model_Order
54
- */
55
- public function getOrder()
56
- {
57
- if (!$this->_order) {
58
- $this->_order = $this->getInfoInstance()->getOrder();
59
- }
60
- return $this->_order;
61
- }
62
-
63
- /**
64
- * Return url for redirection after order placed
65
- * @return string
66
- */
67
- public function getOrderPlaceRedirectUrl()
68
- {
69
- return Mage::getUrl('moneybookers/processing/payment');
70
- }
71
-
72
- /**
73
- * Capture payment through Moneybookers api
74
- *
75
- * @param Varien_Object $payment
76
- * @param decimal $amount
77
- * @return Phoenix_Moneybookers_Model_Abstract
78
- */
79
- public function capture(Varien_Object $payment, $amount)
80
- {
81
- $payment->setStatus(self::STATUS_APPROVED)
82
- ->setTransactionId($this->getTransactionId())
83
- ->setIsTransactionClosed(0);
84
-
85
- return $this;
86
- }
87
-
88
- /**
89
- * Camcel payment
90
- *
91
- * @param Varien_Object $payment
92
- * @return Phoenix_Moneybookers_Model_Abstract
93
- */
94
- public function cancel(Varien_Object $payment)
95
- {
96
- $payment->setStatus(self::STATUS_DECLINED)
97
- ->setTransactionId($this->getTransactionId())
98
- ->setIsTransactionClosed(1);
99
-
100
- return $this;
101
- }
102
-
103
- /**
104
- * Return url of payment method
105
- *
106
- * @return string
107
- */
108
- public function getUrl()
109
- {
110
- return 'https://www.moneybookers.com/app/payment.pl';
111
- }
112
-
113
- /**
114
- * Return url of payment method
115
- *
116
- * @return string
117
- */
118
- public function getLocale()
119
- {
120
- $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
121
- if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLocales)) {
122
- return $locale[0];
123
- }
124
- return $this->getDefaultLocale();
125
- }
126
-
127
- /**
128
- * prepare params array to send it to gateway page via POST
129
- *
130
- * @return array
131
- */
132
- public function getFormFields()
133
- {
134
- $order_id = $this->getOrder()->getRealOrderId();
135
- $billing = $this->getOrder()->getBillingAddress();
136
- if ($this->getOrder()->getBillingAddress()->getEmail()) {
137
- $email = $this->getOrder()->getBillingAddress()->getEmail();
138
- } else {
139
- $email = $this->getOrder()->getCustomerEmail();
140
- }
141
-
142
- $params = array(
143
- 'merchant_fields' => 'partner',
144
- 'partner' => 'magento',
145
- 'pay_to_email' => Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_EMAIL),
146
- 'transaction_id' => $order_id,
147
- 'return_url' => Mage::getUrl('moneybookers/processing/success', array('transaction_id' => $order_id)),
148
- 'cancel_url' => Mage::getUrl('moneybookers/processing/cancel', array('transaction_id' => $order_id)),
149
- 'status_url' => Mage::getUrl('moneybookers/processing/status'),
150
- 'language' => $this->getLocale(),
151
- 'amount' => round($this->getOrder()->getGrandTotal(), 2),
152
- 'currency' => $this->getOrder()->getOrderCurrencyCode(),
153
- 'recipient_description' => $this->getOrder()->getStore()->getWebsite()->getName(),
154
- 'firstname' => $billing->getFirstname(),
155
- 'lastname' => $billing->getLastname(),
156
- 'address' => $billing->getStreet(-1),
157
- 'postal_code' => $billing->getPostcode(),
158
- 'city' => $billing->getCity(),
159
- 'country' => $billing->getCountryModel()->getIso3Code(),
160
- 'pay_from_email' => $email,
161
- 'phone_number' => $billing->getTelephone(),
162
- 'detail1_description' => Mage::helper('moneybookers')->__('Order ID'),
163
- 'detail1_text' => $order_id,
164
- 'payment_methods' => $this->_paymentMethod,
165
- 'hide_login' => $this->_hidelogin,
166
- 'new_window_redirect' => '1'
167
- );
168
-
169
- // add optional day of birth
170
- if ($billing->getDob()) {
171
- $params['date_of_birth'] = Mage::app()->getLocale()->date($billing->getDob(), null, null, false)->toString('dmY');
172
- }
173
-
174
- return $params;
175
- }
176
- /**
177
- * Get initialized flag status
178
- * @return true
179
- */
180
- public function isInitializeNeeded()
181
- {
182
- return true;
183
- }
184
-
185
- /**
186
- * Instantiate state and set it to state onject
187
- * //@param
188
- * //@param
189
- */
190
- public function initialize($paymentAction, $stateObject)
191
- {
192
- $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
193
- $stateObject->setState($state);
194
- $stateObject->setStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
195
- $stateObject->setIsNotified(false);
196
- }
197
-
198
- /**
199
- * Get config action to process initialization
200
- *
201
- * @return string
202
- */
203
- public function getConfigPaymentAction()
204
- {
205
- $paymentAction = $this->getConfigData('payment_action');
206
- return empty($paymentAction) ? true : $paymentAction;
207
- }
208
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Acc.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Acc extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_acc';
26
- protected $_paymentMethod = 'ACC';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Csi.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Csi extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_csi';
26
- protected $_paymentMethod = 'CSI';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Did.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Did extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_did';
26
- protected $_paymentMethod = 'DID';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Dnk.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Dnk extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_dnk';
26
- protected $_paymentMethod = 'DNK';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Ebt.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Ebt extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_ebt';
26
- protected $_paymentMethod = 'EBT';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Ent.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Ent extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_ent';
26
- protected $_paymentMethod = 'ENT';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Event.php DELETED
@@ -1,270 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /**
22
- * Moneybookers notification processor model
23
- */
24
- class Phoenix_Moneybookers_Model_Event
25
- {
26
- const MONEYBOOKERS_STATUS_FAIL = -2;
27
- const MONEYBOOKERS_STATUS_CANCEL = -1;
28
- const MONEYBOOKERS_STATUS_PENDING = 0;
29
- const MONEYBOOKERS_STATUS_SUCCESS = 2;
30
-
31
- /*
32
- * @param Mage_Sales_Model_Order
33
- */
34
- protected $_order = null;
35
-
36
- /**
37
- * Event request data
38
- * @var array
39
- */
40
- protected $_eventData = array();
41
-
42
- /**
43
- * Enent request data setter
44
- * @param array $data
45
- * @return Phoenix_Moneybookers_Model_Event
46
- */
47
- public function setEventData(array $data)
48
- {
49
- $this->_eventData = $data;
50
- return $this;
51
- }
52
-
53
- /**
54
- * Event request data getter
55
- * @param string $key
56
- * @return array|string
57
- */
58
- public function getEventData($key = null)
59
- {
60
- if (null === $key) {
61
- return $this->_eventData;
62
- }
63
- return isset($this->_eventData[$key]) ? $this->_eventData[$key] : null;
64
- }
65
-
66
- /**
67
- * Get singleton of Checkout Session Model
68
- *
69
- * @return Mage_Checkout_Model_Session
70
- */
71
- protected function _getCheckout()
72
- {
73
- return Mage::getSingleton('checkout/session');
74
- }
75
-
76
- /**
77
- * Process status notification from Monebookers server
78
- *
79
- * @return String
80
- */
81
- public function processStatusEvent()
82
- {
83
- try {
84
- $params = $this->_validateEventData();
85
- $msg = '';
86
- switch($params['status']) {
87
- case self::MONEYBOOKERS_STATUS_FAIL: //fail
88
- $msg = Mage::helper('moneybookers')->__('Payment failed.');
89
- $this->_processCancel($msg);
90
- break;
91
- case self::MONEYBOOKERS_STATUS_CANCEL: //cancel
92
- $msg = Mage::helper('moneybookers')->__('Payment was canceled.');
93
- $this->_processCancel($msg);
94
- break;
95
- case self::MONEYBOOKERS_STATUS_PENDING: //pending
96
- $msg = Mage::helper('moneybookers')->__('Pending bank transfer created.');
97
- $this->_processSale($params['status'], $msg);
98
- break;
99
- case self::MONEYBOOKERS_STATUS_SUCCESS: //ok
100
- $msg = Mage::helper('moneybookers')->__('The amount has been authorized and captured by Moneybookers.');
101
- $this->_processSale($params['status'], $msg);
102
- break;
103
- }
104
- return $msg;
105
- } catch (Mage_Core_Exception $e) {
106
- return $e->getMessage();
107
- } catch(Exception $e) {
108
- Mage::logException($e);
109
- }
110
- return;
111
- }
112
-
113
- /**
114
- * Process cancelation
115
- */
116
- public function cancelEvent() {
117
- try {
118
- $this->_validateEventData(false);
119
- $this->_processCancel('Payment was canceled.');
120
- return Mage::helper('moneybookers')->__('The order has been canceled.');
121
- } catch (Mage_Core_Exception $e) {
122
- return $e->getMessage();
123
- } catch(Exception $e) {
124
- Mage::logException($e);
125
- }
126
- return '';
127
- }
128
-
129
- /**
130
- * Validate request and return QuoteId
131
- * Can throw Mage_Core_Exception and Exception
132
- *
133
- * @return int
134
- */
135
- public function successEvent(){
136
- $this->_validateEventData(false);
137
- return $this->_order->getQuoteId();
138
- }
139
-
140
- /**
141
- * Processed order cancelation
142
- * @param string $msg Order history message
143
- */
144
- protected function _processCancel($msg)
145
- {
146
- $this->_order->cancel();
147
- $this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_CANCELED, $msg);
148
- $this->_order->save();
149
- }
150
-
151
- /**
152
- * Processes payment confirmation, creates invoice if necessary, updates order status,
153
- * sends order confirmation to customer
154
- * @param string $msg Order history message
155
- */
156
- protected function _processSale($status, $msg)
157
- {
158
- switch ($status) {
159
- case self::MONEYBOOKERS_STATUS_SUCCESS:
160
- $this->_createInvoice();
161
- $this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $msg);
162
- // save transaction ID
163
- $this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id'));
164
- // send new order email
165
- $this->_order->sendNewOrderEmail();
166
- $this->_order->setEmailSent(true);
167
- break;
168
- case self::MONEYBOOKERS_STATUS_PENDING:
169
- $this->_order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, $msg);
170
- // save transaction ID
171
- $this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id'));
172
- break;
173
- }
174
- $this->_order->save();
175
- }
176
-
177
- /**
178
- * Builds invoice for order
179
- */
180
- protected function _createInvoice()
181
- {
182
- if (!$this->_order->canInvoice()) {
183
- return;
184
- }
185
- $invoice = $this->_order->prepareInvoice();
186
- $invoice->register()->capture();
187
- $this->_order->addRelatedObject($invoice);
188
- }
189
-
190
- /**
191
- * Checking returned parameters
192
- * Thorws Mage_Core_Exception if error
193
- * @param bool $fullCheck Whether to make additional validations such as payment status, transaction signature etc.
194
- *
195
- * @return array $params request params
196
- */
197
- protected function _validateEventData($fullCheck = true)
198
- {
199
- // get request variables
200
- $params = $this->_eventData;
201
- if (empty($params)) {
202
- Mage::throwException('Request does not contain any elements.');
203
- }
204
-
205
- // check order ID
206
- if (empty($params['transaction_id'])
207
- || ($fullCheck == false && $this->_getCheckout()->getMoneybookersRealOrderId() != $params['transaction_id'])
208
- ) {
209
- Mage::throwException('Missing or invalid order ID.');
210
- }
211
- // load order for further validation
212
- $this->_order = Mage::getModel('sales/order')->loadByIncrementId($params['transaction_id']);
213
- if (!$this->_order->getId()) {
214
- Mage::throwException('Order not found.');
215
- }
216
-
217
- if (0 !== strpos($this->_order->getPayment()->getMethodInstance()->getCode(), 'moneybookers_')) {
218
- Mage::throwException('Unknown payment method.');
219
- }
220
-
221
- // make additional validation
222
- if ($fullCheck) {
223
- // check payment status
224
- if (empty($params['status'])) {
225
- Mage::throwException('Unknown payment status.');
226
- }
227
-
228
- // check transaction signature
229
- if (empty($params['md5sig'])) {
230
- Mage::throwException('Invalid transaction signature.');
231
- }
232
-
233
- $checkParams = array('merchant_id', 'transaction_id', 'secret', 'mb_amount', 'mb_currency', 'status');
234
- $md5String = '';
235
- foreach ($checkParams as $key) {
236
- if ($key == 'merchant_id') {
237
- $md5String .= Mage::getStoreConfig(Phoenix_Moneybookers_Helper_Data::XML_PATH_CUSTOMER_ID,
238
- $this->_order->getStoreId()
239
- );
240
- } elseif ($key == 'secret') {
241
- $secretKey = Mage::getStoreConfig(
242
- Phoenix_Moneybookers_Helper_Data::XML_PATH_SECRET_KEY,
243
- $this->_order->getStoreId()
244
- );
245
-
246
- if (empty($secretKey)) {
247
- Mage::throwException('Secret key is empty.');
248
- }
249
-
250
- $md5String .= strtoupper(md5($secretKey));
251
- } elseif (isset($params[$key])) {
252
- $md5String .= $params[$key];
253
- }
254
- }
255
- $md5String = strtoupper(md5($md5String));
256
-
257
- if ($md5String != $params['md5sig']) {
258
- Mage::throwException('Hash is not valid.');
259
- }
260
-
261
- // check transaction amount if currency matches
262
- if ($this->_order->getOrderCurrencyCode() == $params['mb_currency']) {
263
- if (round($this->_order->getGrandTotal(), 2) != $params['mb_amount']) {
264
- Mage::throwException('Transaction amount does not match.');
265
- }
266
- }
267
- }
268
- return $params;
269
- }
270
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Gcb.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Gcb extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_gcb';
26
- protected $_paymentMethod = 'GCB';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Gir.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Gir extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_gir';
26
- protected $_paymentMethod = 'GIR';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Idl.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Idl extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_idl';
26
- protected $_paymentMethod = 'IDL';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Lsr.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Lsr extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_lsr';
26
- protected $_paymentMethod = 'LSR';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Mae.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Mae extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_mae';
26
- protected $_paymentMethod = 'MAE';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Npy.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Npy extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_npy';
26
- protected $_paymentMethod = 'NPY';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Obt.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Obt extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_obt';
26
- protected $_paymentMethod = 'OBT';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Pli.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Pli extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_pli';
26
- protected $_paymentMethod = 'PLI';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Psp.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Psp extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_psp';
26
- protected $_paymentMethod = 'PSP';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Pwy.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Pwy extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_pwy';
26
- protected $_paymentMethod = 'PWY';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Sft.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Sft extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_sft';
26
- protected $_paymentMethod = 'SFT';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/So2.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_So2 extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_so2';
26
- protected $_paymentMethod = 'SO2';
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/Model/Wlt.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_Model_Wlt extends Phoenix_Moneybookers_Model_Abstract
21
- {
22
- /**
23
- * unique internal payment method identifier
24
- */
25
- protected $_code = 'moneybookers_wlt';
26
- protected $_paymentMethod = 'WLT';
27
- protected $_hidelogin = '0';
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/controllers/MoneybookersController.php DELETED
@@ -1,87 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_MoneybookersController extends Mage_Adminhtml_Controller_Action
21
- {
22
- /**
23
- * Retrieve Moneybookers helper
24
- *
25
- * @return Phoenix_Moneybookers_Helper_Data
26
- */
27
- protected function _getHelper()
28
- {
29
- return Mage::helper('moneybookers');
30
- }
31
-
32
- /**
33
- * Send activation Email to Moneybookers
34
- */
35
- public function activateemailAction()
36
- {
37
- $this->_getHelper()->activateEmail();
38
- }
39
-
40
- /**
41
- * Check if email is registered at Moneybookers
42
- */
43
- public function checkemailAction()
44
- {
45
- try {
46
- $params = $this->getRequest()->getParams();
47
- if (empty($params['email'])) {
48
- Mage::throwException('Error: No parameters specified');
49
- }
50
- $response = $this->_getHelper()->checkEmailRequest($params);
51
- if (empty($response)) {
52
- Mage::throwException('Error: Connection to moneybookers.com failed');
53
- }
54
- $this->getResponse()->setBody($response);
55
- return;
56
- } catch (Mage_Core_Exception $e) {
57
- $response = $e->getMessage();
58
- } catch (Exception $e) {
59
- $response = 'Error: System error during request';
60
- }
61
- $this->getResponse()->setBody($response);
62
- }
63
-
64
- /**
65
- * Check if entered secret is valid
66
- */
67
- public function checksecretAction()
68
- {
69
- try {
70
- $params = $this->getRequest()->getParams();
71
- if (empty($params['email']) || empty($params['secret'])) {
72
- Mage::throwException('Error: No parameters specified');
73
- }
74
- $response = $this->_getHelper()->checkSecretRequest($params);
75
- if (empty($response)) {
76
- Mage::throwException('Error: Connection to moneybookers.com failed');
77
- }
78
- $this->getResponse()->setBody($response);
79
- return;
80
- } catch (Mage_Core_Exception $e) {
81
- $response = $e->getMessage();
82
- } catch (Exception $e) {
83
- $response = 'Error: System error during request';
84
- }
85
- $this->getResponse()->setBody($response);
86
- }
87
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php DELETED
@@ -1,146 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
- class Phoenix_Moneybookers_ProcessingController extends Mage_Core_Controller_Front_Action
21
- {
22
- /**
23
- * Get singleton of Checkout Session Model
24
- *
25
- * @return Mage_Checkout_Model_Session
26
- */
27
- protected function _getCheckout()
28
- {
29
- return Mage::getSingleton('checkout/session');
30
- }
31
-
32
- /**
33
- * Iframe page which submits the payment data to Moneybookers.
34
- */
35
- public function placeformAction()
36
- {
37
- $this->loadLayout();
38
- $this->renderLayout();
39
- }
40
-
41
- /**
42
- * Show orderPlaceRedirect page which contains the Moneybookers iframe.
43
- */
44
- public function paymentAction()
45
- {
46
- try {
47
- $session = $this->_getCheckout();
48
-
49
- $order = Mage::getModel('sales/order');
50
- $order->loadByIncrementId($session->getLastRealOrderId());
51
- if (!$order->getId()) {
52
- Mage::throwException('No order for processing found');
53
- }
54
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
55
- Mage::helper('moneybookers')->__('The customer was redirected to Moneybookers.')
56
- );
57
- $order->save();
58
-
59
- $session->setMoneybookersQuoteId($session->getQuoteId());
60
- $session->setMoneybookersRealOrderId($session->getLastRealOrderId());
61
- $session->getQuote()->setIsActive(false)->save();
62
- $session->clear();
63
-
64
- $this->loadLayout();
65
- $this->renderLayout();
66
- } catch (Exception $e){
67
- Mage::logException($e);
68
- parent::_redirect('checkout/cart');
69
- }
70
- }
71
-
72
- /**
73
- * Action to which the customer will be returned when the payment is made.
74
- */
75
- public function successAction()
76
- {
77
- $event = Mage::getModel('moneybookers/event')
78
- ->setEventData($this->getRequest()->getParams());
79
- try {
80
- $quoteId = $event->successEvent();
81
- $this->_getCheckout()->setLastSuccessQuoteId($quoteId);
82
- $this->_redirect('checkout/onepage/success');
83
- return;
84
- } catch (Mage_Core_Exception $e) {
85
- $this->_getCheckout()->addError($e->getMessage());
86
- } catch(Exception $e) {
87
- Mage::logException($e);
88
- }
89
- $this->_redirect('checkout/cart');
90
- }
91
-
92
- /**
93
- * Action to which the customer will be returned if the payment process is
94
- * cancelled.
95
- * Cancel order and redirect user to the shopping cart.
96
- */
97
- public function cancelAction()
98
- {
99
- $event = Mage::getModel('moneybookers/event')
100
- ->setEventData($this->getRequest()->getParams());
101
- $message = $event->cancelEvent();
102
-
103
- // set quote to active
104
- $session = $this->_getCheckout();
105
- if ($quoteId = $session->getMoneybookersQuoteId()) {
106
- $quote = Mage::getModel('sales/quote')->load($quoteId);
107
- if ($quote->getId()) {
108
- $quote->setIsActive(true)->save();
109
- $session->setQuoteId($quoteId);
110
- }
111
- }
112
-
113
- $session->addError($message);
114
- $this->_redirect('checkout/cart');
115
- }
116
-
117
- /**
118
- * Action to which the transaction details will be posted after the payment
119
- * process is complete.
120
- */
121
- public function statusAction()
122
- {
123
- $event = Mage::getModel('moneybookers/event')
124
- ->setEventData($this->getRequest()->getParams());
125
- $message = $event->processStatusEvent();
126
- $this->getResponse()->setBody($message);
127
- }
128
-
129
- /**
130
- * Set redirect into responce. This has to be encapsulated in an JavaScript
131
- * call to jump out of the iframe.
132
- *
133
- * @param string $path
134
- * @param array $arguments
135
- */
136
- protected function _redirect($path, $arguments=array())
137
- {
138
- $this->getResponse()->setBody(
139
- $this->getLayout()
140
- ->createBlock('moneybookers/redirect')
141
- ->setRedirectUrl(Mage::getUrl($path, $arguments))
142
- ->toHtml()
143
- );
144
- return $this;
145
- }
146
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/etc/config.xml DELETED
@@ -1,306 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * @category Phoenix
17
- * @package Phoenix_Moneybookers
18
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
- -->
22
- <config>
23
- <modules>
24
- <Phoenix_Moneybookers>
25
- <version>1.6.0.0</version>
26
- </Phoenix_Moneybookers>
27
- </modules>
28
- <global>
29
- <models>
30
- <moneybookers>
31
- <class>Phoenix_Moneybookers_Model</class>
32
- </moneybookers>
33
- </models>
34
- <helpers>
35
- <moneybookers>
36
- <class>Phoenix_Moneybookers_Helper</class>
37
- </moneybookers>
38
- </helpers>
39
- <resources>
40
- <moneybookers_setup>
41
- <setup>
42
- <module>Phoenix_Moneybookers</module>
43
- </setup>
44
- </moneybookers_setup>
45
- </resources>
46
- <blocks>
47
- <moneybookers><class>Phoenix_Moneybookers_Block</class></moneybookers>
48
- </blocks>
49
- <template>
50
- <email>
51
- <moneybookers_activateemail>
52
- <label>Moneybookers activate email</label>
53
- <file>moneybookers_activateemail.html</file>
54
- <type>html</type>
55
- </moneybookers_activateemail>
56
- </email>
57
- </template>
58
- <payment>
59
- <groups>
60
- <mbookers>Moneybookers</mbookers>
61
- </groups>
62
- </payment>
63
- </global>
64
- <frontend>
65
- <secure_url>
66
- <moneybookers_processing>/moneybookers/processing</moneybookers_processing>
67
- </secure_url>
68
- <routers>
69
- <moneybookers>
70
- <use>standard</use>
71
- <args>
72
- <module>Phoenix_Moneybookers</module>
73
- <frontName>moneybookers</frontName>
74
- </args>
75
- </moneybookers>
76
- </routers>
77
- <translate>
78
- <modules>
79
- <Phoenix_Moneybookers>
80
- <files>
81
- <default>Phoenix_Moneybookers.csv</default>
82
- </files>
83
- </Phoenix_Moneybookers>
84
- </modules>
85
- </translate>
86
- <layout>
87
- <updates>
88
- <moneybookers>
89
- <file>moneybookers.xml</file>
90
- </moneybookers>
91
- </updates>
92
- </layout>
93
- </frontend>
94
- <admin>
95
- <routers>
96
- <adminhtml>
97
- <args>
98
- <modules>
99
- <moneybookers after="Mage_Adminhtml">Phoenix_Moneybookers</moneybookers>
100
- </modules>
101
- </args>
102
- </adminhtml>
103
- </routers>
104
- </admin>
105
- <adminhtml>
106
- <translate>
107
- <modules>
108
- <Phoenix_Moneybookers>
109
- <files>
110
- <default>Phoenix_Moneybookers.csv</default>
111
- </files>
112
- </Phoenix_Moneybookers>
113
- </modules>
114
- </translate>
115
- <layout>
116
- <updates>
117
- <moneybookers>
118
- <file>moneybookers.xml</file>
119
- </moneybookers>
120
- </updates>
121
- </layout>
122
- <acl>
123
- <resources>
124
- <admin>
125
- <children>
126
- <system>
127
- <children>
128
- <config>
129
- <children>
130
- <moneybookers translate="title" module="moneybookers">
131
- <title>Moneybookers Settings</title>
132
- </moneybookers>
133
- </children>
134
- </config>
135
- </children>
136
- </system>
137
- </children>
138
- </admin>
139
- </resources>
140
- </acl>
141
- </adminhtml>
142
- <phoenix>
143
- <moneybookers>
144
- <verify_url>http://www.phoenix-medien.de/index.php?id=105</verify_url>
145
- </moneybookers>
146
- </phoenix>
147
- <default>
148
- <payment>
149
- <moneybookers_acc>
150
- <group>mbookers</group>
151
- <active>0</active>
152
- <model>moneybookers/acc</model>
153
- <title>Credit Card / Visa, Mastercard, AMEX, JCB, Diners</title>
154
- <allowspecific>0</allowspecific>
155
- </moneybookers_acc>
156
- <moneybookers_csi>
157
- <group>mbookers</group>
158
- <active>0</active>
159
- <model>moneybookers/csi</model>
160
- <title>CartaSi</title>
161
- <allowspecific>1</allowspecific>
162
- <specificcountry>IT</specificcountry>
163
- </moneybookers_csi>
164
- <moneybookers_did>
165
- <group>mbookers</group>
166
- <active>0</active>
167
- <model>moneybookers/did</model>
168
- <title>Lastschrift (ELV)</title>
169
- <allowspecific>1</allowspecific>
170
- <specificcountry>DE</specificcountry>
171
- </moneybookers_did>
172
- <moneybookers_dnk>
173
- <group>mbookers</group>
174
- <active>0</active>
175
- <model>moneybookers/dnk</model>
176
- <title>Dankort</title>
177
- <allowspecific>1</allowspecific>
178
- <specificcountry>DK</specificcountry>
179
- </moneybookers_dnk>
180
- <moneybookers_ebt>
181
- <group>mbookers</group>
182
- <active>0</active>
183
- <model>moneybookers/ebt</model>
184
- <title>Nordea Solo</title>
185
- <allowspecific>1</allowspecific>
186
- <specificcountry>SE</specificcountry>
187
- </moneybookers_ebt>
188
- <moneybookers_ent>
189
- <group>mbookers</group>
190
- <active>0</active>
191
- <model>moneybookers/ent</model>
192
- <title>eNETS</title>
193
- <allowspecific>1</allowspecific>
194
- <specificcountry>SG</specificcountry>
195
- </moneybookers_ent>
196
- <moneybookers_gcb>
197
- <group>mbookers</group>
198
- <active>0</active>
199
- <model>moneybookers/gcb</model>
200
- <title>Carte Bleue</title>
201
- <allowspecific>1</allowspecific>
202
- <specificcountry>FR</specificcountry>
203
- </moneybookers_gcb>
204
- <moneybookers_gir>
205
- <group>mbookers</group>
206
- <active>0</active>
207
- <model>moneybookers/gir</model>
208
- <title>Giropay</title>
209
- <allowspecific>1</allowspecific>
210
- <specificcountry>DE</specificcountry>
211
- </moneybookers_gir>
212
- <moneybookers_idl>
213
- <group>mbookers</group>
214
- <active>0</active>
215
- <model>moneybookers/idl</model>
216
- <title>iDeal</title>
217
- <allowspecific>1</allowspecific>
218
- <specificcountry>NL</specificcountry>
219
- </moneybookers_idl>
220
- <moneybookers_lsr>
221
- <group>mbookers</group>
222
- <active>0</active>
223
- <model>moneybookers/lsr</model>
224
- <title>Laser</title>
225
- <allowspecific>1</allowspecific>
226
- <specificcountry>IE</specificcountry>
227
- </moneybookers_lsr>
228
- <moneybookers_mae>
229
- <group>mbookers</group>
230
- <active>0</active>
231
- <model>moneybookers/mae</model>
232
- <title>Maestro</title>
233
- <allowspecific>1</allowspecific>
234
- <specificcountry>GB,AT,ES</specificcountry>
235
- </moneybookers_mae>
236
- <moneybookers_npy>
237
- <group>mbookers</group>
238
- <active>0</active>
239
- <model>moneybookers/npy</model>
240
- <title>EPS Online-Überweisung</title>
241
- <allowspecific>1</allowspecific>
242
- <specificcountry>AT</specificcountry>
243
- </moneybookers_npy>
244
- <moneybookers_pli>
245
- <group>mbookers</group>
246
- <active>0</active>
247
- <model>moneybookers/pli</model>
248
- <title>POLi</title>
249
- <allowspecific>1</allowspecific>
250
- <specificcountry>AU</specificcountry>
251
- </moneybookers_pli>
252
- <moneybookers_psp>
253
- <group>mbookers</group>
254
- <active>0</active>
255
- <model>moneybookers/psp</model>
256
- <title>Postepay</title>
257
- <allowspecific>1</allowspecific>
258
- <specificcountry>IT</specificcountry>
259
- </moneybookers_psp>
260
- <moneybookers_pwy>
261
- <group>mbookers</group>
262
- <active>0</active>
263
- <model>moneybookers/pwy</model>
264
- <title>All Polish Banks</title>
265
- <allowspecific>1</allowspecific>
266
- <specificcountry>PL</specificcountry>
267
- </moneybookers_pwy>
268
- <moneybookers_sft>
269
- <group>mbookers</group>
270
- <active>0</active>
271
- <model>moneybookers/sft</model>
272
- <title>Sofortüberweisung</title>
273
- <allowspecific>1</allowspecific>
274
- <specificcountry>DE</specificcountry>
275
- </moneybookers_sft>
276
- <moneybookers_so2>
277
- <group>mbookers</group>
278
- <active>0</active>
279
- <model>moneybookers/so2</model>
280
- <title>Nordea Solo</title>
281
- <allowspecific>1</allowspecific>
282
- <specificcountry>FI</specificcountry>
283
- </moneybookers_so2>
284
- <moneybookers_wlt>
285
- <group>mbookers</group>
286
- <active>0</active>
287
- <model>moneybookers/wlt</model>
288
- <title>Moneybookers eWallet</title>
289
- <allowspecific>0</allowspecific>
290
- </moneybookers_wlt>
291
- <moneybookers_obt>
292
- <group>mbookers</group>
293
- <active>0</active>
294
- <model>moneybookers/obt</model>
295
- <title>Onlineüberweisung (empfohlen)</title>
296
- <allowspecific>1</allowspecific>
297
- <specificcountry>GB,DE</specificcountry>
298
- </moneybookers_obt>
299
- </payment>
300
- <moneybookers>
301
- <settings>
302
- <activationstatus>0</activationstatus>
303
- </settings>
304
- </moneybookers>
305
- </default>
306
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/etc/system.xml DELETED
@@ -1,1201 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * @category Phoenix
17
- * @package Phoenix_Moneybookers
18
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
- -->
22
- <config>
23
- <sections>
24
- <moneybookers translate="label" module="moneybookers">
25
- <label>Moneybookers</label>
26
- <tab>sales</tab>
27
- <frontend_type>text</frontend_type>
28
- <sort_order>990</sort_order>
29
- <show_in_default>1</show_in_default>
30
- <show_in_website>1</show_in_website>
31
- <show_in_store>1</show_in_store>
32
- <groups>
33
- <settings translate="label">
34
- <label>Moneybookers Settings</label>
35
- <frontend_type>text</frontend_type>
36
- <sort_order>1</sort_order>
37
- <show_in_default>1</show_in_default>
38
- <show_in_website>1</show_in_website>
39
- <show_in_store>1</show_in_store>
40
- <fields>
41
- <moneybookers_email translate="label,comment">
42
- <label>Email Address of Your Moneybookers Account</label>
43
- <comment><![CDATA[To have access to the international payment network of Moneybookers please register <a href="http://www.moneybookers.com/partners/magento/" target="_blank">here</a> for a free account if you don’t have one yet.]]></comment>
44
- <frontend_type>text</frontend_type>
45
- <sort_order>1</sort_order>
46
- <show_in_default>1</show_in_default>
47
- <show_in_website>1</show_in_website>
48
- <show_in_store>1</show_in_store>
49
- </moneybookers_email>
50
- <customer_id translate="label">
51
- <label>Customer ID</label>
52
- <frontend_type>text</frontend_type>
53
- <sort_order>2</sort_order>
54
- <show_in_default>1</show_in_default>
55
- <show_in_website>1</show_in_website>
56
- <show_in_store>1</show_in_store>
57
- </customer_id>
58
- <secret_key translate="label,comment">
59
- <label>Secret Word</label>
60
- <comment>Pre-shared secret key to secure the transaction. After activation Moneybookers will give you access to a new section in your Moneybookers account called "Merchant tools". Please choose a secret word (do not use your password for this) and provide it in your Moneybookers admin area and above.</comment>
61
- <frontend_type>text</frontend_type>
62
- <sort_order>3</sort_order>
63
- <show_in_default>1</show_in_default>
64
- <show_in_website>1</show_in_website>
65
- <show_in_store>1</show_in_store>
66
- </secret_key>
67
- <activationstatus>
68
- <comment></comment>
69
- <frontend_type>text</frontend_type>
70
- <sort_order>4</sort_order>
71
- <show_in_default>1</show_in_default>
72
- <show_in_website>1</show_in_website>
73
- <show_in_store>1</show_in_store>
74
- </activationstatus>
75
- </fields>
76
- </settings>
77
- <moneybookers_acc translate="label" module="moneybookers">
78
- <label>All Credit Cards / Visa, Mastercard, AMEX, JCB, Diners (powered by Moneybookers) - International</label>
79
- <frontend_type>text</frontend_type>
80
- <sort_order>201</sort_order>
81
- <show_in_default>1</show_in_default>
82
- <show_in_website>1</show_in_website>
83
- <show_in_store>1</show_in_store>
84
- <fields>
85
- <active translate="label">
86
- <label>Enabled</label>
87
- <frontend_type>select</frontend_type>
88
- <config_path>payment/moneybookers_acc/active</config_path>
89
- <source_model>adminhtml/system_config_source_yesno</source_model>
90
- <sort_order>1</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
- </active>
95
- <sort_order translate="label">
96
- <label>Sort Order</label>
97
- <frontend_type>text</frontend_type>
98
- <config_path>payment/moneybookers_acc/sort_order</config_path>
99
- <sort_order>3</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
- </sort_order>
104
- <title translate="label">
105
- <label>Title</label>
106
- <frontend_type>text</frontend_type>
107
- <config_path>payment/moneybookers_acc/title</config_path>
108
- <sort_order>5</sort_order>
109
- <show_in_default>1</show_in_default>
110
- <show_in_website>1</show_in_website>
111
- <show_in_store>1</show_in_store>
112
- </title>
113
- <allowspecific translate="label">
114
- <label>Payment from Applicable Countries</label>
115
- <frontend_type>allowspecific</frontend_type>
116
- <config_path>payment/moneybookers_acc/allowspecific</config_path>
117
- <sort_order>6</sort_order>
118
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
119
- <show_in_default>1</show_in_default>
120
- <show_in_website>1</show_in_website>
121
- <show_in_store>1</show_in_store>
122
- </allowspecific>
123
- <specificcountry translate="label">
124
- <label>Payment from Specific Countries</label>
125
- <frontend_type>multiselect</frontend_type>
126
- <config_path>payment/moneybookers_acc/specificcountry</config_path>
127
- <sort_order>7</sort_order>
128
- <source_model>adminhtml/system_config_source_country</source_model>
129
- <show_in_default>1</show_in_default>
130
- <show_in_website>1</show_in_website>
131
- <show_in_store>1</show_in_store>
132
- <can_be_empty>1</can_be_empty>
133
- </specificcountry>
134
- </fields>
135
- </moneybookers_acc>
136
- <moneybookers_csi translate="label" module="moneybookers">
137
- <label>CartaSi (powered by Moneybookers) - Italy</label>
138
- <frontend_type>text</frontend_type>
139
- <sort_order>252</sort_order>
140
- <show_in_default>1</show_in_default>
141
- <show_in_website>1</show_in_website>
142
- <show_in_store>1</show_in_store>
143
- <fields>
144
- <active translate="label">
145
- <label>Enabled</label>
146
- <frontend_type>select</frontend_type>
147
- <config_path>payment/moneybookers_csi/active</config_path>
148
- <source_model>adminhtml/system_config_source_yesno</source_model>
149
- <sort_order>1</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
- </active>
154
- <sort_order translate="label">
155
- <label>Sort Order</label>
156
- <frontend_type>text</frontend_type>
157
- <config_path>payment/moneybookers_csi/sort_order</config_path>
158
- <sort_order>3</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
- </sort_order>
163
- <title translate="label">
164
- <label>Title</label>
165
- <frontend_type>text</frontend_type>
166
- <config_path>payment/moneybookers_csi/title</config_path>
167
- <sort_order>5</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
- </title>
172
- <allowspecific translate="label">
173
- <label>Payment from Applicable Countries</label>
174
- <frontend_type>allowspecific</frontend_type>
175
- <config_path>payment/moneybookers_csi/allowspecific</config_path>
176
- <sort_order>6</sort_order>
177
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
178
- <show_in_default>1</show_in_default>
179
- <show_in_website>1</show_in_website>
180
- <show_in_store>1</show_in_store>
181
- </allowspecific>
182
- <specificcountry translate="label">
183
- <label>Payment from Specific Countries</label>
184
- <frontend_type>multiselect</frontend_type>
185
- <config_path>payment/moneybookers_csi/specificcountry</config_path>
186
- <sort_order>7</sort_order>
187
- <source_model>adminhtml/system_config_source_country</source_model>
188
- <show_in_default>1</show_in_default>
189
- <show_in_website>1</show_in_website>
190
- <show_in_store>1</show_in_store>
191
- <can_be_empty>1</can_be_empty>
192
- </specificcountry>
193
- </fields>
194
- </moneybookers_csi>
195
- <moneybookers_did translate="label" module="moneybookers">
196
- <label>Lastschrift (ELV) (powered by Moneybookers) - Germany</label>
197
- <frontend_type>text</frontend_type>
198
- <sort_order>211</sort_order>
199
- <show_in_default>1</show_in_default>
200
- <show_in_website>1</show_in_website>
201
- <show_in_store>1</show_in_store>
202
- <fields>
203
- <active translate="label">
204
- <label>Enabled</label>
205
- <frontend_type>select</frontend_type>
206
- <config_path>payment/moneybookers_did/active</config_path>
207
- <source_model>adminhtml/system_config_source_yesno</source_model>
208
- <sort_order>1</sort_order>
209
- <show_in_default>1</show_in_default>
210
- <show_in_website>1</show_in_website>
211
- <show_in_store>1</show_in_store>
212
- </active>
213
- <sort_order translate="label">
214
- <label>Sort Order</label>
215
- <frontend_type>text</frontend_type>
216
- <config_path>payment/moneybookers_did/sort_order</config_path>
217
- <sort_order>3</sort_order>
218
- <show_in_default>1</show_in_default>
219
- <show_in_website>1</show_in_website>
220
- <show_in_store>1</show_in_store>
221
- </sort_order>
222
- <title translate="label">
223
- <label>Title</label>
224
- <frontend_type>text</frontend_type>
225
- <config_path>payment/moneybookers_did/title</config_path>
226
- <sort_order>5</sort_order>
227
- <show_in_default>1</show_in_default>
228
- <show_in_website>1</show_in_website>
229
- <show_in_store>1</show_in_store>
230
- </title>
231
- <allowspecific translate="label">
232
- <label>Payment from Applicable Countries</label>
233
- <frontend_type>allowspecific</frontend_type>
234
- <config_path>payment/moneybookers_did/allowspecific</config_path>
235
- <sort_order>6</sort_order>
236
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
237
- <show_in_default>1</show_in_default>
238
- <show_in_website>1</show_in_website>
239
- <show_in_store>1</show_in_store>
240
- </allowspecific>
241
- <specificcountry translate="label">
242
- <label>Payment from Specific Countries</label>
243
- <frontend_type>multiselect</frontend_type>
244
- <config_path>payment/moneybookers_did/specificcountry</config_path>
245
- <sort_order>7</sort_order>
246
- <source_model>adminhtml/system_config_source_country</source_model>
247
- <show_in_default>1</show_in_default>
248
- <show_in_website>1</show_in_website>
249
- <show_in_store>1</show_in_store>
250
- <can_be_empty>1</can_be_empty>
251
- </specificcountry>
252
- </fields>
253
- </moneybookers_did>
254
- <moneybookers_dnk translate="label" module="moneybookers">
255
- <label>Dankort (powered by Moneybookers) - Denmark</label>
256
- <frontend_type>text</frontend_type>
257
- <sort_order>241</sort_order>
258
- <show_in_default>1</show_in_default>
259
- <show_in_website>1</show_in_website>
260
- <show_in_store>1</show_in_store>
261
- <fields>
262
- <active translate="label">
263
- <label>Enabled</label>
264
- <frontend_type>select</frontend_type>
265
- <config_path>payment/moneybookers_dnk/active</config_path>
266
- <source_model>adminhtml/system_config_source_yesno</source_model>
267
- <sort_order>1</sort_order>
268
- <show_in_default>1</show_in_default>
269
- <show_in_website>1</show_in_website>
270
- <show_in_store>1</show_in_store>
271
- </active>
272
- <sort_order translate="label">
273
- <label>Sort Order</label>
274
- <frontend_type>text</frontend_type>
275
- <config_path>payment/moneybookers_dnk/sort_order</config_path>
276
- <sort_order>3</sort_order>
277
- <show_in_default>1</show_in_default>
278
- <show_in_website>1</show_in_website>
279
- <show_in_store>1</show_in_store>
280
- </sort_order>
281
- <title translate="label">
282
- <label>Title</label>
283
- <frontend_type>text</frontend_type>
284
- <config_path>payment/moneybookers_dnk/title</config_path>
285
- <sort_order>5</sort_order>
286
- <show_in_default>1</show_in_default>
287
- <show_in_website>1</show_in_website>
288
- <show_in_store>1</show_in_store>
289
- </title>
290
- <allowspecific translate="label">
291
- <label>Payment from Applicable Countries</label>
292
- <frontend_type>allowspecific</frontend_type>
293
- <config_path>payment/moneybookers_dnk/allowspecific</config_path>
294
- <sort_order>6</sort_order>
295
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
296
- <show_in_default>1</show_in_default>
297
- <show_in_website>1</show_in_website>
298
- <show_in_store>1</show_in_store>
299
- </allowspecific>
300
- <specificcountry translate="label">
301
- <label>Payment from Specific Countries</label>
302
- <frontend_type>multiselect</frontend_type>
303
- <config_path>payment/moneybookers_dnk/specificcountry</config_path>
304
- <sort_order>7</sort_order>
305
- <source_model>adminhtml/system_config_source_country</source_model>
306
- <show_in_default>1</show_in_default>
307
- <show_in_website>1</show_in_website>
308
- <show_in_store>1</show_in_store>
309
- <can_be_empty>1</can_be_empty>
310
- </specificcountry>
311
- </fields>
312
- </moneybookers_dnk>
313
- <moneybookers_ebt translate="label" module="moneybookers">
314
- <label>Nordea Solo (powered by Moneybookers) - Sweden</label>
315
- <frontend_type>text</frontend_type>
316
- <sort_order>271</sort_order>
317
- <show_in_default>1</show_in_default>
318
- <show_in_website>1</show_in_website>
319
- <show_in_store>1</show_in_store>
320
- <fields>
321
- <active translate="label">
322
- <label>Enabled</label>
323
- <frontend_type>select</frontend_type>
324
- <config_path>payment/moneybookers_ebt/active</config_path>
325
- <source_model>adminhtml/system_config_source_yesno</source_model>
326
- <sort_order>1</sort_order>
327
- <show_in_default>1</show_in_default>
328
- <show_in_website>1</show_in_website>
329
- <show_in_store>1</show_in_store>
330
- </active>
331
- <sort_order translate="label">
332
- <label>Sort Order</label>
333
- <frontend_type>text</frontend_type>
334
- <config_path>payment/moneybookers_ebt/sort_order</config_path>
335
- <sort_order>3</sort_order>
336
- <show_in_default>1</show_in_default>
337
- <show_in_website>1</show_in_website>
338
- <show_in_store>1</show_in_store>
339
- </sort_order>
340
- <title translate="label">
341
- <label>Title</label>
342
- <frontend_type>text</frontend_type>
343
- <config_path>payment/moneybookers_ebt/title</config_path>
344
- <sort_order>5</sort_order>
345
- <show_in_default>1</show_in_default>
346
- <show_in_website>1</show_in_website>
347
- <show_in_store>1</show_in_store>
348
- </title>
349
- <allowspecific translate="label">
350
- <label>Payment from Applicable Countries</label>
351
- <config_path>payment/moneybookers_ebt/allowspecific</config_path>
352
- <frontend_type>allowspecific</frontend_type>
353
- <sort_order>6</sort_order>
354
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
355
- <show_in_default>1</show_in_default>
356
- <show_in_website>1</show_in_website>
357
- <show_in_store>1</show_in_store>
358
- </allowspecific>
359
- <specificcountry translate="label">
360
- <label>Payment from Specific Countries</label>
361
- <frontend_type>multiselect</frontend_type>
362
- <config_path>payment/moneybookers_ebt/specificcountry</config_path>
363
- <sort_order>7</sort_order>
364
- <source_model>adminhtml/system_config_source_country</source_model>
365
- <show_in_default>1</show_in_default>
366
- <show_in_website>1</show_in_website>
367
- <show_in_store>1</show_in_store>
368
- <can_be_empty>1</can_be_empty>
369
- </specificcountry>
370
- </fields>
371
- </moneybookers_ebt>
372
- <moneybookers_ent translate="label" module="moneybookers">
373
- <label>eNETS (powered by Moneybookers) - Singapore</label>
374
- <frontend_type>text</frontend_type>
375
- <sort_order>261</sort_order>
376
- <show_in_default>1</show_in_default>
377
- <show_in_website>1</show_in_website>
378
- <show_in_store>1</show_in_store>
379
- <fields>
380
- <active translate="label">
381
- <label>Enabled</label>
382
- <frontend_type>select</frontend_type>
383
- <config_path>payment/moneybookers_ent/active</config_path>
384
- <source_model>adminhtml/system_config_source_yesno</source_model>
385
- <sort_order>1</sort_order>
386
- <show_in_default>1</show_in_default>
387
- <show_in_website>1</show_in_website>
388
- <show_in_store>1</show_in_store>
389
- </active>
390
- <sort_order translate="label">
391
- <label>Sort Order</label>
392
- <frontend_type>text</frontend_type>
393
- <config_path>payment/moneybookers_ent/sort_order</config_path>
394
- <sort_order>3</sort_order>
395
- <show_in_default>1</show_in_default>
396
- <show_in_website>1</show_in_website>
397
- <show_in_store>1</show_in_store>
398
- </sort_order>
399
- <title translate="label">
400
- <label>Title</label>
401
- <frontend_type>text</frontend_type>
402
- <config_path>payment/moneybookers_ent/title</config_path>
403
- <sort_order>5</sort_order>
404
- <show_in_default>1</show_in_default>
405
- <show_in_website>1</show_in_website>
406
- <show_in_store>1</show_in_store>
407
- </title>
408
- <allowspecific translate="label">
409
- <label>Payment from Applicable Countries</label>
410
- <frontend_type>allowspecific</frontend_type>
411
- <config_path>payment/moneybookers_ent/allowspecific</config_path>
412
- <sort_order>6</sort_order>
413
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
414
- <show_in_default>1</show_in_default>
415
- <show_in_website>1</show_in_website>
416
- <show_in_store>1</show_in_store>
417
- </allowspecific>
418
- <specificcountry translate="label">
419
- <label>Payment from Specific Countries</label>
420
- <frontend_type>multiselect</frontend_type>
421
- <config_path>payment/moneybookers_ent/specificcountry</config_path>
422
- <sort_order>7</sort_order>
423
- <source_model>adminhtml/system_config_source_country</source_model>
424
- <show_in_default>1</show_in_default>
425
- <show_in_website>1</show_in_website>
426
- <show_in_store>1</show_in_store>
427
- <can_be_empty>1</can_be_empty>
428
- </specificcountry>
429
- </fields>
430
- </moneybookers_ent>
431
- <moneybookers_gcb translate="label" module="moneybookers">
432
- <label>Carte Bleue (powered by Moneybookers) - France</label>
433
- <frontend_type>text</frontend_type>
434
- <sort_order>231</sort_order>
435
- <show_in_default>1</show_in_default>
436
- <show_in_website>1</show_in_website>
437
- <show_in_store>1</show_in_store>
438
- <fields>
439
- <active translate="label">
440
- <label>Enabled</label>
441
- <frontend_type>select</frontend_type>
442
- <config_path>payment/moneybookers_gcb/active</config_path>
443
- <source_model>adminhtml/system_config_source_yesno</source_model>
444
- <sort_order>1</sort_order>
445
- <show_in_default>1</show_in_default>
446
- <show_in_website>1</show_in_website>
447
- <show_in_store>1</show_in_store>
448
- </active>
449
- <sort_order translate="label">
450
- <label>Sort Order</label>
451
- <frontend_type>text</frontend_type>
452
- <config_path>payment/moneybookers_gcb/sort_order</config_path>
453
- <sort_order>3</sort_order>
454
- <show_in_default>1</show_in_default>
455
- <show_in_website>1</show_in_website>
456
- <show_in_store>1</show_in_store>
457
- </sort_order>
458
- <title translate="label">
459
- <label>Title</label>
460
- <frontend_type>text</frontend_type>
461
- <config_path>payment/moneybookers_gcb/title</config_path>
462
- <sort_order>5</sort_order>
463
- <show_in_default>1</show_in_default>
464
- <show_in_website>1</show_in_website>
465
- <show_in_store>1</show_in_store>
466
- </title>
467
- <allowspecific translate="label">
468
- <label>Payment from Applicable Countries</label>
469
- <frontend_type>allowspecific</frontend_type>
470
- <config_path>payment/moneybookers_gcb/allowspecific</config_path>
471
- <sort_order>6</sort_order>
472
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
473
- <show_in_default>1</show_in_default>
474
- <show_in_website>1</show_in_website>
475
- <show_in_store>1</show_in_store>
476
- </allowspecific>
477
- <specificcountry translate="label">
478
- <label>Payment from Specific Countries</label>
479
- <frontend_type>multiselect</frontend_type>
480
- <config_path>payment/moneybookers_gcb/specificcountry</config_path>
481
- <sort_order>7</sort_order>
482
- <source_model>adminhtml/system_config_source_country</source_model>
483
- <show_in_default>1</show_in_default>
484
- <show_in_website>1</show_in_website>
485
- <show_in_store>1</show_in_store>
486
- <can_be_empty>1</can_be_empty>
487
- </specificcountry>
488
- </fields>
489
- </moneybookers_gcb>
490
- <moneybookers_gir translate="label" module="moneybookers">
491
- <label>Giropay (powered by Moneybookers) - Germany</label>
492
- <frontend_type>text</frontend_type>
493
- <sort_order>212</sort_order>
494
- <show_in_default>1</show_in_default>
495
- <show_in_website>1</show_in_website>
496
- <show_in_store>1</show_in_store>
497
- <fields>
498
- <active translate="label">
499
- <label>Enabled</label>
500
- <frontend_type>select</frontend_type>
501
- <config_path>payment/moneybookers_gir/active</config_path>
502
- <source_model>adminhtml/system_config_source_yesno</source_model>
503
- <sort_order>1</sort_order>
504
- <show_in_default>1</show_in_default>
505
- <show_in_website>1</show_in_website>
506
- <show_in_store>1</show_in_store>
507
- </active>
508
- <sort_order translate="label">
509
- <label>Sort Order</label>
510
- <frontend_type>text</frontend_type>
511
- <config_path>payment/moneybookers_gir/sort_order</config_path>
512
- <sort_order>3</sort_order>
513
- <show_in_default>1</show_in_default>
514
- <show_in_website>1</show_in_website>
515
- <show_in_store>1</show_in_store>
516
- </sort_order>
517
- <title translate="label">
518
- <label>Title</label>
519
- <frontend_type>text</frontend_type>
520
- <config_path>payment/moneybookers_gir/title</config_path>
521
- <sort_order>5</sort_order>
522
- <show_in_default>1</show_in_default>
523
- <show_in_website>1</show_in_website>
524
- <show_in_store>1</show_in_store>
525
- </title>
526
- <allowspecific translate="label">
527
- <label>Payment from Applicable Countries</label>
528
- <frontend_type>allowspecific</frontend_type>
529
- <config_path>payment/moneybookers_gir/allowspecific</config_path>
530
- <sort_order>6</sort_order>
531
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
532
- <show_in_default>1</show_in_default>
533
- <show_in_website>1</show_in_website>
534
- <show_in_store>1</show_in_store>
535
- </allowspecific>
536
- <specificcountry translate="label">
537
- <label>Payment from Specific Countries</label>
538
- <frontend_type>multiselect</frontend_type>
539
- <config_path>payment/moneybookers_gir/specificcountry</config_path>
540
- <sort_order>7</sort_order>
541
- <source_model>adminhtml/system_config_source_country</source_model>
542
- <show_in_default>1</show_in_default>
543
- <show_in_website>1</show_in_website>
544
- <show_in_store>1</show_in_store>
545
- <can_be_empty>1</can_be_empty>
546
- </specificcountry>
547
- </fields>
548
- </moneybookers_gir>
549
- <moneybookers_idl translate="label" module="moneybookers">
550
- <label>iDeal (powered by Moneybookers) - Netherlands</label>
551
- <frontend_type>text</frontend_type>
552
- <sort_order>291</sort_order>
553
- <show_in_default>1</show_in_default>
554
- <show_in_website>1</show_in_website>
555
- <show_in_store>1</show_in_store>
556
- <fields>
557
- <active translate="label">
558
- <label>Enabled</label>
559
- <frontend_type>select</frontend_type>
560
- <config_path>payment/moneybookers_idl/active</config_path>
561
- <source_model>adminhtml/system_config_source_yesno</source_model>
562
- <sort_order>1</sort_order>
563
- <show_in_default>1</show_in_default>
564
- <show_in_website>1</show_in_website>
565
- <show_in_store>1</show_in_store>
566
- </active>
567
- <sort_order translate="label">
568
- <label>Sort Order</label>
569
- <frontend_type>text</frontend_type>
570
- <config_path>payment/moneybookers_idl/sort_order</config_path>
571
- <sort_order>3</sort_order>
572
- <show_in_default>1</show_in_default>
573
- <show_in_website>1</show_in_website>
574
- <show_in_store>1</show_in_store>
575
- </sort_order>
576
- <title translate="label">
577
- <label>Title</label>
578
- <frontend_type>text</frontend_type>
579
- <config_path>payment/moneybookers_idl/title</config_path>
580
- <sort_order>5</sort_order>
581
- <show_in_default>1</show_in_default>
582
- <show_in_website>1</show_in_website>
583
- <show_in_store>1</show_in_store>
584
- </title>
585
- <allowspecific translate="label">
586
- <label>Payment from Applicable Countries</label>
587
- <frontend_type>allowspecific</frontend_type>
588
- <config_path>payment/moneybookers_idl/allowspecific</config_path>
589
- <sort_order>6</sort_order>
590
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
591
- <show_in_default>1</show_in_default>
592
- <show_in_website>1</show_in_website>
593
- <show_in_store>1</show_in_store>
594
- </allowspecific>
595
- <specificcountry translate="label">
596
- <label>Payment from Specific Countries</label>
597
- <frontend_type>multiselect</frontend_type>
598
- <config_path>payment/moneybookers_idl/specificcountry</config_path>
599
- <sort_order>7</sort_order>
600
- <source_model>adminhtml/system_config_source_country</source_model>
601
- <show_in_default>1</show_in_default>
602
- <show_in_website>1</show_in_website>
603
- <show_in_store>1</show_in_store>
604
- <can_be_empty>1</can_be_empty>
605
- </specificcountry>
606
- </fields>
607
- </moneybookers_idl>
608
- <moneybookers_lsr translate="label" module="moneybookers">
609
- <label>Laser (powered by Moneybookers) - Ireland</label>
610
- <frontend_type>text</frontend_type>
611
- <sort_order>221</sort_order>
612
- <show_in_default>1</show_in_default>
613
- <show_in_website>1</show_in_website>
614
- <show_in_store>1</show_in_store>
615
- <fields>
616
- <active translate="label">
617
- <label>Enabled</label>
618
- <frontend_type>select</frontend_type>
619
- <config_path>payment/moneybookers_lsr/active</config_path>
620
- <source_model>adminhtml/system_config_source_yesno</source_model>
621
- <sort_order>1</sort_order>
622
- <show_in_default>1</show_in_default>
623
- <show_in_website>1</show_in_website>
624
- <show_in_store>1</show_in_store>
625
- </active>
626
- <sort_order translate="label">
627
- <label>Sort Order</label>
628
- <frontend_type>text</frontend_type>
629
- <config_path>payment/moneybookers_lsr/sort_order</config_path>
630
- <sort_order>3</sort_order>
631
- <show_in_default>1</show_in_default>
632
- <show_in_website>1</show_in_website>
633
- <show_in_store>1</show_in_store>
634
- </sort_order>
635
- <title translate="label">
636
- <label>Title</label>
637
- <frontend_type>text</frontend_type>
638
- <config_path>payment/moneybookers_lsr/title</config_path>
639
- <sort_order>5</sort_order>
640
- <show_in_default>1</show_in_default>
641
- <show_in_website>1</show_in_website>
642
- <show_in_store>1</show_in_store>
643
- </title>
644
- <allowspecific translate="label">
645
- <label>Payment from Applicable Countries</label>
646
- <frontend_type>allowspecific</frontend_type>
647
- <config_path>payment/moneybookers_lsr/allowspecific</config_path>
648
- <sort_order>6</sort_order>
649
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
650
- <show_in_default>1</show_in_default>
651
- <show_in_website>1</show_in_website>
652
- <show_in_store>1</show_in_store>
653
- </allowspecific>
654
- <specificcountry translate="label">
655
- <label>Payment from Specific Countries</label>
656
- <frontend_type>multiselect</frontend_type>
657
- <config_path>payment/moneybookers_lsr/specificcountry</config_path>
658
- <sort_order>7</sort_order>
659
- <source_model>adminhtml/system_config_source_country</source_model>
660
- <show_in_default>1</show_in_default>
661
- <show_in_website>1</show_in_website>
662
- <show_in_store>1</show_in_store>
663
- <can_be_empty>1</can_be_empty>
664
- </specificcountry>
665
- </fields>
666
- </moneybookers_lsr>
667
- <moneybookers_mae translate="label" module="moneybookers">
668
- <label>Maestro (powered by Moneybookers) - United Kingdom, Austria, Spain</label>
669
- <frontend_type>text</frontend_type>
670
- <sort_order>231</sort_order>
671
- <show_in_default>1</show_in_default>
672
- <show_in_website>1</show_in_website>
673
- <show_in_store>1</show_in_store>
674
- <fields>
675
- <active translate="label">
676
- <label>Enabled</label>
677
- <frontend_type>select</frontend_type>
678
- <config_path>payment/moneybookers_mae/active</config_path>
679
- <source_model>adminhtml/system_config_source_yesno</source_model>
680
- <sort_order>1</sort_order>
681
- <show_in_default>1</show_in_default>
682
- <show_in_website>1</show_in_website>
683
- <show_in_store>1</show_in_store>
684
- </active>
685
- <sort_order translate="label">
686
- <label>Sort Order</label>
687
- <frontend_type>text</frontend_type>
688
- <config_path>payment/moneybookers_mae/sort_order</config_path>
689
- <sort_order>3</sort_order>
690
- <show_in_default>1</show_in_default>
691
- <show_in_website>1</show_in_website>
692
- <show_in_store>1</show_in_store>
693
- </sort_order>
694
- <title translate="label">
695
- <label>Title</label>
696
- <frontend_type>text</frontend_type>
697
- <config_path>payment/moneybookers_mae/title</config_path>
698
- <sort_order>5</sort_order>
699
- <show_in_default>1</show_in_default>
700
- <show_in_website>1</show_in_website>
701
- <show_in_store>1</show_in_store>
702
- </title>
703
- <allowspecific translate="label">
704
- <label>Payment from Applicable Countries</label>
705
- <frontend_type>allowspecific</frontend_type>
706
- <config_path>payment/moneybookers_mae/allowspecific</config_path>
707
- <sort_order>6</sort_order>
708
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
709
- <show_in_default>1</show_in_default>
710
- <show_in_website>1</show_in_website>
711
- <show_in_store>1</show_in_store>
712
- </allowspecific>
713
- <specificcountry translate="label">
714
- <label>Payment from Specific Countries</label>
715
- <frontend_type>multiselect</frontend_type>
716
- <config_path>payment/moneybookers_mae/specificcountry</config_path>
717
- <sort_order>7</sort_order>
718
- <source_model>adminhtml/system_config_source_country</source_model>
719
- <show_in_default>1</show_in_default>
720
- <show_in_website>1</show_in_website>
721
- <show_in_store>1</show_in_store>
722
- <can_be_empty>1</can_be_empty>
723
- </specificcountry>
724
- </fields>
725
- </moneybookers_mae>
726
- <moneybookers_npy translate="label" module="moneybookers">
727
- <label>EPS Online-Überweisung (powered by Moneybookers) - Austria</label>
728
- <frontend_type>text</frontend_type>
729
- <sort_order>301</sort_order>
730
- <show_in_default>1</show_in_default>
731
- <show_in_website>1</show_in_website>
732
- <show_in_store>1</show_in_store>
733
- <fields>
734
- <active translate="label">
735
- <label>Enabled</label>
736
- <frontend_type>select</frontend_type>
737
- <config_path>payment/moneybookers_npy/active</config_path>
738
- <source_model>adminhtml/system_config_source_yesno</source_model>
739
- <sort_order>1</sort_order>
740
- <show_in_default>1</show_in_default>
741
- <show_in_website>1</show_in_website>
742
- <show_in_store>1</show_in_store>
743
- </active>
744
- <sort_order translate="label">
745
- <label>Sort Order</label>
746
- <frontend_type>text</frontend_type>
747
- <config_path>payment/moneybookers_npy/sort_order</config_path>
748
- <sort_order>3</sort_order>
749
- <show_in_default>1</show_in_default>
750
- <show_in_website>1</show_in_website>
751
- <show_in_store>1</show_in_store>
752
- </sort_order>
753
- <title translate="label">
754
- <label>Title</label>
755
- <frontend_type>text</frontend_type>
756
- <config_path>payment/moneybookers_npy/title</config_path>
757
- <sort_order>5</sort_order>
758
- <show_in_default>1</show_in_default>
759
- <show_in_website>1</show_in_website>
760
- <show_in_store>1</show_in_store>
761
- </title>
762
- <allowspecific translate="label">
763
- <label>Payment from Applicable Countries</label>
764
- <frontend_type>allowspecific</frontend_type>
765
- <config_path>payment/moneybookers_npy/allowspecific</config_path>
766
- <sort_order>6</sort_order>
767
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
768
- <show_in_default>1</show_in_default>
769
- <show_in_website>1</show_in_website>
770
- <show_in_store>1</show_in_store>
771
- </allowspecific>
772
- <specificcountry translate="label">
773
- <label>Payment from Specific Countries</label>
774
- <frontend_type>multiselect</frontend_type>
775
- <config_path>payment/moneybookers_npy/specificcountry</config_path>
776
- <sort_order>7</sort_order>
777
- <source_model>adminhtml/system_config_source_country</source_model>
778
- <show_in_default>1</show_in_default>
779
- <show_in_website>1</show_in_website>
780
- <show_in_store>1</show_in_store>
781
- <can_be_empty>1</can_be_empty>
782
- </specificcountry>
783
- </fields>
784
- </moneybookers_npy>
785
- <moneybookers_pli translate="label" module="moneybookers">
786
- <label>POLi (powered by Moneybookers) - Australia</label>
787
- <frontend_type>text</frontend_type>
788
- <sort_order>311</sort_order>
789
- <show_in_default>1</show_in_default>
790
- <show_in_website>1</show_in_website>
791
- <show_in_store>1</show_in_store>
792
- <fields>
793
- <active translate="label">
794
- <label>Enabled</label>
795
- <frontend_type>select</frontend_type>
796
- <config_path>payment/moneybookers_pli/active</config_path>
797
- <source_model>adminhtml/system_config_source_yesno</source_model>
798
- <sort_order>1</sort_order>
799
- <show_in_default>1</show_in_default>
800
- <show_in_website>1</show_in_website>
801
- <show_in_store>1</show_in_store>
802
- </active>
803
- <sort_order translate="label">
804
- <label>Sort Order</label>
805
- <frontend_type>text</frontend_type>
806
- <config_path>payment/moneybookers_pli/sort_order</config_path>
807
- <sort_order>3</sort_order>
808
- <show_in_default>1</show_in_default>
809
- <show_in_website>1</show_in_website>
810
- <show_in_store>1</show_in_store>
811
- </sort_order>
812
- <title translate="label">
813
- <label>Title</label>
814
- <frontend_type>text</frontend_type>
815
- <config_path>payment/moneybookers_pli/title</config_path>
816
- <sort_order>5</sort_order>
817
- <show_in_default>1</show_in_default>
818
- <show_in_website>1</show_in_website>
819
- <show_in_store>1</show_in_store>
820
- </title>
821
- <allowspecific translate="label">
822
- <label>Payment from Applicable Countries</label>
823
- <frontend_type>allowspecific</frontend_type>
824
- <config_path>payment/moneybookers_pli/allowspecific</config_path>
825
- <sort_order>6</sort_order>
826
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
827
- <show_in_default>1</show_in_default>
828
- <show_in_website>1</show_in_website>
829
- <show_in_store>1</show_in_store>
830
- </allowspecific>
831
- <specificcountry translate="label">
832
- <label>Payment from Specific Countries</label>
833
- <frontend_type>multiselect</frontend_type>
834
- <config_path>payment/moneybookers_pli/specificcountry</config_path>
835
- <sort_order>7</sort_order>
836
- <source_model>adminhtml/system_config_source_country</source_model>
837
- <show_in_default>1</show_in_default>
838
- <show_in_website>1</show_in_website>
839
- <show_in_store>1</show_in_store>
840
- <can_be_empty>1</can_be_empty>
841
- </specificcountry>
842
- </fields>
843
- </moneybookers_pli>
844
- <moneybookers_psp translate="label" module="moneybookers">
845
- <label>Postepay (powered by Moneybookers) - Italy</label>
846
- <frontend_type>text</frontend_type>
847
- <sort_order>251</sort_order>
848
- <show_in_default>1</show_in_default>
849
- <show_in_website>1</show_in_website>
850
- <show_in_store>1</show_in_store>
851
- <fields>
852
- <active translate="label">
853
- <label>Enabled</label>
854
- <frontend_type>select</frontend_type>
855
- <config_path>payment/moneybookers_psp/active</config_path>
856
- <source_model>adminhtml/system_config_source_yesno</source_model>
857
- <sort_order>1</sort_order>
858
- <show_in_default>1</show_in_default>
859
- <show_in_website>1</show_in_website>
860
- <show_in_store>1</show_in_store>
861
- </active>
862
- <sort_order translate="label">
863
- <label>Sort Order</label>
864
- <frontend_type>text</frontend_type>
865
- <config_path>payment/moneybookers_psp/sort_order</config_path>
866
- <sort_order>3</sort_order>
867
- <show_in_default>1</show_in_default>
868
- <show_in_website>1</show_in_website>
869
- <show_in_store>1</show_in_store>
870
- </sort_order>
871
- <title translate="label">
872
- <label>Title</label>
873
- <frontend_type>text</frontend_type>
874
- <config_path>payment/moneybookers_psp/title</config_path>
875
- <sort_order>5</sort_order>
876
- <show_in_default>1</show_in_default>
877
- <show_in_website>1</show_in_website>
878
- <show_in_store>1</show_in_store>
879
- </title>
880
- <allowspecific translate="label">
881
- <label>Payment from Applicable Countries</label>
882
- <frontend_type>allowspecific</frontend_type>
883
- <config_path>payment/moneybookers_psp/allowspecific</config_path>
884
- <sort_order>6</sort_order>
885
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
886
- <show_in_default>1</show_in_default>
887
- <show_in_website>1</show_in_website>
888
- <show_in_store>1</show_in_store>
889
- </allowspecific>
890
- <specificcountry translate="label">
891
- <label>Payment from Specific Countries</label>
892
- <frontend_type>multiselect</frontend_type>
893
- <config_path>payment/moneybookers_psp/specificcountry</config_path>
894
- <sort_order>7</sort_order>
895
- <source_model>adminhtml/system_config_source_country</source_model>
896
- <show_in_default>1</show_in_default>
897
- <show_in_website>1</show_in_website>
898
- <show_in_store>1</show_in_store>
899
- <can_be_empty>1</can_be_empty>
900
- </specificcountry>
901
- </fields>
902
- </moneybookers_psp>
903
- <moneybookers_pwy translate="label" module="moneybookers">
904
- <label>Przelewy24 (powered by Moneybookers) - Poland</label>
905
- <frontend_type>text</frontend_type>
906
- <sort_order>321</sort_order>
907
- <show_in_default>1</show_in_default>
908
- <show_in_website>1</show_in_website>
909
- <show_in_store>1</show_in_store>
910
- <fields>
911
- <active translate="label">
912
- <label>Enabled</label>
913
- <frontend_type>select</frontend_type>
914
- <config_path>payment/moneybookers_pwy/active</config_path>
915
- <source_model>adminhtml/system_config_source_yesno</source_model>
916
- <sort_order>1</sort_order>
917
- <show_in_default>1</show_in_default>
918
- <show_in_website>1</show_in_website>
919
- <show_in_store>1</show_in_store>
920
- </active>
921
- <sort_order translate="label">
922
- <label>Sort Order</label>
923
- <frontend_type>text</frontend_type>
924
- <config_path>payment/moneybookers_pwy/sort_order</config_path>
925
- <sort_order>3</sort_order>
926
- <show_in_default>1</show_in_default>
927
- <show_in_website>1</show_in_website>
928
- <show_in_store>1</show_in_store>
929
- </sort_order>
930
- <title translate="label">
931
- <label>Title</label>
932
- <frontend_type>text</frontend_type>
933
- <config_path>payment/moneybookers_pwy/title</config_path>
934
- <sort_order>5</sort_order>
935
- <show_in_default>1</show_in_default>
936
- <show_in_website>1</show_in_website>
937
- <show_in_store>1</show_in_store>
938
- </title>
939
- <allowspecific translate="label">
940
- <label>Payment from Applicable Countries</label>
941
- <frontend_type>allowspecific</frontend_type>
942
- <config_path>payment/moneybookers_pwy/allowspecific</config_path>
943
- <sort_order>6</sort_order>
944
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
945
- <show_in_default>1</show_in_default>
946
- <show_in_website>1</show_in_website>
947
- <show_in_store>1</show_in_store>
948
- </allowspecific>
949
- <specificcountry translate="label">
950
- <label>Payment from Specific Countries</label>
951
- <frontend_type>multiselect</frontend_type>
952
- <config_path>payment/moneybookers_pwy/specificcountry</config_path>
953
- <sort_order>7</sort_order>
954
- <source_model>adminhtml/system_config_source_country</source_model>
955
- <show_in_default>1</show_in_default>
956
- <show_in_website>1</show_in_website>
957
- <show_in_store>1</show_in_store>
958
- <can_be_empty>1</can_be_empty>
959
- </specificcountry>
960
- </fields>
961
- </moneybookers_pwy>
962
- <moneybookers_sft translate="label" module="moneybookers">
963
- <label>Sofortüberweisung (powered by Moneybookers) - Germany</label>
964
- <frontend_type>text</frontend_type>
965
- <sort_order>213</sort_order>
966
- <show_in_default>1</show_in_default>
967
- <show_in_website>1</show_in_website>
968
- <show_in_store>1</show_in_store>
969
- <fields>
970
- <active translate="label">
971
- <label>Enabled</label>
972
- <frontend_type>select</frontend_type>
973
- <config_path>payment/moneybookers_sft/active</config_path>
974
- <source_model>adminhtml/system_config_source_yesno</source_model>
975
- <sort_order>1</sort_order>
976
- <show_in_default>1</show_in_default>
977
- <show_in_website>1</show_in_website>
978
- <show_in_store>1</show_in_store>
979
- </active>
980
- <sort_order translate="label">
981
- <label>Sort Order</label>
982
- <frontend_type>text</frontend_type>
983
- <config_path>payment/moneybookers_sft/sort_order</config_path>
984
- <sort_order>3</sort_order>
985
- <show_in_default>1</show_in_default>
986
- <show_in_website>1</show_in_website>
987
- <show_in_store>1</show_in_store>
988
- </sort_order>
989
- <title translate="label">
990
- <label>Title</label>
991
- <frontend_type>text</frontend_type>
992
- <config_path>payment/moneybookers_sft/title</config_path>
993
- <sort_order>5</sort_order>
994
- <show_in_default>1</show_in_default>
995
- <show_in_website>1</show_in_website>
996
- <show_in_store>1</show_in_store>
997
- </title>
998
- <allowspecific translate="label">
999
- <label>Payment from Applicable Countries</label>
1000
- <frontend_type>allowspecific</frontend_type>
1001
- <config_path>payment/moneybookers_sft/allowspecific</config_path>
1002
- <sort_order>6</sort_order>
1003
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1004
- <show_in_default>1</show_in_default>
1005
- <show_in_website>1</show_in_website>
1006
- <show_in_store>1</show_in_store>
1007
- </allowspecific>
1008
- <specificcountry translate="label">
1009
- <label>Payment from Specific Countries</label>
1010
- <frontend_type>multiselect</frontend_type>
1011
- <config_path>payment/moneybookers_sft/specificcountry</config_path>
1012
- <sort_order>7</sort_order>
1013
- <source_model>adminhtml/system_config_source_country</source_model>
1014
- <show_in_default>1</show_in_default>
1015
- <show_in_website>1</show_in_website>
1016
- <show_in_store>1</show_in_store>
1017
- <can_be_empty>1</can_be_empty>
1018
- </specificcountry>
1019
- </fields>
1020
- </moneybookers_sft>
1021
- <moneybookers_so2 translate="label" module="moneybookers">
1022
- <label>Nordea Solo (powered by Moneybookers) - Finland</label>
1023
- <frontend_type>text</frontend_type>
1024
- <sort_order>281</sort_order>
1025
- <show_in_default>1</show_in_default>
1026
- <show_in_website>1</show_in_website>
1027
- <show_in_store>1</show_in_store>
1028
- <fields>
1029
- <active translate="label">
1030
- <label>Enabled</label>
1031
- <frontend_type>select</frontend_type>
1032
- <config_path>payment/moneybookers_so2/active</config_path>
1033
- <source_model>adminhtml/system_config_source_yesno</source_model>
1034
- <sort_order>1</sort_order>
1035
- <show_in_default>1</show_in_default>
1036
- <show_in_website>1</show_in_website>
1037
- <show_in_store>1</show_in_store>
1038
- </active>
1039
- <sort_order translate="label">
1040
- <label>Sort Order</label>
1041
- <frontend_type>text</frontend_type>
1042
- <config_path>payment/moneybookers_so2/sort_order</config_path>
1043
- <sort_order>3</sort_order>
1044
- <show_in_default>1</show_in_default>
1045
- <show_in_website>1</show_in_website>
1046
- <show_in_store>1</show_in_store>
1047
- </sort_order>
1048
- <title translate="label">
1049
- <label>Title</label>
1050
- <frontend_type>text</frontend_type>
1051
- <config_path>payment/moneybookers_so2/title</config_path>
1052
- <sort_order>5</sort_order>
1053
- <show_in_default>1</show_in_default>
1054
- <show_in_website>1</show_in_website>
1055
- <show_in_store>1</show_in_store>
1056
- </title>
1057
- <allowspecific translate="label">
1058
- <label>Payment from Applicable Countries</label>
1059
- <frontend_type>allowspecific</frontend_type>
1060
- <config_path>payment/moneybookers_so2/allowspecific</config_path>
1061
- <sort_order>6</sort_order>
1062
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1063
- <show_in_default>1</show_in_default>
1064
- <show_in_website>1</show_in_website>
1065
- <show_in_store>1</show_in_store>
1066
- </allowspecific>
1067
- <specificcountry translate="label">
1068
- <label>Payment from Specific Countries</label>
1069
- <frontend_type>multiselect</frontend_type>
1070
- <config_path>payment/moneybookers_so2/specificcountry</config_path>
1071
- <sort_order>7</sort_order>
1072
- <source_model>adminhtml/system_config_source_country</source_model>
1073
- <show_in_default>1</show_in_default>
1074
- <show_in_website>1</show_in_website>
1075
- <show_in_store>1</show_in_store>
1076
- <can_be_empty>1</can_be_empty>
1077
- </specificcountry>
1078
- </fields>
1079
- </moneybookers_so2>
1080
- <moneybookers_wlt translate="label" module="moneybookers">
1081
- <label>Moneybookers eWallet</label>
1082
- <frontend_type>text</frontend_type>
1083
- <sort_order>331</sort_order>
1084
- <show_in_default>1</show_in_default>
1085
- <show_in_website>1</show_in_website>
1086
- <show_in_store>1</show_in_store>
1087
- <fields>
1088
- <active translate="label">
1089
- <label>Enabled</label>
1090
- <frontend_type>select</frontend_type>
1091
- <config_path>payment/moneybookers_wlt/active</config_path>
1092
- <source_model>adminhtml/system_config_source_yesno</source_model>
1093
- <sort_order>1</sort_order>
1094
- <show_in_default>1</show_in_default>
1095
- <show_in_website>1</show_in_website>
1096
- <show_in_store>1</show_in_store>
1097
- </active>
1098
- <sort_order translate="label">
1099
- <label>Sort Order</label>
1100
- <frontend_type>text</frontend_type>
1101
- <config_path>payment/moneybookers_wlt/sort_order</config_path>
1102
- <sort_order>3</sort_order>
1103
- <show_in_default>1</show_in_default>
1104
- <show_in_website>1</show_in_website>
1105
- <show_in_store>1</show_in_store>
1106
- </sort_order>
1107
- <title translate="label">
1108
- <label>Title</label>
1109
- <frontend_type>text</frontend_type>
1110
- <config_path>payment/moneybookers_wlt/title</config_path>
1111
- <sort_order>5</sort_order>
1112
- <show_in_default>1</show_in_default>
1113
- <show_in_website>1</show_in_website>
1114
- <show_in_store>1</show_in_store>
1115
- </title>
1116
- <allowspecific translate="label">
1117
- <label>Payment from Applicable Countries</label>
1118
- <frontend_type>allowspecific</frontend_type>
1119
- <config_path>payment/moneybookers_wlt/allowspecific</config_path>
1120
- <sort_order>6</sort_order>
1121
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1122
- <show_in_default>1</show_in_default>
1123
- <show_in_website>1</show_in_website>
1124
- <show_in_store>1</show_in_store>
1125
- </allowspecific>
1126
- <specificcountry translate="label">
1127
- <label>Payment from Specific Countries</label>
1128
- <frontend_type>multiselect</frontend_type>
1129
- <config_path>payment/moneybookers_wlt/specificcountry</config_path>
1130
- <sort_order>7</sort_order>
1131
- <source_model>adminhtml/system_config_source_country</source_model>
1132
- <show_in_default>1</show_in_default>
1133
- <show_in_website>1</show_in_website>
1134
- <show_in_store>1</show_in_store>
1135
- <can_be_empty>1</can_be_empty>
1136
- </specificcountry>
1137
- </fields>
1138
- </moneybookers_wlt>
1139
- <moneybookers_obt translate="label" module="moneybookers">
1140
- <label>Online Bank Transfer (powered by Moneybookers)</label>
1141
- <frontend_type>text</frontend_type>
1142
- <sort_order>381</sort_order>
1143
- <show_in_default>1</show_in_default>
1144
- <show_in_website>1</show_in_website>
1145
- <show_in_store>1</show_in_store>
1146
- <fields>
1147
- <active translate="label">
1148
- <label>Enabled</label>
1149
- <frontend_type>select</frontend_type>
1150
- <config_path>payment/moneybookers_obt/active</config_path>
1151
- <source_model>adminhtml/system_config_source_yesno</source_model>
1152
- <sort_order>1</sort_order>
1153
- <show_in_default>1</show_in_default>
1154
- <show_in_website>1</show_in_website>
1155
- <show_in_store>1</show_in_store>
1156
- </active>
1157
- <sort_order translate="label">
1158
- <label>Sort Order</label>
1159
- <frontend_type>text</frontend_type>
1160
- <config_path>payment/moneybookers_obt/sort_order</config_path>
1161
- <sort_order>3</sort_order>
1162
- <show_in_default>1</show_in_default>
1163
- <show_in_website>1</show_in_website>
1164
- <show_in_store>1</show_in_store>
1165
- </sort_order>
1166
- <title translate="label">
1167
- <label>Title</label>
1168
- <frontend_type>text</frontend_type>
1169
- <config_path>payment/moneybookers_obt/title</config_path>
1170
- <sort_order>5</sort_order>
1171
- <show_in_default>1</show_in_default>
1172
- <show_in_website>1</show_in_website>
1173
- <show_in_store>1</show_in_store>
1174
- </title>
1175
- <allowspecific translate="label">
1176
- <label>Payment from Applicable Countries</label>
1177
- <frontend_type>allowspecific</frontend_type>
1178
- <config_path>payment/moneybookers_obt/allowspecific</config_path>
1179
- <sort_order>6</sort_order>
1180
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
1181
- <show_in_default>1</show_in_default>
1182
- <show_in_website>1</show_in_website>
1183
- <show_in_store>1</show_in_store>
1184
- </allowspecific>
1185
- <specificcountry translate="label">
1186
- <label>Payment from Specific Countries</label>
1187
- <frontend_type>multiselect</frontend_type>
1188
- <config_path>payment/moneybookers_obt/specificcountry</config_path>
1189
- <sort_order>7</sort_order>
1190
- <source_model>adminhtml/system_config_source_country</source_model>
1191
- <show_in_default>1</show_in_default>
1192
- <show_in_website>1</show_in_website>
1193
- <show_in_store>1</show_in_store>
1194
- <can_be_empty>1</can_be_empty>
1195
- </specificcountry>
1196
- </fields>
1197
- </moneybookers_obt>
1198
- </groups>
1199
- </moneybookers>
1200
- </sections>
1201
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/install-1.6.0.0.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- $installer = $this;
22
- /* @var $installer Mage_Core_Model_Resource_Setup */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Phoenix/Moneybookers/sql/moneybookers_setup/mysql4-upgrade-1.2-1.2.0.1.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Phoenix
16
- * @package Phoenix_Moneybookers
17
- * @copyright Copyright (c) 2013 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- /* @var $installer Mage_Core_Model_Resource_Setup */
22
- $installer = $this;
23
-
24
- $installer->startSetup();
25
- $conn = $installer->getConnection();
26
-
27
- $select = $conn
28
- ->select()
29
- ->from($this->getTable('core/config_data'), array('scope', 'scope_id', 'path', 'value'))
30
- ->where(new Zend_Db_Expr("path LIKE 'moneybookers/moneybookers%'"));
31
- $data = $conn->fetchAll($select);
32
-
33
- if (!empty($data)) {
34
- foreach ($data as $key => $value) {
35
- $data[$key]['path'] = preg_replace('/^moneybookers\/moneybookers/', 'payment/moneybookers', $value['path']);
36
- }
37
- $conn->insertOnDuplicate($this->getTable('core/config_data'), $data, array('path'));
38
- $conn->delete($this->getTable('core/config_data'), new Zend_Db_Expr("path LIKE 'moneybookers/moneybookers%'"));
39
- }
40
-
41
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/brainsins_recommender.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ -->
24
+ <layout>
25
+ <adminhtml_system_config_edit>
26
+ <reference name="head">
27
+ <action method="addCss">
28
+ <stylesheet>brainsins/recommender/css/brainsins_recommender.css</stylesheet>
29
+ </action>
30
+ <action method="addItem">
31
+ <type>skin_js</type>
32
+ <name>brainsins/recommender/js/brainsins_recommender.js</name>
33
+ </action>
34
+ </reference>
35
+ </adminhtml_system_config_edit>
36
+ </layout>
app/design/adminhtml/default/default/template/brainsins/recommender/help.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ */
24
+ ?>
25
+ <?php
26
+ if ($this->getHelpLink()):
27
+ ?>
28
+ <div class="brainsins-help">
29
+ <?php //echo Mage::helper('brainsins_recommender')->__('Need help? Click <a href="%s" target="_blank">here</a> to learn more.', $this->getHelpLink()); ?>
30
+ </div>
31
+ <?php
32
+ endif;
33
+ ?>
34
+ <div></div>
app/design/frontend/base/default/layout/brainsins_recommender.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
4
+ * personalized product recommendations into a Magento Store.
5
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
6
+ *
7
+ * This file is part of BrainSINS' Magento Extension.
8
+ *
9
+ * BrainSINS' Magento Extension is free software: you can redistribute it
10
+ * and/or modify it under the terms of the GNU General Public License
11
+ * as published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * Foobar is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ * Please do not hesitate to contact us at info@brainsins.com
23
+ -->
24
+ <layout version="0.1.0">
25
+ <default>
26
+ <reference name="before_body_end">
27
+ <block type="core/template" name="brainsins_js" after="-">
28
+ <action method="setTemplate" ifconfig="brainsins_recommender_options/brainsins_recommender_general/enabled" after="-">
29
+ <template>brainsins/recommender/js.phtml</template>
30
+ </action>
31
+ </block>
32
+ </reference>
33
+ </default>
34
+ </layout>
app/{code/community → design/frontend/base/default/template/brainsins/recommender}/.DS_Store RENAMED
Binary file
app/design/frontend/base/default/template/brainsins/recommender/js.phtml ADDED
@@ -0,0 +1,414 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_enabled = Mage::getStoreConfigFlag('brainsins_recommender_options/brainsins_recommender_general/enabled', Mage::app()->getStore()->getStoreId()); ?>
2
+ <?php if($_enabled):?>
3
+ <?php $_bskey = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/bs_key', Mage::app()->getStore()->getStoreId()); ?>
4
+ <?php $_bs_ajax_tracking = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_advanced/ajax_tracking', Mage::app()->getStore()->getStoreId()); ?>
5
+ <?php $_bs_custom_script = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_advanced/custom_script', Mage::app()->getStore()->getStoreId()); ?>
6
+ <!-- BrainSINS Code Starts -->
7
+ <script type='text/javascript'>
8
+ <?php
9
+ $_apiMode = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_advanced/api_mode', Mage::app()->getStore()->getStoreId());
10
+ $_script_path = '"/brainsins.js"';
11
+ $_custom_script_path = "/$_bskey/$_bskey.js";
12
+ ?>
13
+ <?php if($_bs_custom_script):?>
14
+ var bs_custom_script = true;
15
+ <?php endif; ?>
16
+ <?php if(!$_bs_ajax_tracking):?>
17
+ var bs = document.createElement('script');
18
+ bs.type = 'text/javascript';
19
+ bs.async = true;
20
+ bs.src = (document.location.protocol == 'https:' ? 'https://d2xkqxdy6ewr93.cloudfront.net' : 'http://clients.cdn.brainsins.com') + <?php echo $_script_path?> ;
21
+ var head = document.getElementsByTagName('head')[0];
22
+ head.appendChild(bs);
23
+ <?php endif; ?>
24
+ brainsins_token = "<?php echo $_bskey ?>";
25
+ <?php if ($_apiMode && $_apiMode == "1") {
26
+ echo 'var brainsins_api_mode = "B";';
27
+ }?>
28
+ <?php
29
+ //$_lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
30
+ $_lang = Mage::app()->getStore()->getCode();
31
+ $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
32
+ //HOME PAGE
33
+ if(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName().'/'.Mage::app()->getRequest()->getRouteName() == 'index/index/cms')
34
+ {
35
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('home', Mage::app()->getStore()->getStoreId());
36
+ echo "
37
+ var BrainSINSData = {
38
+ pageType: 'home',
39
+ currency: '".$currentCurrencyCode."',
40
+ language: '".$_lang."'
41
+ ";
42
+ echo Mage::helper('brainsins_recommender')->getRecommendersJs($_recommenders);
43
+ echo "};";
44
+ }
45
+ //PRODUCT PAGE
46
+ elseif(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'product/view')
47
+ {
48
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('product', Mage::app()->getStore()->getStoreId());
49
+ echo "
50
+ var BrainSINSData = {
51
+ pageType: 'product',
52
+ currency: '".$currentCurrencyCode."',
53
+ productId: ".Mage::registry('current_product')->getId().",
54
+ language: '".$_lang."'";
55
+ echo Mage::helper('brainsins_recommender')->getRecommendersJs($_recommenders);
56
+ echo "};";
57
+ }
58
+ //CART PAGE
59
+ elseif(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'cart/index')
60
+ {
61
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('cart', Mage::app()->getStore()->getStoreId());
62
+ $cart_js = '';
63
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
64
+ $result = Mage::helper('brainsins_recommender')->updateCartInBrainsins($quote, true);
65
+ /* SUSTITUIDO POR WS */
66
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
67
+ $items = $quote->getAllVisibleItems();
68
+ if(count($items) > 0)
69
+ {
70
+ $cart_js .= "pageType: 'cart',
71
+ cart: [
72
+ ";
73
+ for ($i = 0; $i < sizeof($items); $i++)
74
+ {
75
+ $item = $items[$i];
76
+ $cart_js .= "{id: '{$item->getProductId()}', quantity: '{$item->getQty()}', price: '{$item->getPriceInclTax()}'}";
77
+ if ($i < sizeof($items) - 1) {
78
+ $cart_js .= ",";
79
+ }
80
+ }
81
+ $cart_js .= '
82
+ ]';
83
+ }
84
+ else
85
+ {
86
+ $cart_js .= "pageType: 'cart'";
87
+ }
88
+
89
+ echo "
90
+ var BrainSINSData = {
91
+ ".$cart_js.",
92
+ currency: '".$currentCurrencyCode."',
93
+ language: '".$_lang."'";
94
+ echo Mage::helper('brainsins_recommender')->getRecommendersJs($_recommenders);
95
+ echo "};";
96
+ }
97
+ //CHECKOUT PAGE
98
+ elseif(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'onepage/index' ||
99
+ Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'multishipping/addresses')
100
+ {
101
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
102
+ $result = Mage::helper('brainsins_recommender')->updateCartInBrainsins($quote, true);
103
+
104
+ echo "
105
+ var BrainSINSData = {
106
+ pageType: 'checkout',
107
+ currency: '".$currentCurrencyCode."',
108
+ language: '".$_lang."'";
109
+ echo "};";
110
+ }
111
+ //THANK YOU PAGE
112
+ elseif(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'onepage/success')
113
+ {
114
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('checkout', Mage::app()->getStore()->getStoreId());
115
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
116
+ $order = Mage::getModel('sales/order')->load($orderId);
117
+ $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
118
+ $totalAmount = Mage::helper('directory')->currencyConvert($order->getGrandTotal(), $currentCurrencyCode, $baseCurrencyCode);
119
+ echo "
120
+ var BrainSINSData = {
121
+ pageType: 'thankYou',
122
+ currency: '".$currentCurrencyCode."',
123
+ language: '".$_lang."',
124
+ totalAmount: ".number_format($totalAmount, 2, ".", "");
125
+ echo Mage::helper('brainsins_recommender')->getRecommendersJs($_recommenders);
126
+ echo "};";
127
+ }
128
+ //CATEGORY PAGE
129
+ elseif(Mage::app()->getRequest()->getControllerName().'/'.Mage::app()->getRequest()->getActionName() == 'category/view')
130
+ {
131
+ $_recommenders = Mage::helper('brainsins_recommender')->getConfiguration('category', Mage::app()->getStore()->getStoreId());
132
+ $categories = array();
133
+ $root_category = Mage::app()->getStore()->getRootCategoryId();
134
+ $current_category = Mage::registry('current_category');
135
+ array_push($categories, $current_category->getId());
136
+ $parent_category = $current_category->getParentCategory();
137
+ while ($root_category < $parent_category->getId()) {
138
+ array_push($categories, $parent_category->getId());
139
+ $parent_category = $parent_category->getParentCategory();
140
+ }
141
+ echo "
142
+ var BrainSINSData = {
143
+ pageType: 'category',
144
+ currency: '".$currentCurrencyCode."',
145
+ language: '".$_lang."',
146
+ categoryId: ".$current_category->getId().",
147
+ categories: '".implode(',', array_reverse($categories))."'";
148
+ echo Mage::helper('brainsins_recommender')->getRecommendersJs($_recommenders);
149
+ echo "};";
150
+ }
151
+ else
152
+ {
153
+ echo "
154
+ var BrainSINSData = {
155
+ pageType: 'other',
156
+ currency: '".$currentCurrencyCode."',
157
+ language: '".$_lang."'";
158
+ echo "};";
159
+ }
160
+ ?>
161
+ <?php
162
+
163
+ $bs_register = Mage::getSingleton('core/cookie')->get('brainsins_register');
164
+ $bs_login = Mage::getSingleton('core/cookie')->get('brainsins_login');
165
+ $bs_logout = Mage::getSingleton('core/cookie')->get('brainsins_logout');
166
+ $bs_news = Mage::getSingleton('core/cookie')->get('brainsins_news');
167
+ $email_tracking = Mage::getStoreConfig('brainsins_recommender_options/brainsins_recommender_general/email_tracking', Mage::app()->getStore()->getStoreId());
168
+
169
+ if(!$_bs_ajax_tracking && $bs_register && $bs_register != '0')
170
+ {
171
+ if($email_tracking == '1')
172
+ {
173
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_register');
174
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
175
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
176
+ if($subscriber->getId() && $subscriber->getSubscriberStatus() == '1')
177
+ {
178
+ Mage::getSingleton('core/cookie')->delete('brainsins_register');
179
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
180
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
181
+ BrainSINSData.userNewsletter = 1;
182
+ BrainSINSData.login = 1;';
183
+ }
184
+ else
185
+ {
186
+ Mage::getSingleton('core/cookie')->delete('brainsins_register');
187
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
188
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
189
+ BrainSINSData.userNewsletter = 0;
190
+ BrainSINSData.login = 1;';
191
+ }
192
+ unset($customer);unset($subscriber);
193
+ }
194
+ elseif($email_tracking == '2')
195
+ {
196
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_register');
197
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
198
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
199
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
200
+ BrainSINSData.userNewsletter = 0;
201
+ BrainSINSData.login = 1;';
202
+ }
203
+ elseif($email_tracking == '0')
204
+ {
205
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_register');
206
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
207
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
208
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
209
+ BrainSINSData.userNewsletter = 0;
210
+ BrainSINSData.login = 1;';
211
+ }
212
+ Mage::getSingleton('core/cookie')->set('brainsins_register', '0', time()+86400, '/');
213
+ if(Mage::getSingleton('core/cookie')->get('brainsins_login'))
214
+ Mage::getSingleton('core/cookie')->set('brainsins_login', '0', time()+86400, '/');
215
+ if(Mage::getSingleton('core/cookie')->get('brainsins_logout'))
216
+ Mage::getSingleton('core/cookie')->set('brainsins_logout', '0', time()+86400, '/');
217
+ if(Mage::getSingleton('core/cookie')->get('brainsins_news'))
218
+ Mage::getSingleton('core/cookie')->set('brainsins_news', '0', time()+86400, '/');
219
+ unset($customer);
220
+ }
221
+ ?>
222
+ <?php
223
+ if(!$_bs_ajax_tracking && $bs_login && $bs_login != '0' && $bs_register == '0')
224
+ {
225
+ if($email_tracking == '1')
226
+ {
227
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_login');
228
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
229
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
230
+ if($subscriber->getId() && $subscriber->getSubscriberStatus() == '1')
231
+ {
232
+ Mage::getSingleton('core/cookie')->delete('brainsins_login');
233
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
234
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
235
+ BrainSINSData.userNewsletter = 1;
236
+ BrainSINSData.login = 1;';
237
+ }
238
+ else
239
+ {
240
+ Mage::getSingleton('core/cookie')->delete('brainsins_login');
241
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
242
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
243
+ BrainSINSData.userNewsletter = 0;
244
+ BrainSINSData.login = 1;';
245
+ }
246
+ unset($customer);unset($subscriber);
247
+ }
248
+ elseif($email_tracking == '2')
249
+ {
250
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_login');
251
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
252
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
253
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
254
+ BrainSINSData.userNewsletter = 1;
255
+ BrainSINSData.login = 1;';
256
+ }
257
+ elseif($email_tracking == '0')
258
+ {
259
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_login');
260
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
261
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
262
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
263
+ BrainSINSData.userNewsletter = 0;
264
+ BrainSINSData.login = 1;';
265
+ }
266
+ Mage::getSingleton('core/cookie')->set('brainsins_login', '0', time()+86400, '/');
267
+ unset($customer);
268
+ }
269
+ ?>
270
+ <?php
271
+ if(!$_bs_ajax_tracking && $bs_logout && $bs_logout != '0' && $bs_register == '0')
272
+ {
273
+ echo 'BrainSINSData.logout = 1;';
274
+ Mage::getSingleton('core/cookie')->set('brainsins_logout', '0', time()+86400, '/');
275
+ }
276
+ ?>
277
+ <?php
278
+ if(!$_bs_ajax_tracking && $bs_news && $bs_news != '0' && $bs_register == '0')
279
+ {
280
+ $customer_id = Mage::getSingleton('core/cookie')->get('brainsins_news');
281
+ $customer = Mage::getModel('customer/customer')->load($customer_id);
282
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($customer->getEmail());
283
+ $lang = explode('_', Mage::app()->getLocale()->getLocaleCode());
284
+ if($subscriber->getSubscriberStatus() == '3')
285
+ {
286
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
287
+ BrainSINSData.userNewsletter = 0;
288
+ BrainSINSData.login = 1;';
289
+ }
290
+ elseif($subscriber->getSubscriberStatus() == '1') {
291
+ echo 'BrainSINSData.userEmail = "' . $customer->getEmail() .'";
292
+ BrainSINSData.userNewsletter = 1;
293
+ BrainSINSData.login = 1;';
294
+ }
295
+ Mage::getSingleton('core/cookie')->set('brainsins_news', '0', time()+86400, '/');
296
+ unset($customer);unset($subscriber);
297
+ }
298
+ ?>
299
+ <?php
300
+ if ($_bs_ajax_tracking) {
301
+ $_url = Mage::getUrl("brainsins/tracking/bdata", array('_secure' => true));
302
+ ?>
303
+ var bdata_controller_url = "<?php echo $_url?>";
304
+ bdata_controller_url += "rnd/" + new Date().getTime() + "/";
305
+ bdata_controller_url += "bdata/" + encodeURIComponent(JSON.stringify(BrainSINSData));
306
+
307
+ bdata_controller_url = bdata_controller_url.replace("https:","").replace("http:","");
308
+
309
+ new Ajax.Request(bdata_controller_url, {
310
+ method: "get",
311
+ onSuccess: function(transport) {
312
+ var newBdata = transport.responseJSON;
313
+ if (newBdata) {
314
+ BrainSINSData = newBdata;
315
+ }
316
+ var bs = document.createElement('script');
317
+ bs.type = 'text/javascript';
318
+ bs.async = true;
319
+ bs.src = (document.location.protocol == 'https:' ? 'https://d2xkqxdy6ewr93.cloudfront.net' : 'http://clients.cdn.brainsins.com') + <?php echo $_script_path?> ;
320
+ var head = document.getElementsByTagName('head')[0];
321
+ head.appendChild(bs);
322
+ var domain = "." + window.location.hostname;
323
+ bsUnsetCookie("brainsins_login", domain);
324
+ bsUnsetCookie("brainsins_news", domain);
325
+ bsUnsetCookie("brainsins_register", domain);
326
+ bsUnsetCookie("brainsins_logout", domain);
327
+ }
328
+ });
329
+
330
+ <?php
331
+ }
332
+ ?>
333
+ <?php if($_bs_custom_script):?>
334
+
335
+ var bs = document.createElement('script');
336
+ bs.type = 'text/javascript';
337
+ bs.async = true;
338
+ bs.src = (document.location.protocol == 'https:' ? 'https://d2xkqxdy6ewr93.cloudfront.net' : 'http://clients.cdn.brainsins.com') + '<?php echo $_custom_script_path?>';
339
+ var head = document.getElementsByTagName('head')[0];
340
+ head.appendChild(bs);
341
+ <?php endif; ?>
342
+ </script>
343
+ <script type="text/javascript">
344
+ function bsTrackProductCallback() {
345
+ var cookies = BrainSINS.Cookies;
346
+ var constants = BrainSINS.Constants;
347
+ var url = cookies.get(constants.urlNext);
348
+ self.location = url;
349
+ return false;
350
+ };
351
+ function bsTrackProductClicked(productId, idRecommendation, idPrevPage, url) {
352
+ var cookies = BrainSINS.Cookies;
353
+ var constants = BrainSINS.Constants;
354
+ cookies.set(constants.urlNext, url, constants.daysInCookie);
355
+ cookies.set(constants.idRecommendation, idRecommendation,
356
+ constants.daysInCookie);
357
+ cookies.set(constants.idPrevPage, idPrevPage, constants.daysInCookie);
358
+ BrainSINSTracker.trackProductview(productId, "bsTrackProductCallback");
359
+ return false;
360
+ };
361
+
362
+ function bsGetCookie(name) {
363
+ var value = "; " + document.cookie;
364
+ var parts = value.split("; " + name + "=");
365
+ if (parts.length == 2)
366
+ return parts.pop().split(";").shift();
367
+ return "";
368
+ }
369
+
370
+ function bsSetCookie(propertyName, value, domain) {
371
+ document.cookie = propertyName + "=" + encodeURI(value) + ";path=/"
372
+ + ";max-age=31536000" + (domain != null ? ";domain=" + domain : "");
373
+ }
374
+
375
+ function bsUnsetCookie(propertyName, domain) {
376
+ document.cookie = propertyName + "='';path=/"
377
+ + ";max-age=0" + (domain != null ? ";domain=" + domain : "");
378
+ }
379
+
380
+
381
+ function requestBrainSINSRecommendations(storeUrl, recommenderId, template, div, maxResults, productId, userId, filterCategories, filterLevel, callback, debug) {
382
+
383
+ if (productId == null) productId = BrainSINSData.productId;
384
+
385
+ if (userId == null) userId = bsGetCookie("bsCoId");
386
+
387
+ var url = storeUrl + "/brainsins/recommendation/recommendations";
388
+ url += "?recommenderId=" + recommenderId;
389
+ url += "&template=" + template;
390
+ url += productId == null ? "" : "&productId=" + productId;
391
+ url += userId == null ? "" : "&userId=" + userId;
392
+ url += maxResults == null ? "" : "&maxResults=" + maxResults;
393
+ url += filterCategories == null ? "" : "&filterCategories=" + filterCategories;
394
+ url += filterLevel == null ? "" : "&filterLevel=" + filterLevel;
395
+
396
+ url += "&rnd=" + new Date().getTime();
397
+ //brainsins/smartecommerce/test.phtml
398
+ if (debug) {
399
+ console.log(url);
400
+ }
401
+ new Ajax.Request(url,
402
+ { method: "get",
403
+ onSuccess: function(transport) {
404
+ document.getElementById(div).innerHTML = transport.responseText;
405
+ if (typeof callback == "function") {
406
+ callback();
407
+ }
408
+ }}
409
+ );
410
+
411
+ }
412
+ </script>
413
+ <!-- BrainSINS Code Ends -->
414
+ <?php endif; ?>
app/design/frontend/base/default/template/brainsins/recommender/sample.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* --- GET RECOMMENDATIONS --- */
3
+ $recommendations = $this->getRecommendations();
4
+ ?>
5
+
6
+ <?php if(count($recommendations)): ?>
7
+ <div class="box-collateral box-up-sell">
8
+ <h2>
9
+ <?php echo $this->__('You may also be interested in the following product(s)') ?></h2>
10
+ <table class="products-grid" id="upsell-product-table">
11
+
12
+ <tr>
13
+ <?php for($_j=0; $_j < count($recommendations); $_j++):
14
+ $id = $recommendations[$_j];
15
+ $product = Mage::getModel("catalog/product");
16
+ $product->load($id);
17
+ ?>
18
+ <td>
19
+ <!-- PLEASE NOTE THE USE OF THE ONCLICK ATTRIBUTE. IT MUST BE USED IN ALL ANCHORS/BUTTONS -->
20
+ <a onclick="<?php echo $this->getOnclick($id, $product->getProductUrl()) ?>" href="<?php echo $product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($product->getName()) ?>" class="product-image">
21
+ <img
22
+ src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(125) ?>"
23
+ width="125" height="125"
24
+ alt="<?php echo $this->htmlEscape($product->getName()) ?>"
25
+ />
26
+ </a>
27
+ <h3 class="product-name"><?php echo $id?></h3>
28
+ <h3 class="product-name">
29
+ <a onclick="<?php echo $this->getOnclick($id, $product->getProductUrl()) ?>" href="<?php echo $product->getProductUrl() ?>"
30
+ title="<?php echo $this->htmlEscape($product->getName()) ?>"><?php echo $this->htmlEscape($product->getName()) ?>
31
+ </a>
32
+ </h3>
33
+
34
+ <?php echo $this->getPriceHtml($product, true, '-upsell') ?>
35
+ <p><button onclick="<?php echo $this->getOnclick($id, $this->getAddToCartUrl($product)) ?>" type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
36
+
37
+ </td>
38
+ <?php endfor; ?>
39
+ </tr>
40
+ </table>
41
+ <script type="text/javascript">decorateTable('upsell-product-table')</script>
42
+ </div>
43
+ <?php endif ?>
app/etc/modules/Brainsins_Recommender.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <!--
4
+ * BrainSINS' Magento Extension allows to integrate the BrainSINS
5
+ * personalized product recommendations into a Magento Store.
6
+ * Copyright (c) 2014 Social Gaming Platform S.R.L.
7
+ *
8
+ * This file is part of BrainSINS' Magento Extension.
9
+ *
10
+ * BrainSINS' Magento Extension is free software: you can redistribute it
11
+ * and/or modify it under the terms of the GNU General Public License
12
+ * as published by the Free Software Foundation, either version 3 of the
13
+ * License, or (at your option) any later version.
14
+ *
15
+ * Foobar is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
22
+ *
23
+ * Please do not hesitate to contact us at info@brainsins.com
24
+ -->
25
+
26
+ <config>
27
+ <modules>
28
+ <Brainsins_Recommender>
29
+ <active>true</active>
30
+ <codePool>community</codePool>
31
+ </Brainsins_Recommender>
32
+ </modules>
33
+ </config>
app/locale/en_US/Brainsins_Recommender.csv ADDED
File without changes
app/locale/es_ES/Brainsins_Recommender.csv ADDED
File without changes
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Brainsins_Recommender</name>
4
- <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
@@ -18,11 +18,11 @@ Some key features:&#xD;
18
  * Easily create marketing rules that modify your e-commerce website or interact with your customers according to user behavior.&#xD;
19
  * Use gamification to engage and cultivate the loyalty of your customers and grow a community of prescribers.&#xD;
20
  * We provide a full e-commerce analytics solution to help you understand the evolution of your online business.</description>
21
- <notes>New version includes the possibility to use the cart abandonment and behavioral targeting services</notes>
22
  <authors><author><name>BrainSINS</name><user>acuevas</user><email>support@brainsins.com</email></author></authors>
23
- <date>2014-09-01</date>
24
- <time>14:42:33</time>
25
- <contents><target name="magecommunity"><dir><dir name="Brainsins"><dir name="Recommender"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Expanded.php" hash="8fb32bbec5454610a8aab055c8891bf7"/><file name="Help.php" hash="df89b5f0a9d7510aa1393c888324e6dd"/></dir><dir name="Form"><dir name="Fieldset"><dir name="Dashboard"><file name="Dashboard.php" hash="7fcdcc0b077e1fcd40f209ada40d183e"/></dir></dir></dir><dir name="Source"><dir name="Feeds"><file name="ProductOffline.php" hash="d2480bf9d3a79f41b5889c46f747c008"/><file name="ProductOnline.php" hash="8a64b9b4cf0b1e57e0afa19889271934"/></dir><dir name="Recommenders"><file name="Cart.php" hash="7ed517187468da5c9878ac1230d45d79"/><file name="Category.php" hash="28a9b7de22a6d63decd1f619b68096a8"/><file name="Checkout.php" hash="3eb762e84f77767bde8a4f68aaf510c9"/><file name="Home.php" hash="5c4cd039a134f428bd083a955ce69f4c"/><file name="Product.php" hash="0b8420fbd092066dd8e2cb132ac218e3"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f524b9a6f3460c3eb9842f5cd6463516"/><file name="sendBrainsinsWS.log" hash="980c17cfaeb0e50531639415ca6f99ca"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="f0187336296261795b3163d7da20a24d"/><file name="Serialized.php" hash="c68122c82e7e1fc13a2575ac4e417d78"/></dir><dir name="Source"><file name="ApiMode.php" hash="80852b4069d03c7a3b70390d67d2f875"/><file name="Attributes.php" hash="c223fe5451b35bb8779ec8d3e077d4b7"/><file name="Emailtracking.php" hash="cad497a703313a2c664ca1426f4640d5"/></dir></dir></dir></dir><file name="Cron.php" hash="bc4accfcba862a6559173111d656bccd"/><file name="Observer.php" hash="1dd050207b28e838567f7904f2a434c5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FeedsController.php" hash="d318a3d4ba80b9587229a4f364bd3de3"/></dir><file name="CartController.php" hash="7620ccf7257d06e7180ed48898ffe966"/><file name="FeedsController.php" hash="81a7c6c7f78ea6686cbda2f1c0da6658"/></dir><dir name="etc"><file name="config.xml" hash="0828af9f521d32c3cb5f78ab0abca89f"/><file name="system.xml" hash="263bc620bc682cbf40f955f82b026240"/></dir></dir></dir><dir name="Cm"><dir name="RedisSession"><dir name="Model"><file name="Session.php" hash="fd4d16e73989a8b93582f8c11f8fdc40"/></dir><dir name="etc"><file name="config.xml" hash="4173754174f995f9f7a141747f417abc"/></dir></dir></dir><dir name="Phoenix"><dir name="Moneybookers"><dir name="Block"><file name="Form.php" hash="d370e3ba59cc15b139c7e1e79e2ec3a8"/><file name="Info.php" hash="62e0b852138497e92e28c9b739fdeb51"/><file name="Jsinit.php" hash="806c21c3c1f6891e056c4fe217e5374b"/><file name="Payment.php" hash="47d945df55393205e90df2bdee7f57ee"/><file name="Placeform.php" hash="bb0a62dde1c87ee4518fad309ecca426"/><file name="Redirect.php" hash="690db6960e1d664f98071cc3363bbf82"/></dir><dir name="Helper"><file name="Data.php" hash="1bcfdee03be9c9b9f1de57945bc10fd8"/></dir><dir name="Model"><file name="Abstract.php" hash="a2baa08ad86464916d7ffff3911c6615"/><file name="Acc.php" hash="9acaa3fe91835c9b5cd76ca6c9652c24"/><file name="Csi.php" hash="800984e5e8f2dd8389db023f0bf94ba8"/><file name="Did.php" hash="2aabc76e6b2fce0fcd2b79fcdae2f39f"/><file name="Dnk.php" hash="5f6a72c8b66d82e1b596af71ff7761ef"/><file name="Ebt.php" hash="6f0700837364d81149375a5aff3cb432"/><file name="Ent.php" hash="e14c39741e0fa1685695f7b03ade94c7"/><file name="Event.php" hash="2157aee0bbdd7e617e38d93aa7ea25cb"/><file name="Gcb.php" hash="164aaab54b6588476311553fa1e8aa8e"/><file name="Gir.php" hash="8cbbe836c24a75f96ca254cc64b37530"/><file name="Idl.php" hash="406ea46922aec31a9a36e7546b536e93"/><file name="Lsr.php" hash="b6123f853a9c50e8a9042f22322a3c6a"/><file name="Mae.php" hash="27d52b915464d18e796e40ee1934eda4"/><file name="Npy.php" hash="3e7de0ae735d2ab2ed25f699760c0aa1"/><file name="Obt.php" hash="50574d80cbef899ede7d633578b2e501"/><file name="Pli.php" hash="03287f56e87f6c3e49b85e1f3da924c6"/><file name="Psp.php" hash="6d332cc36358e9f3f5ac620cba9af1d9"/><file name="Pwy.php" hash="51c8d18558856ad32d72cba9f98a855f"/><file name="Sft.php" hash="0b9ed6c8854b102c4a517e173254980f"/><file name="So2.php" hash="ddfb8422fcbf683bc638d30b444a33cf"/><file name="Wlt.php" hash="274c375afcbfb88771c46a690de0a28e"/></dir><dir name="controllers"><file name="MoneybookersController.php" hash="1053419f00a59f2066eba6cee216a268"/><file name="ProcessingController.php" hash="abbb7c0deac91e3706bec90441ce1d93"/></dir><dir name="etc"><file name="config.xml" hash="e4ef3eb7e2c9e2034b4742d17a1c5172"/><file name="system.xml" hash="88c6ba64f6818bec99318033a65d21ce"/></dir><dir name="sql"><dir name="moneybookers_setup"><file name="install-1.6.0.0.php" hash="a5edad640edce622fc5d38cf5c66690b"/><file name="mysql4-upgrade-1.2-1.2.0.1.php" hash="b5cdb216060dedaf870604fdfd6dc931"/></dir></dir></dir></dir><dir><file name=".DS_Store" hash="c7a63c203a59292d521472373612a165"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="brainsins"><dir name="recommender"><dir name="css"><file name="brainsins_recommender.css" hash="2f78edfcf818a7c73f88c6f90fcae4bd"/></dir><dir name="images"><file name="brainsins.png" hash="98f06e0c5eb7668dd7293fc89614f7bc"/><file name="brainsins_logo.png" hash="cb4086cde3e5eef572159bd9f2ebd298"/><file name="feed_file_nok.gif" hash="e4f28607f075a105e53fa3113d84bd26"/><file name="feed_file_ok.gif" hash="834dfafd5f8b44c4b24a4c00add56fcf"/></dir><dir name="js"><file name="brainsins_recommender.js" hash="7714eec6618fade6d59fe6e9d6670e78"/></dir></dir></dir></dir></dir></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Brainsins_Recommender</name>
4
+ <version>2.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
18
  * Easily create marketing rules that modify your e-commerce website or interact with your customers according to user behavior.&#xD;
19
  * Use gamification to engage and cultivate the loyalty of your customers and grow a community of prescribers.&#xD;
20
  * We provide a full e-commerce analytics solution to help you understand the evolution of your online business.</description>
21
+ <notes>Fixed issues in catalog feed generation for multi-store data</notes>
22
  <authors><author><name>BrainSINS</name><user>acuevas</user><email>support@brainsins.com</email></author></authors>
23
+ <date>2015-07-09</date>
24
+ <time>10:17:30</time>
25
+ <contents><target name="magecommunity"><dir name="Brainsins"><dir name="Recommender"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Expanded.php" hash="8fb32bbec5454610a8aab055c8891bf7"/><file name="Help.php" hash="df89b5f0a9d7510aa1393c888324e6dd"/></dir><dir name="Form"><dir name="Fieldset"><dir name="Dashboard"><file name="Dashboard.php" hash="7fcdcc0b077e1fcd40f209ada40d183e"/></dir></dir></dir><dir name="Source"><dir name="Feeds"><file name="ProductOffline.php" hash="d2480bf9d3a79f41b5889c46f747c008"/><file name="ProductOnline.php" hash="8a64b9b4cf0b1e57e0afa19889271934"/></dir><dir name="Recommenders"><file name="Cart.php" hash="3c8b3efaa4edfb696483b7e04787f852"/><file name="Category.php" hash="df3bdf28ef21e61d954d561e5bf69e13"/><file name="Checkout.php" hash="a4cf4b2b0df44b8efdc983a2616105c1"/><file name="Home.php" hash="c77c1afbdac04b9eec90e749aa67a6f9"/><file name="Product.php" hash="2ca0f98935197a5f515d0882e4177e00"/><file name="Show.php" hash="108263f746e4650ad46878b97edfd43c"/></dir><file name=".DS_Store" hash="cd13bedbe6a831f3f69fe4edf83e8755"/></dir><file name=".DS_Store" hash="ffb635d260d4dc0cfe910fcfa4678f0b"/></dir><file name=".DS_Store" hash="e76a7d37275624e6d31515a1898a2639"/></dir><file name=".DS_Store" hash="9f70fac690f62d5ca42c10fdf22cec46"/></dir><file name="Recommendations.php" hash="223234fb802b171bc46d4840e9a3e325"/><file name=".DS_Store" hash="4760d19954d6579511c6aa164b4b8b24"/></dir><dir name="Helper"><file name="Data.php" hash="9d781e8ba2d63e28e4e743feb74cf67f"/><file name="sendBrainsinsWS.log" hash="3ea4f9e70438ab097c878da3f1929a0f"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="f0187336296261795b3163d7da20a24d"/><file name="Serialized.php" hash="c68122c82e7e1fc13a2575ac4e417d78"/></dir><dir name="Source"><file name="Apimode.php" hash="80852b4069d03c7a3b70390d67d2f875"/><file name="Attributes.php" hash="c223fe5451b35bb8779ec8d3e077d4b7"/><file name="Emailtracking.php" hash="cad497a703313a2c664ca1426f4640d5"/></dir></dir></dir></dir><file name="Brainsins.php" hash="4012634c558c030effa04c92485621ba"/><file name="Cron.php" hash="04e1ed2c59fa488e614fe903abac45d1"/><file name="Observer.php" hash="b7ad40b26c31c5d00a508e8f6d85f294"/><file name="Recommendation.php" hash="a8918aceeb106b2b5afe8664c87229ef"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FeedsController.php" hash="d318a3d4ba80b9587229a4f364bd3de3"/></dir><file name="CartController.php" hash="c1e857c1f5dc3f0ecf202bb825f48a84"/><file name="FeedsController.php" hash="f54c8cebf3830dafd891c70852f4fab2"/><file name="LoginController.php" hash="d785c70c275d0e68231af0e452d42ce1"/><file name="RecommendationController.php" hash="1ead8f07f6ff07b5ed2283581a4ad1ab"/><file name="TrackingController.php" hash="5b5baab64b88cd56c994ac2e903cb0f6"/></dir><dir name="etc"><file name="config.xml" hash="11188a29343022b03ae5fff1d5feb93d"/><file name="system.xml" hash="8b991e7e736e3d78f75cc2fe9f85fbd9"/></dir><file name=".DS_Store" hash="58c3442e4ba49421d0b1b8a710915663"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="brainsins_recommender.xml" hash="a0008aeb7f895e96b60995792d37bed9"/></dir><dir name="template"><dir name="brainsins"><dir name="recommender"><file name="help.phtml" hash="890622a39d07bd9029fbab39e3f7abf7"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="brainsins_recommender.xml" hash="900b7d4523b6aa3f96bbb68adc417782"/></dir><dir name="template"><dir name="brainsins"><dir name="recommender"><file name="js.phtml" hash="d3ca9cdfd0b92c9a792ba5d3a9f00a68"/><file name="sample.phtml" hash="8ee06704ba1f71a60c771e5e8816912a"/><file name=".DS_Store" hash="130a08fd4b88f2255cfb0f1659d73a38"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Brainsins_Recommender.xml" hash="c21aad4e40fa1f6116c385a7a244f459"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Brainsins_Recommender.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="es_ES"><file name="Brainsins_Recommender.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="brainsins"><dir name="recommender"><dir name="css"><file name="brainsins_recommender.css" hash="db420d334316b3d19f013c7d1289e6c8"/></dir><dir name="images"><file name="brainsins.png" hash="98f06e0c5eb7668dd7293fc89614f7bc"/><file name="brainsins_logo.png" hash="cb4086cde3e5eef572159bd9f2ebd298"/><file name="feed_file_nok.gif" hash="e4f28607f075a105e53fa3113d84bd26"/><file name="feed_file_ok.gif" hash="834dfafd5f8b44c4b24a4c00add56fcf"/></dir><dir name="js"><file name="brainsins_recommender.js" hash="e30774992d3a502228863676c187abe7"/></dir></dir></dir></dir></dir></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
28
  </package>
skin/adminhtml/default/default/brainsins/recommender/css/brainsins_recommender.css CHANGED
@@ -19,7 +19,7 @@ select.custom-select-first {
19
  font: 12px arial, helvetica, sans-serif;
20
  min-height: 17px;
21
  width: 381px!important;
22
- margin-left: -36px;
23
  }
24
 
25
  select.custom-select-last {
@@ -29,8 +29,9 @@ select.custom-select-last {
29
  background: #fff;
30
  font: 12px arial, helvetica, sans-serif;
31
  min-height: 17px;
32
- width: 317px!important;
33
  margin-left: 2px;
 
34
  }
35
 
36
  select.custom-select-after-before {
@@ -42,7 +43,7 @@ select.custom-select-after-before {
42
  min-height: 17px;
43
  width: 62px!important;
44
  min-width: 62px!important;
45
- margin-left: -36px;
46
  }
47
 
48
  select.custom-select-after-before-hide {
@@ -54,7 +55,7 @@ select.custom-select-after-before-hide {
54
  min-height: 17px;
55
  width: 62px!important;
56
  min-width: 62px!important;
57
- margin-left: -36px;
58
  display: none;
59
  }
60
 
@@ -93,19 +94,21 @@ input.custom-input-text {
93
 
94
  p.custom-p {
95
  margin-top: 3px;
96
- margin-left: -36px;
97
  min-height: 21px;
98
  }
99
 
100
  button.custom {
101
  float: right!important;
102
  margin-left: 2px;
 
 
103
  }
104
 
105
  div.recommender-separator {
106
  border-bottom: 1px solid black;
107
  margin-bottom: 6px;
108
- margin-left: -36px;
109
  }
110
 
111
  .form-list td.value p.note {
@@ -139,4 +142,12 @@ span.custom-div {
139
  .brainsins-help {
140
  font-weight: bold;
141
  margin: -10px 0 10px 0;
 
 
 
 
 
 
 
 
142
  }
19
  font: 12px arial, helvetica, sans-serif;
20
  min-height: 17px;
21
  width: 381px!important;
22
+ /*margin-left: -36px;*/
23
  }
24
 
25
  select.custom-select-last {
29
  background: #fff;
30
  font: 12px arial, helvetica, sans-serif;
31
  min-height: 17px;
32
+ /*width: 317px!important;*/
33
  margin-left: 2px;
34
+ width: 220px!important
35
  }
36
 
37
  select.custom-select-after-before {
43
  min-height: 17px;
44
  width: 62px!important;
45
  min-width: 62px!important;
46
+ /*margin-left: -36px;*/
47
  }
48
 
49
  select.custom-select-after-before-hide {
55
  min-height: 17px;
56
  width: 62px!important;
57
  min-width: 62px!important;
58
+ /*margin-left: -36px;*/
59
  display: none;
60
  }
61
 
94
 
95
  p.custom-p {
96
  margin-top: 3px;
97
+ /*margin-left: -36px;*/
98
  min-height: 21px;
99
  }
100
 
101
  button.custom {
102
  float: right!important;
103
  margin-left: 2px;
104
+ margin-top:5px;
105
+ margin-bottom:5px;
106
  }
107
 
108
  div.recommender-separator {
109
  border-bottom: 1px solid black;
110
  margin-bottom: 6px;
111
+ /*margin-left: -36px;*/
112
  }
113
 
114
  .form-list td.value p.note {
142
  .brainsins-help {
143
  font-weight: bold;
144
  margin: -10px 0 10px 0;
145
+ }
146
+
147
+ .brainsins-recommenders-first-line {
148
+ margin-bottom: 5px;
149
+ }
150
+
151
+ .brainsins-recommenders-first-line-second-item {
152
+ width:20px;
153
  }
skin/adminhtml/default/default/brainsins/recommender/js/brainsins_recommender.js CHANGED
@@ -26,16 +26,19 @@ Event.observe(window, 'load', function() {
26
  {
27
  $('brainsins_recommender_options_brainsins_recommender_general').down(2).show();
28
  }
29
- if($('urlOfflineFeedController'))
30
- {
31
- runOfflineFeed($('urlOfflineFeedController').value, $('urlOfflineFeedFile').value, '');
32
- $('btnRunOfflineFeed').hide();
33
- }
34
- else
35
- {
 
36
  $('btnRunOfflineFeed').removeClassName('disabled');
37
  $('btnRunOfflineFeed').removeClassName('disabled');
38
  $('btnRunOfflineFeed').enable();
 
 
39
  $('btnViewOfflineFeed').removeClassName('disabled');
40
  $('btnViewOfflineFeed').removeClassName('disabled');
41
  $('btnViewOfflineFeed').enable();
@@ -43,6 +46,7 @@ Event.observe(window, 'load', function() {
43
  $('btnViewOnlineFeed').removeClassName('disabled');
44
  $('btnViewOnlineFeed').enable();
45
  }
 
46
  if($('brainsins_recommender_options_product_feed_product_description_attribute').value == '')
47
  {
48
  var options = $('brainsins_recommender_options_product_feed_product_description_attribute');
@@ -345,3 +349,7 @@ function goToError(div) {
345
  function FormatNu(nu) {
346
  return nu>9?nu:'0'+nu;
347
  }
 
 
 
 
26
  {
27
  $('brainsins_recommender_options_brainsins_recommender_general').down(2).show();
28
  }
29
+ // if($('urlOfflineFeedController'))
30
+ // {
31
+ // runOfflineFeed($('urlOfflineFeedController').value, $('urlOfflineFeedFile').value, '');
32
+ // $('btnRunOfflineFeed').hide();
33
+ // }
34
+ // else
35
+ // {
36
+ if ($('btnRunOfflineFeed')) {
37
  $('btnRunOfflineFeed').removeClassName('disabled');
38
  $('btnRunOfflineFeed').removeClassName('disabled');
39
  $('btnRunOfflineFeed').enable();
40
+ }
41
+ if ($('btnViewOfflineFeed')) {
42
  $('btnViewOfflineFeed').removeClassName('disabled');
43
  $('btnViewOfflineFeed').removeClassName('disabled');
44
  $('btnViewOfflineFeed').enable();
46
  $('btnViewOnlineFeed').removeClassName('disabled');
47
  $('btnViewOnlineFeed').enable();
48
  }
49
+ // }
50
  if($('brainsins_recommender_options_product_feed_product_description_attribute').value == '')
51
  {
52
  var options = $('brainsins_recommender_options_product_feed_product_description_attribute');
349
  function FormatNu(nu) {
350
  return nu>9?nu:'0'+nu;
351
  }
352
+
353
+ function showRecommenderList() {
354
+ window.open("https://analytics.brainsins.com/optimization/recommenderslist");
355
+ }