YOOCHOOSE_Recommender_Engine - Version 2.0.5

Version Notes

Download this release

Release Info

Developer yoochoose
Extension YOOCHOOSE_Recommender_Engine
Version 2.0.5
Comparing to
See all releases


Code changes from version 2.0.2 to 2.0.5

app/code/community/Yoochoose/JsTracking/Helper/Data.php CHANGED
@@ -11,11 +11,14 @@ class Yoochoose_JsTracking_Helper_Data extends Mage_Core_Helper_Abstract
11
  CURLOPT_HEADER => 0,
12
  CURLOPT_CUSTOMREQUEST => "POST",
13
  CURLOPT_RETURNTRANSFER => TRUE,
14
- CURLOPT_FOLLOWLOCATION => TRUE,
 
 
15
  CURLOPT_TIMEOUT => 10,
16
  CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
17
  CURLOPT_USERPWD => "$customerId:$licenceKey",
18
  CURLOPT_SSL_VERIFYPEER => FALSE,
 
19
  CURLOPT_HTTPHEADER => array(
20
  'Content-Type: application/json',
21
  'Content-Length: ' . strlen($bodyString),
@@ -23,9 +26,16 @@ class Yoochoose_JsTracking_Helper_Data extends Mage_Core_Helper_Abstract
23
  CURLOPT_POSTFIELDS => $bodyString
24
  );
25
 
 
 
26
  $cURL = curl_init();
27
  curl_setopt_array($cURL, $options);
28
  $response = curl_exec($cURL);
 
 
 
 
 
29
  $result = json_decode($response, true);
30
 
31
  $eno = curl_errno($cURL);
11
  CURLOPT_HEADER => 0,
12
  CURLOPT_CUSTOMREQUEST => "POST",
13
  CURLOPT_RETURNTRANSFER => TRUE,
14
+ // !!!ATTENTION!!! Do not include CURLOPT_FOLLOWLOCATION option. If safe_mode is activated, the whole request won't work.
15
+ // More information: http://stackoverflow.com/questions/33780802
16
+ //CURLOPT_FOLLOWLOCATION => TRUE,
17
  CURLOPT_TIMEOUT => 10,
18
  CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
19
  CURLOPT_USERPWD => "$customerId:$licenceKey",
20
  CURLOPT_SSL_VERIFYPEER => FALSE,
21
+ CURLINFO_HEADER_OUT => TRUE,
22
  CURLOPT_HTTPHEADER => array(
23
  'Content-Type: application/json',
24
  'Content-Length: ' . strlen($bodyString),
26
  CURLOPT_POSTFIELDS => $bodyString
27
  );
28
 
29
+ Mage::log("Requesting [".$url."]...", Zend_Log::INFO, 'yoochoose.log');
30
+
31
  $cURL = curl_init();
32
  curl_setopt_array($cURL, $options);
33
  $response = curl_exec($cURL);
34
+
35
+ Mage::log("Request header dump:\n ".curl_getinfo($cURL, CURLINFO_HEADER_OUT), Zend_Log::DEBUG, 'yoochoose.log');
36
+
37
+ Mage::log("Response body:\n ".$response, Zend_Log::DEBUG, 'yoochoose.log');
38
+
39
  $result = json_decode($response, true);
40
 
41
  $eno = curl_errno($cURL);
app/code/community/Yoochoose/JsTracking/Model/Api2/YCProducts/Rest/Admin/V1.php CHANGED
@@ -16,6 +16,8 @@ class Yoochoose_JsTracking_Model_Api2_YCProducts_Rest_Admin_V1 extends Yoochoose
16
  $offset = $this->getRequest()->getParam('offset');
17
  $storeId = $this->_getStore()->getId();
18
  $helper = Mage::getModel('catalog/product_media_config');
 
 
19
  $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
20
 
21
  /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
@@ -42,7 +44,8 @@ class Yoochoose_JsTracking_Model_Api2_YCProducts_Rest_Admin_V1 extends Yoochoose
42
  'description' => $product->getDescription(),
43
  'price' => $product->getPrice(),
44
  'url' => $storeUrl . $product->getUrlPath(),
45
- 'image' => $helper->getMediaUrl($product['image']),
 
46
  'manufacturer' => $manufacturer ? $manufacturer : null,
47
  'categories' => array(),
48
  'tags' => array(),
16
  $offset = $this->getRequest()->getParam('offset');
17
  $storeId = $this->_getStore()->getId();
18
  $helper = Mage::getModel('catalog/product_media_config');
19
+ $imagePlaceholder = Mage::getStoreConfig("catalog/placeholder/image_placeholder");
20
+ $placeholderFullPath = $helper->getBaseMediaUrl(). '/placeholder/' . $imagePlaceholder;
21
  $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
22
 
23
  /* @var $collection Mage_Catalog_Model_Resource_Product_Collection */
44
  'description' => $product->getDescription(),
45
  'price' => $product->getPrice(),
46
  'url' => $storeUrl . $product->getUrlPath(),
47
+ 'image' => ($product->getImage() ? $helper->getMediaUrl($product->getImage()) :
48
+ ($imagePlaceholder ? $placeholderFullPath : null)),
49
  'manufacturer' => $manufacturer ? $manufacturer : null,
50
  'categories' => array(),
51
  'tags' => array(),
app/code/community/Yoochoose/JsTracking/controllers/ProductsController.php CHANGED
@@ -40,10 +40,12 @@ class Yoochoose_JsTracking_ProductsController extends Mage_Core_Controller_Front
40
  $productIds = $this->getRequest()->getParam('productIds');
41
 
42
  $helper = Mage::getModel('catalog/product_media_config');
 
 
43
  $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
44
  $priceHelper = Mage::helper('core');
45
  $storeId = Mage::app()->getStore()->getStoreId();
46
- $attributes = array('name', 'thumbnail', 'price', 'url_path');
47
  $collection = Mage::getResourceModel('catalog/product_collection')->
48
  setStoreId($storeId)->
49
  addAttributeToSelect($attributes)->
@@ -51,15 +53,14 @@ class Yoochoose_JsTracking_ProductsController extends Mage_Core_Controller_Front
51
  addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))->
52
  addAttributeToFilter('entity_id', array('in' => explode(',', $productIds)));
53
 
54
- $collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
55
- $collection->getSelect()->columns(array('e.entity_id'));
56
- $products = $collection->load()->toArray();
57
 
58
  foreach ($products as &$product) {
59
  unset($product['stock_item']);
60
  $product['url_path'] = $storeUrl . $product['url_path'];
61
- $product['thumbnail'] = $helper->getMediaUrl($product['thumbnail']);
62
  $product['price'] = $priceHelper->currency($product['price'], true, false);
 
 
63
  }
64
 
65
  header('Content-Type: application/json;');
40
  $productIds = $this->getRequest()->getParam('productIds');
41
 
42
  $helper = Mage::getModel('catalog/product_media_config');
43
+ $thumbnailPlaceholder = Mage::getStoreConfig("catalog/placeholder/thumbnail_placeholder");
44
+ $placeholderFullPath = $helper->getBaseMediaUrl(). '/placeholder/' . $thumbnailPlaceholder;
45
  $storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
46
  $priceHelper = Mage::helper('core');
47
  $storeId = Mage::app()->getStore()->getStoreId();
48
+ $attributes = array('entity_id', 'name', 'thumbnail', 'price', 'url_path');
49
  $collection = Mage::getResourceModel('catalog/product_collection')->
50
  setStoreId($storeId)->
51
  addAttributeToSelect($attributes)->
53
  addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))->
54
  addAttributeToFilter('entity_id', array('in' => explode(',', $productIds)));
55
 
56
+ $products = $collection->load()->toArray($attributes);
 
 
57
 
58
  foreach ($products as &$product) {
59
  unset($product['stock_item']);
60
  $product['url_path'] = $storeUrl . $product['url_path'];
 
61
  $product['price'] = $priceHelper->currency($product['price'], true, false);
62
+ $product['thumbnail'] = ($product['thumbnail'] ? $helper->getMediaUrl($product['thumbnail']) :
63
+ ($thumbnailPlaceholder ? $placeholderFullPath : null));
64
  }
65
 
66
  header('Content-Type: application/json;');
app/code/community/Yoochoose/JsTracking/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Yoochoose_JsTracking>
5
- <version>2.0.2</version>
6
  </Yoochoose_JsTracking>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Yoochoose_JsTracking>
5
+ <version>2.0.5</version>
6
  </Yoochoose_JsTracking>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -2,7 +2,7 @@
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.2</version>
6
  <stability>stable</stability>
7
  <license>MIT</license>
8
  <channel>community</channel>
@@ -24,9 +24,9 @@
24
  <email>support@yoochoose.com</email>
25
  </author>
26
  </authors>
27
- <date>2015-10-29</date>
28
- <time>14:56:01</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="bb8a0d04974c9287fc53fc2b2e9bfee0"/><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="27685adc8213169a1b7832ed88e06dbe"/><file name="system.xml" hash="5b44e489b58c97187849ae5c79c4e777"/></dir></dir></dir></target></contents>
30
  <compatible/>
31
  <dependencies>
32
  <required>
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.5</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-11-19</date>
28
+ <time>19:35:25</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="11b512d089188345565db57050d7929d"/></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="c379bf10048db77d2e9c56ef165c475f"/></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="ee9a82d8c749571314115f52a256052b"/><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="c9593275feab19ab4616c06be2c1522b"/><file name="system.xml" hash="5b44e489b58c97187849ae5c79c4e777"/></dir></dir></dir></target></contents>
30
  <compatible/>
31
  <dependencies>
32
  <required>