YOOCHOOSE_Recommender_Engine - Version 2.0.1

Version Notes

Download this release

Release Info

Developer yoochoose
Extension YOOCHOOSE_Recommender_Engine
Version 2.0.1
Comparing to
See all releases


Code changes from version 2.0.0 to 2.0.1

app/code/community/Yoochoose/JsTracking/Model/Observer.php CHANGED
@@ -1,92 +1,92 @@
1
- <?php
2
-
3
- class Yoochoose_JsTracking_Model_Observer
4
- {
5
- const YOOCHOOSE_LICENSE_URL = 'https://admin.yoochoose.net/api/v4/';
6
-
7
- protected $orderIds;
8
-
9
- /**
10
- * Applies the special price percentage discount
11
- * @param Varien_Event_Observer $observer
12
- * @return Yoochoose_JsTracking_Observer
13
- */
14
- public function trackBuy($observer)
15
- {
16
- $orderIds = $observer->getEvent()->getOrderIds();
17
- if (empty($orderIds) || !is_array($orderIds)) {
18
- return;
19
- }
20
-
21
- $block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('head');
22
- if ($block) {
23
- $block->setOrderId(end($orderIds));
24
- }
25
- }
26
-
27
- /**
28
- *
29
- * @param Varien_Event_Observer $observer
30
- */
31
- public function adminSystemConfigChangedSectionYoochoose($observer)
32
- {
33
- $customerId = Mage::getStoreConfig('yoochoose/general/customer_id');
34
- $licenseKey = Mage::getStoreConfig('yoochoose/general/license_key');
35
- $code = Mage::getSingleton('adminhtml/config_data')->getStore();
36
- $scopeId = Mage::getModel('core/store')->load($code)->getId();
37
- if ($scopeId === null) {
38
- $scopeId = 0;
39
- }
40
-
41
- $scopeName = $scopeId === 0 ? 'default' : 'stores';
42
- if (!$customerId && !$licenseKey) {
43
- return;
44
- }
45
-
46
- try {
47
- $body = array(
48
- 'base' => array(
49
- 'type' => 'MAGENTO',
50
- 'pluginId' => Mage::getStoreConfig('yoochoose/general/plugin_id'),
51
- 'endpoint' => Mage::getStoreConfig('yoochoose/general/endpoint'),
52
- ),
53
- 'frontend' => array(
54
- 'design' => Mage::getStoreConfig('yoochoose/general/design'),
55
- ));
56
-
57
- $url = self::YOOCHOOSE_LICENSE_URL . $customerId . '/plugin/';
58
- $url .= (Mage::getStoreConfig('yoochoose/general/endpoint_overwrite') ? 'update?createIfNeeded' : 'create?recheckType') . '=true&fallbackDesign=true';
59
- Mage::getModel('core/config')->saveConfig('yoochoose/general/endpoint_overwrite', 0, $scopeName, $scopeId);
60
-
61
- Mage::helper('yoochoose_jstracking')->_getHttpPage($url, $body, $customerId, $licenseKey);
62
- Mage::log('Plugin registrated successfully', Zend_Log::INFO, 'yoochoose.log');
63
- Mage::getSingleton('adminhtml/session')->addSuccess('Plugin registrated successfully');
64
-
65
- } catch (Exception $ex) {
66
- Mage::log($ex->getMessage(), Zend_Log::ERR, 'yoochoose.log');
67
- Mage::throwException('Plugin registration failed: ' . $ex->getMessage());
68
- }
69
-
70
- }
71
-
72
- /**
73
- * Adds additional filters to search results
74
- *
75
- * @param Varien_Event_Observer $observer
76
- */
77
- public function filterParameters(Varien_Event_Observer $observer)
78
- {
79
- $manufacturerName = Mage::app()->getRequest()->getParam('manufacturer');
80
- $block = Mage::app()->getLayout()->getBlock('search_result_list');
81
- if ($block && $manufacturerName) {
82
- $productModel = Mage::getModel('catalog/product');
83
- $attr = $productModel->getResource()->getAttribute('manufacturer');
84
- if ($attr->usesSource()) {
85
- $manufacturerId = $attr->getSource()->getOptionId($manufacturerName);
86
- }
87
-
88
- $collection = $block->getLoadedProductCollection();
89
- $collection->addAttributeToFilter('manufacturer', $manufacturerId);
90
- }
91
- }
92
  }
1
+ <?php
2
+
3
+ class Yoochoose_JsTracking_Model_Observer
4
+ {
5
+ const YOOCHOOSE_LICENSE_URL = 'https://admin.yoochoose.net/api/v4/';
6
+
7
+ protected $orderIds;
8
+
9
+ /**
10
+ * Applies the special price percentage discount
11
+ * @param Varien_Event_Observer $observer
12
+ * @return Yoochoose_JsTracking_Observer
13
+ */
14
+ public function trackBuy($observer)
15
+ {
16
+ $orderIds = $observer->getEvent()->getOrderIds();
17
+ if (empty($orderIds) || !is_array($orderIds)) {
18
+ return;
19
+ }
20
+
21
+ $block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('yoochoose.jstracking');
22
+ if ($block) {
23
+ $block->setOrderId(end($orderIds));
24
+ }
25
+ }
26
+
27
+ /**
28
+ *
29
+ * @param Varien_Event_Observer $observer
30
+ */
31
+ public function adminSystemConfigChangedSectionYoochoose($observer)
32
+ {
33
+ $customerId = Mage::getStoreConfig('yoochoose/general/customer_id');
34
+ $licenseKey = Mage::getStoreConfig('yoochoose/general/license_key');
35
+ $code = Mage::getSingleton('adminhtml/config_data')->getStore();
36
+ $scopeId = Mage::getModel('core/store')->load($code)->getId();
37
+ if ($scopeId === null) {
38
+ $scopeId = 0;
39
+ }
40
+
41
+ $scopeName = $scopeId === 0 ? 'default' : 'stores';
42
+ if (!$customerId && !$licenseKey) {
43
+ return;
44
+ }
45
+
46
+ try {
47
+ $body = array(
48
+ 'base' => array(
49
+ 'type' => 'MAGENTO',
50
+ 'pluginId' => Mage::getStoreConfig('yoochoose/general/plugin_id'),
51
+ 'endpoint' => Mage::getStoreConfig('yoochoose/general/endpoint'),
52
+ ),
53
+ 'frontend' => array(
54
+ 'design' => Mage::getStoreConfig('yoochoose/general/design'),
55
+ ));
56
+
57
+ $url = self::YOOCHOOSE_LICENSE_URL . $customerId . '/plugin/';
58
+ $url .= (Mage::getStoreConfig('yoochoose/general/endpoint_overwrite') ? 'update?createIfNeeded' : 'create?recheckType') . '=true&fallbackDesign=true';
59
+ Mage::getModel('core/config')->saveConfig('yoochoose/general/endpoint_overwrite', 0, $scopeName, $scopeId);
60
+
61
+ Mage::helper('yoochoose_jstracking')->_getHttpPage($url, $body, $customerId, $licenseKey);
62
+ Mage::log('Plugin registrated successfully', Zend_Log::INFO, 'yoochoose.log');
63
+ Mage::getSingleton('adminhtml/session')->addSuccess('Plugin registrated successfully');
64
+
65
+ } catch (Exception $ex) {
66
+ Mage::log($ex->getMessage(), Zend_Log::ERR, 'yoochoose.log');
67
+ Mage::throwException('Plugin registration failed: ' . $ex->getMessage());
68
+ }
69
+
70
+ }
71
+
72
+ /**
73
+ * Adds additional filters to search results
74
+ *
75
+ * @param Varien_Event_Observer $observer
76
+ */
77
+ public function filterParameters(Varien_Event_Observer $observer)
78
+ {
79
+ $manufacturerName = Mage::app()->getRequest()->getParam('manufacturer');
80
+ $block = Mage::app()->getLayout()->getBlock('search_result_list');
81
+ if ($block && $manufacturerName) {
82
+ $productModel = Mage::getModel('catalog/product');
83
+ $attr = $productModel->getResource()->getAttribute('manufacturer');
84
+ if ($attr->usesSource()) {
85
+ $manufacturerId = $attr->getSource()->getOptionId($manufacturerName);
86
+ }
87
+
88
+ $collection = $block->getLoadedProductCollection();
89
+ $collection->addAttributeToFilter('manufacturer', $manufacturerId);
90
+ }
91
+ }
92
  }
app/code/community/Yoochoose/JsTracking/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Yoochoose_JsTracking>
5
- <version>2.0.0</version>
6
  </Yoochoose_JsTracking>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Yoochoose_JsTracking>
5
+ <version>2.0.1</version>
6
  </Yoochoose_JsTracking>
7
  </modules>
8
  <global>
app/code/community/Yoochoose/JsTracking/etc/config.xml.orig DELETED
@@ -1,138 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <modules>
4
- <Yoochoose_JsTracking>
5
- <version>2.0.0</version>
6
- </Yoochoose_JsTracking>
7
- </modules>
8
- <global>
9
- <models>
10
- <yoochoose_jstracking>
11
- <class>Yoochoose_JsTracking_Model</class>
12
- </yoochoose_jstracking>
13
- <adminhtml>
14
- <rewrite>
15
- <search_catalog>Yoochoose_JsTracking_Model_Adminhtml_Search_Catalog</search_catalog>
16
- </rewrite>
17
- </adminhtml>
18
- </models>
19
- <helpers>
20
- <yoochoose_jstracking>
21
- <class>Yoochoose_JsTracking_Helper</class>
22
- </yoochoose_jstracking>
23
- </helpers>
24
-
25
- <blocks>
26
- <yoochoose_jstracking>
27
- <class>Yoochoose_JsTracking_Block</class>
28
- </yoochoose_jstracking>
29
- </blocks>
30
- </global>
31
- <frontend>
32
- <routers>
33
- <yoochoose>
34
- <use>standard</use>
35
- <args>
36
- <module>Yoochoose_JsTracking</module>
37
- <frontName>yoochoose</frontName>
38
- </args>
39
- </yoochoose>
40
- <catalogsearch>
41
- <args>
42
- <modules>
43
- <Yoochoose_JsTracking before="Mage_CatalogSearch">Yoochoose_JsTracking</Yoochoose_JsTracking>
44
- </modules>
45
- </args>
46
- </catalogsearch>
47
- </routers>
48
- <events>
49
- <checkout_onepage_controller_success_action>
50
- <observers>
51
- <checkout_finish>
52
- <type>singleton</type>
53
- <class>Yoochoose_JsTracking_Model_Observer</class>
54
- <method>trackBuy</method>
55
- </checkout_finish>
56
- </observers>
57
- </checkout_onepage_controller_success_action>
58
- <controller_action_layout_render_before_catalogsearch_result_index>
59
- <observers>
60
- <stackexchange_catalogsearch>
61
- <type>singleton</type>
62
- <class>Yoochoose_JsTracking_Model_Observer</class>
63
- <method>filterParameters</method>
64
- </stackexchange_catalogsearch>
65
- </observers>
66
- </controller_action_layout_render_before_catalogsearch_result_index>
67
- </events>
68
- <layout>
69
- <updates>
70
- <yoochoose_jstracking module="Yoochoose_JsTracking">
71
- <file>yoochoose_jstracking.xml</file>
72
- </yoochoose_jstracking>
73
- </updates>
74
- </layout>
75
- </frontend>
76
-
77
- <admin>
78
- <routers>
79
- <adminhtml>
80
- <args>
81
- <modules>
82
- <yoochoose after="Mage_Adminhtml">Yoochoose_JsTracking</yoochoose>
83
- </modules>
84
- </args>
85
- </adminhtml>
86
- </routers>
87
- </admin>
88
-
89
- <adminhtml>
90
- <events>
91
- <admin_system_config_changed_section_yoochoose>
92
- <observers>
93
- <yoochoose>
94
- <type>singleton</type>
95
- <class>Yoochoose_JsTracking_Model_Observer</class>
96
- <method>adminSystemConfigChangedSectionYoochoose</method>
97
- </yoochoose>
98
- </observers>
99
- </admin_system_config_changed_section_yoochoose>
100
- </events>
101
- <acl>
102
- <resources>
103
- <admin>
104
- <children>
105
- <system>
106
- <children>
107
- <config>
108
- <children>
109
- <yoochoose>
110
- <title>Yoochoose</title>
111
- </yoochoose>
112
- </children>
113
- </config>
114
- </children>
115
- </system>
116
- </children>
117
- </admin>
118
- </resources>
119
- </acl>
120
- </adminhtml>
121
-
122
- <default>
123
- <yoochoose>
124
- <general>
125
- <itemtypeid>1</itemtypeid>
126
- <language_country>1</language_country>
127
- </general>
128
- <recommendation_blocks>
129
- <personal_title>Recommendations for You</personal_title>
130
- <bestseller_title>Bestsellers</bestseller_title>
131
- <related_title>Related products</related_title>
132
- <upselling_title>You may also be interested in the following products</upselling_title>
133
- <category_page_title>Recommendation in %</category_page_title>
134
- <crossselling_title>You may also be interested in the following products</crossselling_title>
135
- </recommendation_blocks>
136
- </yoochoose>
137
- </default>
138
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,7 +1,8 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>YOOCHOOSE_Recommender_Engine</name>
4
- <version>2.0.0</version>
 
5
  <stability>stable</stability>
6
  <license>MIT</license>
7
  <channel>community</channel>
@@ -23,9 +24,9 @@
23
  <email>support@yoochoose.com</email>
24
  </author>
25
  </authors>
26
- <date>2015-07-27</date>
27
- <time>11:25:25</time>
28
- <contents><target name="mageetc"><dir name="modules"><file name="Yoochoose_JsTracking.xml" hash="14527f4cb00af1e51ae49735de37bf07"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="yoochoose_jstracking.xml" hash="168087bdb7131b4770d6f5678b533da5"/></dir><dir name="template"><dir name="yoochoose"><file name="head.phtml" hash="6664db6c78bb01ebbc7f329117dbf2f6"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="yoochoose"><dir name="system"><dir name="config"><file name="configure_auth.phtml" hash="6fd498b6bd4c0f6645133e32e024e2d4"/><file name="customize.phtml" hash="7089e299419ce91bc3d29862987ce966"/><file name="register.phtml" hash="fb122e554f22db9621f406b36964dd53"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Yoochoose"><dir name="JsTracking"><dir name="Block"><dir name="Field"><file name="ConfigureAuth.php" hash="ce97bdaa6c0e706ec369f9f17edff852"/><file name="Customize.php" hash="4d6c47263d5604b16f501e3e063c4594"/><file name="Language.php" hash="37229ec818f82c4400b38655c8dbc92f"/><file name="Readonly.php" hash="97aa48dad489377d7c183f5dc12d5bb7"/><file name="Register.php" hash="feca222aaad944bd0fd5843c00c3a90b"/></dir><file name="Head.php" hash="979ff183780a2fb456e75ba44b3e6f90"/></dir><dir name="Helper"><file name="Data.php" hash="13263edfbe948e01d612acb977dcb519"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Catalog.php" hash="ae4a136dace9d2eba7295064df0e8a25"/></dir></dir><dir name="Api2"><dir name="YCCategory"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="4c472bb5c4303b87782cdbd80780bc7a"/></dir></dir></dir><file name="YCCategory.php" hash="057f7d74de4b516a5f40ba7ca90444d2"/><dir name="YCProducts"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="41d5f47548ca59f3748ffd6c9a4ae2bd"/></dir></dir></dir><file name="YCProducts.php" hash="eeb12a6aac6bdcd54255e266a72ebbfc"/><dir name="YCStoreView"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="3175f0494eb930aab7007a4307c07e2b"/></dir></dir></dir><file name="YCStoreView.php" hash="0df53a526e74f7599cb6e280801ddd3b"/><dir name="YCSubscriber"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="791fd6ae69f5c0ffce26570d123fbe38"/></dir></dir></dir><file name="YCSubscriber.php" hash="4b14357894a245ddf6de7d035074d8b5"/></dir><file name="Observer.php" hash="8a69a3c956a21e692ccec5d695e5f47d"/><file name="RequiredValidation.php" hash="40b3d59328810b5be34ad71b43a06e95"/><file name="ScriptValidation.php" hash="9f2273ad041f0c6ae1d67a2b1111cb40"/><dir name="System"><dir name="Config"><dir name="Source"><file name="DisplayRecommendation.php" hash="70bb3693b6a98d127e288f172fb79b81"/><file name="Languages.php" hash="eea7f822218c77e79d7a846967e4256c"/><file name="RenderSource.php" hash="612a9bcfef8c11a23e53cd006c633954"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="YoochooseController.php" hash="0ce02d730647497ced42d19339034b02"/></dir><file name="ProductsController.php" hash="c671a9390a595ae48df4a64e0ca84544"/><file name="ResultController.php" hash="820f75e120bc3baf5461e4086eb53a05"/></dir><dir name="etc"><file name="adminhtml.xml" hash="eb2bc6290160e21ca92ae377e640a179"/><file name="api2.xml" hash="b5e6e4d319b54dc51021130dc1be52ff"/><file name="config.xml" hash="84a2996b077dcd0b4742577d540f1a87"/><file name="config.xml.orig" hash="84a2996b077dcd0b4742577d540f1a87"/><file name="system.xml" hash="5b44e489b58c97187849ae5c79c4e777"/></dir></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies>
31
  <required>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>YOOCHOOSE_Recommender_Engine</name>
4
+ <!-- DO NOT CHANGE THE VERSION HERE. Use app\code\community\Yoochoose\JsTracking\etc\config.xml -->
5
+ <version>2.0.1</version>
6
  <stability>stable</stability>
7
  <license>MIT</license>
8
  <channel>community</channel>
24
  <email>support@yoochoose.com</email>
25
  </author>
26
  </authors>
27
+ <date>2015-08-28</date>
28
+ <time>15:07:16</time>
29
+ <contents><target name="mageetc"><dir name="modules"><file name="Yoochoose_JsTracking.xml" hash="14527f4cb00af1e51ae49735de37bf07"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="yoochoose_jstracking.xml" hash="168087bdb7131b4770d6f5678b533da5"/></dir><dir name="template"><dir name="yoochoose"><file name="head.phtml" hash="6664db6c78bb01ebbc7f329117dbf2f6"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="yoochoose"><dir name="system"><dir name="config"><file name="configure_auth.phtml" hash="6fd498b6bd4c0f6645133e32e024e2d4"/><file name="customize.phtml" hash="7089e299419ce91bc3d29862987ce966"/><file name="register.phtml" hash="fb122e554f22db9621f406b36964dd53"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Yoochoose"><dir name="JsTracking"><dir name="Block"><dir name="Field"><file name="ConfigureAuth.php" hash="ce97bdaa6c0e706ec369f9f17edff852"/><file name="Customize.php" hash="4d6c47263d5604b16f501e3e063c4594"/><file name="Language.php" hash="37229ec818f82c4400b38655c8dbc92f"/><file name="Readonly.php" hash="97aa48dad489377d7c183f5dc12d5bb7"/><file name="Register.php" hash="feca222aaad944bd0fd5843c00c3a90b"/></dir><file name="Head.php" hash="979ff183780a2fb456e75ba44b3e6f90"/></dir><dir name="Helper"><file name="Data.php" hash="13263edfbe948e01d612acb977dcb519"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Search"><file name="Catalog.php" hash="ae4a136dace9d2eba7295064df0e8a25"/></dir></dir><dir name="Api2"><dir name="YCCategory"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="4c472bb5c4303b87782cdbd80780bc7a"/></dir></dir></dir><file name="YCCategory.php" hash="057f7d74de4b516a5f40ba7ca90444d2"/><dir name="YCProducts"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="41d5f47548ca59f3748ffd6c9a4ae2bd"/></dir></dir></dir><file name="YCProducts.php" hash="eeb12a6aac6bdcd54255e266a72ebbfc"/><dir name="YCStoreView"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="3175f0494eb930aab7007a4307c07e2b"/></dir></dir></dir><file name="YCStoreView.php" hash="0df53a526e74f7599cb6e280801ddd3b"/><dir name="YCSubscriber"><dir name="Rest"><dir name="Admin"><file name="V1.php" hash="791fd6ae69f5c0ffce26570d123fbe38"/></dir></dir></dir><file name="YCSubscriber.php" hash="4b14357894a245ddf6de7d035074d8b5"/></dir><file name="Observer.php" hash="fcc0a8e8bca8df7b8080708621b2a904"/><file name="RequiredValidation.php" hash="40b3d59328810b5be34ad71b43a06e95"/><file name="ScriptValidation.php" hash="9f2273ad041f0c6ae1d67a2b1111cb40"/><dir name="System"><dir name="Config"><dir name="Source"><file name="DisplayRecommendation.php" hash="70bb3693b6a98d127e288f172fb79b81"/><file name="Languages.php" hash="eea7f822218c77e79d7a846967e4256c"/><file name="RenderSource.php" hash="612a9bcfef8c11a23e53cd006c633954"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="YoochooseController.php" hash="0ce02d730647497ced42d19339034b02"/></dir><file name="ProductsController.php" hash="c671a9390a595ae48df4a64e0ca84544"/><file name="ResultController.php" hash="820f75e120bc3baf5461e4086eb53a05"/></dir><dir name="etc"><file name="adminhtml.xml" hash="eb2bc6290160e21ca92ae377e640a179"/><file name="api2.xml" hash="b5e6e4d319b54dc51021130dc1be52ff"/><file name="config.xml" hash="a9f06a61c77880c77ed261c270b57d17"/><file name="system.xml" hash="5b44e489b58c97187849ae5c79c4e777"/></dir></dir></dir></target></contents>
30
  <compatible/>
31
  <dependencies>
32
  <required>