dzinehub_featuredcategory_v1 - Version 1.0.0.1

Version Notes

Tested to work with magento v1.9, v 1.8, v1.7, v1.6 and v1.5

Download this release

Release Info

Developer Srilekha
Extension dzinehub_featuredcategory_v1
Version 1.0.0.1
Comparing to
See all releases


Version 1.0.0.1

Files changed (27) hide show
  1. app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category.php +27 -0
  2. app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit.php +37 -0
  3. app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Form.php +27 -0
  4. app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Tab/Main.php +70 -0
  5. app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Tabs.php +31 -0
  6. app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Grid.php +91 -0
  7. app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Renderer/Image.php +30 -0
  8. app/code/local/Dzinehub/FeaturedCategory/Block/Category.php +20 -0
  9. app/code/local/Dzinehub/FeaturedCategory/Helper/Data.php +86 -0
  10. app/code/local/Dzinehub/FeaturedCategory/Model/Category.php +33 -0
  11. app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Category.php +17 -0
  12. app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Category/Collection.php +18 -0
  13. app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Setup.php +13 -0
  14. app/code/local/Dzinehub/FeaturedCategory/Model/Source/Abovebelow.php +21 -0
  15. app/code/local/Dzinehub/FeaturedCategory/controllers/Adminhtml/CategoryController.php +150 -0
  16. app/code/local/Dzinehub/FeaturedCategory/controllers/CategoryController.php +18 -0
  17. app/code/local/Dzinehub/FeaturedCategory/etc/adminhtml.xml +61 -0
  18. app/code/local/Dzinehub/FeaturedCategory/etc/config.xml +94 -0
  19. app/code/local/Dzinehub/FeaturedCategory/etc/system.xml +74 -0
  20. app/code/local/Dzinehub/FeaturedCategory/sql/dz_featcat_setup/mysql4-install-1.0.0.php +25 -0
  21. app/design/adminhtml/default/default/layout/featuredcat.xml +9 -0
  22. app/design/frontend/base/default/layout/featuredcat.xml +16 -0
  23. app/design/frontend/base/default/template/featuredcat/featuredcat.phtml +67 -0
  24. app/etc/modules/Dzinehub_FeaturedCategory.xml +9 -0
  25. media/placeholder/image.jpg +0 -0
  26. package.xml +20 -0
  27. skin/frontend/base/default/css/featuredcat/featuredcat.css +29 -0
app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /***************************************************************************
4
+ @extension : Featured Category Images
5
+ @Version : 1.0.0.
6
+ @package : Dzinehub_FeaturedCategory
7
+ @class : app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category.php
8
+ @author : Srilekha
9
+ @email : arun@dzine-hub.com
10
+ @support : http://www.dzine-hub.com/contact-us/
11
+ ***************************************************************************/
12
+
13
+ class Dzinehub_FeaturedCategory_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Widget_Grid_Container{
14
+
15
+ public function __construct(){
16
+
17
+ $this->_blockGroup='dz_featcat';
18
+
19
+ $this->_controller='adminhtml_category';
20
+
21
+ $this->_headerText=Mage::helper('dz_featcat')->__('Featured Category');
22
+
23
+ $this->_addButtonLabel=Mage::helper('dz_featcat')->__('Add Featured Items');
24
+
25
+ parent::__construct();
26
+ }
27
+ }
app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /***************************************************************************
4
+ @extension : Featured Category Images
5
+ @Version : 1.0.0.
6
+ @package : Dzinehub_FeaturedCategory
7
+ @class : app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit.php
8
+ @author : Srilekha
9
+ @email : arun@dzine-hub.com
10
+ @support : http://www.dzine-hub.com/contact-us/
11
+ ***************************************************************************/
12
+
13
+ class Dzinehub_FeaturedCategory_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container{
14
+
15
+ public function __construct(){
16
+
17
+ parent::__construct();
18
+
19
+ $this->_objectId='id';
20
+ $this->_blockGroup='dz_featcat';
21
+ $this->_controller='adminhtml_category';
22
+ $this->_mode='edit';
23
+
24
+ $this->_updateButton('save', 'label', Mage::helper('dz_featcat')->__('Save Category'));
25
+ $this->_updateButton('delete','label',Mage::helper('dz_featcat')->__('Delete Category'));
26
+ }
27
+ public function getHeaderText(){
28
+ if(Mage::registry('dz_featcat_data') && Mage::registry('dz_featcat_data')->getId()){
29
+ return Mage::helper('dz_featcat')->__("Edit Featured Category %s",
30
+ $this->htmlEscape(Mage::registry('dz_featcat_data')->getName()));
31
+ }
32
+ else{
33
+ return Mage::helper('dz_featcat')->__('Add Featured Item');
34
+ }
35
+ }
36
+
37
+ }
app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Form.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Form.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Block_Adminhtml_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form{
12
+
13
+ protected function _prepareForm()
14
+ {
15
+ $form = new Varien_Data_Form(array(
16
+ 'id' => 'edit_form',
17
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
18
+ 'method' => 'post',
19
+ 'enctype' => 'multipart/form-data'
20
+ )
21
+ );
22
+
23
+ $form->setUseContainer(true);
24
+ $this->setForm($form);
25
+ return parent::_prepareForm();
26
+ }
27
+ }
app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Tab/Main.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Tab/Main.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Block_Adminhtml_Category_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
12
+ {
13
+ protected function _prepareForm()
14
+ {
15
+ $form = new Varien_Data_Form();
16
+ $this->setForm($form);
17
+ $fieldset = $form->addFieldSet('dz_featcat_fieldset', array(
18
+ 'legend' => Mage::helper('dz_featcat')->__('Category Information')
19
+ ));
20
+
21
+ $fieldset -> addField('name','text',array(
22
+ 'name' => 'name',
23
+ 'label' => Mage::helper('dz_featcat')->__('Name'),
24
+ 'title' => Mage::helper('dz_featcat')->__('Name'),
25
+ 'required' => true
26
+ ));
27
+
28
+ $fieldset -> addField('file_image','image',array(
29
+ 'name' => 'file_image',
30
+ 'label' => Mage::helper('dz_featcat')->__('Image'),
31
+ 'title' => Mage::helper('dz_featcat')->__('Image'),
32
+ 'after_element_html' => '<div><small>Image width and height should not exceed 400px</small></div>',
33
+ ));
34
+ $fieldset -> addField('link','text',array(
35
+ 'name' => 'link',
36
+ 'label' => Mage::helper('dz_featcat')->__('Link'),
37
+ 'title' => Mage::helper('dz_featcat')->__('Link'),
38
+ 'class' => 'validate-url',
39
+ 'after_element_html' => '<small>Always enter absolute url</small>',
40
+
41
+ ));
42
+
43
+ $fieldset->addField('sort_order','text',array(
44
+ 'name' => 'sort_order',
45
+ 'label' => Mage::helper('dz_featcat')->__('Sort Order'),
46
+ 'title' => Mage::helper('dz_featcat')->__('Sort Order'),
47
+ 'required' => true,
48
+ 'class' => 'validate-number',
49
+ ));
50
+
51
+ $fieldset -> addField('status','select',array(
52
+ 'name' => 'status',
53
+ 'label' => Mage::helper('dz_featcat')->__('Status'),
54
+ 'title' => Mage::helper('dz_featcat')->__('Status'),
55
+ 'options' => array(
56
+ 0 => Mage::helper('dz_featcat')->__('Disabled'),
57
+ 1 => Mage::helper('dz_featcat')->__('Enabled')
58
+ ),
59
+ 'required'=>true
60
+ ));
61
+ Mage::dispatchEvent('adminhtml_category_edit_tab_main_prepare_form', array('form'=>$form));
62
+
63
+
64
+ if(Mage::registry('dz_featcat_data'))
65
+ {
66
+ $form->setValues(Mage::registry('dz_featcat_data')->getData());
67
+ }
68
+ return parent::_prepareForm();
69
+ }
70
+ }
app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Tabs.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Edit/Tabs.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Block_Adminhtml_Category_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs{
12
+
13
+ public function __construct(){
14
+
15
+ parent::__construct();
16
+ $this->setId('dz_featcat_tabs');
17
+ $this->setDestElementId('edit_form');
18
+ $this->setTitle(Mage::helper('dz_featcat')->__('New Featured Category'));
19
+ }
20
+
21
+ protected function _beforeToHtml(){
22
+
23
+ $this->addTab('form_tab',array(
24
+ 'label' => Mage::helper('dz_featcat')->__('Featured Category Information'),
25
+ 'title' => Mage::helper('dz_featcat')->__('Featured Category Information'),
26
+ 'content'=> $this->getLayout()->createBlock('dz_featcat/adminhtml_category_edit_tab_main')->toHtml(),
27
+ 'active' => true
28
+ ));
29
+ return parent::_beforeToHtml();
30
+ }
31
+ }
app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Grid.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /***************************************************************************
4
+ @extension : Featured Category Images
5
+ @Version : 1.0.0.
6
+ @package : Dzinehub_FeaturedCategory
7
+ @class : app/code/local/Dzinehub/FeaturedCategory/Adminhtml/Category/Grid.php
8
+ @author : Srilekha
9
+ @email : arun@dzine-hub.com
10
+ @support : http://www.dzine-hub.com/contact-us/
11
+ ***************************************************************************/
12
+
13
+ class Dzinehub_FeaturedCategory_Block_Adminhtml_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid{
14
+
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+ $this->setId('dz_featcatGrid');
19
+ $this->setDefaultDir('DESC');
20
+ $this->setDefaultSort('category_id');
21
+ $this->setSaveParametersInSession(true);
22
+ }
23
+
24
+ protected function _prepareCollection()
25
+ {
26
+ $collection=Mage::getModel('dz_featcat/category')->getCollection();
27
+ $this->setCollection($collection);
28
+ return parent::_prepareCollection();
29
+ }
30
+
31
+ protected function _prepareColumns()
32
+ {
33
+ $this->addColumn('category_id',array(
34
+ 'header' => Mage::helper('dz_featcat')->__('Category ID'),
35
+ 'index' => 'category_id',
36
+ 'align' => 'left',
37
+ 'width' => '10px'
38
+ ));
39
+
40
+ $this->addColumn('image',array(
41
+ 'header' => Mage::helper('dz_featcat')->__('Image'),
42
+ 'index' => 'image',
43
+ 'align' => 'center',
44
+ 'type' => 'image',
45
+ 'renderer'=> 'dz_featcat/adminhtml_category_renderer_image',
46
+ 'width' => '100px',
47
+ ));
48
+
49
+ $this->addColumn('name',array(
50
+ 'header' => Mage::helper('dz_featcat')->__('Name'),
51
+ 'index' => 'name'
52
+ ));
53
+
54
+ $this->addColumn('link',array(
55
+ 'header' => Mage::helper('dz_featcat')->__('Link'),
56
+ 'index' => 'link'
57
+ ));
58
+
59
+ $this->addColumn('status',array(
60
+ 'header' => Mage::helper('dz_featcat')->__('Status'),
61
+ 'index' => 'status',
62
+ 'type' => 'options',
63
+ 'options'=> array(
64
+ 1 => Mage::helper('dz_featcat')->__('Enabled'),
65
+ 0 => Mage::helper('dz_featcat')->__('Disabled')
66
+ )
67
+ ));
68
+
69
+ $this->addColumn('sort_order',array(
70
+ 'header' => Mage::helper('dz_featcat')->__('sort_order'),
71
+ 'index' => 'sort_order',
72
+ ));
73
+
74
+ $this->addColumn('created_at', array(
75
+ 'header' => Mage::helper('dz_featcat')->__('Created At'),
76
+ 'align' => 'left',
77
+ 'width' => '120px',
78
+ 'type' => 'date',
79
+ 'default' => '--',
80
+ 'index' => 'created_at',
81
+ ));
82
+
83
+ return parent::_prepareColumns();
84
+ }
85
+
86
+ public function getRowUrl($row)
87
+ {
88
+ return $this->getUrl('*/*/edit',array('id'=>$row->getId()));
89
+ }
90
+
91
+ }
app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Renderer/Image.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Block/Adminhtml/Category/Renderer/Image.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Block_Adminhtml_Category_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
12
+ {
13
+ public function render(Varien_Object $row)
14
+ {
15
+ if($row->getData($this->getColumn()->getIndex())==""){
16
+ return "";
17
+ }
18
+ else
19
+ {
20
+ $html = '<img ';
21
+ $html .= 'id="' . $this->getColumn()->getId() . '" ';
22
+ $html .= 'src="' . Mage::getBaseUrl('media').'featuredcategory/'.$row->getData($this->getColumn()->getIndex()) . '"';
23
+ $html.='width="'.$this->getColumn()->getWidth().'"';
24
+ $html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
25
+
26
+ return $html;
27
+ }
28
+ }
29
+
30
+ }
app/code/local/Dzinehub/FeaturedCategory/Block/Category.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /***************************************************************************
4
+ @extension : Featured Category Images
5
+ @Version : 1.0.0.
6
+ @package : Dzinehub_FeaturedCategory
7
+ @class : app/code/local/Dzinehub/FeaturedCategory/Block/Category.php
8
+ @author : Srilekha
9
+ @email : arun@dzine-hub.com
10
+ @support : http://www.dzine-hub.com/contact-us/
11
+ ***************************************************************************/
12
+ class Dzinehub_FeaturedCategory_Block_Category extends Mage_Core_Block_Template{
13
+
14
+ protected function getFeatured()
15
+ {
16
+ $collection=Mage::getResourceModel('dz_featcat/category_collection')->addFieldToFilter('status',1);
17
+ $collection->setOrder('sort_order','ASC');
18
+ return $collection;
19
+ }
20
+ }
app/code/local/Dzinehub/FeaturedCategory/Helper/Data.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Helper/Data.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Helper_Data extends Mage_Core_Helper_Abstract{
12
+
13
+ const MEDIA_PATH="featuredcategory";
14
+ const MAX_FILE_SIZE = 1048576;
15
+
16
+ protected $_allowedExtensions = array('jpg', 'gif', 'png');
17
+
18
+ public function getBaseDir()
19
+ {
20
+ return Mage::getBaseDir('media') . DS . self::MEDIA_PATH;
21
+ }
22
+
23
+ public function getBaseUrl()
24
+ {
25
+ return Mage::getBaseUrl('media') . '/' . self::MEDIA_PATH;
26
+ }
27
+ public function uploadImage($scope)
28
+ {
29
+ $adapter = new Zend_File_Transfer_Adapter_Http();
30
+ if ($adapter->isUploaded($scope)) {
31
+ // validate image
32
+ if (!$adapter->isValid($scope)) {
33
+ Mage::throwException(Mage::helper('featured')->__('Uploaded image is not valid'));
34
+ }
35
+ $upload = new Varien_File_Uploader($scope);
36
+ $upload->setAllowCreateFolders(true);
37
+ $upload->setAllowedExtensions(array('jpeg','jpg', 'gif', 'png'));
38
+ $upload->setAllowRenameFiles(true);
39
+ $upload->setFilesDispersion(false);
40
+ if ($upload->save($this->getBaseDir())) {
41
+ return $upload->getUploadedFileName();
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+
47
+ public function removeImage($imageFile)
48
+ {
49
+ $io = new Varien_Io_File();
50
+ $io->open(array('path' => $this->getBaseDir()));
51
+ if ($io->fileExists($imageFile)) {
52
+ return $io->rm($imageFile);
53
+ }
54
+ return false;
55
+ }
56
+
57
+ public function getFeaturedTitle(){
58
+ return Mage::getStoreConfig('featured_category/general/title');
59
+ }
60
+ public function resizeImage($imageName, $width=NULL, $height=NULL, $imagePath=NULL)
61
+ {
62
+ $imagePath = str_replace("/", DS, $imagePath);
63
+ $imagePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $imageName;
64
+
65
+ if($width == NULL && $height == NULL) {
66
+ $width = 100;
67
+ $height = 100;
68
+ }
69
+ $resizePath = $width . 'x' . $height;
70
+ $resizePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $resizePath . DS . $imageName;
71
+
72
+ if (file_exists($imagePathFull) && !file_exists($resizePathFull)) {
73
+ $imageObj = new Varien_Image($imagePathFull);
74
+ $imageObj->constrainOnly(TRUE);
75
+ $imageObj->keepAspectRatio(TRUE);
76
+ $imageObj->keepFrame(TRUE);
77
+ $imageObj->keepTransparency(FALSE);
78
+ $imageObj->backgroundColor(array(255,255,255));
79
+ $imageObj->resize($width,$height);
80
+ $imageObj->save($resizePathFull);
81
+ }
82
+
83
+ $imagePath=str_replace(DS, "/", $imagePath);
84
+ return Mage::getBaseUrl("media") . $imagePath . "/" . $resizePath . "/" . $imageName;
85
+ }
86
+ }
app/code/local/Dzinehub/FeaturedCategory/Model/Category.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Model/Category.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Model_Category extends Mage_Core_Model_Abstract{
12
+
13
+ protected function _construct(){
14
+
15
+ $this->_init('dz_featcat/category');
16
+ }
17
+ protected function _beforeSave()
18
+ {
19
+
20
+ parent::_beforeSave();
21
+ $now = Mage::getSingleton('core/date')->gmtDate();
22
+
23
+ if ($this->isObjectNew()){
24
+ $this->setCreatedAt($now);
25
+ }
26
+ return $this;
27
+ }
28
+ protected function _afterSave()
29
+ {
30
+ return parent::_afterSave();
31
+ }
32
+
33
+ }
app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Category.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Category.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract{
12
+
13
+ protected function _construct(){
14
+
15
+ $this->_init('dz_featcat/category','category_id');
16
+ }
17
+ }
app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Category/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Category/Collection.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract{
12
+
13
+ protected function _construct()
14
+ {
15
+ $this->_init('dz_featcat/category');
16
+
17
+ }
18
+ }
app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/Model/Mysql4/Setup.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup{
12
+
13
+ }
app/code/local/Dzinehub/FeaturedCategory/Model/Source/Abovebelow.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ /***************************************************************************
4
+ @extension : Featured Category Images
5
+ @Version : 1.0.0.
6
+ @package : Dzinehub_FeaturedCategory
7
+ @class : app/code/local/Dzinehub/FeaturedCategory/Model/Source/Abovebelow.php
8
+ @author : Srilekha
9
+ @email : arun@dzine-hub.com
10
+ @support : http://www.dzine-hub.com/contact-us/
11
+ ***************************************************************************/
12
+ class Dzinehub_FeaturedCategory_Model_Source_Abovebelow
13
+ {
14
+ public function toOptionArray()
15
+ {
16
+ return array(
17
+ array('value'=>'above', 'label'=>Mage::helper('dz_featcat')->__('Above image')),
18
+ array('value'=>'below', 'label'=>Mage::helper('dz_featcat')->__('Below image')),
19
+ );
20
+ }
21
+ }
app/code/local/Dzinehub/FeaturedCategory/controllers/Adminhtml/CategoryController.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/controllers/Adminhtml/CategoryController.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_Adminhtml_CategoryController extends Mage_Adminhtml_Controller_Action{
12
+
13
+ protected function _initAction()
14
+ {
15
+ $this->loadLayout()
16
+ ->_setActiveMenu('dzinehub')
17
+ ->_title($this->__('Featured Category'))
18
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Featured Category Manager'),
19
+ Mage::helper('adminhtml')->__('Featured Category Manager'));
20
+
21
+ return $this;
22
+ }
23
+ public function indexAction()
24
+ {
25
+ $this->_initAction();
26
+ $this->renderLayout();
27
+ }
28
+ public function gridAction()
29
+ {
30
+ $this->loadLayout();
31
+ $this->renderLayout();
32
+ }
33
+ public function editAction()
34
+ {
35
+ $id=$this->getRequest()->getParam('id');
36
+ $model=Mage::getModel('dz_featcat/category')->load($id);
37
+ if($model->getId() || $id==0)
38
+ {
39
+ $data=Mage::getSingleton('adminhtml/session')->getFormData(true);
40
+ if(!empty($data)){
41
+
42
+ $model->setData($data);
43
+ }
44
+
45
+ Mage::register('dz_featcat_data',$model);
46
+
47
+ $this->loadLayout();
48
+ $this->_setActiveMenu('featured_cat');
49
+
50
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Manage Category'),Mage::helper('adminhtml')->__('Manage Category'));
51
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Items'),Mage::helper('adminhtml')->__('Items'));
52
+
53
+ $this->getLayout()->getBlock('head')->setCanLoadExtnJs(true);
54
+
55
+ $this->_addContent($this->getLayout()->createBlock('dz_featcat/adminhtml_category_edit'))
56
+ ->_addLeft($this->getLayout()->createBlock('dz_featcat/adminhtml_category_edit_tabs'));
57
+
58
+ $this->renderLayout();
59
+
60
+ }
61
+ else{
62
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dz_featcat')->__('Category does not exist'));
63
+ $this->_redirect('*/*/');
64
+ }
65
+ }
66
+
67
+ public function newAction()
68
+ {
69
+ $this->_forward('edit');
70
+ }
71
+ public function saveAction()
72
+ {
73
+ $model=Mage::getModel('dz_featcat/category');
74
+ $data=$this->getRequest()->getPost();
75
+ $redirectPath = '*/*';
76
+ $redirectParams = array();
77
+ if($data)
78
+ {
79
+ $id=$this->getRequest()->getParam('id');
80
+ if($id)
81
+ {
82
+ $model->load($id);
83
+ }
84
+ $model->addData($data);
85
+
86
+ try
87
+ {
88
+ $hasError=false;
89
+ $imageHelper=Mage::helper('dz_featcat');
90
+ $imageFile = $imageHelper->uploadImage('file_image');
91
+
92
+ if ($imageFile) {
93
+ $model->setImage($imageFile);
94
+ }
95
+ else{
96
+ unset($data['file_image']);
97
+
98
+ }
99
+ $model->save();
100
+ $this->_getSession()->addSuccess(Mage::helper('dz_featcat')->__('The category has been saved'));
101
+
102
+ }
103
+ catch(Mage_Core_Exception $e)
104
+ {
105
+ $hasError=true;
106
+ $this->_getSession()->addError($e->getMessage());
107
+ }
108
+ catch(Exception $e)
109
+ {
110
+ $this->_getSession()->addError($e,Mage::helper('dz_featcat')->__('An error occured while saving the category'));
111
+ }
112
+ if($hasError)
113
+ {
114
+ $this->_getSession()->setFormData($data);
115
+ $redirectPath='*/*/edit';
116
+ $redirectParams=array($this->getRequest()->getParam('id'));
117
+ }
118
+
119
+ }
120
+ $this->_redirect($redirectPath,$redirectParams);
121
+ }
122
+ public function deleteAction(){
123
+ $id=$this->getRequest()->getParam('id');
124
+ if($id){
125
+ try
126
+ {
127
+ $model=Mage::getModel('dz_featcat/category');
128
+ $model->load($id);
129
+ if(!$model->getId()){
130
+ Mage::throwException(Mage::helper('dz_featcat')->__('Unable to find the category'));
131
+ }
132
+ $model->delete();
133
+ $this->_getSession()->addSuccess(Mage::helper('dz_featcat')->__('The category item has been saved'));
134
+ }
135
+ catch(Mage_Core_Exception $e)
136
+ {
137
+ $this->_getSession()->addError($e->getMessage());
138
+ }
139
+ catch(Exception $e)
140
+ {
141
+ $this->_getSession()->addException($e,Mage::helper('dz_featcat')->__('An error occured while deleting the category'));
142
+ }
143
+
144
+ }
145
+ $this->_redirect('*/*/');
146
+ }
147
+ }
148
+
149
+
150
+
app/code/local/Dzinehub/FeaturedCategory/controllers/CategoryController.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images
4
+ @Version : 1.0.0.
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/code/local/Dzinehub/FeaturedCategory/controllers/CategoryController.php
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ class Dzinehub_FeaturedCategory_CategoryController extends Mage_Core_Controller_Front_Action{
12
+
13
+ public function indexAction(){
14
+ $this->loadLayout();
15
+ $this->renderLayout();
16
+ }
17
+
18
+ }
app/code/local/Dzinehub/FeaturedCategory/etc/adminhtml.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <dzinehub translate="title" module="dz_featcat">
5
+ <title>dZine-Hub</title>
6
+ <sort_order>80</sort_order>
7
+ <children>
8
+ <featured_cat translate="title" module="dz_featcat">
9
+ <title>Featured Category</title>
10
+ <sort_order>2</sort_order>
11
+ <children>
12
+ <menu1 module="dz_featcat">
13
+ <title>Manage Featured Category</title>
14
+ <sort_order>1</sort_order>
15
+ <action>dz_featcat/adminhtml_category</action>
16
+ </menu1>
17
+ </children>
18
+ </featured_cat>
19
+ </children>
20
+ </dzinehub>
21
+ </menu>
22
+ <acl>
23
+ <resources>
24
+ <all>
25
+ <title>Allow Everything</title>
26
+ </all>
27
+ <admin>
28
+ <children>
29
+ <dzinehub translate="title" module="dz_featcat">
30
+ <title>dZine-Hub</title>
31
+ <sort_order>80</sort_order>
32
+ <children>
33
+ <featured_cat module="dz_featcat" translate="title">
34
+ <title>Dzine-Hub Featured Category</title>
35
+ <sort_order>2</sort_order>
36
+ <children>
37
+ <menu1 module="dz_featcat">
38
+ <title>Manage Featured Category</title>
39
+ <action>dz_featcat/adminhtml_category</action>
40
+ </menu1>
41
+ </children>
42
+ </featured_cat>
43
+ </children>
44
+ </dzinehub>
45
+ <system>
46
+ <children>
47
+ <config>
48
+ <children>
49
+ <featured_category module="dz_featcat" translate="title">
50
+ <title>Dzine-Hub Featured Category</title>
51
+ <sort_order>02</sort_order>
52
+ </featured_category>
53
+ </children>
54
+ </config>
55
+ </children>
56
+ </system>
57
+ </children>
58
+ </admin>
59
+ </resources>
60
+ </acl>
61
+ </config>
app/code/local/Dzinehub/FeaturedCategory/etc/config.xml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Dzinehub_FeaturedCategory>
5
+ <version>1.0.0</version>
6
+ </Dzinehub_FeaturedCategory>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <dz_featcat>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Dzinehub_FeaturedCategory</module>
14
+ <frontName>dz_featcat</frontName>
15
+ </args>
16
+ </dz_featcat>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <dz_featcat>
21
+ <file>featuredcat.xml</file>
22
+ </dz_featcat>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <dz_featcat>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Dzinehub_FeaturedCategory</module>
32
+ <frontName>dz_featcat</frontName>
33
+ </args>
34
+ </dz_featcat>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <layout>
39
+ <updates>
40
+ <dz_featcat>
41
+ <file>featuredcat.xml</file>
42
+ </dz_featcat>
43
+ </updates>
44
+ </layout>
45
+ </adminhtml>
46
+
47
+ <global>
48
+ <models>
49
+ <dz_featcat>
50
+ <class>Dzinehub_FeaturedCategory_Model</class>
51
+ <resourceModel>dz_featcat_mysql4</resourceModel>
52
+ </dz_featcat>
53
+ <dz_featcat_mysql4>
54
+ <class>Dzinehub_FeaturedCategory_Model_Mysql4</class>
55
+ <entities>
56
+ <category>
57
+ <table>dzinehub_featuredcategory</table>
58
+ </category>
59
+ </entities>
60
+ </dz_featcat_mysql4>
61
+ </models>
62
+ <resources>
63
+ <dz_featcat_setup>
64
+ <setup>
65
+ <module>Dzinehub_FeaturedCategory</module>
66
+ <class>Dzinehub_FeaturedCategory_Model_Mysql4_Setup</class>
67
+ </setup>
68
+ <connection>
69
+ <use>core_setup</use>
70
+ </connection>
71
+ </dz_featcat_setup>
72
+ <dz_featcat_write>
73
+ <connection>
74
+ <use>core_write</use>
75
+ </connection>
76
+ </dz_featcat_write>
77
+ <dz_featcat_read>
78
+ <connection>
79
+ <use>core_read</use>
80
+ </connection>
81
+ </dz_featcat_read>
82
+ </resources>
83
+ <helpers>
84
+ <dz_featcat>
85
+ <class>Dzinehub_FeaturedCategory_Helper</class>
86
+ </dz_featcat>
87
+ </helpers>
88
+ <blocks>
89
+ <dz_featcat>
90
+ <class>Dzinehub_FeaturedCategory_Block</class>
91
+ </dz_featcat>
92
+ </blocks>
93
+ </global>
94
+ </config>
app/code/local/Dzinehub/FeaturedCategory/etc/system.xml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <Dzine-Hub translate="title" module="dz_featcat">
5
+ <label>Dzine-Hub</label>
6
+ <!--<label><![CDATA[<div style="position: absolute;"><img id="dzinehub_extension" src="" alt="" border="0" /></div>&nbsp;<script>$('dzinehub_extension').src = SKIN_URL + "images/dzinehub/dzinehub.png";</script>]]></label>-->
7
+ <sort_order>150</sort_order>
8
+ </Dzine-Hub>
9
+ </tabs>
10
+ <sections>
11
+ <featured_category translate="title" module="dz_featcat">
12
+ <label>Featured Category</label>
13
+ <sort_order>02</sort_order>
14
+ <tab>Dzine-Hub</tab>
15
+ <frontend_type>text</frontend_type>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general tranlate="label" module="dz_featcat">
21
+ <label>General Settings</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <enable_disable_field translate="label comment">
29
+ <label>Enable/Disable Featured Category</label>
30
+ <frontend_type>select</frontend_type>
31
+ <sort_order>01</sort_order>
32
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
33
+ <comment>Enable featured category to display in frontend</comment>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </enable_disable_field>
38
+ <title translate="label">
39
+ <label>Featured Category Title</label>
40
+ <depends>
41
+ <enable_disable_field>1</enable_disable_field>
42
+ </depends>
43
+ <frontend_type>text</frontend_type>
44
+ <sort_order>02</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </title>
49
+ <!--<noofcategory translate="title">
50
+ <label>Number of categories per row</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>03</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </noofcategory>-->
57
+ <namedisplay translate="title">
58
+ <label>Display category name above or below</label>
59
+ <frontend_type>select</frontend_type>
60
+ <depends>
61
+ <enable_disable_field>1</enable_disable_field>
62
+ </depends>
63
+ <sort_order>04</sort_order>
64
+ <source_model>dz_featcat/source_abovebelow</source_model>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </namedisplay>
69
+ </fields>
70
+ </general>
71
+ </groups>
72
+ </featured_category>
73
+ </sections>
74
+ </config>
app/code/local/Dzinehub/FeaturedCategory/sql/dz_featcat_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer=$this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('dz_featcat/category')}`
9
+ (
10
+ `category_id` int(100) NOT NULL AUTO_INCREMENT,
11
+ `name` varchar(50) NOT NULL,
12
+ `image` varchar(50) NOT NULL,
13
+ `link` varchar(100) NOT NULL,
14
+ `status` smallint(6) NOT NULL default '0',
15
+ `sort_order` smallint(6) NOT NULL default '0',
16
+ `created_at` datetime NULL,
17
+ PRIMARY KEY (`category_id`)
18
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
19
+ ");
20
+
21
+ $installer->endSetup();
22
+
23
+
24
+
25
+
app/design/adminhtml/default/default/layout/featuredcat.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <dz_featcat_adminhtml_category_index>
5
+ <reference name="content">
6
+ <block type="dz_featcat/adminhtml_category" name="dz_featcat.index"/>
7
+ </reference>
8
+ </dz_featcat_adminhtml_category_index>
9
+ </layout>
app/design/frontend/base/default/layout/featuredcat.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/featuredcat/featuredcat.css</stylesheet></action>
6
+ </reference>
7
+ </default>
8
+ <dz_featcat_category_index>
9
+ <reference name="root">
10
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
11
+ </reference>
12
+ <reference name="content">
13
+ <block type="dz_featcat/category" name="dz_featcat_index" as="featcat" template="featuredcat/featuredcat.phtml"/>
14
+ </reference>
15
+ </dz_featcat_category_index>
16
+ </layout>
app/design/frontend/base/default/template/featuredcat/featuredcat.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************************
3
+ @extension : Featured Category Images.
4
+ @Version : 1.0.0
5
+ @package : Dzinehub_FeaturedCategory
6
+ @class : app/design/frontend/base/default/template/featuredcat/featuredcat.phtml
7
+ @author : Srilekha
8
+ @email : arun@dzine-hub.com
9
+ @support : http://www.dzine-hub.com/contact-us/
10
+ ***************************************************************************/
11
+ $feature= $this->getFeatured();
12
+ if(Mage::getStoreConfig('featured_category/general/enable_disable_field')==1) : ?>
13
+
14
+ <div class="featured_category">
15
+ <?php if(Mage::helper('dz_featcat')->getFeaturedTitle()!="") :?>
16
+ <h1 class="featured_title"><?php echo Mage::helper('dz_featcat')->getFeaturedTitle()?></h1>
17
+ <?php endif?>
18
+ <ul>
19
+ <?php if($feature->getSize()): ?>
20
+ <?php $i==0; foreach($feature as $obj):
21
+ //var_dump($obj->getSize());?>
22
+ <?php if($obj->getStatus()==1): ?>
23
+
24
+ <li class="feature_cat">
25
+ <?php $link=$obj->getLink(); ?>
26
+ <?php $userimage = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .'featuredcategory/'
27
+ .$obj->getImage();?>
28
+ <?php $defaultimage = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) .'placeholder/image.jpg'
29
+ ?>
30
+
31
+ <?php if(Mage::getStoreConfig('featured_category/general/namedisplay')=='above'): ?>
32
+
33
+ <div class="cat_name"><a href="<?php echo $link ?>"><?php echo $obj->getName(); ?></a></div>
34
+ <?php if($obj->getImage()!=''):?>
35
+ <div class="feature_cat_image"><a href="<?php echo $link ?>">
36
+
37
+ <img src="<?php echo Mage::helper('dz_featcat')->resizeImage($obj->getImage(), 200,200, 'featuredcategory'); ?>" alt="Featured category" />
38
+
39
+ <!-- <img src="<?php echo $userimage ?>" alt="user_image" />--></a> </div>
40
+ <?php else: ?>
41
+ <div class="feature_cat_image"><a href="<?php echo $link ?>">
42
+ <!--<img src="<?php echo $defaultimage ?>" alt="user_image" />-->
43
+ <img src="<?php echo Mage::helper('dz_featcat')->resizeImage('image.jpg', 200,200, 'placeholder'); ?>" alt="Featured category default" />
44
+ </a></div>
45
+ <?php endif?>
46
+ <?php else: ?>
47
+
48
+ <?php if($obj->getImage()!=''):?>
49
+ <div class="feature_cat_image"><a href="<?php echo $link ?>"><img src="<?php echo Mage::helper('dz_featcat')->resizeImage($obj->getImage(), 200,200, 'featuredcategory'); ?>" alt="Featured category" /></a> </div>
50
+ <?php else: ?>
51
+ <div class="feature_cat_image"><a href="<?php echo $link ?>"> <img src="<?php echo Mage::helper('dz_featcat')->resizeImage('image.jpg', 200,200, 'placeholder'); ?>" alt="Featured category default" /></a></div>
52
+ <?php endif ?>
53
+ <div class="cat_name"><a href="<?php echo $link ?>"><?php echo $obj->getName(); ?></a></div>
54
+ <?php endif ?>
55
+ </li>
56
+
57
+
58
+ <?php endif ?>
59
+ <?php endforeach;?>
60
+ <?php else: ?>
61
+ <div class="note_msg">No categories </div>
62
+ <?php endif ?>
63
+ </ul>
64
+ </div>
65
+
66
+ <div class="feaclear"></div>
67
+ <?php endif?>
app/etc/modules/Dzinehub_FeaturedCategory.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Dzinehub_FeaturedCategory>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Dzinehub_FeaturedCategory>
8
+ </modules>
9
+ </config>
media/placeholder/image.jpg ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>dzinehub_featuredcategory_v1</name>
4
+ <version>1.0.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/gpl-license.php">GNU General Public License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension is used to create dynamic featured category images in your website.</summary>
10
+ <description>This extension lets you to create featured category images in your magento website and map category urls for that featured categories.&#xD;
11
+ This extension is very simple and easily handled from the magento admin.&#xD;
12
+ For any support inquiries, contact us at www.dzine-hub.com/contact</description>
13
+ <notes>Tested to work with magento v1.9, v 1.8, v1.7, v1.6 and v1.5</notes>
14
+ <authors><author><name>Srilekha</name><user>srilekha</user><email>arun@dzine-hub.com</email></author></authors>
15
+ <date>2015-11-27</date>
16
+ <time>10:20:37</time>
17
+ <contents><target name="magelocal"><dir name="Dzinehub"><dir name="FeaturedCategory"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="86cb1ba04016d890c62f8d4b84e3d73e"/><dir name="Tab"><file name="Main.php" hash="d1619b6ee5c226e2ef4b223d5b428ab2"/></dir><file name="Tabs.php" hash="c078982133244a41d840cdc43150480c"/></dir><file name="Edit.php" hash="7e3f906273390daea424449aee3c234c"/><file name="Grid.php" hash="676c56deb152743dd84b0da5dc4c294f"/><dir name="Renderer"><file name="Image.php" hash="62b1ac9754111b3fb8c6dff52239fe29"/></dir></dir><file name="Category.php" hash="592fbe5085db2b7e1c1d082da48aa77d"/></dir><file name="Category.php" hash="aa19e5ed230cd2d2b7d16dd1dded40e6"/></dir><dir name="Helper"><file name="Data.php" hash="957637a36b2561123e305c9725d7dc3a"/></dir><dir name="Model"><file name="Category.php" hash="f88f4db560334b3b1e67c48af322133a"/><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="2611cfeab5b33973b403efcbe1beb50c"/></dir><file name="Category.php" hash="84ac453fc73770a1b811f4a8a3a8bb1b"/><file name="Setup.php" hash="167c322358cbe663463f5716c15cc972"/></dir><dir name="Source"><file name="Abovebelow.php" hash="3c9821f4fdf3a24626953c66196eff7e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryController.php" hash="1de45e4bbf8ae298c1c1ea5cb4aa9b56"/></dir><file name="CategoryController.php" hash="33f740154650277bec9e06b930c08181"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e3cca45865a987b4a9ddfbfb6d689062"/><file name="config.xml" hash="b0586bea05ec3c6645195ac59b1b9c5b"/><file name="system.xml" hash="8fa768f96655eaa6d6d2714c1b8aca97"/></dir><dir name="sql"><dir name="dz_featcat_setup"><file name="mysql4-install-1.0.0.php" hash="07c136802edd78f13ed226524d3bfaf4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dzinehub_FeaturedCategory.xml" hash="b6488e867179a93a2dc521c4f8c8c8b9"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="featuredcat.xml" hash="43c6b6fc92baac9c349d1424b12043e1"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="featuredcat"><file name="featuredcat.phtml" hash="142ccbf980e24db0aa956f3ac500c30e"/></dir></dir><dir name="layout"><file name="featuredcat.xml" hash="0572bc88b307ca700ba95e21ed77b2a8"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="placeholder"><file name="image.jpg" hash="097ab8a3051bc037ea3de0e17f440540"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="featuredcat"><file name="featuredcat.css" hash="1df7ea3a190b6eace2f0f7619df0bfaa"/></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.1.1</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>
skin/frontend/base/default/css/featuredcat/featuredcat.css ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .feature_cat{
2
+ float: left;
3
+ margin: 5px 10px;
4
+ width: 22%;
5
+ list-style-type: none;
6
+ margin-left: 0em !important;
7
+ }
8
+ .feature_cat img{
9
+ width: 100%;
10
+ }
11
+ .feaclear{
12
+ clear: both;
13
+ }
14
+ @media screen and (max-width: 400px){
15
+ .feature_cat{
16
+ float: none;
17
+ width: 100%;
18
+ margin: 0px;
19
+ margin-left: 0em !important;
20
+ }
21
+ }
22
+ @media screen and (min-width: 401px) and (max-width: 640px){
23
+ .feature_cat{
24
+ width: 50%;
25
+ margin: 0px;
26
+ margin-left: 0em !important;
27
+ padding: 5px;
28
+ }
29
+ }