ntoklo_recommendations - Version 1.0.1

Version Notes

- Fixed package files
- Fixed widget displaying products that are not visible in catalog, or empty widget.

Download this release

Release Info

Developer Magento Core Team
Extension ntoklo_recommendations
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/community/Ntoklo/Recommendations/Block/Chart.php CHANGED
@@ -20,7 +20,7 @@
20
  class Ntoklo_Recommendations_Block_Chart extends Mage_Catalog_Block_Product_Abstract implements Mage_Widget_Block_Interface {
21
 
22
  /** @var $_items */
23
- protected $_items = null;
24
 
25
  /**
26
  * Initialize block's cache
@@ -57,6 +57,8 @@ class Ntoklo_Recommendations_Block_Chart extends Mage_Catalog_Block_Product_Abst
57
  * @return $this
58
  */
59
  private function _prepareData() {
 
 
60
  // Check if feature is enabled
61
  if (!Mage::getStoreConfig(Ntoklo_Recommendations_Helper_Data::CONFIG_XPATH_IS_ENABLED)) {
62
  return $this;
@@ -82,7 +84,37 @@ class Ntoklo_Recommendations_Block_Chart extends Mage_Catalog_Block_Product_Abst
82
 
83
  Mage::getModel('cataloginventory/stock')->addInStockFilterToCollection($collection);
84
 
85
- $this->_items = $collection->getItems();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  return $this;
87
  }
88
 
20
  class Ntoklo_Recommendations_Block_Chart extends Mage_Catalog_Block_Product_Abstract implements Mage_Widget_Block_Interface {
21
 
22
  /** @var $_items */
23
+ protected $_items = array();
24
 
25
  /**
26
  * Initialize block's cache
57
  * @return $this
58
  */
59
  private function _prepareData() {
60
+ $itemIds = array();
61
+
62
  // Check if feature is enabled
63
  if (!Mage::getStoreConfig(Ntoklo_Recommendations_Helper_Data::CONFIG_XPATH_IS_ENABLED)) {
64
  return $this;
84
 
85
  Mage::getModel('cataloginventory/stock')->addInStockFilterToCollection($collection);
86
 
87
+ // Load parent product if possible if product is not visible individually
88
+ /** @var $item Mage_Catalog_Model_Product */
89
+ foreach ($collection->getItems() as $item) {
90
+ if (!$item->isSaleable()) {
91
+ continue;
92
+ }
93
+ if ($item->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
94
+ if (!in_array($item->getId(), $itemIds)) {
95
+ $itemIds[] = $item->getId();
96
+ $this->_items[] = $item;
97
+ }
98
+ } else {
99
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($item->getId());
100
+
101
+ if (!isset($parentIds[0])) {
102
+ $parentIds = Mage::getSingleton('bundle/product_type')->getParentIdsByChild($item->getId());
103
+ }
104
+ if (!isset($parentIds[0])) {
105
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_grouped')->getParentIdsByChild($item->getId());
106
+ }
107
+
108
+ if (isset($parentIds[0])) {
109
+ $item = Mage::getModel('catalog/product')->load($parentIds[0]);
110
+ if (!in_array($item->getId(), $itemIds)) {
111
+ $itemIds[] = $item->getId();
112
+ $this->_items[] = $item;
113
+ }
114
+ }
115
+ }
116
+ }
117
+
118
  return $this;
119
  }
120
 
app/design/frontend/base/default/template/ntoklo/recommendations/widget/chart_vertical.phtml CHANGED
@@ -17,7 +17,7 @@
17
  */
18
  ?>
19
 
20
- <?php if(count($this->getItems())): ?>
21
  <!-- nToklo Chart -->
22
  <div class="block widget-ntoklo-container">
23
  <div class="block-title">
@@ -25,20 +25,18 @@
25
  </div>
26
  <div class="block-content ntoklo-vertical">
27
  <ol class="mini-products-list <?php if($this->isChart()) echo 'chart';?>" id="block-ntoklo-chart">
28
- <?php foreach($this->getItems() as $_item): ?>
29
  <li class="item">
30
- <?php if(!$_item->isComposite() && $_item->isSaleable()): ?>
31
- <div class="product">
32
- <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" class="product-image ntoklo_conversion"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
33
- <div class="product-details">
34
- <p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>" class="ntoklo_conversion"><?php echo $this->htmlEscape($_item->getName()) ?></a></p>
35
- <?php echo $this->getPriceHtml($_item, true, '-ntoklo-chart') ?>
36
- <?php if ($this->helper('wishlist')->isAllow()) : ?>
37
- <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist ntoklo_conversion"><?php echo $this->__('Add to Wishlist') ?></a>
38
- <?php endif; ?>
39
- </div>
40
  </div>
41
- <?php endif; ?>
42
  </li>
43
  <?php endforeach ?>
44
  </ol>
17
  */
18
  ?>
19
 
20
+ <?php if (($_products = $this->getItems()) && count($_products)): ?>
21
  <!-- nToklo Chart -->
22
  <div class="block widget-ntoklo-container">
23
  <div class="block-title">
25
  </div>
26
  <div class="block-content ntoklo-vertical">
27
  <ol class="mini-products-list <?php if($this->isChart()) echo 'chart';?>" id="block-ntoklo-chart">
28
+ <?php $i=0; foreach ($_products as $_item): ?>
29
  <li class="item">
30
+ <div class="product">
31
+ <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" class="product-image ntoklo_conversion"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
32
+ <div class="product-details">
33
+ <p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>" class="ntoklo_conversion"><?php echo $this->htmlEscape($_item->getName()) ?></a></p>
34
+ <?php echo $this->getPriceHtml($_item, true, '-ntoklo-chart') ?>
35
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
36
+ <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist ntoklo_conversion"><?php echo $this->__('Add to Wishlist') ?></a>
37
+ <?php endif; ?>
 
 
38
  </div>
39
+ </div>
40
  </li>
41
  <?php endforeach ?>
42
  </ol>
documentation/readme.html CHANGED
@@ -65,8 +65,7 @@
65
  <p>Download and extract (unzip) the extension's contents on you computer. Navigate inside the extracted folder.</p>
66
 
67
  <p><strong>Upload files</strong></p>
68
- <p>Using a FTP client, upload the content of the extension directory to the store's document root, so that the app directory in
69
- the extension folder overwrites the app directory on the server. If asked to replace any files, select "Yes".</p>
70
 
71
  <p><strong>Clear the cache</strong></p>
72
  <p>In the Magento admin panel, go to <b>System -> Cache Management</b> and press the "Flush Magento Cache" button:</p>
@@ -87,6 +86,10 @@
87
  <img src="skin/img/config.png"/>
88
 
89
  <h1 id="widgets">Widgets</h1>
 
 
 
 
90
  <p>Displaying the product recommendations or trending product chart requires you to configure nToklo widgets on the pages you select.<br/><br />
91
  Navigate to <b>Admin -> CMS -> Widgets</b> and choose "Add New Widget Instance".<br /><br />
92
  Select Type nToklo.</p>
65
  <p>Download and extract (unzip) the extension's contents on you computer. Navigate inside the extracted folder.</p>
66
 
67
  <p><strong>Upload files</strong></p>
68
+ <p>Upload the content of the extension directory to the store's document root so that the app directory in the extension folder merges with the app directory on the server. If asked to replace any files, select "Yes".</p>
 
69
 
70
  <p><strong>Clear the cache</strong></p>
71
  <p>In the Magento admin panel, go to <b>System -> Cache Management</b> and press the "Flush Magento Cache" button:</p>
86
  <img src="skin/img/config.png"/>
87
 
88
  <h1 id="widgets">Widgets</h1>
89
+ <p><strong>Note:</strong><br />
90
+ Widgets will only render 24hrs after integration and configuration is complete. <br />
91
+ nToklo requires at least 24hrs data to provide recommendations and trending charts. <br />
92
+ For more information please see our <a href="http://www.ntoklo.com/getting-started/">website</a>.</p>
93
  <p>Displaying the product recommendations or trending product chart requires you to configure nToklo widgets on the pages you select.<br/><br />
94
  Navigate to <b>Admin -> CMS -> Widgets</b> and choose "Add New Widget Instance".<br /><br />
95
  Select Type nToklo.</p>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ntoklo_recommendations</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">OSL v3.0</license>
7
  <channel>community</channel>
@@ -13,11 +13,12 @@ Uses the Open Data Alliance Universal Variable - Generats UniversalVariable JSON
13
  &#xD;
14
  Utilises native Magento widgets to render personalised product recommendations and trending product charts through nToklo API&#x2019;s.&#xD;
15
  Integrates with your store CMS to account for product categories.</description>
16
- <notes>initial release</notes>
17
- <authors><author><name>nToklo</name><user>ntoklo</user><email>dev@ntoklo.com</email></author></authors>
18
- <date>2013-06-11</date>
19
- <time>12:13:20</time>
20
- <contents><target name="magecommunity"><dir><dir name="Ntoklo"><dir name="Recommendations"><dir name="Block"><dir name="Adminhtml"><dir name="Widget"><dir name="Date"><file name="Helper.php" hash="6df6eb6926c5f06b085c980f0d640b72"/></dir><dir name="Type"><file name="Helper.php" hash="7003dba7c2b54e7dd03013de2f41a4e1"/></dir></dir></dir><file name="Chart.php" hash="e1550e586c10b78d2133fd9a9357a8bc"/><file name="UniversalVariable.php" hash="ccb989862b31cdec6bae7ed823026819"/></dir><dir name="Helper"><file name="Data.php" hash="cab1091fa7a00b5727a77e19009bbe02"/></dir><dir name="Model"><dir name="Cache"><file name="UniversalVariable.php" hash="761f465d4fda0e3d48541fc67af5c4b1"/></dir><file name="Observer.php" hash="79bd41f44e0e743ee50dfb55176d8812"/><file name="Service.php" hash="842507619406f53f312cb5ef01c37799"/><file name="UniversalVariable.php" hash="7744caef59b5c3f056f89577c108e0f5"/><dir name="Widget"><file name="Type.php" hash="f399f8084a0c9c270c92e5fccd74e50f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aff0945a94da77aab01ef814d14309d5"/><file name="cache.xml" hash="9be6ef2826f8e880e0c2db016787cacf"/><file name="config.xml" hash="b8a1f80d0e052d87d9bfc91a9ce43827"/><file name="system.xml" hash="6e9ca200e15d3df11f48d55d7b81947a"/><file name="widget.xml" hash="e94eaffd9ce677d742161bca542c069b"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ntoklo"><dir name="recommendations"><file name="universal_variable.phtml" hash="e25a87c2244ca1c93b133e0b5db5f5f6"/><dir name="widget"><file name="chart_horisontal.phtml" hash="ccba6e9cf4b0d1edb47fa7e3468ac264"/><file name="chart_review_short.phtml" hash="25a789e2e031e33e6e82fcd8fd73aa23"/><file name="chart_vertical.phtml" hash="0f29a662e402cc0d23e7ec97cdf71aa4"/></dir></dir></dir></dir><dir name="layout"><file name="ntoklo_recommendations.xml" hash="54426563db6994151279dde06ac298c8"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Ntoklo_Recommendations.xml" hash="d809f1cc3329034ac5d3ffcc4fe40d4c"/></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="ntoklo_recommendations.csv" hash="ba56401beed41df865bd37b1df0c82aa"/></dir></dir></target><target name="mageweb"><dir><dir name="js"><dir name="ntoklo"><file name="util.js" hash="051d37aa940bb1b877435698e1827295"/></dir></dir></dir></target><target name="mage"><dir><dir><file name="LICENSE.txt" hash="dbef313ce1d00e89c7a2ab5deee450aa"/></dir><dir name="documentation"><file name="readme.html" hash="bc1c15663f3e6b152d37982ee94faea2"/><dir name="skin"><dir name="img"><file name="cc.png" hash="83f629e3f2c6e94df256a92a0d826079"/><file name="config.png" hash="a0f8540c37bbaa614a6e6818c52b9b1e"/><file name="disablec1.png" hash="3b7a509db5f2228c1187dd169c8a7c34"/><file name="disablec2.png" hash="ce25b484b08735a1890a4871eefd23ef"/><file name="logo.png" hash="5bbc2b3e56f571eb96923185485c3a27"/><file name="widgets_1.png" hash="61c6c6acc64e9bad49e2546d43032767"/><file name="widgets_2.png" hash="a357562e6cb535458c30f8a6c53bd44d"/><file name="widgets_3.png" hash="cc6ec6b496b03e516c29eb8ed63aa7a9"/><file name="widgets_4.png" hash="1feb96648e38c0e95629bf897baeb26b"/><file name=".DS_Store" hash="b9cc4725553142cb76a203801d267143"/></dir><file name="style.css" hash="47075b5c784e810c68e506b6a4fe9b7e"/><file name=".DS_Store" hash="9f9a463a038249614133f19302f63178"/></dir><file name=".DS_Store" hash="a31191cb36ae0fd176e70d14c1999652"/></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="ntoklo"><file name="widgets.css" hash="2437f25f0847229039184ed6e8615abe"/></dir></dir></dir></dir></dir></dir></target></contents>
 
21
  <compatible/>
22
- <dependencies><required><php><min>4.2.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ntoklo_recommendations</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">OSL v3.0</license>
7
  <channel>community</channel>
13
  &#xD;
14
  Utilises native Magento widgets to render personalised product recommendations and trending product charts through nToklo API&#x2019;s.&#xD;
15
  Integrates with your store CMS to account for product categories.</description>
16
+ <notes>- Fixed package files&#xD;
17
+ - Fixed widget displaying products that are not visible in catalog, or empty widget.</notes>
18
+ <authors><author><name>nToklo</name><user>auto-converted</user><email>dev@ntoklo.com</email></author></authors>
19
+ <date>2013-06-13</date>
20
+ <time>01:12:33</time>
21
+ <contents><target name="magecommunity"><dir name="Ntoklo"><dir name="Recommendations"><dir name="Block"><dir name="Adminhtml"><dir name="Widget"><dir name="Date"><file name="Helper.php" hash="6df6eb6926c5f06b085c980f0d640b72"/></dir><dir name="Type"><file name="Helper.php" hash="7003dba7c2b54e7dd03013de2f41a4e1"/></dir></dir></dir><file name="Chart.php" hash="a1ae31b76c209ab7e826d885ef36257e"/><file name="UniversalVariable.php" hash="ccb989862b31cdec6bae7ed823026819"/></dir><dir name="Helper"><file name="Data.php" hash="cab1091fa7a00b5727a77e19009bbe02"/></dir><dir name="Model"><dir name="Cache"><file name="UniversalVariable.php" hash="761f465d4fda0e3d48541fc67af5c4b1"/></dir><dir name="Widget"><file name="Type.php" hash="f399f8084a0c9c270c92e5fccd74e50f"/></dir><file name="Observer.php" hash="79bd41f44e0e743ee50dfb55176d8812"/><file name="Service.php" hash="842507619406f53f312cb5ef01c37799"/><file name="UniversalVariable.php" hash="7744caef59b5c3f056f89577c108e0f5"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aff0945a94da77aab01ef814d14309d5"/><file name="cache.xml" hash="9be6ef2826f8e880e0c2db016787cacf"/><file name="config.xml" hash="b8a1f80d0e052d87d9bfc91a9ce43827"/><file name="system.xml" hash="6e9ca200e15d3df11f48d55d7b81947a"/><file name="widget.xml" hash="e94eaffd9ce677d742161bca542c069b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ntoklo"><dir name="recommendations"><dir name="widget"><file name="chart_horisontal.phtml" hash="ccba6e9cf4b0d1edb47fa7e3468ac264"/><file name="chart_review_short.phtml" hash="25a789e2e031e33e6e82fcd8fd73aa23"/><file name="chart_vertical.phtml" hash="ed87dfd4e7667b473a6c276fc769a95c"/></dir><file name="universal_variable.phtml" hash="e25a87c2244ca1c93b133e0b5db5f5f6"/></dir></dir></dir><dir name="layout"><file name="ntoklo_recommendations.xml" hash="54426563db6994151279dde06ac298c8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ntoklo_Recommendations.xml" hash="d809f1cc3329034ac5d3ffcc4fe40d4c"/></dir></target><target name="magelocale"><dir name="en_US"><file name="ntoklo_recommendations.csv" hash="ba56401beed41df865bd37b1df0c82aa"/></dir></target><target name="mageweb"><dir name="js"><dir name="ntoklo"><file name="util.js" hash="051d37aa940bb1b877435698e1827295"/></dir></dir></target><target name="mage"><dir name="."><file name="LICENSE.txt" hash="dbef313ce1d00e89c7a2ab5deee450aa"/></dir><dir name="documentation"><dir name="skin"><dir name="img"><file name="cc.png" hash="83f629e3f2c6e94df256a92a0d826079"/><file name="config.png" hash="a0f8540c37bbaa614a6e6818c52b9b1e"/><file name="disablec1.png" hash="3b7a509db5f2228c1187dd169c8a7c34"/><file name="disablec2.png" hash="ce25b484b08735a1890a4871eefd23ef"/><file name="logo.png" hash="5bbc2b3e56f571eb96923185485c3a27"/><file name="widgets_1.png" hash="61c6c6acc64e9bad49e2546d43032767"/><file name="widgets_2.png" hash="a357562e6cb535458c30f8a6c53bd44d"/><file name="widgets_3.png" hash="cc6ec6b496b03e516c29eb8ed63aa7a9"/><file name="widgets_4.png" hash="1feb96648e38c0e95629bf897baeb26b"/><file name=".DS_Store" hash="b9cc4725553142cb76a203801d267143"/></dir><file name="style.css" hash="47075b5c784e810c68e506b6a4fe9b7e"/><file name=".DS_Store" hash="9f9a463a038249614133f19302f63178"/></dir><file name="readme.html" hash="e62459fda1f5805676a9f442eb92146f"/><file name=".DS_Store" hash="a31191cb36ae0fd176e70d14c1999652"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="ntoklo"><file name="widgets.css" hash="2437f25f0847229039184ed6e8615abe"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
+ <dependencies/>
24
  </package>