minewhat - Version 1.0.20

Version Notes

MineWhat magento plugin

Download this release

Release Info

Developer MineWhat Inc.
Extension minewhat
Version 1.0.20
Comparing to
See all releases


Code changes from version 1.0.19 to 1.0.20

app/code/community/MineWhat/Insights/controllers/ApiController.php CHANGED
@@ -256,6 +256,7 @@ class MineWhat_Insights_ApiController extends Mage_Core_Controller_Front_Action
256
  'image',
257
  'url',
258
  'level',
 
259
  'created_at',
260
  'updated_at'
261
  );
@@ -263,11 +264,13 @@ class MineWhat_Insights_ApiController extends Mage_Core_Controller_Front_Action
263
  $sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
264
  $categories = array();
265
 
266
- $level = $this->getRequest()->getParam('extras');
267
- $debug = $this->getRequest()->getParam('debug', 'false') === 'true';
268
 
269
  if($level && strlen($level)) {
270
  $level = intval($level);
 
 
271
  }
272
 
273
  if(isset($sections[3])) {
@@ -276,7 +279,7 @@ class MineWhat_Insights_ApiController extends Mage_Core_Controller_Front_Action
276
 
277
  $category = Mage::getModel('catalog/category')->load($categoryId);
278
 
279
- $category = $this->getFormattedCategory($category, $debug);
280
  if($category !== null) {
281
  $categories[] = $category;
282
  }
@@ -287,13 +290,26 @@ class MineWhat_Insights_ApiController extends Mage_Core_Controller_Front_Action
287
  $offset = $this->getRequest()->getParam('offset', 1);
288
 
289
  $categoriesCollection = Mage::getModel('catalog/category')->getCollection();
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  $categoriesCollection
291
  ->addAttributeToSelect($attributes)
292
  ->getSelect()->limit($limit, $offset) //we can specify how many categories we want to show on this page
293
  ;
294
 
295
  foreach($categoriesCollection as $category) {
296
- $category = $this->getFormattedCategory($category, $debug);
297
  if($category !== null) {
298
  $categories[] = $category;
299
  }
@@ -445,7 +461,7 @@ class MineWhat_Insights_ApiController extends Mage_Core_Controller_Front_Action
445
 
446
  }
447
 
448
- private function getFormattedCategory($category, $extras, $debug) {
449
 
450
  $formattedCategory = null;
451
 
@@ -457,6 +473,7 @@ class MineWhat_Insights_ApiController extends Mage_Core_Controller_Front_Action
457
  'image' => $category->getImageUrl(),
458
  'url' => $category->getUrl(),
459
  'level' => $category->getLevel(),
 
460
  'created_at' => $category->getCreatedAt(),
461
  'updated_at' => $category->getUpdatedAt()
462
  );
256
  'image',
257
  'url',
258
  'level',
259
+ 'is_active',
260
  'created_at',
261
  'updated_at'
262
  );
264
  $sections = explode('/', trim($this->getRequest()->getPathInfo(), '/'));
265
  $categories = array();
266
 
267
+ $level = $this->getRequest()->getParam('level');
268
+ $active = $this->getRequest()->getParam('active', 'false') === 'true';
269
 
270
  if($level && strlen($level)) {
271
  $level = intval($level);
272
+ } else {
273
+ $level = null;
274
  }
275
 
276
  if(isset($sections[3])) {
279
 
280
  $category = Mage::getModel('catalog/category')->load($categoryId);
281
 
282
+ $category = $this->getFormattedCategory($category);
283
  if($category !== null) {
284
  $categories[] = $category;
285
  }
290
  $offset = $this->getRequest()->getParam('offset', 1);
291
 
292
  $categoriesCollection = Mage::getModel('catalog/category')->getCollection();
293
+
294
+ if($level != null) {
295
+ $categoriesCollection
296
+ ->addAttributeToFilter('level', $level) //we can specify the level of categories to be fetched
297
+ ;
298
+ }
299
+
300
+ if($active != null) {
301
+ $categoriesCollection
302
+ ->addAttributeToFilter('is_active', 1) //if you want only active categories
303
+ ;
304
+ }
305
+
306
  $categoriesCollection
307
  ->addAttributeToSelect($attributes)
308
  ->getSelect()->limit($limit, $offset) //we can specify how many categories we want to show on this page
309
  ;
310
 
311
  foreach($categoriesCollection as $category) {
312
+ $category = $this->getFormattedCategory($category);
313
  if($category !== null) {
314
  $categories[] = $category;
315
  }
461
 
462
  }
463
 
464
+ private function getFormattedCategory($category) {
465
 
466
  $formattedCategory = null;
467
 
473
  'image' => $category->getImageUrl(),
474
  'url' => $category->getUrl(),
475
  'level' => $category->getLevel(),
476
+ 'is_active' => $category->getIsActive(),
477
  'created_at' => $category->getCreatedAt(),
478
  'updated_at' => $category->getUpdatedAt()
479
  );
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>minewhat</name>
4
- <version>1.0.19</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">osl</license>
7
  <channel>community</channel>
@@ -11,7 +11,7 @@
11
  <notes>MineWhat magento plugin</notes>
12
  <authors><author><name>MineWhat Inc.</name><user>MineWhat</user><email>plugins@minewhat.com</email></author></authors>
13
  <date>2015-07-10</date>
14
- <time>11:24:43</time>
15
  <contents><target name="magecommunity"><dir name="MineWhat"><dir name="Insights"><dir name="Block"><dir name="Base"><file name="Script.php" hash="dd44e43a5954e82cfa5cf47921642624"/></dir><dir name="Event"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="41eb512f4f77a8e127253cf246587f0c"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Index.php" hash="fafaf6953262ea2b0bc3092d538c30d1"/></dir><dir name="Onepage"><file name="Success.php" hash="779fa1bb799413b05fc111bdc8bc7023"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="c9284d372a18c6db27dec077c04296ff"/></dir><dir name="Model"><file name="Observer.php" hash="8f8ffe64147205aebc15670bc819ccb5"/></dir><dir name="controllers"><file name="ApiController.php" hash="eaeeb290dc1097a0d93f480f6312fe38"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f1fb655aac4dc7f71cadb6c7a7e816f8"/><file name="config.xml" hash="b4443479201149d5ee72c95ca6ffaae5"/><file name="system.xml" hash="8b5d2901cae5a3f65a06ce7fc65e440d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MineWhat_Insights.xml" hash="8d2f076cbfcc14688ed800f622869d4b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="fe16e289984308941fb830bc97e7cad2"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="f4a801140203b524d44a23ac83e5873a"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="16cf404c9684e5839270fb0931e8fb3b"/></dir><dir name="onepage"><file name="success.phtml" hash="7868bd6e2b4bfe23972a1d6694a8b719"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="minewhat_insights.xml" hash="bffb825f36d0a76fa1e5a1eee1e91b07"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="fe16e289984308941fb830bc97e7cad2"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="f4a801140203b524d44a23ac83e5873a"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="16cf404c9684e5839270fb0931e8fb3b"/></dir><dir name="onepage"><file name="success.phtml" hash="3a1d49f78428e4cfd41e8cdd8cedc863"/></dir></dir></dir><dir name="list"><file name="toolbar.phtml" hash="0d35ba1449c7ed24e040ff3a8242838d"/><file name=".DS_Store" hash="220a7ff2487261d1b60c8b2659878617"/></dir><file name="list.phtml" hash="aedc12d376fd394dea55e6dd7593d573"/><dir name="view"><file name="featured.phtml" hash="5ecd5a962cd7d460d96cf792b2ba8d42"/><file name="list.phtml" hash="045c9f03c610ac296ffc0fe998c9f774"/><file name=".DS_Store" hash="984ca461816e7a9ac20b6ee55374f870"/></dir><file name="view.phtml" hash="25359d701778fd130b5b0bc0af2f223e"/><file name=".DS_Store" hash="b0f57b625503b5c464300f483bbec82e"/></dir><file name=".DS_Store" hash="2edc75db2a6acc90e6fef43665df0ae4"/></dir></dir><dir name="layout"><file name="minewhat_insights.xml" hash="8ed857b2639ce2dcc48e5f0225982650"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.5</min><max>6.0.0</max></php></required></dependencies>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>minewhat</name>
4
+ <version>1.0.20</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">osl</license>
7
  <channel>community</channel>
11
  <notes>MineWhat magento plugin</notes>
12
  <authors><author><name>MineWhat Inc.</name><user>MineWhat</user><email>plugins@minewhat.com</email></author></authors>
13
  <date>2015-07-10</date>
14
+ <time>12:24:43</time>
15
  <contents><target name="magecommunity"><dir name="MineWhat"><dir name="Insights"><dir name="Block"><dir name="Base"><file name="Script.php" hash="dd44e43a5954e82cfa5cf47921642624"/></dir><dir name="Event"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="41eb512f4f77a8e127253cf246587f0c"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Index.php" hash="fafaf6953262ea2b0bc3092d538c30d1"/></dir><dir name="Onepage"><file name="Success.php" hash="779fa1bb799413b05fc111bdc8bc7023"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="c9284d372a18c6db27dec077c04296ff"/></dir><dir name="Model"><file name="Observer.php" hash="8f8ffe64147205aebc15670bc819ccb5"/></dir><dir name="controllers"><file name="ApiController.php" hash="eaeeb290dc1097a0d93f480f6312fe38"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f1fb655aac4dc7f71cadb6c7a7e816f8"/><file name="config.xml" hash="b4443479201149d5ee72c95ca6ffaae5"/><file name="system.xml" hash="8b5d2901cae5a3f65a06ce7fc65e440d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MineWhat_Insights.xml" hash="8d2f076cbfcc14688ed800f622869d4b"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="fe16e289984308941fb830bc97e7cad2"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="f4a801140203b524d44a23ac83e5873a"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="16cf404c9684e5839270fb0931e8fb3b"/></dir><dir name="onepage"><file name="success.phtml" hash="7868bd6e2b4bfe23972a1d6694a8b719"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="minewhat_insights.xml" hash="bffb825f36d0a76fa1e5a1eee1e91b07"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="minewhat"><dir name="insights"><dir name="base"><file name="script.phtml" hash="fe16e289984308941fb830bc97e7cad2"/></dir><dir name="event"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="f4a801140203b524d44a23ac83e5873a"/></dir></dir><dir name="checkout"><dir name="cart"><file name="index.phtml" hash="16cf404c9684e5839270fb0931e8fb3b"/></dir><dir name="onepage"><file name="success.phtml" hash="3a1d49f78428e4cfd41e8cdd8cedc863"/></dir></dir></dir><dir name="list"><file name="toolbar.phtml" hash="0d35ba1449c7ed24e040ff3a8242838d"/><file name=".DS_Store" hash="220a7ff2487261d1b60c8b2659878617"/></dir><file name="list.phtml" hash="aedc12d376fd394dea55e6dd7593d573"/><dir name="view"><file name="featured.phtml" hash="5ecd5a962cd7d460d96cf792b2ba8d42"/><file name="list.phtml" hash="045c9f03c610ac296ffc0fe998c9f774"/><file name=".DS_Store" hash="984ca461816e7a9ac20b6ee55374f870"/></dir><file name="view.phtml" hash="25359d701778fd130b5b0bc0af2f223e"/><file name=".DS_Store" hash="b0f57b625503b5c464300f483bbec82e"/></dir><file name=".DS_Store" hash="2edc75db2a6acc90e6fef43665df0ae4"/></dir></dir><dir name="layout"><file name="minewhat_insights.xml" hash="8ed857b2639ce2dcc48e5f0225982650"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.5</min><max>6.0.0</max></php></required></dependencies>