Skip to content

Commit edd1235

Browse files
committed
add new version of the module with flat flow
1 parent 10af75c commit edd1235

File tree

7 files changed

+32
-79
lines changed

7 files changed

+32
-79
lines changed
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: gringo
5-
* Date: 04/08/15
6-
* Time: 11:36 PM
7-
*/
2+
83
class AM_SubCatMode_Helper_Data extends Mage_Core_Helper_Abstract {
94

105
}

code/local/AM/SubCatMode/Model/Catalog/Category/Attribute/Source/Mode.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
11
<?php
2-
/**
3-
* Onetree SubCategory Display Mode
4-
*
5-
* NOTICE OF LICENSE
6-
*
7-
* This source file is subject to the Open Software License (OSL 3.0)
8-
* that is bundled with this package in the file LICENSE.txt.
9-
* It is also available through the world-wide-web at this URL:
10-
* http://opensource.org/licenses/osl-3.0.php
11-
* If you did not receive a copy of the license and are unable to
12-
* obtain it through the world-wide-web, please send an email
13-
* to support@onetree.com so we can send you a copy immediately.
14-
*
15-
* DISCLAIMER
16-
*
17-
* Do not edit or add to this file if you wish to upgrade SubCategory Display Mode to newer
18-
* versions in the future.
19-
*
20-
* @category Onetree
21-
* @package Onetree_Subcatmode
22-
* @copyright Copyright (c) 2012 Onetree. (http://www.onetree.com)
23-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24-
*/
252

26-
27-
/**
28-
* Onetree subcatmode
29-
*
30-
* @category Onetree
31-
* @package Onetree_Subcatmode
32-
* @author Onetree Team <support@onetree.com>
33-
*/
343
class AM_SubCatMode_Model_Catalog_Category_Attribute_Source_Mode extends Mage_Catalog_Model_Category_Attribute_Source_Mode
354
{
365
public function getAllOptions()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
class AM_SubCatMode_Model_Catalog_Observer
4+
{
5+
/**
6+
* Add image filed to flat select
7+
*
8+
* @param Varien_Event_Observer $observer
9+
*/
10+
public function customSelect(Varien_Event_Observer $observer){
11+
$select = $observer->getSelect();
12+
$select->columns('image');
13+
}
14+
}

code/local/AM/SubCatMode/etc/config.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,15 @@
4545
</am_subcatmode>
4646
</updates>
4747
</layout>
48+
<events>
49+
<catalog_category_flat_loadnodes_before>
50+
<observers>
51+
<am_subcatmode>
52+
<class>AM_SubCatMode_Model_Catalog_Observer</class>
53+
<method>customSelect</method>
54+
</am_subcatmode>
55+
</observers>
56+
</catalog_category_flat_loadnodes_before>
57+
</events>
4858
</frontend>
4959
</config>

design/frontend/template/subcatmode/catalog/category/categories.phtml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
<?php if($_count): ?>
88
<div align="center">
9-
<div class="browse-title"><?php echo $this->getCurrentCategory()->getName(); ?></div>
109
<?php $_columnCount = /*'4'*/ $this->getColumnCount(); $i=0;
1110
foreach ($_categories as $k => $_category):?>
1211

@@ -24,23 +23,23 @@
2423
<?php
2524
$_imgHtml = null;
2625
if($_category->getImage()){
27-
28-
$_imgHtml = '<img src="'. Mage::getBaseUrl('media').'catalog/category/'.$_category->getImage().'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" width="69" height="72"/>';
26+
$scapeName = $this->htmlEscape($_category->getName());
27+
$_imgHtml = '<img src="'. Mage::getBaseUrl('media').'catalog/category/'.$_category->getImage().'" alt="'.$scapeName.'" title="'.$scapeName.'" width="200" height="200"/>';
2928
$_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
3029
}
3130

3231
?>
3332
<li class="category-content<?php echo ($i%$_columnCount==0?' last':'')?>">
3433
<div class="category-content-img">
35-
<a href="<?php echo $this->getCategoryUrl($_category) ?>" alt="<? echo $_category->getName(); ?>">
34+
<a href="<?php echo $this->getCategoryUrl($_category) ?>" alt="<?php echo $this->htmlEscape($_category->getName()); ?>">
3635
<?php echo (!is_null($_imgHtml))?$_imgHtml:''; ?>
3736
</a>
3837
</div>
39-
<h2 class="subcat-name">
38+
<h4 class="subcat-name">
4039
<a href="<?php echo $this->getCategoryUrl($_category) ?>" alt="<? echo $_category->getName(); ?>">
4140
<span><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></span>
4241
</a>
43-
</h2>
42+
</h4>
4443
</li>
4544
<?php if ($i%$_columnCount==0 || $i==$_count): ?>
4645
</ul>
@@ -52,6 +51,7 @@
5251

5352
<style>
5453
.subcat-grid {width: 100% !important;display: inline-table;}
55-
.category-content {width: 130px;height: 110px;float: left;padding-right: 4px;text-align: center;}
54+
.category-content {float: left;padding-right: 4px;text-align: center;}
5655
.subcat-grid .last {padding-right: 0px !important;}
56+
.subcat-name {font-weight: normal}
5757
</style>

design/frontend/template/subcatmode/catalog/category/view.phtml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,3 @@
1-
<?php
2-
/**
3-
* Magento
4-
*
5-
* NOTICE OF LICENSE
6-
*
7-
* This source file is subject to the Academic Free License (AFL 3.0)
8-
* that is bundled with this package in the file LICENSE_AFL.txt.
9-
* It is also available through the world-wide-web at this URL:
10-
* http://opensource.org/licenses/afl-3.0.php
11-
* If you did not receive a copy of the license and are unable to
12-
* obtain it through the world-wide-web, please send an email
13-
* to license@magento.com so we can send you a copy immediately.
14-
*
15-
* DISCLAIMER
16-
*
17-
* Do not edit or add to this file if you wish to upgrade Magento to newer
18-
* versions in the future. If you wish to customize Magento for your
19-
* needs please refer to http://www.magento.com for more information.
20-
*
21-
* @category design
22-
* @package base_default
23-
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25-
*/
26-
?>
27-
<?php
28-
/**
29-
* Category view template
30-
*
31-
* @see Mage_Catalog_Block_Category_View
32-
*/
33-
?>
341
<?php
352
$_helper = $this->helper('catalog/output');
363
$_category = $this->getCurrentCategory();

modman

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Frontend templates
44
design/frontend/layout/* app/design/frontend/base/default/layout/
55
design/frontend/template/* app/design/frontend/base/default/template/am
6-
design/frontend/template/* app/design/frontend/base/default/template/am-test
7-
design/frontend/template/* app/design/frontend/base/default/template/am-test1
86

97
# code
108
@shell mkdir -p "$PROJECT/app/code/local/AM"

0 commit comments

Comments
 (0)