Version Notes
Featured Category is stable version. We have tested it many different version.
Download this release
Release Info
Developer | Synotive Technologies |
Extension | Featured_Category_By_Synotive |
Version | 1.1.0 |
Comparing to | |
See all releases |
Version 1.1.0
- app/code/community/Synotive/Featuredcategory/Block/Featuredcategory.php +26 -0
- app/code/community/Synotive/Featuredcategory/Helper/Data.php +62 -0
- app/code/community/Synotive/Featuredcategory/Model/Featuredcategory.php +10 -0
- app/code/community/Synotive/Featuredcategory/Model/Mysql4/Featuredcategory.php +10 -0
- app/code/community/Synotive/Featuredcategory/Model/Mysql4/Featuredcategory/Collection.php +10 -0
- app/code/community/Synotive/Featuredcategory/Model/Session.php +10 -0
- app/code/community/Synotive/Featuredcategory/Model/Status.php +15 -0
- app/code/community/Synotive/Featuredcategory/Model/Wysiwyg/Config.php +34 -0
- app/code/community/Synotive/Featuredcategory/controllers/IndexController.php +10 -0
- app/code/community/Synotive/Featuredcategory/etc/adminhtml.xml +26 -0
- app/code/community/Synotive/Featuredcategory/etc/config.xml +119 -0
- app/code/community/Synotive/Featuredcategory/etc/system.xml +94 -0
- app/code/community/Synotive/Featuredcategory/sql/featuredcategory_setup/mysql4-install-0.1.0.php +27 -0
- app/design/adminhtml/default/default/layout/featuredcategory.xml +12 -0
- app/design/frontend/base/default/layout/featuredcategory.xml +16 -0
- app/design/frontend/base/default/template/featuredcategory/featuredcategory.phtml +77 -0
- app/etc/modules/Synotive_Featuredcategory.xml +9 -0
- package.xml +19 -0
- skin/frontend/base/default/css/synotive/featuredcategory.css +17 -0
app/code/community/Synotive/Featuredcategory/Block/Featuredcategory.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Synotive_Featuredcategory_Block_Featuredcategory extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function __construct() {
|
5 |
+
parent::__construct();
|
6 |
+
$collection = Mage::getModel('featuredcategory/featuredcategory')->getCollection();
|
7 |
+
$collection->addFieldToFilter('featured_category', 1);
|
8 |
+
return parent::_prepareLayout();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getFeaturedcategory()
|
12 |
+
{
|
13 |
+
if (!$this->hasData('featuredcategory')) {
|
14 |
+
$this->setData('featuredcategory', Mage::registry('featuredcategory'));
|
15 |
+
}
|
16 |
+
return $this->getData('featuredcategory');
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getFeatureCategoryCollection(){
|
21 |
+
$collection = Mage::getModel('featuredcategory/featuredcategory')->getCollection();
|
22 |
+
$collection->addFieldToFilter('featured_category', 1);
|
23 |
+
|
24 |
+
return $collection;
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Synotive/Featuredcategory/Helper/Data.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Synotive_Featuredcategory_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const XML_PATH_ENABLE_FEATURED_CATEGORY = 'featuredcategory/general/enabled_featuredcategory';
|
6 |
+
const XML_PATH_IMAGE_CATEGORY_WIDTH = 'featuredcategory/display_setting/image_width';
|
7 |
+
const XML_PATH_IMAGE_CATEGORY_HEIGHT = 'featuredcategory/display_setting/image_height';
|
8 |
+
const XML_PATH_SHOW_CATEGORIES_ALPHABET = 'featuredcategory/display_setting/show_category_alphabet';
|
9 |
+
const XML_PATH_CATEGORIES_PER_ROW = 'featuredcategory/display_setting/number_categories_per_row';
|
10 |
+
const XML_PATH_NUM_CHAR_PER_CATEGORY = 'featuredcategory/display_setting/number_category_desc_chars';
|
11 |
+
|
12 |
+
public function isEnabledFeaturedCategories(){
|
13 |
+
return (int)Mage::getStoreConfig(self::XML_PATH_ENABLE_FEATURED_CATEGORY);
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getImageCategoriesWidth(){
|
17 |
+
return (int)Mage::getStoreConfig(self::XML_PATH_IMAGE_CATEGORY_WIDTH);
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getImageCategoriesHeight(){
|
21 |
+
return (int)Mage::getStoreConfig(self::XML_PATH_IMAGE_CATEGORY_HEIGHT);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function isShowCategoriesAlphabet(){
|
25 |
+
return (int)Mage::getStoreConfig(self::XML_PATH_SHOW_CATEGORIES_ALPHABET);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getNumberCategoriesPerRow(){
|
29 |
+
return (int)Mage::getStoreConfig(self::XML_PATH_CATEGORIES_PER_ROW);
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getNumberCharsPerCategory(){
|
33 |
+
return (int)Mage::getStoreConfig(self::XML_PATH_NUM_CHAR_PER_CATEGORY);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function resizeImgCategories($fileName, $basePath, $width, $height)
|
37 |
+
{
|
38 |
+
|
39 |
+
$folderURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
40 |
+
$imageURL = $folderURL . $fileName;
|
41 |
+
$newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . "synotive/featuredcategories/resized/". $width . "x" . $height ."/" . $fileName;
|
42 |
+
//if width empty then return original size image's URL
|
43 |
+
if ($width != '') {
|
44 |
+
//if image has already resized then just return URL
|
45 |
+
if (file_exists($basePath) && is_file($basePath) && !file_exists($newPath)) {
|
46 |
+
$imageObj = new Varien_Image($basePath);
|
47 |
+
$imageObj->constrainOnly(TRUE);
|
48 |
+
$imageObj->keepAspectRatio(FALSE);
|
49 |
+
$imageObj->keepFrame(FALSE);
|
50 |
+
$imageObj->resize($width, $height);
|
51 |
+
$imageObj->save($newPath);
|
52 |
+
}
|
53 |
+
|
54 |
+
$resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "synotive/featuredcategories/resized/". $width . "x" . $height ."/". $fileName;
|
55 |
+
//Zend_Debug::dump($resizedURL);die();
|
56 |
+
} else {
|
57 |
+
$resizedURL = $imageURL;
|
58 |
+
}
|
59 |
+
return $resizedURL;
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
app/code/community/Synotive/Featuredcategory/Model/Featuredcategory.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Synotive_Featuredcategory_Model_Featuredcategory extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('featuredcategory/featuredcategory');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Synotive/Featuredcategory/Model/Mysql4/Featuredcategory.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Synotive_Featuredcategory_Model_Mysql4_Featuredcategory extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the featuredcategory_id refers to the key field in your database table.
|
8 |
+
$this->_init('featuredcategory/featuredcategory', 'featuredcategory_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Synotive/Featuredcategory/Model/Mysql4/Featuredcategory/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Synotive_Featuredcategory_Model_Mysql4_Featuredcategory_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('featuredcategory/featuredcategory');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Synotive/Featuredcategory/Model/Session.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Synotive_Featuredcategory_Model_Session extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('featuredcategory');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Synotive/Featuredcategory/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Synotive_Featuredcategory_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('featuredcategory')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('featuredcategory')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Synotive/Featuredcategory/Model/Wysiwyg/Config.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Synotive_Featuredcategory_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config
|
3 |
+
{
|
4 |
+
public function getConfig($data = array())
|
5 |
+
{
|
6 |
+
$config = new Varien_Object();
|
7 |
+
|
8 |
+
$config->setData(array(
|
9 |
+
'enabled' => $this->isEnabled(),
|
10 |
+
'hidden' => $this->isHidden(),
|
11 |
+
'use_container' => false,
|
12 |
+
'add_variables' => false,
|
13 |
+
'add_widgets' => false,
|
14 |
+
'no_display' => false,
|
15 |
+
'translator' => Mage::helper('cms'),
|
16 |
+
'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
|
17 |
+
'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
|
18 |
+
'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'),
|
19 |
+
'encode_directives' => true,
|
20 |
+
'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
|
21 |
+
'popup_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
|
22 |
+
'content_css' => Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
|
23 |
+
'width' => '100%',
|
24 |
+
'plugins' => array()
|
25 |
+
));
|
26 |
+
|
27 |
+
$config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
|
28 |
+
|
29 |
+
if (is_array($data)) {
|
30 |
+
$config->addData($data);
|
31 |
+
}
|
32 |
+
return $config;
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Synotive/Featuredcategory/controllers/IndexController.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Synotive_Featuredcategory_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Featured Categories'));
|
8 |
+
$this->renderLayout();
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Synotive/Featuredcategory/etc/adminhtml.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<featuredcategory translate="title">
|
15 |
+
<title>Featuredcategory Permission Setting</title>
|
16 |
+
<sort_order>50</sort_order>
|
17 |
+
</featuredcategory>
|
18 |
+
</children>
|
19 |
+
</config>
|
20 |
+
</children>
|
21 |
+
</system>
|
22 |
+
</children>
|
23 |
+
</admin>
|
24 |
+
</resources>
|
25 |
+
</acl>
|
26 |
+
</config>
|
app/code/community/Synotive/Featuredcategory/etc/config.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Synotive_Featuredcategory>
|
5 |
+
<version>0.1.1</version>
|
6 |
+
</Synotive_Featuredcategory>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<secure_url>
|
10 |
+
<featuredcategory>/featuredcategory/</featuredcategory>
|
11 |
+
</secure_url>
|
12 |
+
<routers>
|
13 |
+
<featuredcategory>
|
14 |
+
<use>standard</use>
|
15 |
+
<args>
|
16 |
+
<module>Synotive_Featuredcategory</module>
|
17 |
+
<frontName>featuredcategory</frontName>
|
18 |
+
</args>
|
19 |
+
</featuredcategory>
|
20 |
+
</routers>
|
21 |
+
<layout>
|
22 |
+
<updates>
|
23 |
+
<featuredcategory>
|
24 |
+
<file>featuredcategory.xml</file>
|
25 |
+
</featuredcategory>
|
26 |
+
</updates>
|
27 |
+
</layout>
|
28 |
+
</frontend>
|
29 |
+
<admin>
|
30 |
+
<routers>
|
31 |
+
<featuredcategory>
|
32 |
+
<use>admin</use>
|
33 |
+
<args>
|
34 |
+
<module>Synotive_Featuredcategory</module>
|
35 |
+
<frontName>featuredcategory</frontName>
|
36 |
+
</args>
|
37 |
+
</featuredcategory>
|
38 |
+
</routers>
|
39 |
+
</admin>
|
40 |
+
<adminhtml>
|
41 |
+
<layout>
|
42 |
+
<updates>
|
43 |
+
<featuredcategory>
|
44 |
+
<file>featuredcategory.xml</file>
|
45 |
+
</featuredcategory>
|
46 |
+
</updates>
|
47 |
+
</layout>
|
48 |
+
</adminhtml>
|
49 |
+
<global>
|
50 |
+
<models>
|
51 |
+
<featuredcategory>
|
52 |
+
<class>Synotive_Featuredcategory_Model</class>
|
53 |
+
<resourceModel>featuredcategory_mysql4</resourceModel>
|
54 |
+
</featuredcategory>
|
55 |
+
<featuredcategory_mysql4>
|
56 |
+
<class>Synotive_Featuredcategory_Model_Mysql4</class>
|
57 |
+
<entities>
|
58 |
+
<featuredcategory>
|
59 |
+
<table>featuredcategory</table>
|
60 |
+
</featuredcategory>
|
61 |
+
</entities>
|
62 |
+
</featuredcategory_mysql4>
|
63 |
+
</models>
|
64 |
+
<resources>
|
65 |
+
<featuredcategory_setup>
|
66 |
+
<setup>
|
67 |
+
<module>Synotive_Featuredcategory</module>
|
68 |
+
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
|
69 |
+
</setup>
|
70 |
+
<connection>
|
71 |
+
<use>core_setup</use>
|
72 |
+
</connection>
|
73 |
+
</featuredcategory_setup>
|
74 |
+
<featuredcategory_write>
|
75 |
+
<connection>
|
76 |
+
<use>core_write</use>
|
77 |
+
</connection>
|
78 |
+
</featuredcategory_write>
|
79 |
+
<featuredcategory_read>
|
80 |
+
<connection>
|
81 |
+
<use>core_read</use>
|
82 |
+
</connection>
|
83 |
+
</featuredcategory_read>
|
84 |
+
</resources>
|
85 |
+
<blocks>
|
86 |
+
<featuredcategory>
|
87 |
+
<class>Synotive_Featuredcategory_Block</class>
|
88 |
+
</featuredcategory>
|
89 |
+
</blocks>
|
90 |
+
<helpers>
|
91 |
+
<featuredcategory>
|
92 |
+
<class>Synotive_Featuredcategory_Helper</class>
|
93 |
+
</featuredcategory>
|
94 |
+
</helpers>
|
95 |
+
</global>
|
96 |
+
<default>
|
97 |
+
<featuredcategory>
|
98 |
+
<general>
|
99 |
+
<enabled_featuredcategory>1</enabled_featuredcategory>
|
100 |
+
</general>
|
101 |
+
<display_setting>
|
102 |
+
<image_width>120</image_width>
|
103 |
+
<image_height>120</image_height>
|
104 |
+
<show_category_alphabet>0</show_category_alphabet>
|
105 |
+
<number_categories_per_row>3</number_categories_per_row>
|
106 |
+
<number_category_desc_chars>150</number_category_desc_chars>
|
107 |
+
</display_setting>
|
108 |
+
</featuredcategory>
|
109 |
+
</default>
|
110 |
+
<translate>
|
111 |
+
<modules>
|
112 |
+
<Synotive_Featuredcategory>
|
113 |
+
<files>
|
114 |
+
<default>Synotive_Featuredcategory.csv</default>
|
115 |
+
</files>
|
116 |
+
</Synotive_Featuredcategory>
|
117 |
+
</modules>
|
118 |
+
</translate>
|
119 |
+
</config>
|
app/code/community/Synotive/Featuredcategory/etc/system.xml
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<synotive translate="label">
|
5 |
+
<label>Synotive</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</synotive>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<featuredcategory translate="label" module="featuredcategory">
|
11 |
+
<label>Featured Categories</label>
|
12 |
+
<tab>synotive</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>299</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<general translate="label">
|
20 |
+
<label>General Setting</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<enabled_featuredcategory>
|
28 |
+
<label>Enable Featured Category</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
31 |
+
<sort_order>2</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</enabled_featuredcategory>
|
36 |
+
</fields>
|
37 |
+
</general>
|
38 |
+
<display_setting>
|
39 |
+
<label>Display Setting</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<fields>
|
46 |
+
<image_width translate="label">
|
47 |
+
<label>Image Category Width</label>
|
48 |
+
<comment><![CDATA[Unit is px]]></comment>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>0</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</image_width>
|
55 |
+
<image_height translate="label">
|
56 |
+
<label>Image Category Height</label>
|
57 |
+
<comment><![CDATA[Unit is px]]></comment>
|
58 |
+
<frontend_type>text</frontend_type>
|
59 |
+
<sort_order>1</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</image_height>
|
64 |
+
<show_category_alphabet translate="label">
|
65 |
+
<label>Sort Category Alphabet</label>
|
66 |
+
<frontend_type>select</frontend_type>
|
67 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
68 |
+
<sort_order>3</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
</show_category_alphabet>
|
73 |
+
<number_categories_per_row translate="label">
|
74 |
+
<label>Number Categories per Row</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>4</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
</number_categories_per_row>
|
81 |
+
<number_category_desc_chars translate="label">
|
82 |
+
<label>Number of Charactors for Description per Category</label>
|
83 |
+
<frontend_type>text</frontend_type>
|
84 |
+
<sort_order>5</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</number_category_desc_chars>
|
89 |
+
</fields>
|
90 |
+
</display_setting>
|
91 |
+
</groups>
|
92 |
+
</featuredcategory>
|
93 |
+
</sections>
|
94 |
+
</config>
|
app/code/community/Synotive/Featuredcategory/sql/featuredcategory_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$setup->addAttribute('catalog_category', 'featured_category', array(
|
7 |
+
'type' => 'int',
|
8 |
+
'group' => '',
|
9 |
+
'backend' => '',
|
10 |
+
'frontend' => '',
|
11 |
+
'label' => 'Featured Category',
|
12 |
+
'input' => 'select',
|
13 |
+
'class' => '',
|
14 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
15 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
16 |
+
'visible' => true,
|
17 |
+
'required' => false,
|
18 |
+
'user_defined' => false,
|
19 |
+
'default' => '0',
|
20 |
+
'searchable' => false,
|
21 |
+
'filterable' => false,
|
22 |
+
'comparable' => false,
|
23 |
+
'visible_on_front' => false,
|
24 |
+
'unique' => false,
|
25 |
+
'group' => 'General Information', ));
|
26 |
+
$installer->endSetup();
|
27 |
+
?>
|
app/design/adminhtml/default/default/layout/featuredcategory.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<featuredcategory_adminhtml_featuredcategory_edit>
|
4 |
+
<update handle="editor"/>
|
5 |
+
</featuredcategory_adminhtml_featuredcategory_edit>
|
6 |
+
<featuredcategory_adminhtml_featuredcategory_index>
|
7 |
+
<update handle="editor"/>
|
8 |
+
<reference name="content">
|
9 |
+
<block type="featuredcategory/adminhtml_featuredcategory" name="featuredcategory" />
|
10 |
+
</reference>
|
11 |
+
</featuredcategory_adminhtml_featuredcategory_index>
|
12 |
+
</layout>
|
app/design/frontend/base/default/layout/featuredcategory.xml
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addCss"><stylesheet>css/synotive/featuredcategory.css</stylesheet></action>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
<cms_index_index>
|
9 |
+
<reference name="root">
|
10 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
11 |
+
</reference>
|
12 |
+
<reference name="content">
|
13 |
+
<block type="featuredcategory/featuredcategory" name="featuredcategory" template="featuredcategory/featuredcategory.phtml" />
|
14 |
+
</reference>
|
15 |
+
</cms_index_index>
|
16 |
+
</layout> <!-- {{block type="featuredcategory/featuredcategory" name="featuredcategory" template="featuredcategory/featuredcategory.phtml" }}-->
|
app/design/frontend/base/default/template/featuredcategory/featuredcategory.phtml
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$enabledFeaturedCategories = Mage::helper('featuredcategory')->isEnabledFeaturedCategories();
|
3 |
+
$imageCategoriesWidth = Mage::helper('featuredcategory')->getImageCategoriesWidth();
|
4 |
+
$imageCategoriesHeight = Mage::helper('featuredcategory')->getImageCategoriesHeight();
|
5 |
+
$showCategoriesAlphabet = Mage::helper('featuredcategory')->isShowCategoriesAlphabet();
|
6 |
+
$numberCategoriesPerRow = Mage::helper('featuredcategory')->getNumberCategoriesPerRow();
|
7 |
+
$numberCharactorsPerCategory = Mage::helper('featuredcategory')->getNumberCharsPerCategory();
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
$_helper = $this->helper('catalog/output');
|
11 |
+
$categories = Mage::getModel('catalog/category')->getCollection()
|
12 |
+
->addAttributeToSelect('*')
|
13 |
+
->addAttributeToSelect('url_key')
|
14 |
+
->addAttributeToSelect('featured_category', 1);
|
15 |
+
|
16 |
+
if($showCategoriesAlphabet){
|
17 |
+
$categories = Mage::getModel('catalog/category')->getCollection()
|
18 |
+
->addAttributeToSelect('*')
|
19 |
+
->addAttributeToSelect('url_key')
|
20 |
+
->addAttributeToSelect('featured_category', 1)
|
21 |
+
->addAttributeToSort('name', 'ASC');
|
22 |
+
}
|
23 |
+
|
24 |
+
$count = count($categories);
|
25 |
+
?>
|
26 |
+
<?php if($enabledFeaturedCategories): ?>
|
27 |
+
<div class="page-title">
|
28 |
+
<h2>Featured Categories</h2>
|
29 |
+
</div>
|
30 |
+
<div class="featured-category-list">
|
31 |
+
<?php if ($count > 0):?>
|
32 |
+
<?php $i = 0; ?>
|
33 |
+
<?php foreach($categories as $category):?>
|
34 |
+
<?php
|
35 |
+
$categoryID = $category->getId();//id
|
36 |
+
$imageUrl = Mage::getModel('catalog/category')->load($categoryID)->getImageUrl();// base path
|
37 |
+
$category = Mage::getModel('catalog/category')->load($categoryID);
|
38 |
+
$categoryImage = $category->getImage(); // image name
|
39 |
+
$basePath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA).'/catalog/category/'.$category->getImage();
|
40 |
+
$newImageCategoriesResized = Mage::helper('featuredcategory')->resizeImgCategories($categoryImage, $basePath, $imageCategoriesWidth, $imageCategoriesHeight );
|
41 |
+
?>
|
42 |
+
<?php if($category->featured_category):?>
|
43 |
+
<?php if (($i % ($numberCategoriesPerRow)) == 0): ?>
|
44 |
+
<ul class="row-item">
|
45 |
+
<?php endif?>
|
46 |
+
<li class="item<?php if(($i-1)%$numberCategoriesPerRow==0): ?> first<?php elseif($i%$numberCategoriesPerRow==0): ?> last<?php endif; ?>">
|
47 |
+
<div class="featuredcategory-image">
|
48 |
+
<a title="<?php echo $category->getName() ?>" alt="<?php echo $category->getName() ?>" href="<?php echo $category->getUrl() ?>" >
|
49 |
+
<img src="<?php if($category->getImage()) echo $newImageCategoriesResized?>" alt="<?php echo $category->getName() ?>"/>
|
50 |
+
</a>
|
51 |
+
</div>
|
52 |
+
<div class="featuredcategory-name" style="width:<?php echo $imageCategoriesWidth?>px">
|
53 |
+
<h5>
|
54 |
+
<a title="<?php echo $category->getName() ?>" alt="<?php echo $category->getName() ?>" href="<?php echo $category->getUrl() ?>" >
|
55 |
+
<?php echo $category->getName() ?>
|
56 |
+
</a>
|
57 |
+
</h5>
|
58 |
+
<div class="featuredcategory-desc">
|
59 |
+
<?php echo substr($_helper->categoryAttribute($category, $category->getDescription(), 'description'),0, $numberCharactorsPerCategory) ?>
|
60 |
+
</div>
|
61 |
+
<div class="featuredcategory-morelink">
|
62 |
+
<a href="<?php echo $category->getURL(); ?>" class="link" title="<?php echo $category->getName() ?>">More Info</a>
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
</li>
|
66 |
+
<?php $i++?>
|
67 |
+
<?php if ((($i % ($numberCategoriesPerRow)) == 0)): ?>
|
68 |
+
</ul>
|
69 |
+
<?php endif?>
|
70 |
+
<?php endif ?>
|
71 |
+
|
72 |
+
<?php endforeach ?>
|
73 |
+
<script type="text/javascript">decorateGeneric($$('ul.row-item'), ['odd','even','first','last'])</script>
|
74 |
+
<?php endif ?>
|
75 |
+
</div>
|
76 |
+
<?php endif ?>
|
77 |
+
|
app/etc/modules/Synotive_Featuredcategory.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Synotive_Featuredcategory>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Synotive_Featuredcategory>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Featured_Category_By_Synotive</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Featured Category provides the functionality to show categories in home page.</summary>
|
10 |
+
<description>Featured Category provides the functionality to show categories in home page.So Admin can easily highlight his category which is not popular.
|
11 |
+
</description>
|
12 |
+
<notes>Featured Category is stable version. We have tested it many different version.</notes>
|
13 |
+
<authors><author><name>Synotive Technologies</name><user>Synotive</user><email>magento@synotive.com</email></author></authors>
|
14 |
+
<date>2015-01-30</date>
|
15 |
+
<time>06:20:48</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="Synotive"><dir name="Featuredcategory"><dir name="Block"><file name="Featuredcategory.php" hash="a71d5c137ed838ea2b7c904ed2e7bda3"/></dir><dir name="Helper"><file name="Data.php" hash="bed64fa8cbe2745876650be15523f6ce"/></dir><dir name="Model"><file name="Featuredcategory.php" hash="9027903a181f4b48d6525cfd89910539"/><dir name="Mysql4"><dir name="Featuredcategory"><file name="Collection.php" hash="4473aaf714c1869c943085f51133da85"/></dir><file name="Featuredcategory.php" hash="bbad987945e40ed68ce2292ccdefb7c4"/></dir><file name="Session.php" hash="4f641d130bbd81461cdda2f2fd6f4617"/><file name="Status.php" hash="bbd9301885ec29bf1420ab2b617a4799"/><dir name="Wysiwyg"><file name="Config.php" hash="0f28afa047774f158c3f672af21a7264"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="894bdad8ffb110688a88c2e2ab464027"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8348f67cad5570c6b2226e8079a95f0a"/><file name="config.xml" hash="f40d71fb5c8cffa4f5549df35bf572c2"/><file name="system.xml" hash="e25d5f9b46e4d13bec4b72db15ff190c"/></dir><dir name="sql"><dir name="featuredcategory_setup"><file name="mysql4-install-0.1.0.php" hash="356b24c42f458cfbb3b9c479d82db5b3"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Synotive_Featuredcategory.xml" hash="91b6887e41c13215eee2905c31435c71"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="featuredcategory.xml" hash="580d39a15cfc7f8f833606628482cc91"/></dir><dir name="template"><dir name="featuredcategory"><file name="featuredcategory.phtml" hash="8288912e6d3a382902c33c5b8d09d4ab"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="featuredcategory.xml" hash="1df508da44b935808be0dd0cdd5ba495"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir><dir name="css"><dir name="synotive"><file name="featuredcategory.css" hash="046d46cd57f97c183545ddde2f5d0d1b"/></dir></dir></dir></dir></dir></dir></target></contents>
|
17 |
+
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.0.0</min><max>5.6.2</max></php></required></dependencies>
|
19 |
+
</package>
|
skin/frontend/base/default/css/synotive/featuredcategory.css
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.featured-category-list{}
|
2 |
+
.featured-category-list ul{float:left; width:100%; margin:12px 0 12px;}
|
3 |
+
.featured-category-list ul li{
|
4 |
+
background: none repeat scroll 0 0 #FFFFFF;
|
5 |
+
border: 1px solid #E1E1E1;
|
6 |
+
box-shadow: 0 0 0 #F0F0F0 inset, 0 0 5px #E8E6E6;
|
7 |
+
float: left;
|
8 |
+
margin-right: 12px;
|
9 |
+
margin-bottom: 12px;
|
10 |
+
padding: 12px;
|
11 |
+
text-align: left;
|
12 |
+
}
|
13 |
+
.featured-category-list .featuredcategory-image{border:1px solid #efefef;}
|
14 |
+
.featured-category-list .featuredcategory-name h5{text-align:left; float:left; margin:6px 0 0;}
|
15 |
+
.featured-category-list .featuredcategory-name h5 a{text-decoration:none; color:#333333; font-size:12px; font-weight:bold; text-transform:uppercase;}
|
16 |
+
.featured-category-list .featuredcategory-desc{ float:left; margin: 5px 0 5px 0; text-align: justify; }
|
17 |
+
.featured-category-list .featuredcategory-morelink{ float:right; margin: 5px 0 5px 0;}
|