CommerceStack_Recommender - Version 1.2.3

Version Notes

Please contact help@commercestack.com with any feature requests, bugs, issues, or questions.

Download this release

Release Info

Developer CommerceStack
Extension CommerceStack_Recommender
Version 1.2.3
Comparing to
See all releases


Code changes from version 1.2.2 to 1.2.3

app/code/community/CommerceStack/Recommender/Model/AdminNotification/Feed.php CHANGED
@@ -6,6 +6,11 @@ class CommerceStack_Recommender_Model_AdminNotification_Feed extends Mage_AdminN
6
  try
7
  {
8
  $xml = parent::getFeedData();
 
 
 
 
 
9
  $client = Mage::helper('recommender/pest');
10
 
11
  $commercestackXml = $client->get('notification/');
6
  try
7
  {
8
  $xml = parent::getFeedData();
9
+ if ($xml === false)
10
+ {
11
+ return false;
12
+ }
13
+
14
  $client = Mage::helper('recommender/pest');
15
 
16
  $commercestackXml = $client->get('notification/');
app/code/community/CommerceStack/Recommender/controllers/IndexController.php CHANGED
@@ -4,8 +4,8 @@ class CommerceStack_Recommender_IndexController extends Mage_Adminhtml_Controlle
4
  public function updateAction()
5
  {
6
  session_write_close(); // prevent other requests from blocking during update because of locked session file
7
- ini_set('memory_limit', '8192M');
8
- set_time_limit(72000);
9
  $dataHelper = Mage::helper('recommender');
10
  $currentTask = 1;
11
 
@@ -17,17 +17,13 @@ class CommerceStack_Recommender_IndexController extends Mage_Adminhtml_Controlle
17
 
18
  // Basic analysis
19
  $dataHelper->setCurrentTask($currentTask);
20
- $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('sales/order_grid'), 'entity_id', 'order', 1000);
21
  $currentTask++;
22
 
23
  $dataHelper->setCurrentTask($currentTask);
24
  $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('sales/order_item'), 'item_id', 'orderitem', 1000);
25
  $currentTask++;
26
 
27
- $dataHelper->setCurrentTask($currentTask);
28
- $dataHelper->postRecordset('v.entity_id as product_id, v.value as url_path', (string)Mage::getConfig()->getTablePrefix() . 'catalog_product_entity_varchar v' , "INNER JOIN " . $dataHelper->getTableNameSafe('eav/attribute') . " eav ON v.attribute_id = eav.attribute_id AND eav.attribute_code='url_path'", '', 'entity_id', 'producturl', 0);
29
- $currentTask++;
30
-
31
  $dataHelper->setCurrentTask($currentTask);
32
  $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('log/customer'), 'log_id', 'logcustomer', 10000);
33
  $currentTask++;
@@ -41,11 +37,11 @@ class CommerceStack_Recommender_IndexController extends Mage_Adminhtml_Controlle
41
  $currentTask++;
42
 
43
  $dataHelper->setCurrentTask($currentTask);
44
- $dataHelper->postRecordset('*', $dataHelper->getTableNameSafe('core/url_rewrite'), '', 'WHERE product_id IS NOT null', 'url_rewrite_id', 'urlrewrite', 50000);
45
  $currentTask++;
46
 
47
  $dataHelper->setCurrentTask($currentTask);
48
- $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('reports/viewed_product_index'), 'index_id', 'viewedproduct', 10000);
49
  $currentTask++;
50
 
51
  $productLinks = Mage::getModel('recommender/product_link');
@@ -54,6 +50,10 @@ class CommerceStack_Recommender_IndexController extends Mage_Adminhtml_Controlle
54
  $dataHelper->setClientStatus('complete');
55
 
56
  // Continue advanced analysis
 
 
 
 
57
  $dataHelper->setCurrentTask($currentTask);
58
  $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('reports/compared_product_index'), 'index_id', 'comparedproduct', 10000);
59
  $currentTask++;
4
  public function updateAction()
5
  {
6
  session_write_close(); // prevent other requests from blocking during update because of locked session file
7
+ //ini_set('memory_limit', '512M');
8
+ set_time_limit(7200);
9
  $dataHelper = Mage::helper('recommender');
10
  $currentTask = 1;
11
 
17
 
18
  // Basic analysis
19
  $dataHelper->setCurrentTask($currentTask);
20
+ $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('sales/order_grid'), 'entity_id', 'order', 10000);
21
  $currentTask++;
22
 
23
  $dataHelper->setCurrentTask($currentTask);
24
  $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('sales/order_item'), 'item_id', 'orderitem', 1000);
25
  $currentTask++;
26
 
 
 
 
 
27
  $dataHelper->setCurrentTask($currentTask);
28
  $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('log/customer'), 'log_id', 'logcustomer', 10000);
29
  $currentTask++;
37
  $currentTask++;
38
 
39
  $dataHelper->setCurrentTask($currentTask);
40
+ $dataHelper->postRecordset('v.entity_id as product_id, v.value as url_path', (string)Mage::getConfig()->getTablePrefix() . 'catalog_product_entity_varchar v' , "INNER JOIN " . $dataHelper->getTableNameSafe('eav/attribute') . " eav ON v.attribute_id = eav.attribute_id AND eav.attribute_code='url_path'", '', 'entity_id', 'producturl', 0);
41
  $currentTask++;
42
 
43
  $dataHelper->setCurrentTask($currentTask);
44
+ $dataHelper->postRecordset('*', $dataHelper->getTableNameSafe('core/url_rewrite'), '', 'WHERE product_id IS NOT null', 'url_rewrite_id', 'urlrewrite', 50000);
45
  $currentTask++;
46
 
47
  $productLinks = Mage::getModel('recommender/product_link');
50
  $dataHelper->setClientStatus('complete');
51
 
52
  // Continue advanced analysis
53
+ $dataHelper->setCurrentTask($currentTask);
54
+ $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('reports/viewed_product_index'), 'index_id', 'viewedproduct', 10000);
55
+ $currentTask++;
56
+
57
  $dataHelper->setCurrentTask($currentTask);
58
  $dataHelper->postUpdate('*', $dataHelper->getTableNameSafe('reports/compared_product_index'), 'index_id', 'comparedproduct', 10000);
59
  $currentTask++;
app/code/community/CommerceStack/Recommender/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <CommerceStack_Recommender>
5
- <version>1.2.2</version>
6
  </CommerceStack_Recommender>
7
  </modules>
8
 
@@ -131,7 +131,7 @@
131
 
132
  <default>
133
  <recommender>
134
- <api_uri>https://api.commercestack.com/</api_uri>
135
  <!--<api_uri>http://127.0.0.1/recommender/public/</api_uri>-->
136
  <relatedproducts>
137
  <numberofrelatedproducts>4</numberofrelatedproducts>
@@ -139,7 +139,7 @@
139
  <numberofupsellproducts>4</numberofupsellproducts>
140
  </relatedproducts>
141
  <relatedproductsadvanced>
142
- <upsellsource>crossell</upsellsource>
143
  </relatedproductsadvanced>
144
  </recommender>
145
  </default>
2
  <config>
3
  <modules>
4
  <CommerceStack_Recommender>
5
+ <version>1.2.3</version>
6
  </CommerceStack_Recommender>
7
  </modules>
8
 
131
 
132
  <default>
133
  <recommender>
134
+ <api_uri>https://api.commercestack.com/</api_uri>
135
  <!--<api_uri>http://127.0.0.1/recommender/public/</api_uri>-->
136
  <relatedproducts>
137
  <numberofrelatedproducts>4</numberofrelatedproducts>
139
  <numberofupsellproducts>4</numberofupsellproducts>
140
  </relatedproducts>
141
  <relatedproductsadvanced>
142
+ <upsellsource>crosssell</upsellsource>
143
  </relatedproductsadvanced>
144
  </recommender>
145
  </default>
js/commercestack/adminhtml/recommender.js CHANGED
@@ -84,20 +84,6 @@ function getStatus()
84
  $('row_recommender_relatedproducts_update').show();
85
  }
86
  });
87
-
88
- // new Ajax.Request(commercestackStatusAuthUrl,
89
- // {
90
- // method:'get',
91
- // onSuccess: function(transport)
92
- // {
93
- // var status = transport.responseText.evalJSON();
94
- // updateUI(status);
95
- // },
96
- // onFailure: function(){
97
- // $$('#row_recommender_relatedproducts_update td.value p.note span')[0].update('Unable to connect to CommerceStack server');
98
- // $('row_recommender_relatedproducts_update').show();
99
- // }
100
- // });
101
  }
102
  }
103
 
@@ -109,18 +95,27 @@ function updateUI(status)
109
  {
110
  msg = 'Packaging and downloading results (this could take a few minutes)...';
111
  }
112
- else if(status.current_task == 0 && status.current_frame == 0 && status.total_tasks == 1 && status.total_frames == 1)
113
- {
114
- msg = 'Gathering data...';
115
- }
116
  else
117
  {
118
- taskPct = Math.max((status.current_task - 1) / status.total_tasks, 0);
119
- framePct = status.current_frame / status.total_frames;
120
- pctComplete = taskPct + (framePct / status.total_tasks);
121
- msg = 'Analyzing data... ' + Math.round(100*pctComplete) + '% complete';
 
 
 
 
 
 
 
 
 
 
 
 
122
  }
123
 
 
124
  $$('#row_recommender_relatedproducts_cancel td.value p.note span')[0].update(msg);
125
 
126
  $('row_recommender_relatedproducts_update').hide();
@@ -202,6 +197,12 @@ function updateCommerceStackRecs(updateActionUrl)
202
  method:'get',
203
  onSuccess: function(transport)
204
  {
 
 
 
 
 
 
205
  },
206
  onFailure: function()
207
  {
84
  $('row_recommender_relatedproducts_update').show();
85
  }
86
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
  }
89
 
95
  {
96
  msg = 'Packaging and downloading results (this could take a few minutes)...';
97
  }
 
 
 
 
98
  else
99
  {
100
+ // If communications is dead, try to restart
101
+ if(status.secs_since_last_request > 120) {
102
+ $$('#row_recommender_relatedproducts_update td.value button')[0].click();
103
+ }
104
+
105
+ if(status.current_task == 0 && status.current_frame == 0 && status.total_tasks == 1 && status.total_frames == 1)
106
+ {
107
+ msg = 'Gathering data...';
108
+ }
109
+ else
110
+ {
111
+ taskPct = Math.max((status.current_task - 1) / status.total_tasks, 0);
112
+ framePct = status.current_frame / status.total_frames;
113
+ pctComplete = taskPct + (framePct / status.total_tasks);
114
+ msg = 'Analyzing data... ' + Math.round(100*pctComplete) + '% complete';
115
+ }
116
  }
117
 
118
+
119
  $$('#row_recommender_relatedproducts_cancel td.value p.note span')[0].update(msg);
120
 
121
  $('row_recommender_relatedproducts_update').hide();
197
  method:'get',
198
  onSuccess: function(transport)
199
  {
200
+ if(transport.responseText.indexOf("<title>Log into Magento Admin Page</title>") > -1) {
201
+ // We've been logged out, set status to cancelled and redirect to login page
202
+ jQuery.post(commercestackStatusAuthUrl, 'cancelRequested');
203
+ window.location.reload(true);
204
+ }
205
+
206
  },
207
  onFailure: function()
208
  {
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CommerceStack_Recommender</name>
4
- <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License v 3.0</license>
7
  <channel>community</channel>
@@ -16,9 +16,9 @@ Please contact help@commercestack.com with any bugs, issues, or feature requests
16
  After installing, navigate to System-&gt;Configuration-&gt;Related Products Manager to begin.</description>
17
  <notes>Please contact help@commercestack.com with any feature requests, bugs, issues, or questions.</notes>
18
  <authors><author><name>CommerceStack</name><user>dbright</user><email>dbright@commercestack.com</email></author></authors>
19
- <date>2012-05-23</date>
20
- <time>23:58:45</time>
21
- <contents><target name="magecommunity"><dir name="CommerceStack"><dir name="Recommender"><dir name="Block"><dir name="Cart"><file name="Crosssell.php" hash="f931d15f47b6390cc6b2d3c86a2df030"/></dir><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Crosssell.php" hash="4eacb2e01e0ec6ead7109fe696fc2e23"/><file name="Related.php" hash="3469e281271de8f9457f82fdc90ca104"/></dir><file name="Tabs.php" hash="aa26d6e9e585117100e983616e6a0afa"/></dir></dir></dir><dir name="Product"><dir name="List"><file name="Related.php" hash="10398409402120307ec7f24b7d396b40"/><file name="Upsell.php" hash="4edc3dd9e8cb5e946a0309494bc53e99"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Apikey.php" hash="fae5b45d9eace7c2934b9f70f5ec6c8e"/><file name="Apikeyurl.php" hash="5ce3031fd84f912b3552d7c37f2a04ac"/><file name="Cancelbutton.php" hash="070131f41c4969cf51917b486e487b26"/><file name="Updatebutton.php" hash="2a370f132bc2b6fc5d21f2f477b6115e"/></dir><file name="Form.php" hash="de1c3b70b03ac09fe1d5c7cd7613feb1"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="083f605fdc5dde5bb9d27fe17e90ab0a"/><dir name="Pest"><file name="PestJSON.php" hash="95059011a55bd0036c5029ba5b2d0f0c"/><file name="PestXML.php" hash="7e8e2a8c75b8a58d11bef9c47b4e960d"/></dir><file name="Pest.php" hash="15ac0a66957144f848b067c11710204d"/></dir><dir name="Model"><dir name="AdminNotification"><file name="Feed.php" hash="2bd82d4400ebe38cdb526eb98508ebdc"/></dir><dir name="Product"><file name="Link.php" hash="0e08ed99339e2acd77cce3e738cdbfae"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><dir name="Link"><dir name="Product"><file name="Collection.php" hash="ebf570a39f98b982d09a60f3af1768df"/></dir></dir><file name="Link.php" hash="0910e13e6a3b3cac3573a4ea1df59e9f"/></dir></dir></dir><dir name="Mysql4"><file name="Setup.php" hash="79f3bcb4122135514d6f68f3db50b9f1"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Upsellsource.php" hash="34ed5e3c61bd288340b7de3809953ad3"/></dir></dir></dir></dir><dir name="controllers"><file name="AccountController.php" hash="05af8f614f7822b480b9b9e55b25d45e"/><file name="IndexController.php" hash="875938773662f1c43bca00bdd5df369d"/><file name="ProductController.php" hash="fb4235ad3604eaeaee7e8e0e1fe71f04"/></dir><dir name="etc"><file name="config.xml" hash="62306bbd7d8be798b915c1b3eaf4546d"/><file name="system.xml" hash="089389d636f112dbead01f1be6c656a8"/></dir><dir name="sql"><dir name="recommender_setup"><file name="mysql4-install-0.9.3.php" hash="d72ccc127f8f2ccef5216e7eaf62babc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="recommender.xml" hash="f19e768264b836355637a61d6a1463f5"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="commercestack"><dir name="adminhtml"><file name="recommender.js" hash="7f62afcaf756ac31c40bcb7afaab06e9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CommerceStack_Recommender.xml" hash="c0faaf57bb93c70fe6ba45e68c96fc11"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.13</min><max>5.4.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CommerceStack_Recommender</name>
4
+ <version>1.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License v 3.0</license>
7
  <channel>community</channel>
16
  After installing, navigate to System-&gt;Configuration-&gt;Related Products Manager to begin.</description>
17
  <notes>Please contact help@commercestack.com with any feature requests, bugs, issues, or questions.</notes>
18
  <authors><author><name>CommerceStack</name><user>dbright</user><email>dbright@commercestack.com</email></author></authors>
19
+ <date>2012-05-31</date>
20
+ <time>22:37:04</time>
21
+ <contents><target name="magecommunity"><dir name="CommerceStack"><dir name="Recommender"><dir name="Block"><dir name="Cart"><file name="Crosssell.php" hash="f931d15f47b6390cc6b2d3c86a2df030"/></dir><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Crosssell.php" hash="4eacb2e01e0ec6ead7109fe696fc2e23"/><file name="Related.php" hash="3469e281271de8f9457f82fdc90ca104"/></dir><file name="Tabs.php" hash="aa26d6e9e585117100e983616e6a0afa"/></dir></dir></dir><dir name="Product"><dir name="List"><file name="Related.php" hash="10398409402120307ec7f24b7d396b40"/><file name="Upsell.php" hash="4edc3dd9e8cb5e946a0309494bc53e99"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Apikey.php" hash="fae5b45d9eace7c2934b9f70f5ec6c8e"/><file name="Apikeyurl.php" hash="5ce3031fd84f912b3552d7c37f2a04ac"/><file name="Cancelbutton.php" hash="070131f41c4969cf51917b486e487b26"/><file name="Updatebutton.php" hash="2a370f132bc2b6fc5d21f2f477b6115e"/></dir><file name="Form.php" hash="de1c3b70b03ac09fe1d5c7cd7613feb1"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="083f605fdc5dde5bb9d27fe17e90ab0a"/><dir name="Pest"><file name="PestJSON.php" hash="95059011a55bd0036c5029ba5b2d0f0c"/><file name="PestXML.php" hash="7e8e2a8c75b8a58d11bef9c47b4e960d"/></dir><file name="Pest.php" hash="15ac0a66957144f848b067c11710204d"/></dir><dir name="Model"><dir name="AdminNotification"><file name="Feed.php" hash="bf32debf65f8e5ca5371843333730b02"/></dir><dir name="Product"><file name="Link.php" hash="0e08ed99339e2acd77cce3e738cdbfae"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><dir name="Link"><dir name="Product"><file name="Collection.php" hash="ebf570a39f98b982d09a60f3af1768df"/></dir></dir><file name="Link.php" hash="0910e13e6a3b3cac3573a4ea1df59e9f"/></dir></dir></dir><dir name="Mysql4"><file name="Setup.php" hash="79f3bcb4122135514d6f68f3db50b9f1"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Upsellsource.php" hash="34ed5e3c61bd288340b7de3809953ad3"/></dir></dir></dir></dir><dir name="controllers"><file name="AccountController.php" hash="05af8f614f7822b480b9b9e55b25d45e"/><file name="IndexController.php" hash="b8bb54f5d0f1c1f48305ee4eeaffc28a"/><file name="ProductController.php" hash="fb4235ad3604eaeaee7e8e0e1fe71f04"/></dir><dir name="etc"><file name="config.xml" hash="f07f518f24c5f1d7c3ca9001e2267392"/><file name="system.xml" hash="089389d636f112dbead01f1be6c656a8"/></dir><dir name="sql"><dir name="recommender_setup"><file name="mysql4-install-0.9.3.php" hash="d72ccc127f8f2ccef5216e7eaf62babc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="recommender.xml" hash="f19e768264b836355637a61d6a1463f5"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="commercestack"><dir name="adminhtml"><file name="recommender.js" hash="601ad02149731e2054d28c1fa3aecc85"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CommerceStack_Recommender.xml" hash="c0faaf57bb93c70fe6ba45e68c96fc11"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.13</min><max>5.4.0</max></php></required></dependencies>
24
  </package>