Easy_Topsellers - Version 1.0.0

Version Notes

Easy_Topsellers

Download this release

Release Info

Developer Magento Core Team
Extension Easy_Topsellers
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Magazento/Easytopsell/Block/Category.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magazento_Easytopsell_Block_Category extends Mage_Catalog_Block_Product_Abstract {
4
+
5
+
6
+ protected function _construct() {
7
+ parent::_construct();
8
+ $this->addData(array(
9
+ 'cache_lifetime' => 86400,
10
+ 'cache_tags' => array('magazentoeasytopsell_category'),
11
+ ));
12
+
13
+ }
14
+ protected function _beforeToHtml() {
15
+
16
+ $storeId = Mage::app()->getStore()->getId();
17
+ $sellDate=$this->getModel()->getSellDate($this->getModel()->getCatDaysLimit());
18
+ $collection = Mage::getResourceModel('reports/product_sold_collection')
19
+ ->addOrderedQty()
20
+ ->setStoreId($storeId)
21
+ ->addStoreFilter($storeId)
22
+ ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
23
+ ->addUrlRewrite()
24
+ ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
25
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
26
+ ->setOrder('ordered_qty', 'desc')
27
+ ->setPageSize($this->getModel()->getCatProductsLimit())
28
+ ->setCurPage(1)
29
+ ->setOrder('ordered_qty', 'desc');
30
+
31
+
32
+
33
+ $c = Mage::registry("current_category");
34
+ $catId = $c->getData('entity_id');
35
+ if ($catId>0) {
36
+ $category = $this->getModel()->getCategory($catId);
37
+ $collection->addCategoryFilter($category);
38
+ }
39
+
40
+
41
+ $this->setProductCollection($collection);
42
+ return parent::_beforeToHtml();
43
+ }
44
+
45
+ public function getModel() {
46
+ return Mage::getModel('easytopsell/data');
47
+ }
48
+
49
+ }
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+ // ->setDateRange($sellDate['startdate'], $sellDate['todaydate'])
65
+ // ->addAttributeToFilter('is_salable')
66
+ // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
67
+ // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
68
+ // ->addSaleableFilterToCollection()
69
+ // ->addInStockFilterToCollection()
70
+ // ->addUrlRewrite()
71
+ //// ->addCategoryFilter($currentCategory)
72
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
73
+ // ->setCurPage(1)
74
+ // ->addOrderedQty()
75
+ // ->setOrder('ordered_qty', 'desc');
76
+ //
77
+
78
+ // ->addAttributeToSelect(array('entity_id', 'name', 'price', 'small_image', 'short_description', 'description', 'type_id', 'status'))
79
+ // ->addOrderedQty()
80
+ // ->setStoreId($storeId)
81
+ // ->addStoreFilter($storeId)
82
+ //// ->addCategoryFilter($currentCategory)
83
+ // ->setOrder('ordered_qty', 'desc')
84
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
85
+ // ->setCurPage(1);
86
+ //
87
+ // $collection= array();
88
+ // foreach ($rawcollection as $product) {
89
+ //// $addproduct = $product->getData('is_salable');
90
+ // $collection[]=$product->getData();
91
+ // }
92
+ // var_dump($rawcollection);
93
+ ////
94
+ //
95
+ // exit();
app/code/community/Magazento/Easytopsell/Block/Home.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magazento_Easytopsell_Block_Home extends Mage_Catalog_Block_Product_Abstract {
4
+
5
+
6
+ protected function _construct() {
7
+ parent::_construct();
8
+ $this->addData(array(
9
+ 'cache_lifetime' => 86400,
10
+ 'cache_tags' => array('magazentoeasytopsell_home'),
11
+ ));
12
+
13
+ }
14
+ protected function _beforeToHtml() {
15
+
16
+ $storeId = Mage::app()->getStore()->getId();
17
+ $sellDate=$this->getModel()->getSellDate($this->getModel()->getHomepageDaysLimit());
18
+ $collection = Mage::getResourceModel('reports/product_sold_collection')
19
+ ->addOrderedQty()
20
+ ->setStoreId($storeId)
21
+ ->addStoreFilter($storeId)
22
+ ->setDateRange($sellDate['startdate'], $sellDate['todaydate']) //
23
+ ->addUrlRewrite()
24
+ ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
25
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
26
+ ->setOrder('ordered_qty', 'desc')
27
+ ->setPageSize($this->getModel()->getHomepageProductsLimit())
28
+ ->setCurPage(1)
29
+ ->setOrder('ordered_qty', 'desc');
30
+
31
+ $catId=$this->getModel()->getHomepageCatID();
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
+ public function getModel() {
43
+ return Mage::getModel('easytopsell/Data');
44
+ }
45
+
46
+ }
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+ // ->setDateRange($sellDate['startdate'], $sellDate['todaydate'])
62
+ // ->addAttributeToFilter('is_salable')
63
+ // ->addAttributeToFilter('visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)))
64
+ // ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
65
+ // ->addSaleableFilterToCollection()
66
+ // ->addInStockFilterToCollection()
67
+ // ->addUrlRewrite()
68
+ //// ->addCategoryFilter($currentCategory)
69
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
70
+ // ->setCurPage(1)
71
+ // ->addOrderedQty()
72
+ // ->setOrder('ordered_qty', 'desc');
73
+ //
74
+
75
+ // ->addAttributeToSelect(array('entity_id', 'name', 'price', 'small_image', 'short_description', 'description', 'type_id', 'status'))
76
+ // ->addOrderedQty()
77
+ // ->setStoreId($storeId)
78
+ // ->addStoreFilter($storeId)
79
+ //// ->addCategoryFilter($currentCategory)
80
+ // ->setOrder('ordered_qty', 'desc')
81
+ // ->setPageSize($this->getModel()->getHomepageProductsLimit())
82
+ // ->setCurPage(1);
83
+ //
84
+ // $collection= array();
85
+ // foreach ($rawcollection as $product) {
86
+ //// $addproduct = $product->getData('is_salable');
87
+ // $collection[]=$product->getData();
88
+ // }
89
+ // var_dump($rawcollection);
90
+ ////
91
+ //
92
+ // exit();
app/code/community/Magazento/Easytopsell/Block/Info.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magazento_Easytopsell_Block_Info extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
4
+
5
+ public function render(Varien_Data_Form_Element_Abstract $element) {
6
+ $html = $this->_getHeaderHtml($element);
7
+ $html.= $this->_getFieldHtml($element);
8
+ $html .= $this->_getFooterHtml($element);
9
+ return $html;
10
+ }
11
+
12
+ protected function _getFieldHtml($fieldset) {
13
+ $content = 'This extension is developed by <a href="http://Magazento.com/" target="_blank">Magazento.com</a><br/>';
14
+ $content.= 'Magento Store Setup, modules, data migration, templates, upgrades and much more!';
15
+ return $content;
16
+ }
17
+
18
+
19
+ }
app/code/community/Magazento/Easytopsell/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magazento_Easytopsell_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+
7
+ }
app/code/community/Magazento/Easytopsell/Model/Data.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ Class Magazento_Easytopsell_Model_Data {
3
+
4
+
5
+ public function getSellDate($days) {
6
+ $product = Mage::getModel('catalog/product');
7
+ $product=array();
8
+ // $dateformat=Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
9
+ $product['todaydate'] = date('Y-m-d H:i:s', time());
10
+ $product['startdate'] = date('Y-m-d H:i:s', time() - 60 * 60 * 24 * $days);
11
+ return $product;
12
+
13
+ }
14
+ public function isExtensionEnabled() {
15
+ return Mage::getStoreConfig('easytopsell/options/enable');
16
+ }
17
+ public function isOutOfStock() {
18
+ return Mage::getStoreConfig('easytopsell/options/outofstock');
19
+ }
20
+ public function getTitle()
21
+ {
22
+ return Mage::getStoreConfig('easytopsell/options/blocktitle');
23
+ }
24
+ public function getNoProductsText()
25
+ {
26
+ return Mage::getStoreConfig('easytopsell/options/noproducttext');
27
+ }
28
+ public function getHomepageCatID()
29
+ {
30
+ return Mage::getStoreConfig('easytopsell/homepageoptions/homecat');
31
+ }
32
+
33
+
34
+
35
+ public function getCategory ($id){
36
+ $categoryId = $id;
37
+ if (!$categoryId || !is_numeric($categoryId))
38
+ $category = Mage::registry("current_category");
39
+ else {
40
+ $category = Mage::getModel("catalog/category")->load($categoryId);
41
+ if (!$category->getId())
42
+ $category = Mage::registry("current_category");
43
+ }
44
+ return $category;
45
+ }
46
+
47
+
48
+ public function getHomepageProductsLimit() {
49
+ $count = (int) Mage::getStoreConfig('easytopsell/homepageoptions/homecount');
50
+ if ($count <=0) $count=5;
51
+ return $count;
52
+ }
53
+ public function getHomepageDaysLimit() {
54
+ $count = (int) Mage::getStoreConfig('easytopsell/homepageoptions/homedays');
55
+ if ($count <=0) $count=5;
56
+ return $count;
57
+ }
58
+
59
+
60
+ public function getCatProductsLimit() {
61
+ $count = (int) Mage::getStoreConfig('easytopsell/catpageoptions/catcount');
62
+ if ($count <=0) $count=5;
63
+ return $count;
64
+ }
65
+ public function getCatDaysLimit() {
66
+ $count = (int) Mage::getStoreConfig('easytopsell/catpageoptions/catdays');
67
+ if ($count <=0) $count=5;
68
+ return $count;
69
+ }
70
+
71
+
72
+
73
+
74
+
75
+
76
+ }
app/code/community/Magazento/Easytopsell/etc/config.xml ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Easytopsell>
5
+ <version>1.0.0</version>
6
+ </Magazento_Easytopsell>
7
+ </modules>
8
+ <frontend>
9
+ <layout>
10
+ <updates>
11
+ <easytopsell>
12
+ <file>magazento_easytopsell.xml</file>
13
+ </easytopsell>
14
+ </updates>
15
+ </layout>
16
+ <translate>
17
+ <modules>
18
+ <Magazento_Easytopsell>
19
+ <files>
20
+ <default>Magazento_Easytopsell.csv</default>
21
+ </files>
22
+ </Magazento_Easytopsell>
23
+ </modules>
24
+ </translate>
25
+ </frontend>
26
+
27
+ <global>
28
+ <models>
29
+ <easytopsell>
30
+ <class>Magazento_Easytopsell_Model</class>
31
+ <resourceModel>easytopsell_mysql4</resourceModel>
32
+ </easytopsell>
33
+ <easytopsell_mysql4>
34
+ <class>Magazento_Easytopsell_Model_Mysql4</class>
35
+ <entities>
36
+ <slide>
37
+ <table>magazento_easytopsell_slide</table>
38
+ </slide>
39
+ <slide_category>
40
+ <table>magazento_easytopsell_slide_category</table>
41
+ </slide_category>
42
+ <category>
43
+ <table>magazento_easytopsell_category</table>
44
+ </category>
45
+ <category_store>
46
+ <table>magazento_easytopsell_category_store</table>
47
+ </category_store>
48
+ </entities>
49
+ </easytopsell_mysql4>
50
+ </models>
51
+ <resources>
52
+ <easytopsell_setup>
53
+ <setup>
54
+ <module>Magazento_Easytopsell</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </easytopsell_setup>
60
+ <easytopsell_write>
61
+ <connection>
62
+ <use>core_write</use>
63
+ </connection>
64
+ </easytopsell_write>
65
+ <easytopsell_read>
66
+ <connection>
67
+ <use>core_read</use>
68
+ </connection>
69
+ </easytopsell_read>
70
+ </resources>
71
+ <blocks>
72
+ <easytopsell>
73
+ <class>Magazento_Easytopsell_Block</class>
74
+ </easytopsell>
75
+ </blocks>
76
+ <helpers>
77
+ <easytopsell>
78
+ <class>Magazento_Easytopsell_Helper</class>
79
+ </easytopsell>
80
+ </helpers>
81
+ </global>
82
+ <admin>
83
+ <routers>
84
+ <magazento_easytopsell>
85
+ <use>admin</use>
86
+ <args>
87
+ <module>Magazento_Easytopsell</module>
88
+ <frontName>easytopsell</frontName>
89
+ </args>
90
+ </magazento_easytopsell>
91
+ </routers>
92
+ </admin>
93
+ <adminhtml>
94
+ <acl>
95
+ <resources>
96
+ <admin>
97
+ <children>
98
+ <system>
99
+ <children>
100
+ <config>
101
+ <children>
102
+ <easytopsell translate="title" module="easytopsell">
103
+ <title>Easytopsell</title>
104
+ </easytopsell>
105
+ </children>
106
+ </config>
107
+ </children>
108
+ </system>
109
+ </children>
110
+ </admin>
111
+ </resources>
112
+ </acl>
113
+ <menu>
114
+ <magazento translate="title" module="easytopsell">
115
+ <title>Magazento</title>
116
+ <sort_order>65</sort_order>
117
+ <children>
118
+ <easytopsell translate="title" module="easytopsell">
119
+ <title>Easytopsell</title>
120
+ <sort_order>65</sort_order>
121
+ <children>
122
+ <settings translate="title" module="easytopsell">
123
+ <title>Settings</title>
124
+ <action>adminhtml/system_config/edit/section/easytopsell</action>
125
+ <sort_order>40</sort_order>
126
+ </settings>
127
+ </children>
128
+ </easytopsell>
129
+ </children>
130
+ </magazento>
131
+ </menu>
132
+ </adminhtml>
133
+ <default>
134
+ <easytopsell>
135
+ <options>
136
+ <enable>1</enable>
137
+ <blocktitle>TOPSELLERS</blocktitle>
138
+ <noproducttext>be first... </noproducttext>
139
+ <salable>1</salable>
140
+ </options>
141
+ <homepageoptions>
142
+ <homecount>10</homecount>
143
+ <homedays>365</homedays>
144
+ <homecat>0</homecat>
145
+ <homesidebarleft>1</homesidebarleft>
146
+ <homesidebarright>2</homesidebarright>
147
+ <homeactions>1</homeactions>
148
+ <homeprice>1</homeprice>
149
+ </homepageoptions>
150
+ <catpageoptions>
151
+ <catcount>5</catcount>
152
+ <catdays>365</catdays>
153
+ <catsidebarleft>1</catsidebarleft>
154
+ <catsidebarright>2</catsidebarright>
155
+ <catactions>1</catactions>
156
+ <catprice>1</catprice>
157
+ </catpageoptions>
158
+ </easytopsell>
159
+ </default>
160
+ </config>
app/code/community/Magazento/Easytopsell/etc/system.xml ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magazento translate="label">
5
+ <label>Magazento.com</label>
6
+ <sort_order>250</sort_order>
7
+ </magazento>
8
+ </tabs>
9
+ <sections>
10
+ <easytopsell translate="label" module="easytopsell">
11
+ <label>EasyTopsell</label>
12
+ <tab>magazento</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
+ <info translate="label">
198
+ <label>About</label>
199
+ <frontend_type>text</frontend_type>
200
+ <frontend_model>easytopsell/info</frontend_model>
201
+ <sort_order>70</sort_order>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>1</show_in_website>
204
+ <show_in_store>1</show_in_store>
205
+ </info>
206
+ </groups>
207
+ </easytopsell>
208
+ </sections>
209
+ </config>
app/design/frontend/default/default/layout/magazento_easytopsell.xml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>magazento/easytopseller/style.css</stylesheet></action>
8
+ </reference>
9
+ <reference name="left">
10
+ <block type="easytopsell/home" name="easytopsell.home">
11
+ <action method="setTemplate" ifconfig="easytopsell/homepageoptions/homesidebarleft">
12
+ <template>magazento/easytopsell/home.phtml</template>
13
+ </action>
14
+ </block>
15
+ </reference>
16
+ <reference name="right">
17
+ <block type="easytopsell/home" name="easytopsell.home" >
18
+ <action method="setTemplate" ifconfig="easytopsell/homepageoptions/homesidebarright">
19
+ <template>magazento/easytopsell/home.phtml</template>
20
+ </action>
21
+ </block>
22
+ </reference>
23
+ </cms_index_index>
24
+
25
+ <catalog_category_default>
26
+ <reference name="left">
27
+ <block type="easytopsell/category" name="easytopsell.cat" >
28
+ <action method="setTemplate" ifconfig="easytopsell/catpageoptions/catsidebarleft">
29
+ <template>magazento/easytopsell/category.phtml</template>
30
+ </action>
31
+ </block>
32
+ </reference>
33
+ <reference name="right">
34
+ <block type="easytopsell/category" name="easytopsell.cat" >
35
+ <action method="setTemplate" ifconfig="easytopsell/catpageoptions/catsidebarright">
36
+ <template>magazento/easytopsell/category.phtml</template>
37
+ </action>
38
+ </block>
39
+ </reference>
40
+ </catalog_category_default>
41
+
42
+ <catalog_category_layered>
43
+ <reference name="left">
44
+ <block type="easytopsell/category" name="easytopsell.cat" >
45
+ <action method="setTemplate" ifconfig="easytopsell/catpageoptions/catsidebarleft">
46
+ <template>magazento/easytopsell/category.phtml</template>
47
+ </action>
48
+ </block>
49
+ </reference>
50
+ <reference name="right">
51
+ <block type="easytopsell/category" name="easytopsell.cat" >
52
+ <action method="setTemplate" ifconfig="easytopsell/catpageoptions/catsidebarright">
53
+ <template>magazento/easytopsell/category.phtml</template>
54
+ </action>
55
+ </block>
56
+ </reference>
57
+ </catalog_category_layered>
58
+
59
+
60
+
61
+
62
+ </layout>
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <!-- <catalog_category_default>
75
+ <reference name="left">
76
+ <block type="easytopsell/home" name="left.easytopsell" as="easytopsell" >
77
+ <action method="setTemplate" ifconfig="easytopsell/catpageoptions/catsidebarleft">
78
+ <template>magazento/easytopsell/category.phtml</template>
79
+ </action>
80
+ </block>
81
+ </reference>
82
+ <reference name="right">
83
+ <block type="easytopsell/category" name="right.easytopsell" as="easytopsell" >
84
+ <action method="setTemplate" ifconfig="easytopsell/catpageoptions/catsidebarright">
85
+ <template>magazento/easytopsell/category.phtml</template>
86
+ </action>
87
+ </block>
88
+ </reference>
89
+ </catalog_category_default>-->
app/design/frontend/default/default/template/magazento/easytopsell/category.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (Mage::getStoreConfig('easytopsell/options/enable')):?>
2
+
3
+
4
+ <div class="block block-topseller">
5
+ <div class="block-title title-topseller">
6
+ <?php echo $this->getModel()->getTitle() ?>
7
+ </div>
8
+ <div class="block-content">
9
+ <?php $_products = $this->getProductCollection(); ?>
10
+ <?php if ($_products): ?>
11
+ <ol class="mini-products-list" id="bestseller-sidebar">
12
+ <?php $i=0; foreach ($_products->getItems() as $_product): ?>
13
+ <?php $i++; ?>
14
+ <?php if ($_product->getData('is_salable')): ?>
15
+ <li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
16
+ <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>
17
+ <div class="product-details">
18
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
19
+ <?php if (Mage::getStoreConfig('easytopsell/catpageoptions/catprice')):?>
20
+ <?php echo $this->getPriceHtml($_product, true) ?>
21
+ <?php endif; ?>
22
+ <?php if (Mage::getStoreConfig('easytopsell/catpageoptions/catactions')):?>
23
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
24
+ <?php endif; ?>
25
+ </div>
26
+ </li>
27
+ <?php else: ?>
28
+ <?php if($this->getModel()->isOutOfStock()): ?>
29
+ <li class="item">
30
+ <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>
31
+ <div class="product-details">
32
+ <p class="product-name"><a href="<?php echo $this->getProductUrl($_product) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></p>
33
+ <?php if (Mage::getStoreConfig('easytopsell/catpageoptions/catprice')):?>
34
+ <?php echo $this->getPriceHtml($_product, true) ?>
35
+ <?php endif; ?>
36
+ <?php if (Mage::getStoreConfig('easytopsell/catpageoptions/catactions')):?>
37
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
38
+ <?php endif; ?>
39
+ </div>
40
+ </li>
41
+ <?php endif; ?>
42
+
43
+ <?php endif; ?>
44
+ <?php endforeach; ?>
45
+ </ol>
46
+
47
+ <?php else: ?>
48
+ <?php echo $this->getModel()->getNoProductsText(); ?>
49
+ <?php endif; ?>
50
+ </div>
51
+ </div>
52
+
53
+
54
+
55
+ <?php endif; ?>
app/design/frontend/default/default/template/magazento/easytopsell/home.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (Mage::getStoreConfig('easytopsell/options/enable')):?>
2
+
3
+ <div class="block block-topseller">
4
+ <div class="block-title title-topseller">
5
+ <?php echo $this->getModel()->getTitle() ?>
6
+ </div>
7
+ <div class="block-content">
8
+ <?php $_products = $this->getProductCollection(); ?>
9
+ <?php if ($_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('easytopsell/homepageoptions/homeprice')):?>
19
+ <?php echo $this->getPriceHtml($_product, true) ?>
20
+ <?php endif; ?>
21
+ <?php if (Mage::getStoreConfig('easytopsell/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('easytopsell/homepageoptions/homeprice')):?>
33
+ <?php echo $this->getPriceHtml($_product, true) ?>
34
+ <?php endif; ?>
35
+ <?php if (Mage::getStoreConfig('easytopsell/homepageoptions/homeactions')):?>
36
+ <a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
37
+ <?php endif; ?>
38
+ </div>
39
+ </li>
40
+ <?php endif; ?>
41
+
42
+ <?php endif; ?>
43
+ <?php endforeach; ?>
44
+ </ol>
45
+
46
+ <?php else: ?>
47
+ <?php echo $this->getModel()->getNoProductsText(); ?>
48
+ <?php endif; ?>
49
+ </div>
50
+ </div>
51
+
52
+
53
+
54
+ <?php endif; ?>
app/etc/modules/Magazento_Easytopsell.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magazento_Easytopsell>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magazento_Easytopsell>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magazento_Easytopsell.csv ADDED
File without changes
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Easy_Topsellers</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Easy_Topsellers</summary>
10
+ <description>Easy_Topsellers</description>
11
+ <notes>Easy_Topsellers</notes>
12
+ <authors><author><name>volgodark</name><user>auto-converted</user><email>volgodark@gmail.com</email></author></authors>
13
+ <date>2011-03-10</date>
14
+ <time>20:58:50</time>
15
+ <contents><target name="magelocale"><dir name="en_US"><file name="Magazento_Easytopsell.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="magazento_easytopsell.xml" hash="7f652db292d6564402fbe0c640041944"/></dir><dir name="template"><dir name="magazento"><dir name="easytopsell"><file name="category.phtml" hash="e6360d9c1b3e156d4bbc220c80956254"/><file name="home.phtml" hash="b0a41ed9fd4a941a8203e772d1681ccb"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="magazento"><dir name="easytopseller"><file name="style.css" hash="3d08de88cf731f45a66ea8fc6af5878e"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Magazento"><dir name="Easytopsell"><dir name="Block"><file name="Category.php" hash="5c0ea500fabbdd343435c2a2b6f8a85d"/><file name="Home.php" hash="e5c84d5f6c517459a5a7a3e1b0438295"/><file name="Info.php" hash="307e4b291bedbff98e92f49fa4f81b5e"/></dir><dir name="etc"><file name="config.xml" hash="1412aeb027d53e1d5e8ca566d1b1d34f"/><file name="system.xml" hash="ef106af954194674fbb31a4f058573e7"/></dir><dir name="Helper"><file name="Data.php" hash="7b08dbc1645274f7deafc996dc3677a9"/></dir><dir name="Model"><file name="Data.php" hash="d3b4429060b070432be858a98075a0cb"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magazento_Easytopsell.xml" hash="bcf1d8c496a3d7759a347cc782e934c6"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/frontend/default/default/magazento/easytopseller/style.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ .block-topseller { font-size: 11px; line-height: 1.25; }
2
+ .block-topseller .title-topseller {
3
+ background-position: 0 0;
4
+ background-repeat: no-repeat;
5
+ padding-left: 10px;
6
+ line-height: 1.7;
7
+ font-weight: bold;
8
+ }