ecommerceoffice_mostpopular - Version 1.0.3

Version Notes

1.0.3

Download this release

Release Info

Developer volgodark
Extension ecommerceoffice_mostpopular
Version 1.0.3
Comparing to
See all releases


Version 1.0.3

app/code/community/Ecommerceoffice/Mostpopular/Block/Category.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Ecommerceoffice.com
5
+ * Copyright Proskuryakov Ivan. Ecommerceoffice.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Ecommerceoffice_Mostpopular_Block_Category extends Mage_Catalog_Block_Product_Abstract {
12
+
13
+
14
+
15
+ protected function _beforeToHtml() {
16
+
17
+ $storeId = Mage::app()->getStore()->getId();
18
+ $collection = Mage::getResourceModel('reports/product_collection')
19
+ ->addAttributeToSelect('*')
20
+ ->setStoreId($storeId)
21
+ ->addStoreFilter($storeId)
22
+ ->addViewsCount()
23
+ ->setPageSize($this->getModel()->getCatProductsLimit())
24
+ ->setCurPage(1)
25
+ ->setOrder('views_count', 'desc');
26
+
27
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
28
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
29
+
30
+ $c = Mage::registry("current_category");
31
+ $catId = $c->getData('entity_id');
32
+ if ($catId>0) {
33
+ $category = $this->getModel()->getCategory($catId);
34
+ $collection->addCategoryFilter($category);
35
+ }
36
+
37
+
38
+ $this->setProductCollection($collection);
39
+ return parent::_beforeToHtml();
40
+ }
41
+
42
+
43
+
44
+ public function getModel() {
45
+ return Mage::getModel('mostpopular/data');
46
+ }
47
+
48
+ }
49
+
app/code/community/Ecommerceoffice/Mostpopular/Block/Home.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Ecommerceoffice.com
5
+ * Copyright Proskuryakov Ivan. Ecommerceoffice.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Ecommerceoffice_Mostpopular_Block_Home extends Mage_Catalog_Block_Product_Abstract {
12
+
13
+
14
+
15
+
16
+ protected function _beforeToHtml() {
17
+
18
+ $storeId = Mage::app()->getStore()->getId();
19
+ $collection = Mage::getResourceModel('reports/product_collection')
20
+ ->addAttributeToSelect('*')
21
+ ->setStoreId($storeId)
22
+ ->addStoreFilter($storeId)
23
+ ->addViewsCount()
24
+ ->setPageSize($this->getModel()->getHomepageProductsLimit())
25
+ ->setCurPage(1)
26
+ ->setOrder('views_count', 'desc');
27
+
28
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
29
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
30
+ $catId=$this->getModel()->getHomepageCatID();
31
+ if ($catId>0) {
32
+ $category = $this->getModel()->getCategory($catId);
33
+ $collection->addCategoryFilter($category);
34
+ }
35
+
36
+ // var_dump(count($collection));
37
+ $this->setProductCollection($collection);
38
+ return parent::_beforeToHtml();
39
+ }
40
+
41
+ public function getModel() {
42
+ return Mage::getModel('mostpopular/data');
43
+ }
44
+
45
+ }
46
+
app/code/community/Ecommerceoffice/Mostpopular/Block/Page/Html/Footer.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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 license@magentocommerce.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.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Page
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ class Ecommerceoffice_Mostpopular_Block_Page_Html_Footer extends Mage_Page_Block_Html_Footer
28
+ {
29
+
30
+ public function getCopyright()
31
+ {
32
+ if (!$this->_copyright) {
33
+ $this->_copyright = '<a href="http://www.magazento.com/">Magento Templates</a> '.Mage::getStoreConfig('design/footer/copyright');
34
+ }
35
+
36
+ return $this->_copyright;
37
+
38
+ }
39
+ }
app/code/community/Ecommerceoffice/Mostpopular/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Ecommerceoffice.com
5
+ * Copyright Proskuryakov Ivan. Ecommerceoffice.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ class Ecommerceoffice_Mostpopular_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+
14
+
15
+ }
app/code/community/Ecommerceoffice/Mostpopular/Model/Data.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Created on Mar 16, 2011
4
+ * Author Ivan Proskuryakov - volgodark@gmail.com - Ecommerceoffice.com
5
+ * Copyright Proskuryakov Ivan. Ecommerceoffice.com © 2011. All Rights Reserved.
6
+ * Single Use, Limited Licence and Single Use No Resale Licence ["Single Use"]
7
+ */
8
+ ?>
9
+ <?php
10
+ Class Ecommerceoffice_Mostpopular_Model_Data {
11
+
12
+
13
+ // public function getSellDate($days) {
14
+ // $product = Mage::getModel('catalog/product');
15
+ // $product=array();
16
+ //// $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
17
+ //// $dateformat=Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
18
+ // $product['todaydate'] = date('Y-m-d H:i:s', time());
19
+ // $product['startdate'] = date('Y-m-d H:i:s', time() - 60 * 60 * 24 * $days);
20
+ // return $product;
21
+ //
22
+ // }
23
+ public function isExtensionEnabled() {
24
+ return Mage::getStoreConfig('mostpopular/options/enable');
25
+ }
26
+ public function isOutOfStock() {
27
+ return Mage::getStoreConfig('mostpopular/options/outofstock');
28
+ }
29
+ public function getTitle()
30
+ {
31
+ return Mage::getStoreConfig('mostpopular/options/blocktitle');
32
+ }
33
+ public function getNoProductsText()
34
+ {
35
+ return Mage::getStoreConfig('mostpopular/options/noproducttext');
36
+ }
37
+ public function getHomepageCatID()
38
+ {
39
+ return Mage::getStoreConfig('mostpopular/homepageoptions/homecat');
40
+ }
41
+
42
+
43
+
44
+ public function getCategory ($id){
45
+ $categoryId = $id;
46
+ if (!$categoryId || !is_numeric($categoryId))
47
+ $category = Mage::registry("current_category");
48
+ else {
49
+ $category = Mage::getModel("catalog/category")->load($categoryId);
50
+ if (!$category->getId())
51
+ $category = Mage::registry("current_category");
52
+ }
53
+ return $category;
54
+ }
55
+
56
+
57
+ public function getHomepageProductsLimit() {
58
+ $count = (int) Mage::getStoreConfig('mostpopular/homepageoptions/homecount');
59
+ if ($count <=0) $count=5;
60
+ return $count;
61
+ }
62
+ // public function getHomepageDaysLimit() {
63
+ // $count = (int) Mage::getStoreConfig('mostpopular/homepageoptions/homedays');
64
+ // if ($count <=0) $count=5;
65
+ // return $count;
66
+ // }
67
+
68
+
69
+ public function getCatProductsLimit() {
70
+ $count = (int) Mage::getStoreConfig('mostpopular/catpageoptions/catcount');
71
+ if ($count <=0) $count=5;
72
+ return $count;
73
+ }
74
+ // public function getCatDaysLimit() {
75
+ // $count = (int) Mage::getStoreConfig('mostpopular/catpageoptions/catdays');
76
+ // if ($count <=0) $count=5;
77
+ // return $count;
78
+ // }
79
+
80
+
81
+
82
+
83
+
84
+
85
+ }
app/code/community/Ecommerceoffice/Mostpopular/etc/config.xml ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Ecommerceoffice_Mostpopular>
5
+ <version>1.0.0</version>
6
+ </Ecommerceoffice_Mostpopular>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <mostpopular>
12
+ <file>ecommerceoffice_mostpopular.xml</file>
13
+ </mostpopular>
14
+ </updates>
15
+ </layout>
16
+ </frontend>
17
+
18
+ <global>
19
+ <models>
20
+ <mostpopular>
21
+ <class>Ecommerceoffice_Mostpopular_Model</class>
22
+ <resourceModel>mostpopular_mysql4</resourceModel>
23
+ </mostpopular>
24
+ <mostpopular_mysql4>
25
+ <class>Ecommerceoffice_Mostpopular_Model_Mysql4</class>
26
+ <entities>
27
+ <slide>
28
+ <table>ecommerceoffice_mostpopular_slide</table>
29
+ </slide>
30
+ <slide_category>
31
+ <table>ecommerceoffice_mostpopular_slide_category</table>
32
+ </slide_category>
33
+ <category>
34
+ <table>ecommerceoffice_mostpopular_category</table>
35
+ </category>
36
+ <category_store>
37
+ <table>ecommerceoffice_mostpopular_category_store</table>
38
+ </category_store>
39
+ </entities>
40
+ </mostpopular_mysql4>
41
+ </models>
42
+ <resources>
43
+ <mostpopular_setup>
44
+ <setup>
45
+ <module>Ecommerceoffice_Mostpopular</module>
46
+ </setup>
47
+ <connection>
48
+ <use>core_setup</use>
49
+ </connection>
50
+ </mostpopular_setup>
51
+ <mostpopular_write>
52
+ <connection>
53
+ <use>core_write</use>
54
+ </connection>
55
+ </mostpopular_write>
56
+ <mostpopular_read>
57
+ <connection>
58
+ <use>core_read</use>
59
+ </connection>
60
+ </mostpopular_read>
61
+ </resources>
62
+ <blocks>
63
+ <mostpopular>
64
+ <class>Ecommerceoffice_Mostpopular_Block</class>
65
+ </mostpopular>
66
+ <page>
67
+ <rewrite>
68
+ <html_footer>Ecommerceoffice_Mostpopular_Block_Page_Html_Footer</html_footer>
69
+ </rewrite>
70
+ </page>
71
+ </blocks>
72
+ <helpers>
73
+ <mostpopular>
74
+ <class>Ecommerceoffice_Mostpopular_Helper</class>
75
+ </mostpopular>
76
+ </helpers>
77
+ </global>
78
+ <admin>
79
+ <routers>
80
+ <ecommerceoffice_mostpopular>
81
+ <use>admin</use>
82
+ <args>
83
+ <module>Ecommerceoffice_Mostpopular</module>
84
+ <frontName>mostpopular</frontName>
85
+ </args>
86
+ </ecommerceoffice_mostpopular>
87
+ </routers>
88
+ </admin>
89
+ <adminhtml>
90
+ <acl>
91
+ <resources>
92
+ <admin>
93
+ <children>
94
+ <system>
95
+ <children>
96
+ <config>
97
+ <children>
98
+ <mostpopular translate="title" module="mostpopular">
99
+ <title>Mostpopular</title>
100
+ </mostpopular>
101
+ </children>
102
+ </config>
103
+ </children>
104
+ </system>
105
+ </children>
106
+ </admin>
107
+ </resources>
108
+ </acl>
109
+ <menu>
110
+ <ecommerceoffice translate="title" module="mostpopular">
111
+ <title>Ecommerceoffice</title>
112
+ <sort_order>65</sort_order>
113
+ <children>
114
+ <mostpopular translate="title" module="mostpopular">
115
+ <title>Mostpopular</title>
116
+ <sort_order>65</sort_order>
117
+ <children>
118
+ <settings translate="title" module="mostpopular">
119
+ <title>Settings</title>
120
+ <action>adminhtml/system_config/edit/section/mostpopular</action>
121
+ <sort_order>40</sort_order>
122
+ </settings>
123
+ </children>
124
+ </mostpopular>
125
+ </children>
126
+ </ecommerceoffice>
127
+ </menu>
128
+ </adminhtml>
129
+ <default>
130
+ <mostpopular>
131
+ <options>
132
+ <enable>1</enable>
133
+ <blocktitle>MOSTPOPULAR</blocktitle>
134
+ <noproducttext> We have zero products now</noproducttext>
135
+ <salable>1</salable>
136
+ </options>
137
+ <homepageoptions>
138
+ <homecount>10</homecount>
139
+ <homedays>365</homedays>
140
+ <homecat>0</homecat>
141
+ <homesidebarleft>1</homesidebarleft>
142
+ <homesidebarright>2</homesidebarright>
143
+ <homeactions>1</homeactions>
144
+ <homeprice>1</homeprice>
145
+ </homepageoptions>
146
+ <catpageoptions>
147
+ <catcount>5</catcount>
148
+ <catdays>365</catdays>
149
+ <catsidebarleft>1</catsidebarleft>
150
+ <catsidebarright>2</catsidebarright>
151
+ <catactions>1</catactions>
152
+ <catprice>1</catprice>
153
+ </catpageoptions>
154
+ </mostpopular>
155
+ </default>
156
+ </config>
app/code/community/Ecommerceoffice/Mostpopular/etc/system.xml ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <ecommerceoffice translate="label">
5
+ <label>Ecommerceoffice.com</label>
6
+ <sort_order>250</sort_order>
7
+ </ecommerceoffice>
8
+ </tabs>
9
+ <sections>
10
+ <mostpopular translate="label" module="mostpopular">
11
+ <label>MostPopular(MostViewed)</label>
12
+ <tab>ecommerceoffice</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>100</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
+ <options translate="label">
20
+ <label>Options</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
+ <enable translate="label">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>11</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
+ </enable>
36
+ <blocktitle translate="label">
37
+ <label>Title</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>12</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
+ </blocktitle>
44
+ <noproducttext translate="label">
45
+ <label>No product text</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>13</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </noproducttext>
52
+ <outofstock translate="label">
53
+ <label>Salable</label>
54
+ <frontend_type>select</frontend_type>
55
+ <source_model>adminhtml/system_config_source_yesno</source_model>
56
+ <comment>Display out of stock items from product collection</comment>
57
+ <sort_order>14</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </outofstock>
62
+ </fields>
63
+ </options>
64
+ <homepageoptions translate="label">
65
+ <label>Homepage</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>2</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <fields>
72
+ <homecount translate="label">
73
+ <label>Products count</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>51</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </homecount>
80
+ <!-- <homedays translate="label">
81
+ <label>Topseller for * days</label>
82
+ <frontend_type>text</frontend_type>
83
+ <sort_order>52</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </homedays>-->
88
+ <homecat translate="label">
89
+ <label>Category ID</label>
90
+ <frontend_type>text</frontend_type>
91
+ <comment>type "0" for all categories</comment>
92
+ <sort_order>53</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </homecat>
97
+ <homesidebarleft translate="label">
98
+ <label>Left Sidebar</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>adminhtml/system_config_source_yesno</source_model>
101
+ <sort_order>58</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ </homesidebarleft>
106
+ <homesidebarright translate="label">
107
+ <label>Right Sidebar</label>
108
+ <frontend_type>select</frontend_type>
109
+ <source_model>adminhtml/system_config_source_yesno</source_model>
110
+ <sort_order>59</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ </homesidebarright>
115
+ <homeprice translate="label">
116
+ <label>Display price</label>
117
+ <frontend_type>select</frontend_type>
118
+ <source_model>adminhtml/system_config_source_yesno</source_model>
119
+ <sort_order>56</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ </homeprice>
124
+ <homeactions translate="label">
125
+ <label>Display actions</label>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>adminhtml/system_config_source_yesno</source_model>
128
+ <sort_order>57</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ </homeactions>
133
+ </fields>
134
+ </homepageoptions>
135
+ <catpageoptions translate="label">
136
+ <label>Categories</label>
137
+ <frontend_type>text</frontend_type>
138
+ <sort_order>3</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ <fields>
143
+ <catcount translate="label">
144
+ <label>Products count</label>
145
+ <frontend_type>text</frontend_type>
146
+ <sort_order>61</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>1</show_in_store>
150
+ </catcount>
151
+ <!-- <catdays translate="label">
152
+ <label>Topseller for * days</label>
153
+ <frontend_type>text</frontend_type>
154
+ <sort_order>62</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ </catdays>-->
159
+ <catsidebarleft translate="label">
160
+ <label>Left Sidebar</label>
161
+ <frontend_type>select</frontend_type>
162
+ <source_model>adminhtml/system_config_source_yesno</source_model>
163
+ <sort_order>68</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ </catsidebarleft>
168
+ <catsidebarright translate="label">
169
+ <label>Right Sidebar</label>
170
+ <frontend_type>select</frontend_type>
171
+ <source_model>adminhtml/system_config_source_yesno</source_model>
172
+ <sort_order>69</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>1</show_in_store>
176
+ </catsidebarright>
177
+ <catprice translate="label">
178
+ <label>Display price</label>
179
+ <frontend_type>select</frontend_type>
180
+ <source_model>adminhtml/system_config_source_yesno</source_model>
181
+ <sort_order>65</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>1</show_in_store>
185
+ </catprice>
186
+ <catactions translate="label">
187
+ <label>Display actions</label>
188
+ <frontend_type>select</frontend_type>
189
+ <source_model>adminhtml/system_config_source_yesno</source_model>
190
+ <sort_order>66</sort_order>
191
+ <show_in_default>1</show_in_default>
192
+ <show_in_website>1</show_in_website>
193
+ <show_in_store>1</show_in_store>
194
+ </catactions>
195
+ </fields>
196
+ </catpageoptions>
197
+ </groups>
198
+ </mostpopular>
199
+ </sections>
200
+ </config>
app/design/frontend/base/default/layout/ecommerceoffice_mostpopular.xml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+
5
+ <cms_index_index>
6
+ <reference name="head">
7
+ <action method="addCss"><stylesheet>ecommerceoffice/mostpopular/style.css</stylesheet></action>
8
+ </reference>
9
+ <reference name="left">
10
+ <block type="mostpopular/home" name="mostpopular.home.left">
11
+ <action method="setTemplate">
12
+ <template>ecommerceoffice/mostpopular/home_left.phtml</template>
13
+ </action>
14
+ </block>
15
+ </reference>
16
+ <reference name="right">
17
+ <block type="mostpopular/home" name="mostpopular.home.right" >
18
+ <action method="setTemplate">
19
+ <template>ecommerceoffice/mostpopular/home_right.phtml</template>
20
+ </action>
21
+ </block>
22
+ </reference>
23
+ </cms_index_index>
24
+
25
+ <catalog_category_default>
26
+ <reference name="head">
27
+ <action method="addCss"><stylesheet>ecommerceoffice/mostpopular/style.css</stylesheet></action>
28
+ </reference>
29
+ <reference name="left">
30
+ <block type="mostpopular/category" name="mostpopular.cat.left" >
31
+ <action method="setTemplate">
32
+ <template>ecommerceoffice/mostpopular/category_left.phtml</template>
33
+ </action>
34
+ </block>
35
+ </reference>
36
+ <reference name="right">
37
+ <block type="mostpopular/category" name="mostpopular.cat.right" >
38
+ <action method="setTemplate">
39
+ <template>ecommerceoffice/mostpopular/category_right.phtml</template>
40
+ </action>
41
+ </block>
42
+ </reference>
43
+ </catalog_category_default>
44
+
45
+ <catalog_category_layered>
46
+ <reference name="head">
47
+ <action method="addCss"><stylesheet>ecommerceoffice/mostpopular/style.css</stylesheet></action>
48
+ </reference>
49
+ <reference name="left">
50
+ <block type="mostpopular/category" name="mostpopular.cat.left" >
51
+ <action method="setTemplate">
52
+ <template>ecommerceoffice/mostpopular/category_left.phtml</template>
53
+ </action>
54
+ </block>
55
+ </reference>
56
+ <reference name="right">
57
+ <block type="mostpopular/category" name="mostpopular.cat.right" >
58
+ <action method="setTemplate">
59
+ <template>ecommerceoffice/mostpopular/category_right.phtml</template>
60
+ </action>
61
+ </block>
62
+ </reference>
63
+ </catalog_category_layered>
64
+
65
+
66
+ </layout>
67
+
app/design/frontend/base/default/template/ecommerceoffice/mostpopular/category_left.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ((Mage::getStoreConfig('mostpopular/options/enable')) && (Mage::getStoreConfig('mostpopular/catpageoptions/catsidebarleft'))):?>
2
+
3
+ <div class="block block-mostpopular">
4
+ <div class="block-title title-topseller">
5
+ <span><?php echo $this->getModel()->getTitle() ?></span>
6
+ </div>
7
+ <div class="block-content">
8
+ <?php $_products = $this->getProductCollection(); ?>
9
+ <?php if (sizeof($_products)): ?>
10
+ <ol class="mini-products-list" id="bestseller-sidebar">
11
+ <?php $i=0; foreach ($_products->getItems() as $_product): ?>
12
+ <?php $i++; ?>
13
+ <?php if ($_product->getData('is_salable')): ?>
14
+ <li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
15
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
16
+ <div class="product-details">
17
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
18
+ <?php if (Mage::getStoreConfig('mostpopular/catpageoptions/catprice')):?>
19
+ <?php echo $this->getPriceHtml($_product, true) ?>
20
+ <?php endif; ?>
21
+ <?php if (Mage::getStoreConfig('mostpopular/catpageoptions/catactions')):?>
22
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
23
+ <?php endif; ?>
24
+ </div>
25
+ </li>
26
+ <?php else: ?>
27
+ <?php if($this->getModel()->isOutOfStock()): ?>
28
+ <li class="item">
29
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
30
+ <div class="product-details">
31
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
32
+ <?php if (Mage::getStoreConfig('mostpopular/catpageoptions/catprice')):?>
33
+ <?php echo $this->getPriceHtml($_product, true) ?>
34
+ <?php endif; ?>
35
+ <p class="availability out-of-stock"><span>Out of stock</span></p>
36
+ </div>
37
+ </li>
38
+ <?php endif; ?>
39
+
40
+ <?php endif; ?>
41
+ <?php endforeach; ?>
42
+ </ol>
43
+
44
+ <?php else: ?>
45
+ <ol id="bestseller-sidebar" class="mini-products-list">
46
+ <li class="item odd">
47
+ <?php echo $this->getModel()->getNoProductsText(); ?>
48
+ </li>
49
+ </ol>
50
+ <?php endif; ?>
51
+ </div>
52
+ </div>
53
+
54
+
55
+
56
+ <?php endif; ?>
app/design/frontend/base/default/template/ecommerceoffice/mostpopular/category_right.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ((Mage::getStoreConfig('mostpopular/options/enable')) && (Mage::getStoreConfig('mostpopular/catpageoptions/catsidebarright'))):?>
2
+
3
+ <div class="block block-mostpopular">
4
+ <div class="block-title title-topseller">
5
+ <span><?php echo $this->getModel()->getTitle() ?></span>
6
+ </div>
7
+ <div class="block-content">
8
+ <?php $_products = $this->getProductCollection(); ?>
9
+ <?php if (sizeof($_products)): ?>
10
+ <ol class="mini-products-list" id="bestseller-sidebar">
11
+ <?php $i=0; foreach ($_products->getItems() as $_product): ?>
12
+ <?php $i++; ?>
13
+ <?php if ($_product->getData('is_salable')): ?>
14
+ <li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
15
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
16
+ <div class="product-details">
17
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
18
+ <?php if (Mage::getStoreConfig('mostpopular/catpageoptions/catprice')):?>
19
+ <?php echo $this->getPriceHtml($_product, true) ?>
20
+ <?php endif; ?>
21
+ <?php if (Mage::getStoreConfig('mostpopular/catpageoptions/catactions')):?>
22
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
23
+ <?php endif; ?>
24
+ </div>
25
+ </li>
26
+ <?php else: ?>
27
+ <?php if($this->getModel()->isOutOfStock()): ?>
28
+ <li class="item">
29
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
30
+ <div class="product-details">
31
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
32
+ <?php if (Mage::getStoreConfig('mostpopular/catpageoptions/catprice')):?>
33
+ <?php echo $this->getPriceHtml($_product, true) ?>
34
+ <?php endif; ?>
35
+ <p class="availability out-of-stock"><span>Out of stock</span></p>
36
+ </div>
37
+ </li>
38
+ <?php endif; ?>
39
+
40
+ <?php endif; ?>
41
+ <?php endforeach; ?>
42
+ </ol>
43
+
44
+ <?php else: ?>
45
+ <ol id="bestseller-sidebar" class="mini-products-list">
46
+ <li class="item odd">
47
+ <?php echo $this->getModel()->getNoProductsText(); ?>
48
+ </li>
49
+ </ol>
50
+ <?php endif; ?>
51
+ </div>
52
+ </div>
53
+
54
+
55
+
56
+ <?php endif; ?>
app/design/frontend/base/default/template/ecommerceoffice/mostpopular/home_left.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ((Mage::getStoreConfig('mostpopular/options/enable')) && (Mage::getStoreConfig('mostpopular/homepageoptions/homesidebarleft'))):?>
2
+
3
+ <div class="block block-mostpopular">
4
+ <div class="block-title title-topseller">
5
+ <span><?php echo $this->getModel()->getTitle() ?></span>
6
+ </div>
7
+ <div class="block-content">
8
+ <?php $_products = $this->getProductCollection(); ?>
9
+ <?php if (sizeof($_products)): ?>
10
+ <ol class="mini-products-list" id="bestseller-sidebar">
11
+ <?php $i=0; foreach ($_products->getItems() as $_product): ?>
12
+ <?php $i++; ?>
13
+ <?php if ($_product->getData('is_salable')): ?>
14
+ <li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
15
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
16
+ <div class="product-details">
17
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
18
+ <?php if (Mage::getStoreConfig('mostpopular/homepageoptions/homeprice')):?>
19
+ <?php echo $this->getPriceHtml($_product, true) ?>
20
+ <?php endif; ?>
21
+ <?php if (Mage::getStoreConfig('mostpopular/homepageoptions/homeactions')):?>
22
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
23
+ <?php endif; ?>
24
+ </div>
25
+ </li>
26
+ <?php else: ?>
27
+ <?php if($this->getModel()->isOutOfStock()): ?>
28
+ <li class="item">
29
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
30
+ <div class="product-details">
31
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
32
+ <?php if (Mage::getStoreConfig('mostpopular/homepageoptions/homeprice')):?>
33
+ <?php echo $this->getPriceHtml($_product, true) ?>
34
+ <?php endif; ?>
35
+ <p class="availability out-of-stock"><span>Out of stock</span></p>
36
+ </div>
37
+ </li>
38
+ <?php endif; ?>
39
+
40
+ <?php endif; ?>
41
+ <?php endforeach; ?>
42
+ </ol>
43
+
44
+ <?php else: ?>
45
+ <ol id="bestseller-sidebar" class="mini-products-list">
46
+ <li class="item odd">
47
+ <?php echo $this->getModel()->getNoProductsText(); ?>
48
+ </li>
49
+ </ol>
50
+ <?php endif; ?>
51
+ </div>
52
+ </div>
53
+
54
+
55
+
56
+ <?php endif; ?>
app/design/frontend/base/default/template/ecommerceoffice/mostpopular/home_right.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ((Mage::getStoreConfig('mostpopular/options/enable')) && (Mage::getStoreConfig('mostpopular/homepageoptions/homesidebarright'))):?>
2
+
3
+ <div class="block block-mostpopular">
4
+ <div class="block-title title-topseller">
5
+ <span><?php echo $this->getModel()->getTitle() ?></span>
6
+ </div>
7
+ <div class="block-content">
8
+ <?php $_products = $this->getProductCollection(); ?>
9
+ <?php if (sizeof($_products)): ?>
10
+ <ol class="mini-products-list" id="bestseller-sidebar">
11
+ <?php $i=0; foreach ($_products->getItems() as $_product): ?>
12
+ <?php $i++; ?>
13
+ <?php if ($_product->getData('is_salable')): ?>
14
+ <li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
15
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
16
+ <div class="product-details">
17
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
18
+ <?php if (Mage::getStoreConfig('mostpopular/homepageoptions/homeprice')):?>
19
+ <?php echo $this->getPriceHtml($_product, true) ?>
20
+ <?php endif; ?>
21
+ <?php if (Mage::getStoreConfig('mostpopular/homepageoptions/homeactions')):?>
22
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
23
+ <?php endif; ?>
24
+ </div>
25
+ </li>
26
+ <?php else: ?>
27
+ <?php if($this->getModel()->isOutOfStock()): ?>
28
+ <li class="item">
29
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="" /></a>
30
+ <div class="product-details">
31
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
32
+ <?php if (Mage::getStoreConfig('mostpopular/homepageoptions/homeprice')):?>
33
+ <?php echo $this->getPriceHtml($_product, true) ?>
34
+ <?php endif; ?>
35
+ <p class="availability out-of-stock"><span>Out of stock</span></p>
36
+ </div>
37
+ </li>
38
+ <?php endif; ?>
39
+
40
+ <?php endif; ?>
41
+ <?php endforeach; ?>
42
+ </ol>
43
+
44
+ <?php else: ?>
45
+ <ol id="bestseller-sidebar" class="mini-products-list">
46
+ <li class="item odd">
47
+ <?php echo $this->getModel()->getNoProductsText(); ?>
48
+ </li>
49
+ </ol>
50
+ <?php endif; ?>
51
+ </div>
52
+ </div>
53
+
54
+ <?php endif; ?>
app/etc/modules/Ecommerceoffice_Mostpopular.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ecommerceoffice_Mostpopular>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Ecommerceoffice_Mostpopular>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ecommerceoffice_mostpopular</name>
4
+ <version>1.0.3</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Mostpopular (most viewed) products for your store</summary>
10
+ <description>Magento module generates the list of your online store's most popular selling products and displays it in sidebars. Extension allows you fully configure your most popular on your store and of course this extension fully configurable at backend.&#xD;
11
+ </description>
12
+ <notes>1.0.3</notes>
13
+ <authors><author><name>volgodark</name><user>volgodark</user><email>volgodark@gmail.com</email></author></authors>
14
+ <date>2013-11-24</date>
15
+ <time>10:59:02</time>
16
+ <contents><target name="magecommunity"><dir name="Ecommerceoffice"><dir name="Mostpopular"><dir name="Block"><file name="Category.php" hash="18bbd5fb6461abf810ad007886475da2"/><file name="Home.php" hash="5dbbc6b26026d50090a77cf6ef293a5c"/><dir name="Page"><dir name="Html"><file name="Footer.php" hash="7a90525373e8c3359ea4bd92a95d84e5"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ed9c5ab9db52bece9e7e56f7c90c7fc4"/></dir><dir name="Model"><file name="Data.php" hash="d45989d47cba1ec9aad7fd9655018fc7"/></dir><dir name="etc"><file name="config.xml" hash="1fde20800801b0032ea8a98b8815906f"/><file name="system.xml" hash="aed2402862f98c88d4c59711618784ef"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="ecommerceoffice"><dir name="mostpopular"><file name="category_left.phtml" hash="4356850a1008afc77461d7a4a227ee34"/><file name="category_right.phtml" hash="9300debb13101c3ee1f01c4b152a24d1"/><file name="home_left.phtml" hash="7a6671bc0e33fc1830f674bad68beb96"/><file name="home_right.phtml" hash="a13026be00a88fe0a099e94de62daa0c"/></dir></dir></dir><dir name="layout"><file name="ecommerceoffice_mostpopular.xml" hash="05e165e9eb6531e7129574a8d081ef23"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ecommerceoffice_Mostpopular.xml" hash="f2e97bf71f34bc9b001edc868e234caf"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
19
+ </package>