advance_category_listing - Version 1.0.0

Version Notes

This is the initial version of Advanced Category Listing and it is fully tested on our servers.

Download this release

Release Info

Developer Rohit Goel
Extension advance_category_listing
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Webkracker/Categorylistwithimages/Block/Index.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webkracker_Categorylistwithimages_Block_Index extends Mage_Core_Block_Template{
3
+
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $storeId = Mage::app()->getStore()->getStoreId();
8
+ $collection = Mage::getModel('catalog/category')
9
+ ->getCollection()
10
+ ->setStoreId($storeId)
11
+ ->addAttributeToFilter('level',2)
12
+ ->addAttributeToSelect('*')
13
+ ->addIsActiveFilter();
14
+ $this->setCollection($collection);
15
+ }
16
+
17
+
18
+ public function catConfiguration(){
19
+
20
+ $config["width"] = Mage::getStoreConfig('categorywithimages/general/imagewidth')."px";
21
+ $config["height"] = Mage::getStoreConfig('categorywithimages/general/imageheight')."px";
22
+ $config["description"] = Mage::getStoreConfig('categorywithimages/general/description');
23
+ $config["image"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."catalog/product/watermark/".Mage::getStoreConfig('categorywithimages/general/altimage');
24
+ return $config;
25
+ }
26
+ protected function _prepareLayout()
27
+ {
28
+ parent::_prepareLayout();
29
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
30
+ $pager->setAvailableLimit(array(10=>10,20=>20,30=>30,'all'=>'all'));
31
+ $pager->setCollection($this->getCollection());
32
+ $this->setChild('pager', $pager);
33
+ $this->getCollection()->load();
34
+ return $this;
35
+ }
36
+ public function getPagerHtml()
37
+ {
38
+ return $this->getChildHtml('pager');
39
+ }
40
+
41
+
42
+ }
app/code/local/Webkracker/Categorylistwithimages/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webkracker_Categorylistwithimages_Helper_Data extends Mage_Core_Helper_Abstract{
3
+
4
+ function categoryurl(){
5
+
6
+ return $this->_getUrl('categorylistwithimages/index');
7
+
8
+
9
+
10
+ }
11
+
12
+
13
+
14
+ }
15
+
app/code/local/Webkracker/Categorylistwithimages/controllers/IndexController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webkracker_Categorylistwithimages_IndexController extends Mage_Core_Controller_Front_Action{
3
+ public function IndexAction() {
4
+
5
+ $this->loadLayout();
6
+ $this->getLayout()->getBlock("head")->setTitle($this->__("Titlename"));
7
+ $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
8
+ $breadcrumbs->addCrumb("home", array(
9
+ "label" => $this->__("Home Page"),
10
+ "title" => $this->__("Home Page"),
11
+ "link" => Mage::getBaseUrl()
12
+ ));
13
+
14
+ $breadcrumbs->addCrumb("titlename", array(
15
+ "label" => $this->__("Titlename"),
16
+ "title" => $this->__("Titlename")
17
+ ));
18
+
19
+ $this->renderLayout();
20
+
21
+ }
22
+ }
app/code/local/Webkracker/Categorylistwithimages/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <categorywithimages translate="title" module="categorylistwithimages">
12
+ <title>Category List with images Section</title>
13
+ <sort_order>0</sort_order>
14
+ </categorywithimages>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/local/Webkracker/Categorylistwithimages/etc/config.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webkracker_Categorylistwithimages>
5
+ <version>0.1.0</version>
6
+ </Webkracker_Categorylistwithimages>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <categorylistwithimages>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Webkracker_Categorylistwithimages</module>
14
+ <frontName>categorylistwithimages</frontName>
15
+ </args>
16
+ </categorylistwithimages>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <categorylistwithimages>
21
+ <file>categorylistwithimages.xml</file>
22
+ </categorylistwithimages>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <helpers>
28
+ <categorylistwithimages>
29
+ <class>Webkracker_Categorylistwithimages_Helper</class>
30
+ </categorylistwithimages>
31
+ </helpers>
32
+ <blocks>
33
+ <categorylistwithimages>
34
+ <class>Webkracker_Categorylistwithimages_Block</class>
35
+ </categorylistwithimages>
36
+ </blocks>
37
+ </global>
38
+ </config>
app/code/local/Webkracker/Categorylistwithimages/etc/system.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <webkracker translate="label" module="categorylistwithimages">
5
+ <label>Webkracker</label>
6
+ <sort_order>0</sort_order>
7
+ </webkracker>
8
+ </tabs>
9
+ <sections>
10
+ <categorywithimages translate="label" module="categorylistwithimages">
11
+ <label>Category List with images</label>
12
+ <tab>webkracker</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>0</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 settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</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
+ <description translate="label">
28
+ <label>Description</label>
29
+ <frontend_type>textarea</frontend_type>
30
+ <sort_order>0</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <comment>Enter Description</comment>
35
+ </description>
36
+ <imagewidth translate="label">
37
+ <label>Image Width</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>0</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <comment>Enter custom image width</comment>
44
+ </imagewidth>
45
+ <imageheight translate="label">
46
+ <label>Image Height</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>0</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <comment>Enter custom image Height</comment>
53
+ </imageheight>
54
+ <altimage translate="label">
55
+ <label>Alternative image</label>
56
+ <frontend_type>image</frontend_type>
57
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
58
+ <upload_dir config="system/filesystem/media" scope_info="1">catalog/product/watermark</upload_dir>
59
+ <base_url type="media" scope_info="1">catalog/product/watermark</base_url>
60
+ <sort_order>0</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <comment>Image which will show when category has no image assigned</comment>
65
+ </altimage>
66
+ </fields>
67
+ </general>
68
+ </groups>
69
+ </categorywithimages>
70
+ </sections>
71
+ </config>
app/design/frontend/base/default/layout/categorylistwithimages.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <default> <!-- Mage_Customer -->
5
+ <reference name="top.links">
6
+ <action method="addLink" translate="label title" module="categorylistwithimages">
7
+ <label>All Categories</label>
8
+ <url helper="categorylistwithimages/categoryurl"/>
9
+ <title>All Categories</title>
10
+ <prepare/>
11
+ <urlParams/>
12
+ <position>10</position>
13
+ </action>
14
+ </reference>
15
+ </default>
16
+
17
+ <categorylistwithimages_index_index>
18
+ <reference name="root">
19
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
20
+ </reference>
21
+ <reference name="content">
22
+ <block type="categorylistwithimages/index" name="categorylistwithimages_index" template="categorylistwithimages/index.phtml"/>
23
+ </reference>
24
+ </categorylistwithimages_index_index>
25
+
26
+
27
+ </layout>
28
+
app/design/frontend/base/default/template/categorylistwithimages/index.phtml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $categories = $this->getCollection();
3
+ $catconfiguration = $this->catConfiguration();
4
+ ?>
5
+
6
+ <div class="category-description">
7
+ <?php echo $catconfiguration['description']; ?>
8
+ </div>
9
+ <div class="toolbar">
10
+ <?php echo $this->getPagerHtml(); ?>
11
+ </div>
12
+ <div class="category-products">
13
+ <ul class="products-grid products-grid">
14
+ <?php
15
+ foreach($categories as $category)
16
+ {
17
+ $cat_id = $category->getId();
18
+ $cat = Mage::getModel('catalog/category')->load($cat_id);
19
+ $productCount = $cat->getProductCollection()
20
+ ->addAttributeToSelect('entity_id')
21
+ ->addAttributeToFilter('status', 1)
22
+ ->addAttributeToFilter('visibility', 4);
23
+ $catlink = $category->getUrl($category);
24
+ $catname = $category->getName();
25
+ $catdesc = $category->getDescription();
26
+ if($cat->getImageUrl()){
27
+ echo "<li class='item last' style=' width: auto;clear:unset;margin-right:1.5%;'><a href=".$catlink."><p class='category-image'><img style='width:".$catconfiguration['width'].";height:".$catconfiguration['height']."' src='".$cat->getImageUrl()."' title='".$catname."'></p></a>";
28
+ echo "<b>" . $catname . " (" .$productCount->count().")" ."</b>";
29
+ echo '<br><br><a class="button btn-cart" href="'.$catlink.'" title="View Category" >
30
+ <span>View Category</span>
31
+ </a>';
32
+ echo "</li>";
33
+ }
34
+ else{
35
+
36
+ echo "<li class='item last' style=' width: auto;clear:unset;margin-right:1.5%;'><a href=".$catlink."><p class='category-image'><img style='width:".$catconfiguration['width'].";height:".$catconfiguration['height']."' src='".$catconfiguration['image']."' title='".$catname."' ></p></a>";
37
+ echo "<b>" . $catname . " (" .$productCount->count().")" ."</b>";
38
+ echo '<br><br><a class="button btn-cart" href="'.$catlink.'" title="View Category" >
39
+ <span>View Category</span>
40
+ </a>';
41
+ echo "</li>";
42
+ }
43
+ }
44
+ ?>
45
+ </ul>
46
+ </div>
47
+
48
+ <div class="toolbar">
49
+ <?php echo $this->getPagerHtml(); ?>
50
+ </div>
app/etc/modules/Webkracker_Categorylistwithimages.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webkracker_Categorylistwithimages>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.1.0</version>
8
+ </Webkracker_Categorylistwithimages>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>advance_category_listing</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Advanced Category Listing</summary>
10
+ <description>Advanced Category Listing</description>
11
+ <notes>This is the initial version of Advanced Category Listing and it is fully tested on our servers.</notes>
12
+ <authors><author><name>Rohit Goel</name><user>Rohit</user><email>rhtgoel7@gmail.com</email></author></authors>
13
+ <date>2016-03-03</date>
14
+ <time>11:41:14</time>
15
+ <contents><target name="magelocal"><dir name="Webkracker"><dir name="Categorylistwithimages"><dir name="Block"><file name="Index.php" hash="4eabc6867b6c56f050676325bf3b8ce8"/></dir><dir name="Helper"><file name="Data.php" hash="bc65117b4571238a8955bb7fc7205cc6"/></dir><dir name="controllers"><file name="IndexController.php" hash="5eb18e99e53074e4d5e62c73beaeac7b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d006f59231d42b742c82bd7adf9c6fbe"/><file name="config.xml" hash="804ed8bf8ae0da9ad56df43b2c6e511b"/><file name="system.xml" hash="01df029d00f7282239ed37850b3d41d7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Webkracker_Categorylistwithimages.xml" hash="db09a026ef5ecb71094f2578a3eb0af8"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="categorylistwithimages.xml" hash="9fd6cd01e9376836dddd90aec49852ac"/></dir><dir name="template"><dir name="categorylistwithimages"><file name="index.phtml" hash="57dea2204feb97379f8b8d5617cbb39f"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>