Magebuzz_Featuredproducts - Version 0.1.0

Version Notes

Magebuzz extension

Download this release

Release Info

Developer Magebuzz
Extension Magebuzz_Featuredproducts
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (24) hide show
  1. app/code/community/Magebuzz/Featuredproducts/Block/Adminhtml/Featuredproducts/Grid.php +287 -0
  2. app/code/community/Magebuzz/Featuredproducts/Block/Adminhtml/Grid.php +17 -0
  3. app/code/community/Magebuzz/Featuredproducts/Block/Featuredproducts.php +34 -0
  4. app/code/community/Magebuzz/Featuredproducts/Block/Product/List.php +18 -0
  5. app/code/community/Magebuzz/Featuredproducts/Block/Product/List/Categorypage.php +30 -0
  6. app/code/community/Magebuzz/Featuredproducts/Block/Product/List/Homepage.php +29 -0
  7. app/code/community/Magebuzz/Featuredproducts/Block/Product/List/Sidebar.php +21 -0
  8. app/code/community/Magebuzz/Featuredproducts/Helper/Data.php +7 -0
  9. app/code/community/Magebuzz/Featuredproducts/Model/Resource/Eav/Mysql4/Setup.php +7 -0
  10. app/code/community/Magebuzz/Featuredproducts/controllers/FeaturedproductsadminController.php +56 -0
  11. app/code/community/Magebuzz/Featuredproducts/controllers/IndexController.php +10 -0
  12. app/code/community/Magebuzz/Featuredproducts/etc/adminhtml.xml +48 -0
  13. app/code/community/Magebuzz/Featuredproducts/etc/config.xml +132 -0
  14. app/code/community/Magebuzz/Featuredproducts/etc/system.xml +140 -0
  15. app/code/community/Magebuzz/Featuredproducts/sql/featuredproducts_setup/mysql4-install-0.1.0.php +31 -0
  16. app/design/adminhtml/default/default/layout/featuredproducts.xml +8 -0
  17. app/design/frontend/default/default/layout/featuredproducts.xml +44 -0
  18. app/design/frontend/default/default/template/featuredproducts/featuredproducts.phtml +56 -0
  19. app/design/frontend/default/default/template/featuredproducts/list/categorypage.phtml +55 -0
  20. app/design/frontend/default/default/template/featuredproducts/list/homepage.phtml +56 -0
  21. app/design/frontend/default/default/template/featuredproducts/list/sidebar.phtml +31 -0
  22. app/etc/modules/Magebuzz_Featuredproducts.xml +9 -0
  23. app/locale/en_US/Magebuzz_Featuredproducts.csv +16 -0
  24. package.xml +18 -0
app/code/community/Magebuzz/Featuredproducts/Block/Adminhtml/Featuredproducts/Grid.php ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_Block_Adminhtml_Featuredproducts_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
+ {
7
+
8
+ public function __construct()
9
+ {
10
+ parent::__construct();
11
+ $this->setId('productGrid');
12
+ $this->setDefaultSort('magebuzz_featured_product');
13
+ $this->setDefaultDir('DESC');
14
+ $this->setSaveParametersInSession(false);
15
+ $this->setUseAjax(false);
16
+ $this->setVarNameFilter('product_filter');
17
+
18
+ }
19
+
20
+ protected function _getStore()
21
+ {
22
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
23
+ return Mage::app()->getStore($storeId);
24
+ }
25
+
26
+ protected function _prepareCollection()
27
+ {
28
+ $store = $this->_getStore();
29
+ $collection = Mage::getModel('catalog/product')->getCollection()
30
+ ->addAttributeToSelect('sku')
31
+ ->addAttributeToSelect('name')
32
+ ->addAttributeToSelect('attribute_set_id')
33
+ ->addAttributeToSelect('type_id');
34
+
35
+ if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
36
+ $collection->joinField('qty',
37
+ 'cataloginventory/stock_item',
38
+ 'qty',
39
+ 'product_id=entity_id',
40
+ '{{table}}.stock_id=1',
41
+ 'left');
42
+ }
43
+ if ($store->getId()) {
44
+ //$collection->setStoreId($store->getId());
45
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
46
+ $collection->addStoreFilter($store);
47
+ $collection->joinAttribute(
48
+ 'name',
49
+ 'catalog_product/name',
50
+ 'entity_id',
51
+ null,
52
+ 'inner',
53
+ $adminStore
54
+ );
55
+ $collection->joinAttribute(
56
+ 'custom_name',
57
+ 'catalog_product/name',
58
+ 'entity_id',
59
+ null,
60
+ 'inner',
61
+ $store->getId()
62
+ );
63
+ $collection->joinAttribute(
64
+ 'status',
65
+ 'catalog_product/status',
66
+ 'entity_id',
67
+ null,
68
+ 'inner',
69
+ $store->getId()
70
+ );
71
+ $collection->joinAttribute(
72
+ 'visibility',
73
+ 'catalog_product/visibility',
74
+ 'entity_id',
75
+ null,
76
+ 'inner',
77
+ $store->getId()
78
+ );
79
+ $collection->joinAttribute(
80
+ 'price',
81
+ 'catalog_product/price',
82
+ 'entity_id',
83
+ null,
84
+ 'left',
85
+ $store->getId()
86
+ );
87
+ }
88
+ else {
89
+ $collection->addAttributeToSelect('price');
90
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
91
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
92
+ }
93
+
94
+ $this->setCollection($collection);
95
+
96
+ parent::_prepareCollection();
97
+ $this->getCollection()->addWebsiteNamesToResult();
98
+ return $this;
99
+ }
100
+
101
+ protected function _addColumnFilterToCollection($column)
102
+ {
103
+ if ($this->getCollection()) {
104
+ if ($column->getId() == 'websites') {
105
+ $this->getCollection()->joinField('websites',
106
+ 'catalog/product_website',
107
+ 'website_id',
108
+ 'product_id=entity_id',
109
+ null,
110
+ 'left');
111
+ }
112
+ }
113
+ return parent::_addColumnFilterToCollection($column);
114
+ }
115
+
116
+ protected function _prepareColumns()
117
+ {
118
+ // Zend_Debug::dump($this->getFeaturedProducts());
119
+ // die();
120
+
121
+ // $this->addColumn('',
122
+ // array(
123
+ // // 'header'=> Mage::helper('catalog')->__(' '),
124
+ // 'width' => '50px',
125
+ // 'type' => 'checkbox',
126
+ // 'index' => 'entity_id',
127
+ // 'field_name' => 'productIds',
128
+ // 'values' => $this->getFeaturedProducts(), // array of id_product
129
+ // ));
130
+ $this->addColumn('magebuzz_featured_product',
131
+ array(
132
+ 'header'=> Mage::helper('catalog')->__('Featured'),
133
+ 'width' => '50px',
134
+ 'type' => 'options',
135
+ 'index' => 'magebuzz_featured_product',
136
+ 'options' => array(
137
+ // 0 => '',
138
+ 1 => 'Yes')
139
+ ));
140
+ $this->addColumn('entity_id',
141
+ array(
142
+ 'header'=> Mage::helper('catalog')->__('ID'),
143
+ 'width' => '50px',
144
+ 'type' => 'number',
145
+ 'index' => 'entity_id',
146
+ ));
147
+ $this->addColumn('name',
148
+ array(
149
+ 'header'=> Mage::helper('catalog')->__('Name'),
150
+ 'index' => 'name',
151
+ ));
152
+
153
+ $store = $this->_getStore();
154
+ if ($store->getId()) {
155
+ $this->addColumn('custom_name',
156
+ array(
157
+ 'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
158
+ 'index' => 'custom_name',
159
+ ));
160
+ }
161
+
162
+ $this->addColumn('type',
163
+ array(
164
+ 'header'=> Mage::helper('catalog')->__('Type'),
165
+ 'width' => '60px',
166
+ 'index' => 'type_id',
167
+ 'type' => 'options',
168
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
169
+ ));
170
+
171
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
172
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
173
+ ->load()
174
+ ->toOptionHash();
175
+
176
+ $this->addColumn('set_name',
177
+ array(
178
+ 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
179
+ 'width' => '100px',
180
+ 'index' => 'attribute_set_id',
181
+ 'type' => 'options',
182
+ 'options' => $sets,
183
+ ));
184
+
185
+ $this->addColumn('sku',
186
+ array(
187
+ 'header'=> Mage::helper('catalog')->__('SKU'),
188
+ 'width' => '80px',
189
+ 'index' => 'sku',
190
+ ));
191
+
192
+ $store = $this->_getStore();
193
+ $this->addColumn('price',
194
+ array(
195
+ 'header'=> Mage::helper('catalog')->__('Price'),
196
+ 'type' => 'price',
197
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
198
+ 'index' => 'price',
199
+ ));
200
+
201
+ if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
202
+ $this->addColumn('qty',
203
+ array(
204
+ 'header'=> Mage::helper('catalog')->__('Qty'),
205
+ 'width' => '100px',
206
+ 'type' => 'number',
207
+ 'index' => 'qty',
208
+ ));
209
+ }
210
+
211
+ $this->addColumn('visibility',
212
+ array(
213
+ 'header'=> Mage::helper('catalog')->__('Visibility'),
214
+ 'width' => '70px',
215
+ 'index' => 'visibility',
216
+ 'type' => 'options',
217
+ 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
218
+ ));
219
+
220
+ $this->addColumn('status',
221
+ array(
222
+ 'header'=> Mage::helper('catalog')->__('Status'),
223
+ 'width' => '70px',
224
+ 'index' => 'status',
225
+ 'type' => 'options',
226
+ 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
227
+ ));
228
+
229
+ if (!Mage::app()->isSingleStoreMode()) {
230
+ $this->addColumn('websites',
231
+ array(
232
+ 'header'=> Mage::helper('catalog')->__('Websites'),
233
+ 'width' => '100px',
234
+ 'sortable' => false,
235
+ 'index' => 'websites',
236
+ 'type' => 'options',
237
+ 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
238
+ ));
239
+ }
240
+
241
+ // if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss')) {
242
+ // $this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS'));
243
+ // }
244
+
245
+ return parent::_prepareColumns();
246
+ }
247
+
248
+ protected function _prepareMassaction()
249
+ {
250
+ $this->setMassactionIdField('entity_id');
251
+ $this->getMassactionBlock()->setFormFieldName('product');
252
+
253
+ $this->getMassactionBlock()->addItem('setFeatured', array(
254
+ 'label'=> Mage::helper('catalog')->__('Set Featured'),
255
+ 'url' => $this->getUrl('*/featuredproductsadmin/massSetFeatured'),
256
+ 'confirm' => Mage::helper('catalog')->__('Are you sure you want to SET all selected item(s) as featured product(s) ?')
257
+ ));
258
+
259
+ $this->getMassactionBlock()->addItem('unsetFeatured', array(
260
+ 'label'=> Mage::helper('catalog')->__('Unset Featured'),
261
+ 'url' => $this->getUrl('*/featuredproductsadmin/massUnsetFeatured'),
262
+ 'confirm' => Mage::helper('catalog')->__('Are you sure you want to UNSET all selected item(s) as featured product(s) ?')
263
+ ));
264
+
265
+ return $this;
266
+ }
267
+
268
+ public function getFeaturedProducts() {
269
+ $collection = Mage::getModel('catalog/product')->getCollection();
270
+ $collection->addAttributeToFilter('magebuzz_featured_product','1');
271
+ $productIds = $collection->getColumnValues('entity_id');
272
+ return $productIds;
273
+ }
274
+
275
+ // public function getGridUrl()
276
+ // {
277
+ // return $this->getUrl('*/*/grid', array('_current'=>true));
278
+ // }
279
+
280
+ // public function getRowUrl($row)
281
+ // {
282
+ // return $this->getUrl('*/catalog_product/edit', array(
283
+ // 'store'=>$this->getRequest()->getParam('store'),
284
+ // 'id'=>$row->getId())
285
+ // );
286
+ // }
287
+ }
app/code/community/Magebuzz/Featuredproducts/Block/Adminhtml/Grid.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_Block_Adminhtml_Grid extends Mage_Adminhtml_Block_Widget_Grid_Container
6
+ {
7
+ public function __construct()
8
+ {
9
+ //where is the controller
10
+ $this->_controller = 'adminhtml_featuredproducts';
11
+ $this->_blockGroup = 'featuredproducts';
12
+ //text in the admin header
13
+ $this->_headerText = 'Featured Products Management';
14
+ parent::__construct();
15
+ $this->removeButton('add');
16
+ }
17
+ }
app/code/community/Magebuzz/Featuredproducts/Block/Featuredproducts.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+
6
+ class Magebuzz_Featuredproducts_Block_Featuredproducts extends Magebuzz_Featuredproducts_Block_Product_List {
7
+ const NUMBER_COLUMNS = 4;
8
+ const NUMBER_PRODUCTS = 4;
9
+ const DEFAULT_TITLE = "Featured Products";
10
+
11
+ public function getColumnCount() {
12
+ $columnCount = $this->getData('columnCount');
13
+ return is_null($columnCount) ? self::NUMBER_COLUMNS : $productCount;
14
+ }
15
+
16
+ public function getBlockTitle() {
17
+ $title = $this->getData('blockTitle');
18
+ return (is_null($title)) ? self::DEFAULT_TITLE : $title;
19
+ }
20
+
21
+ protected function _getNumberFeaturedProducts() {
22
+ $productCount = $this->getData('productCount');
23
+ return is_null($productCount) ? self::NUMBER_PRODUCTS : $productCount;
24
+ }
25
+
26
+ protected function _getProductCollection() {
27
+ $collection = parent::_getProductCollection();
28
+ $collection->getSelect()->order(new Zend_Db_Expr('RAND()'));
29
+ $collection->getSelect()->limit($this->_getNumberFeaturedProducts());
30
+ Mage::getModel('review/review')->appendSummary($collection);
31
+ return $collection;
32
+ }
33
+
34
+ }
app/code/community/Magebuzz/Featuredproducts/Block/Product/List.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_Block_Product_List extends Mage_Catalog_Block_Product_List {
6
+ protected function _getProductCollection() {
7
+ $collection = Mage::getModel('catalog/product')->getCollection();
8
+ $collection->addAttributeToFilter('magebuzz_featured_product','1');
9
+ $collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
10
+ ->addMinimalPrice()
11
+ ->addFinalPrice()
12
+ ->addTaxPercents();
13
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
14
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
15
+
16
+ return $collection;
17
+ }
18
+ }
app/code/community/Magebuzz/Featuredproducts/Block/Product/List/Categorypage.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_Block_Product_List_Categorypage extends Magebuzz_Featuredproducts_Block_Product_List {
6
+ const NUMBER_COLUMNS = 3;
7
+
8
+ public function getColumnCount() {
9
+ return self::NUMBER_COLUMNS;
10
+ }
11
+
12
+ protected function _getNumberFeaturedProducts() {
13
+ return Mage::getStoreConfig('featured_products/categorypage/number_products');
14
+ }
15
+
16
+ protected function _getProductCollection() {
17
+ $collection = parent::_getProductCollection();
18
+ $collection->addCategoryFilter($this->getLayer()->getCurrentCategory());
19
+ $collection->getSelect()->order(new Zend_Db_Expr('RAND()'));
20
+ $collection->getSelect()->limit($this->_getNumberFeaturedProducts());
21
+ Mage::getModel('review/review')->appendSummary($collection);
22
+ return $collection;
23
+ }
24
+
25
+ public function getBlockTitle() {
26
+ $title = Mage::getStoreConfig('featured_products/categorypage/blocktitle');
27
+ return (empty($title)) ? "Featured Products" : $title;
28
+ }
29
+
30
+ }
app/code/community/Magebuzz/Featuredproducts/Block/Product/List/Homepage.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+
6
+ class Magebuzz_Featuredproducts_Block_Product_List_Homepage extends Magebuzz_Featuredproducts_Block_Product_List {
7
+ const NUMBER_COLUMNS = 4;
8
+
9
+ public function getColumnCount() {
10
+ return self::NUMBER_COLUMNS;
11
+ }
12
+
13
+ protected function _getNumberFeaturedProducts() {
14
+ return Mage::getStoreConfig('featured_products/homepage/number_products');
15
+ }
16
+
17
+ protected function _getProductCollection() {
18
+ $collection = parent::_getProductCollection();
19
+ $collection->getSelect()->order(new Zend_Db_Expr('RAND()'));
20
+ $collection->getSelect()->limit($this->_getNumberFeaturedProducts());
21
+ Mage::getModel('review/review')->appendSummary($collection);
22
+ return $collection;
23
+ }
24
+
25
+ public function getBlockTitle() {
26
+ $title = Mage::getStoreConfig('featured_products/homepage/blocktitle');
27
+ return (empty($title)) ? "Featured Products" : $title;
28
+ }
29
+ }
app/code/community/Magebuzz/Featuredproducts/Block/Product/List/Sidebar.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_Block_Product_List_Sidebar extends Magebuzz_Featuredproducts_Block_Product_List {
6
+ protected function _getNumberFeaturedProducts() {
7
+ return Mage::getStoreConfig('featured_products/sidebar/number_products');
8
+ }
9
+
10
+ protected function _getProductCollection() {
11
+ $collection = parent::_getProductCollection();
12
+ $collection->getSelect()->order(new Zend_Db_Expr('RAND()'));
13
+ $collection->getSelect()->limit($this->_getNumberFeaturedProducts());
14
+ return $collection;
15
+ }
16
+
17
+ public function getBlockTitle() {
18
+ $title = Mage::getStoreConfig('featured_products/sidebar/blocktitle');
19
+ return (empty($title)) ? "Featured Products" : $title;
20
+ }
21
+ }
app/code/community/Magebuzz/Featuredproducts/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_Helper_Data extends Mage_Core_Helper_Abstract {
6
+
7
+ }
app/code/community/Magebuzz/Featuredproducts/Model/Resource/Eav/Mysql4/Setup.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {
6
+
7
+ }
app/code/community/Magebuzz/Featuredproducts/controllers/FeaturedproductsadminController.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_FeaturedproductsadminController extends Mage_Adminhtml_Controller_Action {
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('catalog/featured_products');
9
+ }
10
+
11
+ public function indexAction () {
12
+ $this->_initAction();
13
+ $this->renderLayout();
14
+ }
15
+
16
+ public function massSetFeaturedAction() {
17
+ $productIds = $this->getRequest()->getParam('product');
18
+ if (!is_array($productIds)) {
19
+ $this->_getSession()->addError($this->__('Please select product(s).'));
20
+ } else {
21
+ if (!empty($productIds)) {
22
+ try {
23
+ Mage::getSingleton('catalog/product_action')
24
+ ->updateAttributes($productIds, array('magebuzz_featured_product' => 1), $storeId);
25
+ $this->_getSession()->addSuccess(
26
+ $this->__('Total of %d product(s) have been set as featured.', count($productIds))
27
+ );
28
+ } catch (Exception $e) {
29
+ $this->_getSession()->addError($e->getMessage());
30
+ }
31
+ }
32
+ }
33
+ $this->_redirect('*/*/index');
34
+ }
35
+
36
+ public function massUnsetFeaturedAction() {
37
+ $productIds = $this->getRequest()->getParam('product');
38
+ if (!is_array($productIds)) {
39
+ $this->_getSession()->addError($this->__('Please select product(s).'));
40
+ } else {
41
+ if (!empty($productIds)) {
42
+ try {
43
+ Mage::getSingleton('catalog/product_action')
44
+ ->updateAttributes($productIds, array('magebuzz_featured_product' => 0), $storeId);
45
+ $this->_getSession()->addSuccess(
46
+ $this->__('Total of %d record(s) have been unset as featured.', count($productIds))
47
+ );
48
+ } catch (Exception $e) {
49
+ $this->_getSession()->addError($e->getMessage());
50
+ }
51
+ }
52
+ }
53
+ $this->_redirect('*/*/index');
54
+ }
55
+
56
+ }
app/code/community/Magebuzz/Featuredproducts/controllers/IndexController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ class Magebuzz_Featuredproducts_IndexController extends Mage_Core_Controller_Front_Action {
6
+ public function indexAction() {
7
+ $this->loadLayout();
8
+ $this->renderLayout();
9
+ }
10
+ }
app/code/community/Magebuzz/Featuredproducts/etc/adminhtml.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <menu>
3
+ <catalog>
4
+ <children>
5
+ <featured_products translate="title">
6
+ <title>Featured Products</title>
7
+ <sort_order>10</sort_order>
8
+ <children>
9
+ <management translate="title">
10
+ <title>Manage Featured Products</title>
11
+ <sort_order>1</sort_order>
12
+ <action>adminhtml/featuredproductsadmin/index</action>
13
+ </management>
14
+ <configuration translate="title">
15
+ <title>Configuration</title>
16
+ <sort_order>2</sort_order>
17
+ <action>adminhtml/system_config/edit/section/featured_products</action>
18
+ </configuration>
19
+ </children>
20
+ </featured_products>
21
+ </children>
22
+ </catalog>
23
+ </menu>
24
+
25
+ <acl>
26
+ <resources>
27
+ <all>
28
+ <title>Allow Everything</title>
29
+ </all>
30
+ <admin>
31
+ <children>
32
+ <system>
33
+ <children>
34
+ <config>
35
+ <children>
36
+ <featured_products translate="title">
37
+ <title>Featured Products Config</title>
38
+ <sort_order>100</sort_order>
39
+ </featured_products>
40
+ </children>
41
+ </config>
42
+ </children>
43
+ </system>
44
+ </children>
45
+ </admin>
46
+ </resources>
47
+ </acl>
48
+ </config>
app/code/community/Magebuzz/Featuredproducts/etc/config.xml ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Magebuzz_Featuredproducts>
6
+ <version>0.1.0</version>
7
+ </Magebuzz_Featuredproducts>
8
+ </modules>
9
+
10
+ <global>
11
+ <models>
12
+ <featuredproducts>
13
+ <class>Magebuzz_Featuredproducts_Model</class>
14
+ </featuredproducts>
15
+ </models>
16
+
17
+ <resources>
18
+ <featuredproducts_setup>
19
+ <setup>
20
+ <module>Magebuzz_Featuredproducts</module>
21
+ <class>Magebuzz_Featuredproducts_Model_Resource_Eav_Mysql4_Setup</class>
22
+ </setup>
23
+ <connection>
24
+ <use>core_setup</use>
25
+ </connection>
26
+ </featuredproducts_setup>
27
+
28
+ <featuredproducts_write>
29
+ <connection>
30
+ <use>core_write</use>
31
+ </connection>
32
+ </featuredproducts_write>
33
+
34
+ <featuredproducts_read>
35
+ <connection>
36
+ <use>core_read</use>
37
+ </connection>
38
+ </featuredproducts_read>
39
+ </resources>
40
+
41
+ <blocks>
42
+ <featuredproducts>
43
+ <class>Magebuzz_Featuredproducts_Block</class>
44
+ </featuredproducts>
45
+ </blocks>
46
+
47
+ <helpers>
48
+ <featuredproducts>
49
+ <class>Magebuzz_Featuredproducts_Helper</class>
50
+ </featuredproducts>
51
+ </helpers>
52
+ </global>
53
+
54
+ <frontend>
55
+ <translate>
56
+ <modules>
57
+ <Magebuzz_Featuredproducts>
58
+ <files>
59
+ <default>Magebuzz_Featuredproducts.csv</default>
60
+ </files>
61
+ </Magebuzz_Featuredproducts>
62
+ </modules>
63
+ </translate>
64
+ <routers>
65
+ <featuredproducts>
66
+ <use>standard</use>
67
+ <args>
68
+ <module>Magebuzz_Featuredproducts</module>
69
+ <frontName>featuredproducts</frontName>
70
+ </args>
71
+ </featuredproducts>
72
+ </routers>
73
+
74
+ <layout>
75
+ <updates>
76
+ <featuredproducts>
77
+ <file>featuredproducts.xml</file>
78
+ </featuredproducts>
79
+ </updates>
80
+ </layout>
81
+ </frontend>
82
+
83
+ <admin>
84
+ <routers>
85
+ <adminhtml>
86
+ <args>
87
+ <use>standard</use>
88
+ <modules>
89
+ <Magebuzz_Featuredproducts after="Mage_Adminhtml">Magebuzz_Featuredproducts</Magebuzz_Featuredproducts>
90
+ </modules>
91
+ </args>
92
+ </adminhtml>
93
+ </routers>
94
+ </admin>
95
+
96
+ <adminhtml>
97
+ <translate>
98
+ <modules>
99
+ <Magebuzz_Featuredproducts>
100
+ <files>
101
+ <default>Magebuzz_Featuredproducts.csv</default>
102
+ </files>
103
+ </Magebuzz_Featuredproducts>
104
+ </modules>
105
+ </translate>
106
+ <layout>
107
+ <updates>
108
+ <featuredproducts>
109
+ <file>featuredproducts.xml</file>
110
+ </featuredproducts>
111
+ </updates>
112
+ </layout>
113
+ </adminhtml>
114
+
115
+ <default>
116
+ <featured_products>
117
+ <homepage>
118
+ <number_products>4</number_products>
119
+ <enabled>1</enabled>
120
+ </homepage>
121
+ <categorypage>
122
+ <number_products>4</number_products>
123
+ <enabled>1</enabled>
124
+ </categorypage>
125
+ <sidebar>
126
+ <number_products>4</number_products>
127
+ <enabled>1</enabled>
128
+ </sidebar>
129
+ </featured_products>
130
+ </default>
131
+
132
+ </config>
app/code/community/Magebuzz/Featuredproducts/etc/system.xml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magebuzz translate="label" module="featuredproducts">
5
+ <label>Magebuzz Add-ons</label>
6
+ </magebuzz>
7
+ </tabs>
8
+ <sections>
9
+ <featured_products translate="label" module="featuredproducts">
10
+ <label>Featured Products</label>
11
+ <tab>magebuzz</tab>
12
+ <frontend_type>text</frontend_type>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <homepage translate="label" module="featuredproducts">
19
+ <label>Homepage</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>100</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enabled translate="label" module="featuredproducts">
27
+ <label>Enable</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>1</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
+ </enabled>
35
+
36
+ <blocktitle translate="label" module="featuredproducts">
37
+ <label>Block Title</label>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>2</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
+
45
+ <number_products translate="label" module="featuredproducts">
46
+ <label>Products per Block</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>3</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
+ <validate>validate-digits</validate>
53
+ <comment>Default is "4"</comment>
54
+ </number_products>
55
+ </fields>
56
+ </homepage>
57
+
58
+ <categorypage translate="label" module="featuredproducts">
59
+ <label>Category page</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>200</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <fields>
66
+ <enabled translate="label" module="featuredproducts">
67
+ <label>Enable</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_yesno</source_model>
70
+ <sort_order>1</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ </enabled>
75
+
76
+ <blocktitle translate="label" module="featuredproducts">
77
+ <label>Block Title</label>
78
+ <frontend_type>text</frontend_type>
79
+ <sort_order>2</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ </blocktitle>
84
+
85
+ <number_products translate="label" module="featuredproducts">
86
+ <label>Products per Block</label>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>3</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ <validate>validate-digits</validate>
93
+ <comment>Default is "4"</comment>
94
+ </number_products>
95
+ </fields>
96
+ </categorypage>
97
+
98
+ <sidebar translate="label" module="featuredproducts">
99
+ <label>Sidebar</label>
100
+ <frontend_type>text</frontend_type>
101
+ <sort_order>300</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
+ <fields>
106
+ <enabled translate="label" module="featuredproducts">
107
+ <label>Enable</label>
108
+ <frontend_type>select</frontend_type>
109
+ <source_model>adminhtml/system_config_source_yesno</source_model>
110
+ <sort_order>1</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
+ </enabled>
115
+
116
+ <blocktitle translate="label" module="featuredproducts">
117
+ <label>Block Title</label>
118
+ <frontend_type>text</frontend_type>
119
+ <sort_order>2</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
+ </blocktitle>
124
+
125
+ <number_products translate="label" module="featuredproducts">
126
+ <label>Products per Block</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>3</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
+ <validate>validate-digits</validate>
133
+ <comment>Default is "4"</comment>
134
+ </number_products>
135
+ </fields>
136
+ </sidebar>
137
+ </groups>
138
+ </featured_products>
139
+ </sections>
140
+ </config>
app/code/community/Magebuzz/Featuredproducts/sql/featuredproducts_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ $installer = $this;
6
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
7
+ $installer->startSetup();
8
+
9
+ $setup->addAttribute('catalog_product', 'magebuzz_featured_product', array(
10
+ 'group' => 'General',
11
+ 'attribute_set' => 'Default',
12
+ 'label' => 'Is Featured Product',
13
+ 'type' => 'int',
14
+ 'input' => 'boolean',
15
+ 'default' => '0',
16
+ 'backend' => '',
17
+ 'frontend' => '',
18
+ 'source' => '',
19
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
20
+ 'visible' => true,
21
+ 'required' => true,
22
+ 'user_defined' => true,
23
+ 'searchable' => false,
24
+ 'filterable' => false,
25
+ 'comparable' => false,
26
+ 'visible_on_front' => false,
27
+ 'visible_in_advanced_search' => false,
28
+ 'unique' => false
29
+ ));
30
+
31
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/featuredproducts.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_featuredproductsadmin_index>
4
+ <reference name="content">
5
+ <block type="featuredproducts/adminhtml_grid" name="featuredproducts.adminhtml.grid" ></block>
6
+ </reference>
7
+ </adminhtml_featuredproductsadmin_index>
8
+ </layout>
app/design/frontend/default/default/layout/featuredproducts.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <featuredproducts_index_index>
4
+ <reference name="root">
5
+ <action method="setTemplate">
6
+ <template>page/2columns-right.phtml</template>
7
+ </action>
8
+ </reference>
9
+ <reference name="content">
10
+ <block type="featuredproducts/featuredproducts" name="featuredproducts.featuredproducts" template="featuredproducts/featuredproducts.phtml" productCount="2"/>
11
+ </reference>
12
+
13
+ </featuredproducts_index_index>
14
+
15
+ <default>
16
+ <reference name="right">
17
+ <block type="featuredproducts/product_list_sidebar" name="featuredproducts.list.sidebar" before="-" >
18
+ <action method="setTemplate" ifconfig="featured_products/sidebar/enabled">
19
+ <template>featuredproducts/list/sidebar.phtml</template>
20
+ </action>
21
+ </block>
22
+ </reference>
23
+ </default>
24
+
25
+ <cms_index_index>
26
+ <reference name="content">
27
+ <block type="featuredproducts/product_list_homepage" name="featuredproducts.list.homepage">
28
+ <action method="setTemplate" ifconfig="featured_products/homepage/enabled">
29
+ <template>featuredproducts/list/homepage.phtml</template>
30
+ </action>
31
+ </block>
32
+ </reference>
33
+ </cms_index_index>
34
+
35
+ <catalog_category_layered>
36
+ <reference name="content">
37
+ <block type="featuredproducts/product_list_categorypage" before="product_list" name="featuredproducts.list.categorypage">
38
+ <action method="setTemplate" ifconfig="featured_products/categorypage/enabled">
39
+ <template>featuredproducts/list/categorypage.phtml</template>
40
+ </action>
41
+ </block>
42
+ </reference>
43
+ </catalog_category_layered>
44
+ </layout>
app/design/frontend/default/default/template/featuredproducts/featuredproducts.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ ?>
6
+ <div>
7
+ <?php
8
+ $_productCollection=$this->getLoadedProductCollection();
9
+ $_helper = $this->helper('catalog/output');
10
+ ?>
11
+ <?php if($_productCollection->count()): ?>
12
+
13
+ <div class="category-products">
14
+ <?php // Grid Mode ?>
15
+ <h2><?php echo $this->__($this->getBlockTitle()); ?></h2>
16
+
17
+ <div class="block-content-content">
18
+ <?php $_collectionSize = $_productCollection->count() ?>
19
+ <?php $_columnCount = $this->getColumnCount(); ?>
20
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
21
+ <?php if ($i++%$_columnCount==0): ?>
22
+ <ul class="products-grid">
23
+ <?php endif ?>
24
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
25
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
26
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
27
+
28
+ <?php if($_product->getRatingSummary()): ?>
29
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
30
+ <?php endif; ?>
31
+ <?php echo $this->getPriceHtml($_product, true) ?>
32
+ <div class="actions">
33
+ <?php if($_product->isSaleable()): ?>
34
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
35
+ <?php else: ?>
36
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
37
+ <?php endif; ?>
38
+ <ul class="add-to-links">
39
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
40
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
41
+ <?php endif; ?>
42
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
43
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
44
+ <?php endif; ?>
45
+ </ul>
46
+ </div>
47
+ </li>
48
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
49
+ </ul>
50
+ <?php endif ?>
51
+ <?php endforeach ?>
52
+ </div>
53
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
54
+ </div>
55
+ </div>
56
+ <?php endif; ?>
app/design/frontend/default/default/template/featuredproducts/list/categorypage.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ ?>
6
+ <div>
7
+ <?php
8
+ $_productCollection=$this->getLoadedProductCollection();
9
+ $_helper = $this->helper('catalog/output');
10
+ ?>
11
+ <?php if($_productCollection->count()): ?>
12
+
13
+ <div class="category-products">
14
+ <?php // Grid Mode ?>
15
+ <h2><?php echo $this->__($this->getBlockTitle()); ?></h2>
16
+
17
+ <div class="block-content-content">
18
+ <?php $_collectionSize = $_productCollection->count() ?>
19
+ <?php $_columnCount = $this->getColumnCount(); ?>
20
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
21
+ <?php if ($i++%$_columnCount==0): ?>
22
+ <ul class="products-grid">
23
+ <?php endif ?>
24
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
25
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
26
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
27
+ <?php if($_product->getRatingSummary()): ?>
28
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
29
+ <?php endif; ?>
30
+ <?php echo $this->getPriceHtml($_product, true) ?>
31
+ <div class="actions">
32
+ <?php if($_product->isSaleable()): ?>
33
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
34
+ <?php else: ?>
35
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
36
+ <?php endif; ?>
37
+ <ul class="add-to-links">
38
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
39
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
40
+ <?php endif; ?>
41
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
42
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
43
+ <?php endif; ?>
44
+ </ul>
45
+ </div>
46
+ </li>
47
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
48
+ </ul>
49
+ <?php endif ?>
50
+ <?php endforeach ?>
51
+ </div>
52
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
53
+ </div>
54
+ </div>
55
+ <?php endif; ?>
app/design/frontend/default/default/template/featuredproducts/list/homepage.phtml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ ?>
6
+ <div>
7
+ <?php
8
+ $_productCollection=$this->getLoadedProductCollection();
9
+ $_helper = $this->helper('catalog/output');
10
+ ?>
11
+ <?php if($_productCollection->count()): ?>
12
+
13
+ <div class="category-products">
14
+ <?php // Grid Mode ?>
15
+ <h2><?php echo $this->__($this->getBlockTitle()); ?></h2>
16
+
17
+ <div class="block-content-content">
18
+ <?php $_collectionSize = $_productCollection->count() ?>
19
+ <?php $_columnCount = $this->getColumnCount(); ?>
20
+ <?php $i=0; foreach ($_productCollection as $_product): ?>
21
+ <?php if ($i++%$_columnCount==0): ?>
22
+ <ul class="products-grid">
23
+ <?php endif ?>
24
+ <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
25
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
26
+ <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
27
+
28
+ <?php if($_product->getRatingSummary()): ?>
29
+ <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
30
+ <?php endif; ?>
31
+ <?php echo $this->getPriceHtml($_product, true) ?>
32
+ <div class="actions">
33
+ <?php if($_product->isSaleable()): ?>
34
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
35
+ <?php else: ?>
36
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
37
+ <?php endif; ?>
38
+ <ul class="add-to-links">
39
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
40
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
41
+ <?php endif; ?>
42
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
43
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
44
+ <?php endif; ?>
45
+ </ul>
46
+ </div>
47
+ </li>
48
+ <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
49
+ </ul>
50
+ <?php endif ?>
51
+ <?php endforeach ?>
52
+ </div>
53
+ <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
54
+ </div>
55
+ </div>
56
+ <?php endif; ?>
app/design/frontend/default/default/template/featuredproducts/list/sidebar.phtml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013 www.magebuzz.com
4
+ */
5
+ ?>
6
+ <?php if($this->getLoadedProductCollection()->getSize()): ?>
7
+ <div class="block block-related">
8
+ <div class="block-title">
9
+ <strong><span><?php echo $this->__($this->getBlockTitle()); ?></span></strong>
10
+ </div>
11
+ <div class="block-content">
12
+ <ol class="mini-products-list" id="block-related">
13
+ <?php foreach($this->getLoadedProductCollection() as $_item): ?>
14
+ <li class="item">
15
+ <div class="product">
16
+ <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
17
+ <div class="product-details">
18
+ <p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></p>
19
+ <?php echo $this->getPriceHtml($_item, true, '-related') ?>
20
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
21
+ <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
22
+ <?php endif; ?>
23
+ </div>
24
+ </div>
25
+ </li>
26
+ <?php endforeach ?>
27
+ </ol>
28
+ <script type="text/javascript">decorateList('block-related', 'none-recursive')</script>
29
+ </div>
30
+ </div>
31
+ <?php endif ?>
app/etc/modules/Magebuzz_Featuredproducts.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magebuzz_Featuredproducts>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magebuzz_Featuredproducts>
8
+ </modules>
9
+ </config>
app/locale/en_US/Magebuzz_Featuredproducts.csv ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Featured Products","Featured Products"
2
+ "Add to Wishlist","Add to Wishlist"
3
+ "Add to Compare","Add to Compare"
4
+ "Add to Cart","Add to Cart"
5
+ "Manage Featured Products","Manage Featured Products"
6
+ "Configuration","Configuration"
7
+ "Featured Products Config","Featured Products Config"
8
+ "Please select product(s).","'Please select product(s)."
9
+ "Total of %d product(s) have been set as featured.","Total of %d product(s) have been set as featured."
10
+ "Total of %d record(s) have been unset as featured.","Total of %d record(s) have been unset as featured."
11
+ "Homepage","Homepage"
12
+ "Enable","Enable"
13
+ "Block Title","Block Title"
14
+ "Products per Block","Products per Block"
15
+ "Category page","Category page"
16
+ "Sidebar","Sidebar"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magebuzz_Featuredproducts</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Featured Products Extenstion</summary>
10
+ <description>Magento featured product module built on considering easy navigation for the users to manage store. </description>
11
+ <notes>Magebuzz extension</notes>
12
+ <authors><author><name>Magebuzz</name><user>magebuzz</user><email>magebuzz@gmail.com</email></author></authors>
13
+ <date>2014-02-17</date>
14
+ <time>01:46:33</time>
15
+ <contents><target name="magecommunity"><dir name="Magebuzz"><dir name="Featuredproducts"><dir name="Block"><dir name="Adminhtml"><dir name="Featuredproducts"><file name="Grid.php" hash="24e1017dda15da8b0b7c1cb5f9e23704"/></dir><file name="Grid.php" hash="4121fefe13b452b97a0b085538ce1fd9"/></dir><file name="Featuredproducts.php" hash="afd912fe18b5d8d2d392f491eea678e2"/><dir name="Product"><dir name="List"><file name="Categorypage.php" hash="85f9a7e459eb61b8251d26acb833a497"/><file name="Homepage.php" hash="4167a67831735baa7583a09604459199"/><file name="Sidebar.php" hash="8b4bd6fc03357b6649f71dbf3441502c"/></dir><file name="List.php" hash="03a125626f0bcfa9020062089e18a56f"/></dir></dir><dir name="Helper"><file name="Data.php" hash="91219113b1d8ad3af4daf73acb09cc6d"/></dir><dir name="Model"><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="84761ca251891f1ba579cf9efecb4986"/></dir></dir></dir></dir><dir name="controllers"><file name="FeaturedproductsadminController.php" hash="26146dbd042813697d4d22c33b92bad8"/><file name="IndexController.php" hash="ac962015af16d512a1dfe89efce68a49"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0905d536e89b9e658e565bbcc441262e"/><file name="config.xml" hash="080bbbe410758276281371325e4c5c47"/><file name="system.xml" hash="d1652bbb24d3f0edad6b1e9f4d10663c"/></dir><dir name="sql"><dir name="featuredproducts_setup"><file name="mysql4-install-0.1.0.php" hash="7010d80f4f56e9f45c14fb100ce89298"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="featuredproducts.xml" hash="a9db804c6c93cf9ea8932e937a66ec2e"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="featuredproducts.xml" hash="647d57cb55e90ea5fdef60cf49d1859b"/></dir><dir name="template"><dir name="featuredproducts"><file name="featuredproducts.phtml" hash="accbf6a285e528415bfdec2e5979ddec"/><dir name="list"><file name="categorypage.phtml" hash="16cd6b76bfe6976d71268496e1787934"/><file name="homepage.phtml" hash="accbf6a285e528415bfdec2e5979ddec"/><file name="sidebar.phtml" hash="c39aa259e83b37cd84269b0e848de956"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magebuzz_Featuredproducts.xml" hash="9a7ffe2864a31e174fdde2114dbbb092"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Magebuzz_Featuredproducts.csv" hash="9a4203ac3fac880819eca24c21235858"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>5.4.25</max></php></required></dependencies>
18
+ </package>