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 | 2.0.8 |
Comparing to | |
See all releases |
Code changes from version 2.0.7 to 2.0.8
- app/code/community/CommerceStack/CsApiClient/Model/Account.php +7 -3
- app/code/community/CommerceStack/CsApiClient/Model/Server.php +19 -3
- app/code/community/CommerceStack/CsApiClient/etc/config.xml +5 -5
- app/code/community/CommerceStack/Recommender/Block/Product/List/Related.php +2 -0
- app/code/community/CommerceStack/Recommender/etc/config.xml +1 -1
- package.xml +4 -4
app/code/community/CommerceStack/CsApiClient/Model/Account.php
CHANGED
@@ -63,11 +63,17 @@ class CommerceStack_CsApiClient_Model_Account extends Mage_Core_Model_Abstract
|
|
63 |
$server = Mage::getModel('csapiclient/server');
|
64 |
|
65 |
$endPoint = Mage::getStoreConfig('csapiclient/api/create_account_uri');
|
|
|
|
|
66 |
$response = $server->post($endPoint/* . "?XDEBUG_SESSION_START=PHPSTORM"*/, $xml, null, false);
|
67 |
|
68 |
$xml = simplexml_load_string($response);
|
69 |
|
70 |
-
if(!$xml)
|
|
|
|
|
|
|
|
|
71 |
|
72 |
$config = new Mage_Core_Model_Config();
|
73 |
$config->saveConfig('csapiclient/api/user', (string)$xml->api_user);
|
@@ -80,8 +86,6 @@ class CommerceStack_CsApiClient_Model_Account extends Mage_Core_Model_Abstract
|
|
80 |
Mage::register('recommender_api_user', (string)$xml->api_user);
|
81 |
Mage::register('recommender_api_secret', (string)$xml->api_secret);
|
82 |
|
83 |
-
|
84 |
-
|
85 |
return array('api_user' => (string)$xml->api_user, 'api_secret' => (string)$xml->api_secret);
|
86 |
}
|
87 |
|
63 |
$server = Mage::getModel('csapiclient/server');
|
64 |
|
65 |
$endPoint = Mage::getStoreConfig('csapiclient/api/create_account_uri');
|
66 |
+
|
67 |
+
Mage::log("Account::_createAccount(): xml = \n $xml \n post endpoint: $endPoint \n", null, 'recommender.log');
|
68 |
$response = $server->post($endPoint/* . "?XDEBUG_SESSION_START=PHPSTORM"*/, $xml, null, false);
|
69 |
|
70 |
$xml = simplexml_load_string($response);
|
71 |
|
72 |
+
if(!$xml)
|
73 |
+
{
|
74 |
+
Mage::log("Server did not respond to account creation request", null, 'recommender.log');
|
75 |
+
throw new CsApiClient_Server_ServerError('Server did not respond to account creation request.');
|
76 |
+
}
|
77 |
|
78 |
$config = new Mage_Core_Model_Config();
|
79 |
$config->saveConfig('csapiclient/api/user', (string)$xml->api_user);
|
86 |
Mage::register('recommender_api_user', (string)$xml->api_user);
|
87 |
Mage::register('recommender_api_secret', (string)$xml->api_secret);
|
88 |
|
|
|
|
|
89 |
return array('api_user' => (string)$xml->api_user, 'api_secret' => (string)$xml->api_secret);
|
90 |
}
|
91 |
|
app/code/community/CommerceStack/CsApiClient/Model/Server.php
CHANGED
@@ -12,7 +12,7 @@ class CommerceStack_CsApiClient_Model_Server extends Mage_Core_Model_Abstract
|
|
12 |
{
|
13 |
public $curl_opts = array(
|
14 |
CURLOPT_RETURNTRANSFER => true, // return result instead of echoing
|
15 |
-
CURLOPT_SSL_VERIFYPEER =>
|
16 |
CURLOPT_FOLLOWLOCATION => false, // follow redirects, Location: headers
|
17 |
CURLOPT_MAXREDIRS => 10, // but dont redirect more than 10 times
|
18 |
);
|
@@ -186,7 +186,7 @@ class CommerceStack_CsApiClient_Model_Server extends Mage_Core_Model_Abstract
|
|
186 |
);
|
187 |
|
188 |
curl_close($curl);
|
189 |
-
|
190 |
$this->checkLastResponseForError();
|
191 |
|
192 |
return $body;
|
@@ -202,24 +202,31 @@ class CommerceStack_CsApiClient_Model_Server extends Mage_Core_Model_Abstract
|
|
202 |
$err = null;
|
203 |
switch ($meta['http_code']) {
|
204 |
case 400:
|
|
|
205 |
throw new CsApiClient_Server_BadRequest($this->processError($body));
|
206 |
break;
|
207 |
case 401:
|
|
|
208 |
throw new CsApiClient_Server_Unauthorized($this->processError($body));
|
209 |
break;
|
210 |
case 403:
|
|
|
211 |
throw new CsApiClient_Server_Forbidden($this->processError($body));
|
212 |
break;
|
213 |
case 404:
|
|
|
214 |
throw new CsApiClient_Server_NotFound($this->processError($body));
|
215 |
break;
|
216 |
case 405:
|
|
|
217 |
throw new CsApiClient_Server_MethodNotAllowed($this->processError($body));
|
218 |
break;
|
219 |
case 409:
|
|
|
220 |
throw new CsApiClient_Server_Conflict($this->processError($body));
|
221 |
break;
|
222 |
case 410:
|
|
|
223 |
throw new CsApiClient_Server_Gone($this->processError($body));
|
224 |
break;
|
225 |
case 422:
|
@@ -228,14 +235,23 @@ class CommerceStack_CsApiClient_Model_Server extends Mage_Core_Model_Abstract
|
|
228 |
// a response to a request that is syntactically correct,
|
229 |
// but semantically invalid (for example, when trying to
|
230 |
// create a resource with some required fields missing)
|
|
|
231 |
throw new CsApiClient_Server_InvalidRecord($this->processError($body));
|
232 |
break;
|
233 |
default:
|
234 |
if ($meta['http_code'] >= 400 && $meta['http_code'] <= 499)
|
|
|
|
|
235 |
throw new CsApiClient_Server_ClientError($this->processError($body));
|
|
|
236 |
elseif ($meta['http_code'] >= 500 && $meta['http_code'] <= 599)
|
|
|
|
|
237 |
throw new CsApiClient_Server_ServerError($this->processError($body));
|
238 |
-
|
|
|
|
|
|
|
239 |
throw new CsApiClient_Server_UnknownResponse($this->processError($body));
|
240 |
}
|
241 |
}
|
12 |
{
|
13 |
public $curl_opts = array(
|
14 |
CURLOPT_RETURNTRANSFER => true, // return result instead of echoing
|
15 |
+
CURLOPT_SSL_VERIFYPEER => false,
|
16 |
CURLOPT_FOLLOWLOCATION => false, // follow redirects, Location: headers
|
17 |
CURLOPT_MAXREDIRS => 10, // but dont redirect more than 10 times
|
18 |
);
|
186 |
);
|
187 |
|
188 |
curl_close($curl);
|
189 |
+
|
190 |
$this->checkLastResponseForError();
|
191 |
|
192 |
return $body;
|
202 |
$err = null;
|
203 |
switch ($meta['http_code']) {
|
204 |
case 400:
|
205 |
+
Mage::log("400 error: $body", null, 'recommender.log');
|
206 |
throw new CsApiClient_Server_BadRequest($this->processError($body));
|
207 |
break;
|
208 |
case 401:
|
209 |
+
Mage::log("401 error: $body", null, 'recommender.log');
|
210 |
throw new CsApiClient_Server_Unauthorized($this->processError($body));
|
211 |
break;
|
212 |
case 403:
|
213 |
+
Mage::log("403 error: $body", null, 'recommender.log');
|
214 |
throw new CsApiClient_Server_Forbidden($this->processError($body));
|
215 |
break;
|
216 |
case 404:
|
217 |
+
Mage::log("404 error: $body", null, 'recommender.log');
|
218 |
throw new CsApiClient_Server_NotFound($this->processError($body));
|
219 |
break;
|
220 |
case 405:
|
221 |
+
Mage::log("405 error: $body", null, 'recommender.log');
|
222 |
throw new CsApiClient_Server_MethodNotAllowed($this->processError($body));
|
223 |
break;
|
224 |
case 409:
|
225 |
+
Mage::log("409 error: $body", null, 'recommender.log');
|
226 |
throw new CsApiClient_Server_Conflict($this->processError($body));
|
227 |
break;
|
228 |
case 410:
|
229 |
+
Mage::log("410 error: $body", null, 'recommender.log');
|
230 |
throw new CsApiClient_Server_Gone($this->processError($body));
|
231 |
break;
|
232 |
case 422:
|
235 |
// a response to a request that is syntactically correct,
|
236 |
// but semantically invalid (for example, when trying to
|
237 |
// create a resource with some required fields missing)
|
238 |
+
Mage::log("422 error: $body", null, 'recommender.log');
|
239 |
throw new CsApiClient_Server_InvalidRecord($this->processError($body));
|
240 |
break;
|
241 |
default:
|
242 |
if ($meta['http_code'] >= 400 && $meta['http_code'] <= 499)
|
243 |
+
{
|
244 |
+
Mage::log("Generic client error " . $meta['http_code'] . ": $body", null, 'recommender.log');
|
245 |
throw new CsApiClient_Server_ClientError($this->processError($body));
|
246 |
+
}
|
247 |
elseif ($meta['http_code'] >= 500 && $meta['http_code'] <= 599)
|
248 |
+
{
|
249 |
+
Mage::log("Generic server error " . $meta['http_code'] . ": $body", null, 'recommender.log');
|
250 |
throw new CsApiClient_Server_ServerError($this->processError($body));
|
251 |
+
}
|
252 |
+
elseif (!$meta['http_code'] || $meta['http_code'] >= 600)
|
253 |
+
{
|
254 |
+
Mage::log("Generic server unknown response " . $meta['http_code'] . ": $body", null, 'recommender.log');
|
255 |
throw new CsApiClient_Server_UnknownResponse($this->processError($body));
|
256 |
}
|
257 |
}
|
app/code/community/CommerceStack/CsApiClient/etc/config.xml
CHANGED
@@ -18,9 +18,9 @@
|
|
18 |
<csapiclient>
|
19 |
<api>
|
20 |
<base_uri>https://api.commercestack.com/</base_uri>
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
</config>
|
18 |
<csapiclient>
|
19 |
<api>
|
20 |
<base_uri>https://api.commercestack.com/</base_uri>
|
21 |
+
<!--<base_uri>http://127.0.0.1/recommender/public/</base_uri>-->
|
22 |
+
<create_account_uri>account/</create_account_uri>
|
23 |
+
</api>
|
24 |
+
</csapiclient>
|
25 |
+
</default>
|
26 |
</config>
|
app/code/community/CommerceStack/Recommender/Block/Product/List/Related.php
CHANGED
@@ -99,6 +99,8 @@ class CommerceStack_Recommender_Block_Product_List_Related extends Mage_Catalog_
|
|
99 |
$numRecsToGet = $limit - count($unionLinkedItemCollection);
|
100 |
}
|
101 |
|
|
|
|
|
102 |
// Go up a category level for next iteration
|
103 |
$currentCategory = $currentCategory->getParentCategory();
|
104 |
if(is_null($currentCategory->getId())) break;
|
99 |
$numRecsToGet = $limit - count($unionLinkedItemCollection);
|
100 |
}
|
101 |
|
102 |
+
if(!$useCategoryFilter) break;
|
103 |
+
|
104 |
// Go up a category level for next iteration
|
105 |
$currentCategory = $currentCategory->getParentCategory();
|
106 |
if(is_null($currentCategory->getId())) break;
|
app/code/community/CommerceStack/Recommender/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<CommerceStack_Recommender>
|
5 |
-
<version>2.0.
|
6 |
</CommerceStack_Recommender>
|
7 |
</modules>
|
8 |
|
2 |
<config>
|
3 |
<modules>
|
4 |
<CommerceStack_Recommender>
|
5 |
+
<version>2.0.8</version>
|
6 |
</CommerceStack_Recommender>
|
7 |
</modules>
|
8 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CommerceStack_Recommender</name>
|
4 |
-
<version>2.0.
|
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->Configuration->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>2013-
|
20 |
-
<time>00:
|
21 |
-
<contents><target name="magecommunity"><dir name="CommerceStack"><dir name="Recommender"><dir name="Block"><dir name="Cart"><file name="Crosssell.php" hash="8c596aab92d03c5dbc9bf1ef4a87b51a"/></dir><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Crosssell.php" hash="6bf054a0c4cb02d5029e865c1f834d65"/><file name="Related.php" hash="0daa5a8c523d389eaea2d1d220d96be9"/></dir><file name="Tabs.php" hash="aa26d6e9e585117100e983616e6a0afa"/></dir></dir></dir><dir name="Product"><dir name="List"><file name="Related.php" hash="
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
24 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CommerceStack_Recommender</name>
|
4 |
+
<version>2.0.8</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->Configuration->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>2013-05-22</date>
|
20 |
+
<time>23:00:56</time>
|
21 |
+
<contents><target name="magecommunity"><dir name="CommerceStack"><dir name="Recommender"><dir name="Block"><dir name="Cart"><file name="Crosssell.php" hash="8c596aab92d03c5dbc9bf1ef4a87b51a"/></dir><dir name="Catalog"><dir name="Product"><dir name="Edit"><dir name="Tab"><file name="Crosssell.php" hash="6bf054a0c4cb02d5029e865c1f834d65"/><file name="Related.php" hash="0daa5a8c523d389eaea2d1d220d96be9"/></dir><file name="Tabs.php" hash="aa26d6e9e585117100e983616e6a0afa"/></dir></dir></dir><dir name="Product"><dir name="List"><file name="Related.php" hash="b04b3e526f6bcb64bb0e50a7ba7f494a"/><file name="Upsell.php" hash="3203e829f4142a293b9005f86d2e953c"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Apikey.php" hash="def235a2710cea0b01ace89bce9ffda4"/><file name="Apikeyurl.php" hash="5ce3031fd84f912b3552d7c37f2a04ac"/><file name="Apisecret.php" hash="9b9a92981a5ff80aa4ec3e4255844801"/><file name="Apiuser.php" hash="bba5a87192ab0821d999aa4ab8cddada"/><file name="Cancelbutton.php" hash="7a87871461a6d589a28ccbc18f9d1603"/><file name="Email.php" hash="0231900a317a75e1f72cfdd440df2e45"/><file name="Helpiframe.php" hash="cd049db20bfa53e6a57eaba796a0f5b6"/><file name="Paymentiframe.php" hash="aac32f6d47bf80aef61c1b4288363f7e"/><file name="Updatebutton.php" hash="997d957fab4ac828237b9b0ca92d51e6"/></dir><file name="Form.php" hash="de1c3b70b03ac09fe1d5c7cd7613feb1"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f522b3fa9caa77c3ab85e448382ff469"/></dir><dir name="Model"><dir name="Product"><file name="Link.php" hash="c2fb978783910af6472fbcf50070bb0f"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><dir name="Link"><dir name="Product"><file name="Collection.php" hash="3fb32d0da982297829938dc2427b35cb"/></dir></dir><file name="Link.php" hash="0910e13e6a3b3cac3573a4ea1df59e9f"/></dir></dir></dir><dir name="Mysql4"><file name="Setup.php" hash="1e93566c0f56cc52cdf4e4a73153d2f9"/></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="2ba2f4ae67df9a140ed2b8b5bc4ec986"/><file name="IndexController.php" hash="fdefef57154a23f84a7910b93c2f6e94"/><file name="ProductController.php" hash="83ad4a8d6d22d53f4fb03744950500d9"/></dir><dir name="etc"><file name="config.xml" hash="48760fd7bcd5ed024acaf35baca5b1e7"/><file name="system.xml" hash="2ee1ffb7b78936caf27acc87bc34a4c9"/></dir><dir name="sql"><dir name="recommender_setup"><file name="mysql4-install-0.9.3.php" hash="cfe38102d96814f6b254cc38c07f2037"/><file name="mysql4-upgrade-0.9.3-0.9.4.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-0.9.4-0.9.5.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-0.9.5-1.0.0.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.0.2-1.1.0.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.2.1-1.2.2.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.2.2-1.2.3.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.2.3-1.2.4.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.2.4-1.2.5.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.2.5-1.2.6.php" hash="3beefb00777a6bd04265b7d33c23efa9"/><file name="mysql4-upgrade-1.2.6-2.0.0.php" hash="b2d2b463578d50b2a1a313c36d02ecdf"/></dir></dir></dir><dir name="CsApiClient"><dir name="Model"><file name="Account.php" hash="b463d405e9e6bc18c1ce27dc98992a61"/><file name="Server.php" hash="6dd11dab8794ab53cdb763d4820d36c9"/></dir><dir name="etc"><file name="config.xml" hash="5734d20ccb8807ea84041bf44620fa7c"/></dir></dir><dir name="CsNotification"><dir name="Model"><dir name="AdminNotification"><file name="Feed.php" hash="1f20e704fe895c4a2748612a028ee186"/></dir></dir><dir name="etc"><file name="config.xml" hash="9ede9a59b2e857828a341bbf53953abe"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="recommender.xml" hash="26d8deea180738fdd5e3f0a5bcbc8f07"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="commercestack"><dir name="adminhtml"><file name="recommender.js" hash="b9b1fb4afa53aeb99d3a180f9fafc155"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CommerceStack_Recommender.xml" hash="c0faaf57bb93c70fe6ba45e68c96fc11"/><file name="CommerceStack_CsApiClient.xml" hash="dd56312764a58b18b7e21738ebb8a6b0"/><file name="CommerceStack_CsNotification.xml" hash="94bb10db3af629c7e68bbf32fd18159c"/></dir></target></contents>
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
24 |
</package>
|