Year_Make_Model_Filter_Box - Version 4.2

Version Notes

Added editable configuration value for category navigation

Download this release

Release Info

Developer Magento Core Team
Extension Year_Make_Model_Filter_Box
Version 4.2
Comparing to
See all releases


Code changes from version 4.1 to 4.2

app/code/local/Pektsekye/Catalog/Model/Resource/Eav/Mysql4/Category.php CHANGED
@@ -19,23 +19,27 @@ class Pektsekye_Catalog_Model_Resource_Eav_Mysql4_Category extends Mage_Catalog_
19
  $tree = Mage::getResourceModel('catalog/category_tree');
20
  /** @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
21
 
22
- $helper = new Pektsekye_Ymm_Helper_Data;
 
 
23
 
24
- if($ids = $helper->getProductIds()){
25
-
26
- $pids = implode(',',$ids);
27
- $resource = Mage::getSingleton('core/resource');
28
- $read= $resource->getConnection('core_read');
29
- $categoryTable = $resource->getTableName('catalog_category_entity');
30
- $category_productTable = $resource->getTableName('catalog/category_product_index');
31
- $rows = $read->fetchAll("SELECT entity_id FROM $categoryTable WHERE entity_id NOT IN (SELECT DISTINCT category_id FROM $category_productTable WHERE product_id in ($pids)) ");
32
-
33
- if(count($rows)>0)
34
- foreach ($rows as $r)
35
- $ids [] = $r['entity_id'];
36
 
37
- $tree->addInactiveCategoryIds($ids);
38
-
 
 
 
 
 
 
39
  }
40
 
41
  $nodes = $tree->loadNode($parent)
19
  $tree = Mage::getResourceModel('catalog/category_tree');
20
  /** @var $tree Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree */
21
 
22
+ if(Mage::getStoreConfig('catalog/navigation/filtering', Mage::app()->getStore()->getStoreId())){
23
+
24
+ $helper = new Pektsekye_Ymm_Helper_Data;
25
 
26
+ if($ids = $helper->getProductIds()){
27
+
28
+ $pids = implode(',',$ids);
29
+ $resource = Mage::getSingleton('core/resource');
30
+ $read= $resource->getConnection('core_read');
31
+ $categoryTable = $resource->getTableName('catalog_category_entity');
32
+ $category_productTable = $resource->getTableName('catalog/category_product_index');
33
+ $rows = $read->fetchAll("SELECT entity_id FROM $categoryTable WHERE entity_id NOT IN (SELECT DISTINCT category_id FROM $category_productTable WHERE product_id in ($pids)) ");
 
 
 
 
34
 
35
+ if(count($rows)>0)
36
+ foreach ($rows as $r)
37
+ $ids [] = $r['entity_id'];
38
+
39
+ $tree->addInactiveCategoryIds($ids);
40
+
41
+ }
42
+
43
  }
44
 
45
  $nodes = $tree->loadNode($parent)
app/code/local/Pektsekye/Ymm/Block/Ymm.php CHANGED
@@ -4,7 +4,10 @@ class Pektsekye_Ymm_Block_Ymm extends Mage_Core_Block_Template
4
 
5
  public function _prepareLayout()
6
  {
7
- Mage::app()->cleanCache(array(Mage_Catalog_Model_Category::CACHE_TAG));
 
 
 
8
  return parent::_prepareLayout();
9
  }
10
 
4
 
5
  public function _prepareLayout()
6
  {
7
+ if(Mage::getStoreConfig('catalog/navigation/filtering', Mage::app()->getStore()->getStoreId())){
8
+ Mage::app()->cleanCache(array(Mage_Catalog_Model_Category::CACHE_TAG));
9
+ }
10
+
11
  return parent::_prepareLayout();
12
  }
13
 
app/code/local/Pektsekye/Ymm/etc/config.xml CHANGED
@@ -137,5 +137,14 @@
137
  <class>Pektsekye_Ymm_Helper</class>
138
  </ymm>
139
  </helpers>
140
- </global>
 
 
 
 
 
 
 
 
 
141
  </config>
137
  <class>Pektsekye_Ymm_Helper</class>
138
  </ymm>
139
  </helpers>
140
+ </global>
141
+
142
+ <default>
143
+ <catalog>
144
+ <navigation>
145
+ <filtering>1</filtering>
146
+ </navigation>
147
+ </catalog>
148
+ </default>
149
+
150
  </config>
app/code/local/Pektsekye/Ymm/etc/system.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <sections>
5
+ <catalog translate="label" module="catalog">
6
+ <groups>
7
+ <navigation translate="label">
8
+ <fields>
9
+ <filtering translate="label">
10
+ <label>Enable YMM Filtering</label>
11
+ <frontend_type>select</frontend_type>
12
+ <source_model>adminhtml/system_config_source_yesno</source_model>
13
+ <sort_order>10</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ </filtering>
18
+ </fields>
19
+ </navigation>
20
+ </groups>
21
+ </catalog>
22
+ </sections>
23
+ </config>
app/design/frontend/default/default/template/ymm/ymm.phtml CHANGED
@@ -3,8 +3,8 @@
3
  Written by pektsekye@gmail.com on Wednesday Jul 29 2009
4
  version 4.0
5
  */
6
-
7
- $module = $this->getRequest()->getModuleName();
8
  $resource = Mage::getSingleton('core/resource');
9
  $read= $resource->getConnection('core_read');
10
  $ymmTable = $resource->getTableName('ymm');
@@ -159,7 +159,7 @@ function pop_year(){
159
  <div class="head">
160
  <h4><span><?php echo $this->__('Select Vehicle') ?></span></h4>
161
  </div>
162
- <form name="make_model_year" action="<?php echo $module != 'catalog' ? Mage::getUrl('ymm/product/list') : '' ;?>" method="get">
163
  <div class="content">
164
  <select name="Make" onChange="pop_model();" style="width: 100%">
165
  <?php
@@ -184,7 +184,7 @@ function pop_year(){
184
  </div>
185
  <div class="actions">
186
  <button class="form-button-alt right" type="submit"><span><?php echo $this->__('Go') ?></span></button>
187
- <?php if(isset($Make_selected_var)): ?><a href="<?php echo $module != 'catalog' ? Mage::getBaseUrl() : '' ; ?>?Make=all&Model=all&Year=0">Clear Vehicle</a>&nbsp;&nbsp;&nbsp;&nbsp;<?php endif ?>
188
  </div>
189
  </form>
190
  </div>
3
  Written by pektsekye@gmail.com on Wednesday Jul 29 2009
4
  version 4.0
5
  */
6
+ $request = $this->getRequest();
7
+ $module = $request->getModuleName() .'_'. $request->getControllerName() .'_'. $request->getActionName();
8
  $resource = Mage::getSingleton('core/resource');
9
  $read= $resource->getConnection('core_read');
10
  $ymmTable = $resource->getTableName('ymm');
159
  <div class="head">
160
  <h4><span><?php echo $this->__('Select Vehicle') ?></span></h4>
161
  </div>
162
+ <form name="make_model_year" action="<?php echo $module != 'catalog_category_view' ? Mage::getUrl('ymm/product/list') : '' ;?>" method="get">
163
  <div class="content">
164
  <select name="Make" onChange="pop_model();" style="width: 100%">
165
  <?php
184
  </div>
185
  <div class="actions">
186
  <button class="form-button-alt right" type="submit"><span><?php echo $this->__('Go') ?></span></button>
187
+ <?php if(isset($Make_selected_var)): ?><a href="<?php echo $module != 'catalog_category_view' ? Mage::getBaseUrl() : '' ; ?>?Make=all&Model=all&Year=0">Clear Vehicle</a>&nbsp;&nbsp;&nbsp;&nbsp;<?php endif ?>
188
  </div>
189
  </form>
190
  </div>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Year_Make_Model_Filter_Box</name>
4
- <version>4.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -16,15 +16,11 @@ NOTE: You should know your product id to be able to add an YMM item to it.
16
  You can find product id in the product description page url:
17
  http://yoursite.com/magento/catalog/product/view/id/119/s/coalesce-functioning-on-impatience-t-shirt/category/4/
18
  The number 119 is the product id in the url.</description>
19
- <notes>Category navigation become filtered by ymm.
20
-
21
- Layered navigation "SHOP BY" was added to the ymm/product/list page.
22
-
23
- The products without ymm restrictions are not longer considered as universal and are not shown.</notes>
24
  <authors><author><name>Stanislav</name><user>auto-converted</user><email>pektsekye@gmail.com</email></author></authors>
25
  <date>2009-07-30</date>
26
- <time>19:59:28</time>
27
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ymm.xml" hash="07bb5759f6ff145da493c94452f029af"/></dir><dir name="template"><dir name="ymm"><file name="importExport.phtml" hash="962cd5005434dfb5878b59af757f796e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ymm.xml" hash="d7262dfdd3d36f2115652d979caa6688"/></dir><dir name="template"><dir name="ymm"><file name="ymm.phtml" hash="bf4a4c4aa5c726e68eeae908ee938b1a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pektsekye_Catalog.xml" hash="89e3ec6056b4ba53d06df1370b347d42"/><file name="Pektsekye_CatalogSearch.xml" hash="c1152b8350ae4906db9736369c8e5edf"/><file name="Pektsekye_Ymm.xml" hash="990f4f561816481bd0c517f4fa131436"/></dir></target><target name="magelocal"><dir name="Pektsekye"><dir name="Catalog"><dir name="Model"><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Category.php" hash="5d8d5cd3a20472b66306e161c06865a8"/></dir></dir></dir><file name="Category.php" hash="c1e9b8cfd53a2bf466cbb80d4a9bb227"/></dir></dir><dir name="CatalogSearch"><dir name="Model"><file name="Layer.php" hash="d9576052f726186cbf8d9d23e7ced335"/></dir></dir><dir name="Ymm"><dir name="Block"><dir name="Adminhtml"><dir name="Ymm"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="df436e6aad93d09f7d3082e08373ae22"/></dir><file name="Form.php" hash="c673af9d5e772ee2230a838971a633e1"/><file name="Tabs.php" hash="9048cfd443135e36e2b9cb5de38fcb47"/></dir><file name="Edit.php" hash="fb03b2d7cc9d282221af18c6ce9f6f9f"/><file name="Grid.php" hash="ada75e652f9d9920c08a229242181a05"/><file name="ImportExport.php" hash="e1b161394a704c51c454ead1ca04e6cd"/></dir><file name="Ymm.php" hash="2c2d280c93d8839cd67515cd2d6c7ddd"/></dir><dir name="Product"><file name="Result.php" hash="62a89f2fb905930d5ece223e35d21fda"/></dir><file name="Ymm.php" hash="e3aaa2b05fb14bd52da70d27ae962604"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="YmmController.php" hash="917dbf072d01849a01aa3d35945ef14a"/></dir><file name="IndexController.php" hash="241a989b18c6309977568c050215730a"/><file name="ProductController.php" hash="84c655e892f90dd4b7442243390ebb4a"/></dir><dir name="etc"><file name="config.xml" hash="9a8fe4bc8baab099ee0c9f34acce2ebc"/></dir><dir name="Helper"><file name="Data.php" hash="181c50a246f314fc20991571c4980e5c"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ymm"><file name="Collection.php" hash="1c6a50ea1416ce936892156806d20e15"/></dir><file name="Ymm.php" hash="1608c162d190561029817336de386205"/></dir><file name="Status.php" hash="a10da0eebafef60fcceb6a8c396ad201"/><file name="Ymm.php" hash="fdf6dbac2b9595f7183ca1f951538b97"/></dir><dir name="sql"><dir name="ymm_setup"><file name="mysql4-install-0.1.0.php" hash="9e4d9d55d8996105775b26c667eff6d1"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="b3c26ec790ce60161c9317b01f111ea5"/></dir></dir></dir></dir></target></contents>
28
  <compatible/>
29
  <dependencies/>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Year_Make_Model_Filter_Box</name>
4
+ <version>4.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
16
  You can find product id in the product description page url:
17
  http://yoursite.com/magento/catalog/product/view/id/119/s/coalesce-functioning-on-impatience-t-shirt/category/4/
18
  The number 119 is the product id in the url.</description>
19
+ <notes>Added editable configuration value for category navigation</notes>
 
 
 
 
20
  <authors><author><name>Stanislav</name><user>auto-converted</user><email>pektsekye@gmail.com</email></author></authors>
21
  <date>2009-07-30</date>
22
+ <time>22:54:02</time>
23
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ymm.xml" hash="07bb5759f6ff145da493c94452f029af"/></dir><dir name="template"><dir name="ymm"><file name="importExport.phtml" hash="962cd5005434dfb5878b59af757f796e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ymm.xml" hash="d7262dfdd3d36f2115652d979caa6688"/></dir><dir name="template"><dir name="ymm"><file name="ymm.phtml" hash="3bcc14d3d31a69821f2ff1d523cfc784"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pektsekye_Catalog.xml" hash="89e3ec6056b4ba53d06df1370b347d42"/><file name="Pektsekye_CatalogSearch.xml" hash="c1152b8350ae4906db9736369c8e5edf"/><file name="Pektsekye_Ymm.xml" hash="990f4f561816481bd0c517f4fa131436"/></dir></target><target name="magelocal"><dir name="Pektsekye"><dir name="Catalog"><dir name="Model"><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Category.php" hash="e497f8d795dc4ada58b42828ee1ded75"/></dir></dir></dir><file name="Category.php" hash="c1e9b8cfd53a2bf466cbb80d4a9bb227"/></dir></dir><dir name="CatalogSearch"><dir name="Model"><file name="Layer.php" hash="d9576052f726186cbf8d9d23e7ced335"/></dir></dir><dir name="Ymm"><dir name="Block"><dir name="Adminhtml"><dir name="Ymm"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="df436e6aad93d09f7d3082e08373ae22"/></dir><file name="Form.php" hash="c673af9d5e772ee2230a838971a633e1"/><file name="Tabs.php" hash="9048cfd443135e36e2b9cb5de38fcb47"/></dir><file name="Edit.php" hash="fb03b2d7cc9d282221af18c6ce9f6f9f"/><file name="Grid.php" hash="ada75e652f9d9920c08a229242181a05"/><file name="ImportExport.php" hash="e1b161394a704c51c454ead1ca04e6cd"/></dir><file name="Ymm.php" hash="2c2d280c93d8839cd67515cd2d6c7ddd"/></dir><dir name="Product"><file name="Result.php" hash="62a89f2fb905930d5ece223e35d21fda"/></dir><file name="Ymm.php" hash="bf96d82627a567ea6bb6b5f4b5c96eb4"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="YmmController.php" hash="917dbf072d01849a01aa3d35945ef14a"/></dir><file name="IndexController.php" hash="241a989b18c6309977568c050215730a"/><file name="ProductController.php" hash="84c655e892f90dd4b7442243390ebb4a"/></dir><dir name="etc"><file name="config.xml" hash="512cc2444a24015f9f88133c6173836a"/><file name="system.xml" hash="d3c8b5904ea0396c770b5e551e75d932"/></dir><dir name="Helper"><file name="Data.php" hash="181c50a246f314fc20991571c4980e5c"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ymm"><file name="Collection.php" hash="1c6a50ea1416ce936892156806d20e15"/></dir><file name="Ymm.php" hash="1608c162d190561029817336de386205"/></dir><file name="Status.php" hash="a10da0eebafef60fcceb6a8c396ad201"/><file name="Ymm.php" hash="fdf6dbac2b9595f7183ca1f951538b97"/></dir><dir name="sql"><dir name="ymm_setup"><file name="mysql4-install-0.1.0.php" hash="9e4d9d55d8996105775b26c667eff6d1"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="f84214fc43f665c79b92dc7a092b364f"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="b3c26ec790ce60161c9317b01f111ea5"/></dir></dir></dir></dir></target></contents>
24
  <compatible/>
25
  <dependencies/>
26
  </package>