Ma2_Featured_Products_Free - Version 1.0.0

Version Notes

Version number: 1.0.0
Stability: Stable
Compatibility: 1.7, 1.8

Download this release

Release Info

Developer Magenmarket.com
Extension Ma2_Featured_Products_Free
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (36) hide show
  1. app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit.php +79 -0
  2. app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Grid.php +379 -0
  3. app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Renderer/Name.php +51 -0
  4. app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Renderer/Thumbnail.php +49 -0
  5. app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Renderer/Visibility.php +43 -0
  6. app/code/community/Ma2/FeaturedProducts/Block/Block.php +114 -0
  7. app/code/community/Ma2/FeaturedProducts/Block/Standalone/List.php +119 -0
  8. app/code/community/Ma2/FeaturedProducts/Block/Widget.php +87 -0
  9. app/code/community/Ma2/FeaturedProducts/Helper/Data.php +43 -0
  10. app/code/community/Ma2/FeaturedProducts/Model/System/Config/Source/Listtype.php +36 -0
  11. app/code/community/Ma2/FeaturedProducts/Model/System/Config/Source/Sortby.php +37 -0
  12. app/code/community/Ma2/FeaturedProducts/Model/System/Config/Source/Sortdir.php +36 -0
  13. app/code/community/Ma2/FeaturedProducts/controllers/Adminhtml/FeaturedController.php +144 -0
  14. app/code/community/Ma2/FeaturedProducts/controllers/IndexController.php +54 -0
  15. app/code/community/Ma2/FeaturedProducts/etc/adminhtml.xml +68 -0
  16. app/code/community/Ma2/FeaturedProducts/etc/config.xml +121 -0
  17. app/code/community/Ma2/FeaturedProducts/etc/system.xml +390 -0
  18. app/code/community/Ma2/FeaturedProducts/etc/widget.xml +153 -0
  19. app/code/community/Ma2/FeaturedProducts/sql/featuredproducts_setup/mysql4-install-1.0.0.php +54 -0
  20. app/code/local/Ma2/All/Helper/Data.php +4 -0
  21. app/code/local/Ma2/All/etc/adminhtml.xml +43 -0
  22. app/code/local/Ma2/All/etc/config.xml +56 -0
  23. app/code/local/Ma2/All/etc/system.xml +9 -0
  24. app/design/adminhtml/default/default/layout/ma2_all.xml +7 -0
  25. app/design/frontend/default/default/layout/ma2_all.xml +9 -0
  26. app/design/frontend/default/default/layout/ma2_featuredproducts.xml +20 -0
  27. app/design/frontend/default/default/template/ma2_featuredproducts/block.phtml +114 -0
  28. app/design/frontend/default/default/template/ma2_featuredproducts/standalone.phtml +24 -0
  29. app/design/frontend/default/default/template/ma2_featuredproducts/standalone_list.phtml +120 -0
  30. app/design/frontend/default/default/template/ma2_featuredproducts/widget.phtml +115 -0
  31. app/etc/modules/Ma2_All.xml +9 -0
  32. app/etc/modules/Ma2_FeaturedProducts.xml +9 -0
  33. js/ma2_all/ma2all.css +30 -0
  34. js/ma2_all/ma2all.js +41 -0
  35. package.xml +20 -0
  36. skin/frontend/default/default/ma2_featuredproducts/ma2_featuredproducts.css +92 -0
app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Edit.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Block_Adminhtml_Edit extends Mage_Adminhtml_Block_Widget_Grid_Container {
24
+
25
+ public function __construct() {
26
+
27
+
28
+ $this->_blockGroup = 'featuredproducts';
29
+ $this->_controller = 'adminhtml_edit';
30
+
31
+
32
+ $this->_headerText = Mage::helper('adminhtml')->__('Featured Products Manager');
33
+
34
+ parent::__construct();
35
+
36
+ $this->_removeButton('add');
37
+
38
+ $this->_addButton('save', array(
39
+ 'label' => Mage::helper('featuredproducts')->__('Save Selected'),
40
+ 'onclick' => 'categorySubmit(\'' . $this->getSaveUrl() . '\')',
41
+ 'class' => 'save',
42
+ ));
43
+ }
44
+
45
+ public function getSaveUrl() {
46
+ return $this->getUrl('*/*/save', array('store' => $this->getRequest()->getParam('store')));
47
+ }
48
+
49
+ private function _prependHtml() {
50
+ $html = '
51
+
52
+ <form id="featured_edit_form" action="' . $this->getSaveUrl() . '" method="post" enctype="multipart/form-data">
53
+ <input name="form_key" type="hidden" value="' . $this->getFormKey() . '" />
54
+ <div class="no-display">
55
+ <input type="hidden" name="featured_products" id="saved_featured_products" value="" />
56
+ </div>
57
+ </form>
58
+ ';
59
+
60
+ return $html;
61
+ }
62
+
63
+ public function getHeaderHtml() {
64
+ return '<h3 style="background-image: url(' . $this->getSkinUrl('images/product_rating_full_star.gif') . ');" class="' . $this->getHeaderCssClass() . '">' . $this->getHeaderText() . '</h3>';
65
+ }
66
+
67
+ protected function _prepareLayout() {
68
+ $this->setChild('store_switcher', $this->getLayout()->createBlock('adminhtml/store_switcher', 'store_switcher')->setUseConfirm(false)
69
+ );
70
+ return parent::_prepareLayout();
71
+ }
72
+
73
+ public function getGridHtml() {
74
+
75
+ return $this->getChildHtml('store_switcher') . $this->_prependHtml() . $this->getChildHtml('grid');
76
+ }
77
+
78
+ }
79
+ ?>
app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Grid.php ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Grid.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+ class Ma2_FeaturedProducts_Block_Adminhtml_Edit_Grid extends Mage_Adminhtml_Block_Widget_Grid {
23
+
24
+ public function __construct() {
25
+ parent::__construct();
26
+
27
+ $this->setId('ma2_featured_products');
28
+ $this->setDefaultSort('entity_id');
29
+ $this->setUseAjax(true);
30
+
31
+ $this->setRowClickCallback('FeaturedRowClick');
32
+ }
33
+
34
+ public function getProduct() {
35
+ return Mage::registry('product');
36
+ }
37
+
38
+ protected function _getStore() {
39
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
40
+ return Mage::app()->getStore($storeId);
41
+ }
42
+
43
+ protected function _addColumnFilterToCollection($column) {
44
+
45
+ if ($this->getCollection()) {
46
+ if ($column->getId() == 'websites') {
47
+
48
+ $this->getCollection()->joinField('websites', 'catalog/product_website', 'website_id', 'product_id=entity_id', null, 'left');
49
+ }
50
+ }
51
+
52
+
53
+ if ($column->getId() == "featured") {
54
+ $productIds = $this->_getSelectedProducts();
55
+
56
+ if (empty($productIds)) {
57
+ $productIds = 0;
58
+ }
59
+ if ($column->getFilter()->getValue()) {
60
+ $this->getCollection()->addFieldToFilter('entity_id', array('in' => $productIds));
61
+ } elseif (!empty($productIds)) {
62
+ $this->getCollection()->addFieldToFilter('entity_id', array('nin' => $productIds));
63
+ }
64
+ } else {
65
+
66
+ parent::_addColumnFilterToCollection($column);
67
+ }
68
+
69
+ return $this;
70
+ }
71
+
72
+ protected function _prepareCollection() {
73
+
74
+ $store = $this->_getStore();
75
+
76
+ $collection = Mage::getModel('catalog/product')->getCollection()
77
+ ->addAttributeToSelect('name')
78
+ ->addAttributeToSelect('sku')
79
+ ->addAttributeToSelect('ma2_featured_product')
80
+ ->addAttributeToSelect('type_id')
81
+ ->addAttributeToSelect('attribute_set_id')
82
+ ->addAttributeToSelect('thumbnail')
83
+ ->addAttributeToSelect('small_image')
84
+ ->addAttributeToSelect('image')
85
+ ->addAttributeToFilter('visibility', array('nin' => array(1, 3)));
86
+
87
+
88
+ if ($store->getId()) {
89
+ $collection->addStoreFilter($store);
90
+ $collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());
91
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());
92
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', 1, 'inner', $store->getId());
93
+ $collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId());
94
+ } else {
95
+ $collection->addAttributeToSelect('price');
96
+ $collection->addAttributeToSelect('status');
97
+ $collection->addAttributeToSelect('visibility');
98
+ }
99
+
100
+ $action_name = $this->getRequest()->getActionName();
101
+
102
+ if ($action_name == 'exportCsv' || $action_name == 'exportXml') {
103
+ $collection->addAttributeToFilter('ma2_featured_product', array('eq' => true));
104
+ }
105
+
106
+
107
+ $this->setCollection($collection);
108
+
109
+ parent::_prepareCollection();
110
+
111
+ $this->getCollection()->addWebsiteNamesToResult();
112
+
113
+ return $this;
114
+ }
115
+
116
+ protected function _prepareColumns() {
117
+
118
+ $action_name = $this->getRequest()->getActionName();
119
+
120
+ if ($action_name != 'exportCsv' && $action_name != 'exportXml') {
121
+
122
+ $this->addColumn('featured', array(
123
+ 'header_css_class' => 'a-center',
124
+ 'type' => 'checkbox',
125
+ 'name' => 'featured',
126
+ 'values' => $this->_getSelectedProducts(),
127
+ 'align' => 'center',
128
+ 'index' => 'entity_id'
129
+ ));
130
+ }
131
+
132
+ $this->addColumn('entity_id', array(
133
+ 'header' => Mage::helper('catalog')->__('ID'),
134
+ 'sortable' => true,
135
+ 'width' => '50px',
136
+ 'index' => 'entity_id',
137
+ 'type' => 'number'
138
+ ));
139
+ $this->addColumn('image', array(
140
+ 'header' => Mage::helper('catalog')->__('Image'),
141
+ 'width' => '50px',
142
+ 'index' => 'image',
143
+ 'filter' => false,
144
+ 'renderer' => 'featuredproducts/adminhtml_edit_renderer_thumbnail',
145
+ ));
146
+ $this->addColumn('name', array(
147
+ 'header' => Mage::helper('catalog')->__('Name'),
148
+ 'index' => 'name',
149
+ 'renderer' => 'featuredproducts/adminhtml_edit_renderer_name',
150
+ ));
151
+
152
+ $this->addColumn('type', array(
153
+ 'header' => Mage::helper('catalog')->__('Type'),
154
+ 'width' => '60px',
155
+ 'index' => 'type_id',
156
+ 'type' => 'options',
157
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
158
+ ));
159
+
160
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
161
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
162
+ ->load()
163
+ ->toOptionHash();
164
+
165
+ $this->addColumn('set_name', array(
166
+ 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
167
+ 'width' => '100px',
168
+ 'index' => 'attribute_set_id',
169
+ 'type' => 'options',
170
+ 'options' => $sets,
171
+ ));
172
+
173
+ $this->addColumn('sku', array(
174
+ 'header' => Mage::helper('catalog')->__('SKU'),
175
+ 'width' => '140px',
176
+ 'index' => 'sku'
177
+ ));
178
+
179
+ $this->addColumn('visibility', array(
180
+ 'header' => Mage::helper('catalog')->__('Visibility'),
181
+ 'width' => '140px',
182
+ 'index' => 'visibility',
183
+ 'filter' => false,
184
+ 'renderer' => 'featuredproducts/adminhtml_edit_renderer_visibility',
185
+ ));
186
+
187
+ if (!Mage::app()->isSingleStoreMode()) {
188
+ $this->addColumn('websites', array(
189
+ 'header' => Mage::helper('catalog')->__('Websites'),
190
+ 'width' => '100px',
191
+ 'sortable' => false,
192
+ 'index' => 'websites',
193
+ 'type' => 'options',
194
+ 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
195
+ ));
196
+ }
197
+
198
+ $store = $this->_getStore();
199
+ $this->addColumn('price', array(
200
+ 'header' => Mage::helper('catalog')->__('Price'),
201
+ 'type' => 'price',
202
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
203
+ 'index' => 'price',
204
+ ));
205
+
206
+ $this->addExportType('*/*/exportCsv', Mage::helper('featuredproducts')->__('CSV'));
207
+ $this->addExportType('*/*/exportXml', Mage::helper('featuredproducts')->__('Excel XML'));
208
+
209
+ return parent::_prepareColumns();
210
+ }
211
+
212
+ public function getGridUrl() {
213
+ return $this->getUrl('*/*/grid', array('_current' => true));
214
+ }
215
+
216
+ protected function _getSelectedProducts($json = false) {
217
+ $temp = $this->getRequest()->getPost('featured_ids');
218
+ $store = $this->_getStore();
219
+
220
+ if ($temp) {
221
+ parse_str($temp, $featured_ids);
222
+ }
223
+
224
+ $_prod = Mage::getModel('catalog/product')->getCollection()
225
+ ->joinAttribute('ma2_featured_product', 'catalog_product/ma2_featured_product', 'entity_id', null, 'left', $store->getId())
226
+ ->addAttributeToFilter('ma2_featured_product', '1');
227
+
228
+ $products = $_prod->getColumnValues('entity_id');
229
+ $selected_products = array();
230
+
231
+
232
+ if ($json == true) {
233
+ foreach ($products as $key => $value) {
234
+ $selected_products[$value] = '1';
235
+ }
236
+ return Zend_Json::encode($selected_products);
237
+ } else {
238
+
239
+ foreach ($products as $key => $value) {
240
+ if ((isset($featured_ids[$value])) && ($featured_ids[$value] == 0)) {
241
+
242
+ }else
243
+ $selected_products[$value] = '0';
244
+ }
245
+
246
+ if (isset($featured_ids))
247
+ foreach ($featured_ids as $key => $value) {
248
+ if ($value == 1)
249
+ $selected_products[$key] = '0';
250
+ }
251
+
252
+ return array_keys($selected_products);
253
+ }
254
+
255
+ return $products;
256
+ }
257
+
258
+ //add javascript before/after grid html
259
+ protected function _afterToHtml($html) {
260
+ return $this->_prependHtml() . parent::_afterToHtml($html) . $this->_appendHtml();
261
+ }
262
+
263
+ private function _prependHtml() {
264
+ $gridName = $this->getJsObjectName();
265
+
266
+ $html =
267
+ <<<EndHTML
268
+ <script type="text/javascript">
269
+ //<![CDATA[
270
+
271
+ categoryForm = new varienForm('featured_edit_form');
272
+ categoryForm.submit= function (url) {
273
+
274
+ this._submit();
275
+
276
+ return true;
277
+
278
+
279
+ };
280
+
281
+ document.observe("dom:loaded", function() {
282
+
283
+ var everycheckbox = $$("#ma2_featured_products_table tbody input.checkbox");
284
+
285
+ everycheckbox.each(function(element, index) {
286
+ element.onclick = function(e)
287
+ {
288
+ var val = element.value;
289
+ if(element.checked)
290
+ {
291
+ element.checked = false;
292
+ checkBoxes.set(val, 0);
293
+ }
294
+ else
295
+ {
296
+ element.checked = "checked";
297
+ checkBoxes.set(val, 1);
298
+ }
299
+ }
300
+ });
301
+
302
+ });
303
+
304
+
305
+ function categorySubmit(url) {
306
+
307
+ var params = {};
308
+ var fields = $('featured_edit_form').getElementsBySelector('input', 'select');
309
+
310
+ categoryForm.submit();
311
+ }
312
+
313
+ function FeaturedRowClick(grid, event)
314
+ {
315
+
316
+ var trElement = Event.findElement(event, 'tr');
317
+ var isInput = Event.element(event).tagName == 'INPUT';
318
+
319
+ var checkbox = Element.getElementsBySelector(trElement, 'input.checkbox').first();
320
+
321
+ if(!checkbox) return;
322
+
323
+ var val = checkbox.value;
324
+
325
+ if(checkbox.checked)
326
+ {
327
+ checkbox.checked = false;
328
+ checkBoxes.set(val, 0);
329
+ }
330
+ else
331
+ {
332
+ checkbox.checked = "checked";
333
+ checkBoxes.set(val, 1);
334
+ }
335
+
336
+ $("saved_featured_products").value = checkBoxes.toQueryString();
337
+ $gridName.reloadParams = {'featured_ids':checkBoxes.toQueryString()};
338
+ }
339
+
340
+ //]]>
341
+
342
+ </script>
343
+ EndHTML;
344
+
345
+ return $html;
346
+ }
347
+
348
+ private function _appendHtml() {
349
+ $html = '<script type="text/javascript">
350
+ var checkBoxes = $H();
351
+
352
+ var checkbox_all = $$("#ma2_featured_products_table thead input.checkbox").first();
353
+ var everycheckbox = $$("#ma2_featured_products_table tbody input.checkbox");
354
+
355
+ checkbox_all.observe("click", function(event) {
356
+
357
+ if(checkbox_all.checked)
358
+ {
359
+ everycheckbox.each(function(element, index) {
360
+
361
+ checkBoxes.set(element.value, 1)
362
+
363
+ });
364
+ } else
365
+ {
366
+ everycheckbox.each(function(element, index) {
367
+ checkBoxes.set(element.value, 0)
368
+ });
369
+ }
370
+ $("saved_featured_products").value = checkBoxes.toQueryString();
371
+ });
372
+
373
+ </script>';
374
+
375
+ return $html;
376
+ }
377
+
378
+ }
379
+ ?>
app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Renderer/Name.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Name.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Block_Adminhtml_Edit_Renderer_Name extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
24
+
25
+ protected $_values;
26
+
27
+ /**
28
+ * Renders grid column
29
+ *
30
+ * @param Varien_Object $row
31
+ * @return string
32
+ */
33
+ public function render(Varien_Object $row) {
34
+
35
+ $action_name = $this->getRequest()->getActionName();
36
+
37
+ if ($action_name == 'exportCsv' || $action_name == 'exportXml') {
38
+ return $row->getName();
39
+ }
40
+
41
+ $href = $this->getUrl('*/catalog_product/edit', array(
42
+ 'store' => $this->getRequest()->getParam('store'),
43
+ 'id' => $row->getId()));
44
+
45
+ $html = '<a href="' . $href . '">' . $row->getName() . '</a>';
46
+
47
+ return $html;
48
+ }
49
+
50
+ }
51
+ ?>
app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Renderer/Thumbnail.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Thumbnail.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Block_Adminhtml_Edit_Renderer_Thumbnail extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
24
+ {
25
+ protected $_values;
26
+
27
+ /**
28
+ * Renders grid column
29
+ *
30
+ * @param Varien_Object $row
31
+ * @return string
32
+ */
33
+ public function render(Varien_Object $row)
34
+ {
35
+ $html = 'No image';
36
+ if ($row->getThumbnail() && $row->getThumbnail() != 'noselection'){
37
+ $html = '<a href="'.Mage::helper('catalog/image')->init($row, 'thumbnail').'" target="_blank"><img src="'. Mage::helper('catalog/image')->init($row, 'thumbnail')->resize(50) . '" alt=""/></a>';
38
+ }
39
+ else if ($row->getSmallImage() && $row->getSmallImage() != 'noselection'){
40
+ $html = '<a href="'.Mage::helper('catalog/image')->init($row, 'small_image').'" target="_blank"><img src="'. Mage::helper('catalog/image')->init($row, 'small_image')->resize(50) . '" alt=""/></a>';
41
+ }
42
+ else if ($row->getImage() && $row->getImage() != 'noselection'){
43
+ $html = '<a href="'.Mage::helper('catalog/image')->init($row, 'image').'" target="_blank"><img src="'. Mage::helper('catalog/image')->init($row, 'image')->resize(50) . '" alt=""/></a>';
44
+ }
45
+
46
+ return $html;
47
+ }
48
+ }
49
+ ?>
app/code/community/Ma2/FeaturedProducts/Block/Adminhtml/Edit/Renderer/Visibility.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Visibility.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Block_Adminhtml_Edit_Renderer_Visibility extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
24
+ {
25
+ protected $_values;
26
+
27
+ /**
28
+ * Renders grid column
29
+ *
30
+ * @param Varien_Object $row
31
+ * @return string
32
+ */
33
+ public function render(Varien_Object $row)
34
+ {
35
+
36
+ $this->_values = Mage::getModel('catalog/product_visibility')->getOptionArray();
37
+
38
+ $html = $this->_values[$row->getData($this->getColumn()->getIndex())];
39
+
40
+ return $html;
41
+ }
42
+ }
43
+ ?>
app/code/community/Ma2/FeaturedProducts/Block/Block.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Block.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Block_Block extends Mage_Catalog_Block_Product_Abstract {
24
+ /*
25
+ * Check sort option and limits set in System->Configuration and apply them
26
+ * Additionally, set template to block so call from CMS will look like {{block type="featuredproducts/listing"}}
27
+ */
28
+ protected $params;
29
+
30
+ public function __construct() {
31
+ parent::__construct();
32
+ $this->setTemplate('ma2_featuredproducts/block.phtml');
33
+ $this->params = (array)Mage::getStoreConfig("featuredproducts/block");
34
+ }
35
+
36
+ /**
37
+ * Get products collection
38
+ */
39
+
40
+ protected function _getProductCollection()
41
+ {
42
+ if (is_null($this->_productCollection)) {
43
+ $collection = Mage::getModel('catalog/product')->getCollection();
44
+ $attributes = Mage::getSingleton('catalog/config')
45
+ ->getProductAttributes();
46
+
47
+ $storeId = Mage::app()->getStore()->getId();
48
+
49
+ $collection->addAttributeToSelect($attributes)
50
+ ->addMinimalPrice()
51
+ ->addFinalPrice()
52
+ ->addTaxPercents()
53
+ ->addAttributeToFilter('status', 1)
54
+ ->addAttributeToFilter('ma2_featured_product', 1)
55
+ ->addStoreFilter($storeId)
56
+ ->setOrder($this->params['sort_by'], $this->params['sort_dir'])
57
+ ;
58
+
59
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
60
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
61
+
62
+ $collection->setPageSize($this->params['products_count'])
63
+ ->setCurPage(1);
64
+ Mage::getModel('review/review')->appendSummary($collection);
65
+ $collection->load();
66
+
67
+ $this->_productCollection = $collection;
68
+ }
69
+
70
+ return $this->_productCollection;
71
+ }
72
+
73
+ /*
74
+ * Load featured products collection
75
+ * */
76
+
77
+ protected function _beforeToHtml() {
78
+
79
+ $this->assign('FeaturedProductCollection',$this->_getProductCollection());
80
+ $_columnCount = $this->params['column_count'];
81
+ if(!$_columnCount || $_columnCount == 0 || empty($_columnCount)) $_columnCount = 3;
82
+ $size_width = 100/$_columnCount;
83
+ $this->assign('item_width',$size_width);
84
+ $this->assign('_columnCount',(int)$_columnCount);
85
+
86
+ /* assign variables in the parameters */
87
+ foreach($this->params as $_para=>$value)
88
+ {
89
+ $this->assign($_para, $value);
90
+ }
91
+
92
+ return parent::_beforeToHtml();
93
+ }
94
+
95
+ protected function _toHtml() {
96
+
97
+ if (!$this->helper('featuredproducts')->getIsActive()) {
98
+ return '';
99
+ }
100
+
101
+ return parent::_toHtml();
102
+ }
103
+
104
+ /*
105
+ * Return label for CMS block output
106
+ * */
107
+
108
+ protected function getBlockLabel() {
109
+ return $this->helper('featuredproducts')->getCmsBlockLabel();
110
+ }
111
+
112
+ }
113
+
114
+ ?>
app/code/community/Ma2/FeaturedProducts/Block/Standalone/List.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: List.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Block_Standalone_List extends Mage_Catalog_Block_Product_List
24
+ {
25
+ protected $_productCollection;
26
+ protected $params;
27
+
28
+ public function __construct() {
29
+ parent::__construct();
30
+ $this->params = (array)Mage::getStoreConfig("featuredproducts/standalone");
31
+ }
32
+
33
+ protected function _prepareLayout()
34
+ {
35
+ if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
36
+ $breadcrumbsBlock->addCrumb('home', array(
37
+ 'label'=>Mage::helper('catalog')->__('Home'),
38
+ 'title'=>Mage::helper('catalog')->__('Go to Home Page'),
39
+ 'link'=>Mage::getBaseUrl()
40
+ ));
41
+ }
42
+
43
+ parent::_prepareLayout();
44
+ }
45
+
46
+
47
+ /*
48
+ * Load featured products collection
49
+ * */
50
+ protected function _getProductCollection()
51
+ {
52
+
53
+ if (is_null($this->_productCollection)) {
54
+ $collection = Mage::getModel('catalog/product')->getCollection();
55
+ $attributes = Mage::getSingleton('catalog/config')
56
+ ->getProductAttributes();
57
+
58
+ $storeId = Mage::app()->getStore()->getId();
59
+
60
+ $limit = (int)$this->getRequest()->getParam('limit') ? (int)$this->getRequest()->getParam('limit') : (int)$this->getToolbarBlock()->getDefaultPerPageValue();
61
+
62
+ $collection->addAttributeToSelect($attributes)
63
+ ->addMinimalPrice()
64
+ ->addFinalPrice()
65
+ ->addTaxPercents()
66
+ ->addAttributeToFilter('status', 1)
67
+ ->addAttributeToFilter('ma2_featured_product', 1)
68
+ ->addStoreFilter($storeId)
69
+ ->setOrder($this->getRequest()->getParam('order'), $this->getRequest()->getParam('dir'))
70
+ ;
71
+
72
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
73
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
74
+
75
+ $collection->setPageSize($limit)
76
+ ->setCurPage($this->getRequest()->getParam('p'));
77
+ Mage::getModel('review/review')->appendSummary($collection);
78
+ $collection->load();
79
+
80
+ $this->_productCollection = $collection;
81
+ }
82
+ return $this->_productCollection;
83
+ }
84
+
85
+
86
+ /*
87
+ * Remove "Position" option from Sort By dropdown
88
+ * Assign product and params
89
+ */
90
+ protected function _beforeToHtml()
91
+ {
92
+ parent::_beforeToHtml();
93
+ $toolbar = $this->getToolbarBlock();
94
+ $toolbar->removeOrderFromAvailableOrders('position');
95
+
96
+ if (!$this->_getProductCollection()->count()){
97
+ return '';
98
+ }
99
+
100
+ $this->assign('FeaturedProductCollection', $this->_getProductCollection());
101
+ $_columnCount = (int)$this->params['column_count'];
102
+ if(!$_columnCount || $_columnCount == 0 || empty($_columnCount)) $_columnCount = 3;
103
+ $size_width = 100/$_columnCount;
104
+ $this->assign('item_width',$size_width);
105
+ $this->assign('_columnCount', $_columnCount);
106
+ $this->setData('column_count', $_columnCount);
107
+ /* assign variables in the parameters */
108
+ foreach($this->params as $_para=>$value)
109
+ {
110
+ $this->assign($_para, $value);
111
+ }
112
+
113
+ return $this;
114
+ }
115
+
116
+
117
+
118
+ }
119
+ ?>
app/code/community/Ma2/FeaturedProducts/Block/Widget.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Widget.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+ ?>
23
+ <?php
24
+ class Ma2_FeaturedProducts_Block_Widget extends Mage_Catalog_Block_Product_Abstract
25
+ implements Mage_Widget_Block_Interface
26
+ {
27
+
28
+ /**
29
+ * Get products collection
30
+ */
31
+
32
+ protected function _getProductCollection()
33
+ {
34
+ if (is_null($this->_productCollection)) {
35
+ $collection = Mage::getModel('catalog/product')->getCollection();
36
+ $attributes = Mage::getSingleton('catalog/config')
37
+ ->getProductAttributes();
38
+
39
+ $storeId = Mage::app()->getStore()->getId();
40
+
41
+ $collection->addAttributeToSelect($attributes)
42
+ ->addMinimalPrice()
43
+ ->addFinalPrice()
44
+ ->addTaxPercents()
45
+ ->addAttributeToFilter('status', 1)
46
+ ->addAttributeToFilter('ma2_featured_product', 1)
47
+ ->addStoreFilter($storeId)
48
+ ->setOrder($this->getData('sort_by'), $this->getData('sort_dir'))
49
+ ;
50
+
51
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
52
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
53
+
54
+ $collection->setPageSize($this->getData('products_count'))
55
+ ->setCurPage(1);
56
+ Mage::getModel('review/review')->appendSummary($collection);
57
+ $collection->load();
58
+
59
+ $this->_productCollection = $collection;
60
+ }
61
+
62
+ return $this->_productCollection;
63
+ }
64
+
65
+
66
+ /**
67
+ * To html
68
+ * Assign variables
69
+ */
70
+ protected function _toHtml()
71
+ {
72
+ $this->assign('WidgetProductProductCollection',$this->_getProductCollection());
73
+ $_columnCount = $this->getData('column_count');
74
+ if(!$_columnCount || $_columnCount == 0 || empty($_columnCount)) $_columnCount = 3;
75
+ $size_width = 100/$_columnCount;
76
+ $this->assign('item_width',$size_width);
77
+ $this->assign('_columnCount',(int)$_columnCount);
78
+ /* assign variables in the parameters */
79
+ foreach($this->getData() as $_para=>$value)
80
+ {
81
+ $this->assign($_para, $value);
82
+ }
83
+ return parent::_toHtml();
84
+ }
85
+
86
+ }
87
+ ?>
app/code/community/Ma2/FeaturedProducts/Helper/Data.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Data.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Helper_Data extends Mage_Core_Helper_Abstract {
24
+
25
+ const PATH_PAGE_HEADING = 'featuredproducts/standalone/heading';
26
+ const DEFAULT_LABEL = 'Featured Products';
27
+
28
+ public function getCmsBlockLabel() {
29
+ $configValue = Mage::getStoreConfig(self::PATH_CMS_HEADING);
30
+ return strlen($configValue) > 0 ? $configValue : self::DEFAULT_LABEL;
31
+ }
32
+
33
+ public function getPageLabel() {
34
+ $configValue = Mage::getStoreConfig(self::PATH_PAGE_HEADING);
35
+ return strlen($configValue) > 0 ? $configValue : self::DEFAULT_LABEL;
36
+ }
37
+
38
+ public function getIsActive() {
39
+ return (bool) Mage::getStoreConfig('featuredproducts/standalone/active');
40
+ }
41
+
42
+ }
43
+ ?>
app/code/community/Ma2/FeaturedProducts/Model/System/Config/Source/Listtype.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Listtype.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Model_System_Config_Source_Listtype
24
+ {
25
+ /*
26
+ * Prepare data for System->Configuration dropdown
27
+ * */
28
+ public function toOptionArray()
29
+ {
30
+ return array(
31
+ 'grid' => Mage::helper('adminhtml')->__('Grid'),
32
+ 'list' => Mage::helper('adminhtml')->__('List')
33
+ );
34
+ }
35
+ }
36
+ ?>
app/code/community/Ma2/FeaturedProducts/Model/System/Config/Source/Sortby.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Sortby.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Model_System_Config_Source_Sortby
24
+ {
25
+ /*
26
+ * Prepare data for System->Configuration dropdown
27
+ * */
28
+ public function toOptionArray()
29
+ {
30
+ return array(
31
+ 'price' => Mage::helper('adminhtml')->__('Price'),
32
+ 'name' => Mage::helper('adminhtml')->__('Name'),
33
+ 'created_at' => Mage::helper('adminhtml')->__('Created date')
34
+ );
35
+ }
36
+ }
37
+ ?>
app/code/community/Ma2/FeaturedProducts/Model/System/Config/Source/Sortdir.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: Sortdir.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Model_System_Config_Source_Sortdir
24
+ {
25
+ /*
26
+ * Prepare data for System->Configuration dropdown
27
+ * */
28
+ public function toOptionArray()
29
+ {
30
+ return array(
31
+ 'DESC' => Mage::helper('adminhtml')->__('DESC'),
32
+ 'ASC' => Mage::helper('adminhtml')->__('ASC')
33
+ );
34
+ }
35
+ }
36
+ ?>
app/code/community/Ma2/FeaturedProducts/controllers/Adminhtml/FeaturedController.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: FeaturedController.php 5 2013-11-06 09:05:49Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_Adminhtml_FeaturedController extends Mage_Adminhtml_Controller_Action {
24
+
25
+ protected function _initProduct() {
26
+
27
+ $product = Mage::getModel('catalog/product')
28
+ ->setStoreId($this->getRequest()->getParam('store', 0));
29
+
30
+
31
+ if ($setId = (int) $this->getRequest()->getParam('set')) {
32
+ $product->setAttributeSetId($setId);
33
+ }
34
+
35
+ if ($typeId = $this->getRequest()->getParam('type')) {
36
+ $product->setTypeId($typeId);
37
+ }
38
+
39
+ $product->setData('_edit_mode', true);
40
+
41
+ Mage::register('product', $product);
42
+
43
+ return $product;
44
+ }
45
+
46
+ public function indexAction() {
47
+ $this->_initProduct();
48
+
49
+ $this->loadLayout()->_setActiveMenu('ma2/featuredproduct');
50
+
51
+ $this->_addContent($this->getLayout()->createBlock('featuredproducts/adminhtml_edit'));
52
+
53
+ $this->renderLayout();
54
+ }
55
+
56
+ public function gridAction() {
57
+
58
+ $this->getResponse()->setBody(
59
+ $this->getLayout()->createBlock('featuredproducts/adminhtml_edit_grid')->toHtml()
60
+ );
61
+ }
62
+
63
+ public function saveAction() {
64
+ $data = $this->getRequest()->getPost();
65
+ $collection = Mage::getModel('catalog/product')->getCollection();
66
+ $storeId = $this->getRequest()->getParam('store', 0);
67
+
68
+
69
+ parse_str($data['featured_products'], $featured_products);
70
+
71
+
72
+ $collection->addIdFilter(array_keys($featured_products));
73
+
74
+ try {
75
+
76
+ foreach ($collection->getItems() as $product) {
77
+
78
+ $product->setData('ma2_featured_product', $featured_products[$product->getEntityId()]);
79
+ $product->setStoreId($storeId);
80
+ $product->save();
81
+ }
82
+
83
+
84
+ $this->_getSession()->addSuccess($this->__('Featured product was successfully saved.'));
85
+ $this->_redirect('*/*/index', array('store' => $this->getRequest()->getParam('store')));
86
+ } catch (Exception $e) {
87
+ $this->_getSession()->addError($e->getMessage());
88
+ $this->_redirect('*/*/index', array('store' => $this->getRequest()->getParam('store')));
89
+ }
90
+ }
91
+
92
+ protected function _validateSecretKey() {
93
+ return true;
94
+ }
95
+
96
+ protected function _isAllowed() {
97
+ return Mage::getSingleton('admin/session')->isAllowed('admin/ma2/featuredproduct');
98
+ }
99
+
100
+ private function _getExportFileName($extension='csv') {
101
+
102
+ $store_id = $this->getRequest()->getParam('store');
103
+
104
+ $name = 'featured_products_';
105
+
106
+ if ($store_id) {
107
+ $store = Mage::getModel('core/store')->load($store_id);
108
+
109
+ if ($store && $store->getId()) {
110
+ return $name . $store->getName() . '.' . $extension;
111
+ }
112
+ }
113
+
114
+ return $name . 'AllStores.' . $extension;
115
+ }
116
+
117
+ /**
118
+ * Export stylist grid to CSV format
119
+ */
120
+ public function exportCsvAction() {
121
+
122
+ $fileName = $this->_getExportFileName('csv');
123
+
124
+ $content = $this->getLayout()->createBlock('featuredproducts/adminhtml_edit_grid')
125
+ ->getCsvFile();
126
+
127
+ $this->_prepareDownloadResponse($fileName, $content);
128
+ }
129
+
130
+ /**
131
+ * Export stylist grid to XML format
132
+ */
133
+ public function exportXmlAction() {
134
+
135
+ $fileName = $this->_getExportFileName('xml');
136
+
137
+ $content = $this->getLayout()->createBlock('featuredproducts/adminhtml_edit_grid')
138
+ ->getExcelFile();
139
+
140
+ $this->_prepareDownloadResponse($fileName, $content);
141
+ }
142
+
143
+ }
144
+ ?>
app/code/community/Ma2/FeaturedProducts/controllers/IndexController.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: IndexController.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ class Ma2_FeaturedProducts_IndexController extends Mage_Core_Controller_Front_Action {
24
+ /*
25
+ * Check settings set in System->Configuration and apply them for featured-products page
26
+ * */
27
+
28
+ public function indexAction() {
29
+
30
+ if (!Mage::helper('featuredproducts')->getIsActive()) {
31
+ $this->_forward('noRoute');
32
+ return;
33
+ }
34
+
35
+ $template = Mage::getConfig()->getNode('global/page/layouts/' . Mage::getStoreConfig("featuredproducts/standalone/layout") . '/template');
36
+
37
+ $this->loadLayout();
38
+
39
+ $this->getLayout()->getBlock('root')->setTemplate($template);
40
+ $this->getLayout()->getBlock('head')->setTitle($this->__(Mage::getStoreConfig("featuredproducts/standalone/meta_title")));
41
+ $this->getLayout()->getBlock('head')->setDescription($this->__(Mage::getStoreConfig("featuredproducts/standalone/meta_description")));
42
+ $this->getLayout()->getBlock('head')->setKeywords($this->__(Mage::getStoreConfig("featuredproducts/standalone/meta_keywords")));
43
+
44
+ $breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs');
45
+ $breadcrumbsBlock->addCrumb('featured_products', array(
46
+ 'label' => Mage::helper('featuredproducts')->__(Mage::helper('featuredproducts')->getPageLabel()),
47
+ 'title' => Mage::helper('featuredproducts')->__(Mage::helper('featuredproducts')->getPageLabel()),
48
+ ));
49
+
50
+ $this->renderLayout();
51
+ }
52
+
53
+ }
54
+ ?>
app/code/community/Ma2/FeaturedProducts/etc/adminhtml.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <menu>
3
+ <ma2>
4
+ <children>
5
+ <featuredproduct translate="title">
6
+ <title>Featured Products</title>
7
+ <sort_order>19</sort_order>
8
+ <action>adminhtml/featured/index</action>
9
+ <children>
10
+ <featuredproduct_manager translate="title">
11
+ <title>Featured products manager</title>
12
+ <sort_order>1</sort_order>
13
+ <action>adminhtml/featured/index</action>
14
+ </featuredproduct_manager>
15
+ <featuredproduct_config translate="title">
16
+ <title>Configuration</title>
17
+ <sort_order>2</sort_order>
18
+ <action>adminhtml/system_config/edit/section/featuredproducts</action>
19
+ </featuredproduct_config>
20
+ </children>
21
+ </featuredproduct>
22
+ </children>
23
+ </ma2>
24
+ </menu>
25
+
26
+ <acl>
27
+ <resources>
28
+ <admin>
29
+ <children>
30
+ <system>
31
+ <children>
32
+ <config>
33
+ <children>
34
+ <featuredproducts translate="title" module="featuredproducts">
35
+ <title>Featured Products Settings</title>
36
+ <sort_order>50</sort_order>
37
+ </featuredproducts>
38
+ </children>
39
+ </config>
40
+ </children>
41
+ </system>
42
+ </children>
43
+ </admin>
44
+ <admin>
45
+ <children>
46
+ <ma2>
47
+ <children>
48
+ <featuredproduct translate="title" module="featuredproducts">
49
+ <title>Ma2 Featured Products</title>
50
+ <sort_order>60</sort_order>
51
+ <children>
52
+ <featuredproduct_manager>
53
+ <title>Featured products manager</title>
54
+ <sort_order>1</sort_order>
55
+ </featuredproduct_manager>
56
+ <featuredproduct_config>
57
+ <title>Configuration</title>
58
+ <sort_order>2</sort_order>
59
+ </featuredproduct_config>
60
+ </children>
61
+ </featuredproduct>
62
+ </children>
63
+ </ma2>
64
+ </children>
65
+ </admin>
66
+ </resources>
67
+ </acl>
68
+ </config>
app/code/community/Ma2/FeaturedProducts/etc/config.xml ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_FeaturedProducts>
5
+ <version>1.0.0</version>
6
+ </Ma2_FeaturedProducts>
7
+ </modules>
8
+
9
+ <global>
10
+ <blocks>
11
+ <featuredproducts>
12
+ <class>Ma2_FeaturedProducts_Block</class>
13
+ </featuredproducts>
14
+ </blocks>
15
+
16
+ <helpers>
17
+ <featuredproducts>
18
+ <class>Ma2_FeaturedProducts_Helper</class>
19
+ </featuredproducts>
20
+ </helpers>
21
+
22
+ <models>
23
+ <featuredproducts>
24
+ <class>Ma2_FeaturedProducts_Model</class>
25
+ </featuredproducts>
26
+ </models>
27
+
28
+ <resources>
29
+ <featuredproducts_setup>
30
+ <setup>
31
+ <module>Ma2_FeaturedProducts</module>
32
+ <class>Mage_Eav_Model_Entity_Setup</class>
33
+ </setup>
34
+
35
+ <connection>
36
+ <use>core_setup</use>
37
+ </connection>
38
+ </featuredproducts_setup>
39
+
40
+ <featuredproducts_write>
41
+ <connection>
42
+ <use>core_write</use>
43
+ </connection>
44
+ </featuredproducts_write>
45
+ <featuredproducts_read>
46
+ <connection>
47
+ <use>core_read</use>
48
+ </connection>
49
+ </featuredproducts_read>
50
+ </resources>
51
+ </global>
52
+
53
+ <frontend>
54
+ <routers>
55
+ <featuredproducts>
56
+ <use>standard</use>
57
+ <args>
58
+ <module>Ma2_FeaturedProducts</module>
59
+ <frontName>featured-products</frontName>
60
+ </args>
61
+ </featuredproducts>
62
+ </routers>
63
+ <layout>
64
+ <updates>
65
+ <featuredproducts>
66
+ <file>ma2_featuredproducts.xml</file>
67
+ </featuredproducts>
68
+ </updates>
69
+ </layout>
70
+ </frontend>
71
+
72
+ <admin>
73
+ <routers>
74
+ <adminhtml>
75
+ <args>
76
+ <modules>
77
+ <featuredproducts before="Mage_Adminhtml">Ma2_FeaturedProducts_Adminhtml</featuredproducts>
78
+ </modules>
79
+ </args>
80
+ </adminhtml>
81
+ </routers>
82
+ </admin>
83
+
84
+ <default>
85
+ <featuredproducts>
86
+ <block>
87
+ <heading>Featured Products</heading>
88
+ <show_heading>1</show_heading>
89
+ <products_count>6</products_count>
90
+ <sort_by>created_at</sort_by>
91
+ <sort_dir>DESC</sort_dir>
92
+ <list_type>grid</list_type>
93
+ <column_count>3</column_count>
94
+ <show_addtocart>1</show_addtocart>
95
+ <show_details>1</show_details>
96
+ <show_price>1</show_price>
97
+ <show_short_description>1</show_short_description>
98
+ <short_description_limit>88</short_description_limit>
99
+ <thumbnail_width>135</thumbnail_width>
100
+ <thumbnail_height>135</thumbnail_height>
101
+ </block>
102
+ <standalone>
103
+ <active>0</active>
104
+ <heading>Featured Products</heading>
105
+ <layout>two_columns_right</layout>
106
+ <column_count>3</column_count>
107
+ <show_heading>1</show_heading>
108
+ <show_addtocart>1</show_addtocart>
109
+ <show_details>1</show_details>
110
+ <show_price>1</show_price>
111
+ <show_short_description>1</show_short_description>
112
+ <short_description_limit>88</short_description_limit>
113
+ <thumbnail_width>135</thumbnail_width>
114
+ <thumbnail_height>135</thumbnail_height>
115
+ <meta_title>Featured Products</meta_title>
116
+ <meta_description>Check out our great collection of Featured products</meta_description>
117
+ <meta_keywords>featured, products</meta_keywords>
118
+ </standalone>
119
+ </featuredproducts>
120
+ </default>
121
+ </config>
app/code/community/Ma2/FeaturedProducts/etc/system.xml ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <ma2 translate="label" module="ma2all">
5
+ <label>MagenMarket Extensions</label>
6
+ <sort_order>168</sort_order>
7
+ </ma2>
8
+ </tabs>
9
+ <sections>
10
+ <featuredproducts translate="label" module="featuredproducts">
11
+ <class>separator-top</class>
12
+ <label>Ma2 Featured Products</label>
13
+ <tab>ma2</tab>
14
+ <sort_order>10</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
+ <block translate="label">
20
+ <label>Featured Products Block</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <heading translate="label comment">
28
+ <label>Block Heading</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>2</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
+ </heading>
35
+ <show_heading translate="label comment">
36
+ <required>1</required>
37
+ <visible>1</visible>
38
+ <label>Display Block Heading</label>
39
+ <comment>Choose NO to hide the Block heading.</comment>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>adminhtml/system_config_source_yesno</source_model>
42
+ <sort_order>6</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </show_heading>
47
+ <products_count translate="label">
48
+ <required>1</required>
49
+ <visible>1</visible>
50
+ <label>Maximum number of products</label>
51
+ <value>6</value>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>9</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </products_count>
58
+ <sort_by translate="label">
59
+ <visible>1</visible>
60
+ <label>Sort by</label>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>featuredproducts/system_config_source_sortby</source_model>
63
+ <sort_order>11</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ </sort_by>
68
+ <sort_dir translate="label">
69
+ <visible>1</visible>
70
+ <label>Sort direction</label>
71
+ <frontend_type>select</frontend_type>
72
+ <source_model>featuredproducts/system_config_source_sortdir</source_model>
73
+ <sort_order>13</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
+ </sort_dir>
78
+ <list_type translate="label">
79
+ <visible>1</visible>
80
+ <label>Display mode (grid, list)</label>
81
+ <frontend_type>select</frontend_type>
82
+ <source_model>featuredproducts/system_config_source_listtype</source_model>
83
+ <sort_order>15</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
+ </list_type>
88
+ <column_count>
89
+ <required>0</required>
90
+ <visible>1</visible>
91
+ <label>Number of products per row</label>
92
+ <value>3</value>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>17</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ <depends>
99
+ <list_type><value>grid</value></list_type>
100
+ </depends>
101
+ </column_count>
102
+ <show_addtocart translate="label">
103
+ <visible>1</visible>
104
+ <label> Show Add To Cart button</label>
105
+ <frontend_type>select</frontend_type>
106
+ <sort_order>19</sort_order>
107
+ <value>1</value>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ <source_model>adminhtml/system_config_source_yesno</source_model>
112
+ </show_addtocart>
113
+ <show_details translate="label">
114
+ <visible>1</visible>
115
+ <label> Show Details button</label>
116
+ <frontend_type>select</frontend_type>
117
+ <sort_order>21</sort_order>
118
+ <value>1</value>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ </show_details>
124
+ <show_price translate="label">
125
+ <visible>1</visible>
126
+ <label>Show Price</label>
127
+ <frontend_type>select</frontend_type>
128
+ <sort_order>23</sort_order>
129
+ <value>1</value>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ </show_price>
135
+ <show_short_description translate="label">
136
+ <visible>1</visible>
137
+ <label>Show short description</label>
138
+ <frontend_type>select</frontend_type>
139
+ <sort_order>25</sort_order>
140
+ <value>1</value>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ <source_model>adminhtml/system_config_source_yesno</source_model>
145
+ </show_short_description>
146
+ <short_description_limit>
147
+ <required>0</required>
148
+ <visible>1</visible>
149
+ <label>Short description characters limit</label>
150
+ <frontend_type>text</frontend_type>
151
+ <sort_order>27</sort_order>
152
+ <value>88</value>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ <depends>
157
+ <show_short_description><value>1</value></show_short_description>
158
+ </depends>
159
+ </short_description_limit>
160
+ <thumbnail_width>
161
+ <required>0</required>
162
+ <visible>1</visible>
163
+ <label>Width of thumbnail image</label>
164
+ <frontend_type>text</frontend_type>
165
+ <sort_order>29</sort_order>
166
+ <value>135</value>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ </thumbnail_width>
171
+ <thumbnail_height>
172
+ <required>0</required>
173
+ <visible>1</visible>
174
+ <label>Height of thumbnail image</label>
175
+ <frontend_type>text</frontend_type>
176
+ <sort_order>31</sort_order>
177
+ <value>135</value>
178
+ <show_in_default>1</show_in_default>
179
+ <show_in_website>1</show_in_website>
180
+ <show_in_store>1</show_in_store>
181
+ </thumbnail_height>
182
+ </fields>
183
+ </block>
184
+
185
+ <standalone translate="label">
186
+ <label>Featured Products Standalone Page</label>
187
+ <frontend_type>text</frontend_type>
188
+ <sort_order>1</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ <fields>
193
+ <active translate="label comment">
194
+ <label>Enable standalone page</label>
195
+ <frontend_type>select</frontend_type>
196
+ <source_model>adminhtml/system_config_source_yesno</source_model>
197
+ <sort_order>2</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ <show_in_store>1</show_in_store>
201
+ </active>
202
+ <heading translate="label comment">
203
+ <label>Page Heading</label>
204
+ <frontend_type>text</frontend_type>
205
+ <sort_order>4</sort_order>
206
+ <show_in_default>1</show_in_default>
207
+ <show_in_website>1</show_in_website>
208
+ <show_in_store>1</show_in_store>
209
+ </heading>
210
+ <layout translate="label comment">
211
+ <label>Page Layout</label>
212
+ <comment>Layout for featured-products page</comment>
213
+ <frontend_type>select</frontend_type>
214
+ <source_model>page/source_layout</source_model>
215
+ <sort_order>6</sort_order>
216
+ <show_in_default>1</show_in_default>
217
+ <show_in_website>0</show_in_website>
218
+ <show_in_store>0</show_in_store>
219
+ </layout>
220
+ <show_heading translate="label comment">
221
+ <required>1</required>
222
+ <visible>1</visible>
223
+ <label>Display Page Heading</label>
224
+ <comment>Choose NO to hide the page heading.</comment>
225
+ <frontend_type>select</frontend_type>
226
+ <source_model>adminhtml/system_config_source_yesno</source_model>
227
+ <sort_order>8</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ </show_heading>
232
+
233
+ <spacer1>
234
+ <frontend_type>label</frontend_type>
235
+ <sort_order>10</sort_order>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>1</show_in_store>
239
+ </spacer1>
240
+ <spacer2>
241
+ <label>[ FEATURED PRODUCTS LISTING OPTIONS ]</label>
242
+ <frontend_type>label</frontend_type>
243
+ <sort_order>12</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ <comment><![CDATA[<strong>Note:</strong> To setup default value of List mode, Products per page, Available values of Product per page, etc. please go to <em>System -> Configuration -> Catalog -> Catalog -> Frontend</em>. ]]></comment>
248
+ </spacer2>
249
+
250
+
251
+ <column_count>
252
+ <required>0</required>
253
+ <visible>1</visible>
254
+ <label>Number of products per row in grid mode</label>
255
+ <value>3</value>
256
+ <frontend_type>text</frontend_type>
257
+ <sort_order>16</sort_order>
258
+ <show_in_default>1</show_in_default>
259
+ <show_in_website>1</show_in_website>
260
+ <show_in_store>1</show_in_store>
261
+ </column_count>
262
+ <show_addtocart translate="label">
263
+ <visible>1</visible>
264
+ <label> Show Add To Cart button</label>
265
+ <frontend_type>select</frontend_type>
266
+ <sort_order>19</sort_order>
267
+ <value>1</value>
268
+ <show_in_default>1</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>1</show_in_store>
271
+ <source_model>adminhtml/system_config_source_yesno</source_model>
272
+ </show_addtocart>
273
+ <show_details translate="label">
274
+ <visible>1</visible>
275
+ <label> Show Details button</label>
276
+ <frontend_type>select</frontend_type>
277
+ <sort_order>21</sort_order>
278
+ <value>1</value>
279
+ <show_in_default>1</show_in_default>
280
+ <show_in_website>1</show_in_website>
281
+ <show_in_store>1</show_in_store>
282
+ <source_model>adminhtml/system_config_source_yesno</source_model>
283
+ </show_details>
284
+ <show_price translate="label">
285
+ <visible>1</visible>
286
+ <label>Show Price</label>
287
+ <frontend_type>select</frontend_type>
288
+ <sort_order>23</sort_order>
289
+ <value>1</value>
290
+ <show_in_default>1</show_in_default>
291
+ <show_in_website>1</show_in_website>
292
+ <show_in_store>1</show_in_store>
293
+ <source_model>adminhtml/system_config_source_yesno</source_model>
294
+ </show_price>
295
+ <show_short_description translate="label">
296
+ <visible>1</visible>
297
+ <label>Show short description</label>
298
+ <frontend_type>select</frontend_type>
299
+ <sort_order>25</sort_order>
300
+ <value>1</value>
301
+ <show_in_default>1</show_in_default>
302
+ <show_in_website>1</show_in_website>
303
+ <show_in_store>1</show_in_store>
304
+ <source_model>adminhtml/system_config_source_yesno</source_model>
305
+ </show_short_description>
306
+ <short_description_limit>
307
+ <required>0</required>
308
+ <visible>1</visible>
309
+ <label>Short description characters limit</label>
310
+ <frontend_type>text</frontend_type>
311
+ <sort_order>27</sort_order>
312
+ <value>88</value>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>1</show_in_website>
315
+ <show_in_store>1</show_in_store>
316
+ <depends>
317
+ <show_short_description><value>1</value></show_short_description>
318
+ </depends>
319
+ </short_description_limit>
320
+ <thumbnail_width>
321
+ <required>0</required>
322
+ <visible>1</visible>
323
+ <label>Width of thumbnail image</label>
324
+ <frontend_type>text</frontend_type>
325
+ <sort_order>29</sort_order>
326
+ <value>135</value>
327
+ <show_in_default>1</show_in_default>
328
+ <show_in_website>1</show_in_website>
329
+ <show_in_store>1</show_in_store>
330
+ </thumbnail_width>
331
+ <thumbnail_height>
332
+ <required>0</required>
333
+ <visible>1</visible>
334
+ <label>Height of thumbnail image</label>
335
+ <frontend_type>text</frontend_type>
336
+ <sort_order>31</sort_order>
337
+ <value>135</value>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
+ </thumbnail_height>
342
+
343
+ <spacer3>
344
+ <frontend_type>label</frontend_type>
345
+ <sort_order>33</sort_order>
346
+ <show_in_default>1</show_in_default>
347
+ <show_in_website>1</show_in_website>
348
+ <show_in_store>1</show_in_store>
349
+ </spacer3>
350
+ <spacer4>
351
+ <label>[ PAGE SEO OPTIONS ]</label>
352
+ <frontend_type>label</frontend_type>
353
+ <sort_order>34</sort_order>
354
+ <show_in_default>1</show_in_default>
355
+ <show_in_website>1</show_in_website>
356
+ <show_in_store>1</show_in_store>
357
+ </spacer4>
358
+
359
+ <meta_title translate="label comment">
360
+ <label>Meta Title</label>
361
+ <frontend_type>text</frontend_type>
362
+ <sort_order>35</sort_order>
363
+ <show_in_default>1</show_in_default>
364
+ <show_in_website>1</show_in_website>
365
+ <show_in_store>1</show_in_store>
366
+ </meta_title>
367
+
368
+ <meta_description translate="label comment">
369
+ <label>Meta Description</label>
370
+ <frontend_type>textarea</frontend_type>
371
+ <sort_order>37</sort_order>
372
+ <show_in_default>1</show_in_default>
373
+ <show_in_website>1</show_in_website>
374
+ <show_in_store>1</show_in_store>
375
+ </meta_description>
376
+
377
+ <meta_keywords translate="label comment">
378
+ <label>Meta Keywords</label>
379
+ <frontend_type>textarea</frontend_type>
380
+ <sort_order>39</sort_order>
381
+ <show_in_default>1</show_in_default>
382
+ <show_in_website>1</show_in_website>
383
+ <show_in_store>1</show_in_store>
384
+ </meta_keywords>
385
+ </fields>
386
+ </standalone>
387
+ </groups>
388
+ </featuredproducts>
389
+ </sections>
390
+ </config>
app/code/community/Ma2/FeaturedProducts/etc/widget.xml ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <widgets>
3
+ <featuredproduts translate="name description" type="featuredproducts/widget">
4
+ <name>Ma2 Featured Products widget (standalone)</name>
5
+ <description type="desc">Help adding featured products listing to CMS page or static block</description>
6
+ <parameters>
7
+ <widget_title translate="label description">
8
+ <required>0</required>
9
+ <visible>1</visible>
10
+ <label>Frontend Title</label>
11
+ <value>Featured Products</value>
12
+ <type>text</type>
13
+ <description>The frontend widget instance title</description>
14
+ </widget_title>
15
+ <show_widget_title translate="label description">
16
+ <required>1</required>
17
+ <visible>1</visible>
18
+ <label>Display Frontend Title</label>
19
+ <description>Choose NO to hide the frontend widget instance title.</description>
20
+ <type>select</type>
21
+ <source_model>adminhtml/system_config_source_yesno</source_model>
22
+ </show_widget_title>
23
+ <products_count translate="label">
24
+ <required>1</required>
25
+ <visible>1</visible>
26
+ <label>Maximum number of products</label>
27
+ <value>6</value>
28
+ <type>text</type>
29
+ </products_count>
30
+ <sort_by translate="label">
31
+ <visible>1</visible>
32
+ <label>Sort by</label>
33
+ <type>select</type>
34
+ <values>
35
+ <price translate="label">
36
+ <value>price</value>
37
+ <label>Price</label>
38
+ </price>
39
+ <name translate="label">
40
+ <value>name</value>
41
+ <label>Name</label>
42
+ </name>
43
+ <created_at translate="label">
44
+ <value>created_at</value>
45
+ <label>Created date</label>
46
+ </created_at>
47
+ </values>
48
+ </sort_by>
49
+ <sort_dir translate="label">
50
+ <visible>1</visible>
51
+ <label>Sort direction</label>
52
+ <type>select</type>
53
+ <values>
54
+ <asc translate="label">
55
+ <value>ASC</value><label>ASC</label>
56
+ </asc>
57
+ <desc translate="label">
58
+ <value>DESC</value><label>DESC</label>
59
+ </desc>
60
+ </values>
61
+ </sort_dir>
62
+ <list_type translate="label">
63
+ <visible>1</visible>
64
+ <label>Display mode (grid, list)</label>
65
+ <type>select</type>
66
+ <values>
67
+ <grid_type translate="label">
68
+ <label>Grid</label>
69
+ <value>grid</value>
70
+ </grid_type>
71
+ <list_type translate="label">
72
+ <label>List</label>
73
+ <value>list</value>
74
+ </list_type>
75
+ </values>
76
+ </list_type>
77
+ <column_count>
78
+ <required>0</required>
79
+ <visible>1</visible>
80
+ <label>Number of products per row</label>
81
+ <value>3</value>
82
+ <type>text</type>
83
+ <depends>
84
+ <list_type><value>grid</value></list_type>
85
+ </depends>
86
+ </column_count>
87
+ <show_addtocart translate="label">
88
+ <visible>1</visible>
89
+ <label> Show Add To Cart button</label>
90
+ <type>select</type>
91
+ <value>1</value>
92
+ <source_model>adminhtml/system_config_source_yesno</source_model>
93
+ </show_addtocart>
94
+ <show_details translate="label">
95
+ <visible>1</visible>
96
+ <label> Show Details button</label>
97
+ <type>select</type>
98
+ <value>1</value>
99
+ <source_model>adminhtml/system_config_source_yesno</source_model>
100
+ </show_details>
101
+ <show_price translate="label">
102
+ <visible>1</visible>
103
+ <label>Show Price</label>
104
+ <type>select</type>
105
+ <value>1</value>
106
+ <source_model>adminhtml/system_config_source_yesno</source_model>
107
+ </show_price>
108
+ <show_short_description translate="label">
109
+ <visible>1</visible>
110
+ <label>Show short description</label>
111
+ <type>select</type>
112
+ <value>1</value>
113
+ <source_model>adminhtml/system_config_source_yesno</source_model>
114
+ </show_short_description>
115
+ <short_description_limit>
116
+ <required>0</required>
117
+ <visible>1</visible>
118
+ <label>Short description characters limit</label>
119
+ <type>text</type>
120
+ <value>88</value>
121
+ <depends>
122
+ <show_short_description><value>1</value></show_short_description>
123
+ </depends>
124
+ </short_description_limit>
125
+ <thumbnail_width>
126
+ <required>0</required>
127
+ <visible>1</visible>
128
+ <label>Width of thumbnail image</label>
129
+ <type>text</type>
130
+ <value>135</value>
131
+ </thumbnail_width>
132
+ <thumbnail_height>
133
+ <required>0</required>
134
+ <visible>1</visible>
135
+ <label>Height of thumbnail image</label>
136
+ <type>text</type>
137
+ <value>135</value>
138
+ </thumbnail_height>
139
+ <template>
140
+ <required>1</required>
141
+ <visible>1</visible>
142
+ <label>Select template</label>
143
+ <type>select</type>
144
+ <values>
145
+ <default translate="label">
146
+ <value>ma2_featuredproducts/widget.phtml</value>
147
+ <label>Default Template</label>
148
+ </default>
149
+ </values>
150
+ </template>
151
+ </parameters>
152
+ </featuredproduts>
153
+ </widgets>
app/code/community/Ma2/FeaturedProducts/sql/featuredproducts_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: mysql4-install-1.0.0.php 4 2013-11-05 07:31:07Z linhnt $ */
22
+
23
+ $installer = $this;
24
+
25
+ $installer->addAttribute('catalog_product', 'ma2_featured_product', array(
26
+ 'group' => 'General',
27
+ 'type' => 'int',
28
+ 'backend' => '',
29
+ 'frontend' => '',
30
+ 'label' => 'Featured product',
31
+ 'input' => 'boolean',
32
+ 'class' => '',
33
+ 'source' => '',
34
+ 'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
35
+ 'visible' => true,
36
+ 'required' => false,
37
+ 'user_defined' => false,
38
+ 'default' => '0',
39
+ 'searchable' => false,
40
+ 'filterable' => false,
41
+ 'comparable' => false,
42
+ 'visible_on_front' => false,
43
+ 'unique' => false,
44
+ 'apply_to' => 'simple,configurable,virtual,bundle,downloadable',
45
+ 'is_configurable' => false,
46
+ 'used_in_product_listing', '1'
47
+ ));
48
+
49
+ $installer->updateAttribute('catalog_product', 'ma2_featured_product', 'used_in_product_listing', '1');
50
+ $installer->updateAttribute('catalog_product', 'ma2_featured_product', 'is_global', '0');
51
+
52
+ $installer->endSetup();
53
+
54
+ ?>
app/code/local/Ma2/All/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Ma2_All_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
app/code/local/Ma2/All/etc/adminhtml.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <layout>
4
+ <updates>
5
+ <ma2all module="Ma2_All">
6
+ <file>ma2_all.xml</file>
7
+ </ma2all>
8
+ </updates>
9
+ </layout>
10
+ <menu>
11
+ <ma2 translate="title" module="ma2all">
12
+ <title>MA2</title>
13
+ <sort_order>89</sort_order>
14
+ </ma2>
15
+ </menu>
16
+
17
+ <acl>
18
+ <resources>
19
+ <all>
20
+ <title>Allow Everything</title>
21
+ </all>
22
+ <admin>
23
+ <children>
24
+ <ma2>
25
+ <title>MA2</title>
26
+ <sort_order>89</sort_order>
27
+ </ma2>
28
+ <system>
29
+ <children>
30
+ <config>
31
+ <children>
32
+ <ma2all>
33
+ <title>MagenMarket Extensions</title>
34
+ </ma2all>
35
+ </children>
36
+ </config>
37
+ </children>
38
+ </system>
39
+ </children>
40
+ </admin>
41
+ </resources>
42
+ </acl>
43
+ </config>
app/code/local/Ma2/All/etc/config.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_All>
5
+ <version>0.1.0</version>
6
+ </Ma2_All>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <layout>
11
+ <updates>
12
+ <ma2all>
13
+ <file>ma2_all.xml</file>
14
+ </ma2all>
15
+ </updates>
16
+ </layout>
17
+ </frontend>
18
+
19
+ <global>
20
+ <blocks>
21
+ <ma2all>
22
+ <class>Ma2_All_Block</class>
23
+ </ma2all>
24
+ </blocks>
25
+ <resources>
26
+ <ma2all_setup>
27
+ <setup>
28
+ <module>Ma2_All</module>
29
+ </setup>
30
+ <connection>
31
+ <use>core_setup</use>
32
+ </connection>
33
+ </ma2all_setup>
34
+ <ma2all_write>
35
+ <connection>
36
+ <use>core_write</use>
37
+ </connection>
38
+ </ma2all_write>
39
+ <ma2all_read>
40
+ <connection>
41
+ <use>core_read</use>
42
+ </connection>
43
+ </ma2all_read>
44
+ </resources>
45
+ <models>
46
+ <ma2all>
47
+ <class>Ma2_All_Model</class>
48
+ </ma2all>
49
+ </models>
50
+ <helpers>
51
+ <ma2all>
52
+ <class>Ma2_All_Helper</class>
53
+ </ma2all>
54
+ </helpers>
55
+ </global>
56
+ </config>
app/code/local/Ma2/All/etc/system.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <ma2 translate="label" module="ma2all">
5
+ <label>MagenMarket Extensions</label>
6
+ <sort_order>168</sort_order>
7
+ </ma2>
8
+ </tabs>
9
+ </config>
app/design/adminhtml/default/default/layout/ma2_all.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <adminhtml_system_config_edit>
6
+ </adminhtml_system_config_edit>
7
+ </layout>
app/design/frontend/default/default/layout/ma2_all.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>js_css</type><css>ma2_all/ma2all.css</css></action>
6
+ <action method="addJs"><script>ma2_all/ma2all.js</script></action>
7
+ </reference>
8
+ </default>
9
+ </layout>
app/design/frontend/default/default/layout/ma2_featuredproducts.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><css>ma2_featuredproducts/ma2_featuredproducts.css</css></action>
6
+ </reference>
7
+ </default>
8
+ <featuredproducts_index_index>
9
+ <reference name="content">
10
+ <block type="core/template" name="category.products" template="ma2_featuredproducts/standalone.phtml">
11
+ <block type="featuredproducts/standalone_list" name="featured_product_list" as="featured_product_list" template="ma2_featuredproducts/standalone_list.phtml">
12
+ <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
13
+ <block type="page/html_pager" name="product_list_toolbar_pager"/>
14
+ </block>
15
+ <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
16
+ </block>
17
+ </block>
18
+ </reference>
19
+ </featuredproducts_index_index>
20
+ </layout>
app/design/frontend/default/default/template/ma2_featuredproducts/block.phtml ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: block.phtml 4 2013-11-05 07:31:07Z linhnt $ */
22
+ ?>
23
+ <?php
24
+ $_helper = $this->helper('catalog/output');
25
+ $uniqId = Mage::helper('core')->uniqHash("ma2-featuredproducts-");
26
+ ?>
27
+ <div class="ma2-featuredproducts block-featured-products <?php echo $list_type; ?>-view" id="<?php echo $uniqId; ?>">
28
+ <div class="block-inner">
29
+ <?php if (isset($show_heading) && (int)$show_heading == 1): ?>
30
+ <h3 class="block-title">
31
+ <span class="format-span">
32
+ <span><?php echo $heading;?></span>
33
+ </span>
34
+ </h3>
35
+ <?php endif; ?>
36
+
37
+ <?php if(!$FeaturedProductCollection->count()): ?>
38
+ <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
39
+ <?php else: ?>
40
+
41
+ <div class="product-items">
42
+ <div class="product-items-inner">
43
+ <?php
44
+ $idx=0;
45
+ $_collectionSize = $FeaturedProductCollection->count();
46
+ $inlineStyle = ($list_type == 'grid') ? 'style="width:'.$item_width.'%;"' : '';
47
+ if ($list_type == 'grid' && ($column_count == null || (int)$column_count == 0)) $column_count = 3;
48
+ if ($list_type == 'list') $column_count = 1;
49
+ if (!intval($thumbnail_width)) $thumbnail_width = 135;
50
+ if (!intval($thumbnail_height)) $thumbnail_height = 135;
51
+ ?>
52
+ <?php foreach ($FeaturedProductCollection->getItems() as $pid => $_product): ?>
53
+ <div class="product-item product-<?php echo $pid; ?> <?php echo ($idx == 0) ? 'first' : (($idx+1) == $_collectionSize ? 'last' : ''); ?>" <?php echo $inlineStyle ?>>
54
+ <div class="product-item-inner">
55
+
56
+ <a class="product-image" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
57
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(intval($thumbnail_width), intval($thumbnail_height)); ?>" width="<?php echo intval($thumbnail_width); ?>" height="<?php echo intval($thumbnail_height); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
58
+ </a>
59
+ <div class="product-info">
60
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
61
+ <h4 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h4>
62
+ <?php if($_product->getRatingSummary()): ?>
63
+ <?php echo $this->getReviewsSummaryHtml($_product); ?>
64
+ <?php endif; ?>
65
+
66
+ <?php if($show_short_description == 1):?>
67
+ <div class="product-desc std">
68
+ <?php
69
+ $desc = $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description');
70
+ if(isset($short_description_limit) && !empty($short_description_limit)):
71
+ $shortDesc = explode('|', wordwrap($desc, $short_description_limit, '|'));
72
+ else:
73
+ $shortDesc = explode('|', wordwrap($desc, 88, '|'));
74
+ endif;
75
+ echo $shortDesc[0] . '...';
76
+ ?>
77
+ <?php if($show_details == 1): ?>
78
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="view-detail"><?php echo $this->__('Details') ?></a>
79
+ <?php endif;?>
80
+ </div>
81
+ <?php endif;?>
82
+ <?php if($show_price == 1): ?>
83
+ <?php echo $this->getPriceHtml($_product, true) ?>
84
+ <?php endif;?>
85
+ <div class="actions">
86
+ <ul class="add-to-links">
87
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
88
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
89
+ <?php endif; ?>
90
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
91
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
92
+ <?php endif; ?>
93
+ </ul>
94
+
95
+ <?php if($show_addtocart == 1): ?>
96
+ <?php if($_product->isSaleable()): ?>
97
+ <p><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></p>
98
+ <?php else: ?>
99
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
100
+ <?php endif; ?>
101
+ <?php endif; ?>
102
+ </div>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <?php if (($idx+1) % $column_count == 0 || ($idx+1) == $_collectionSize) echo '<div class="clear"></div>'; ?>
107
+ <?php $idx++; ?>
108
+ <?php endforeach; ?>
109
+
110
+ </div>
111
+ </div>
112
+ <?php endif; ?>
113
+ </div>
114
+ </div>
app/design/frontend/default/default/template/ma2_featuredproducts/standalone.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: standalone.phtml 4 2013-11-05 07:31:07Z linhnt $ */
22
+ ?>
23
+
24
+ <?php echo $this->getChildHtml('featured_product_list');?>
app/design/frontend/default/default/template/ma2_featuredproducts/standalone_list.phtml ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: standalone_list.phtml 4 2013-11-05 07:31:07Z linhnt $ */
22
+ ?>
23
+
24
+ <?php
25
+ $_helper = $this->helper('catalog/output');
26
+ $uniqId = Mage::helper('core')->uniqHash("ma2-featuredproducts-");
27
+
28
+ $list_type = $this->getMode();
29
+ ?>
30
+ <div class="ma2-featuredproducts block-featured-products <?php echo $list_type; ?>-view" id="<?php echo $uniqId; ?>">
31
+ <div class="block-inner">
32
+ <?php if (isset($show_heading) && (int)$show_heading == 1): ?>
33
+ <h3 class="block-title">
34
+ <span class="format-span">
35
+ <span><?php echo $heading;?></span>
36
+ </span>
37
+ </h3>
38
+ <?php endif; ?>
39
+
40
+ <?php if(!$FeaturedProductCollection->count()): ?>
41
+ <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
42
+ <?php else: ?>
43
+ <?php echo $this->getToolbarHtml() ?>
44
+ <div class="product-items">
45
+ <div class="product-items-inner">
46
+ <?php
47
+ $idx=0;
48
+ $_collectionSize = $FeaturedProductCollection->count();
49
+ $inlineStyle = ($list_type == 'grid') ? 'style="width:'.$item_width.'%;"' : '';
50
+ if ($list_type == 'grid' && ($column_count == null || (int)$column_count == 0)) $column_count = 3;
51
+ if ($list_type == 'list') $column_count = 1;
52
+ if (!intval($thumbnail_width)) $thumbnail_width = 135;
53
+ if (!intval($thumbnail_height)) $thumbnail_height = 135;
54
+ ?>
55
+ <?php foreach ($FeaturedProductCollection->getItems() as $pid => $_product): ?>
56
+ <div class="product-item product-<?php echo $pid; ?> <?php echo ($idx == 0) ? 'first' : (($idx+1) == $_collectionSize ? 'last' : ''); ?>" <?php echo $inlineStyle ?>>
57
+ <div class="product-item-inner">
58
+
59
+ <a class="product-image" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
60
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(intval($thumbnail_width), intval($thumbnail_height)); ?>" width="<?php echo intval($thumbnail_width); ?>" height="<?php echo intval($thumbnail_height); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
61
+ </a>
62
+ <div class="product-info">
63
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
64
+ <h4 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h4>
65
+ <?php if($_product->getRatingSummary()): ?>
66
+ <?php echo $this->getReviewsSummaryHtml($_product); ?>
67
+ <?php endif; ?>
68
+
69
+ <?php if($show_short_description == 1):?>
70
+ <div class="product-desc std">
71
+ <?php
72
+ $desc = $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description');
73
+ if(isset($short_description_limit) && !empty($short_description_limit)):
74
+ $shortDesc = explode('|', wordwrap($desc, $short_description_limit, '|'));
75
+ else:
76
+ $shortDesc = explode('|', wordwrap($desc, 88, '|'));
77
+ endif;
78
+ echo $shortDesc[0] . '...';
79
+ ?>
80
+ <?php if($show_details == 1): ?>
81
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="view-detail"><?php echo $this->__('Details') ?></a>
82
+ <?php endif;?>
83
+ </div>
84
+ <?php endif;?>
85
+ <?php if($show_price == 1): ?>
86
+ <?php echo $this->getPriceHtml($_product, true) ?>
87
+ <?php endif;?>
88
+ <div class="actions">
89
+ <ul class="add-to-links">
90
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
91
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
92
+ <?php endif; ?>
93
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
94
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
95
+ <?php endif; ?>
96
+ </ul>
97
+
98
+ <?php if($show_addtocart == 1): ?>
99
+ <?php if($_product->isSaleable()): ?>
100
+ <p><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></p>
101
+ <?php else: ?>
102
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
103
+ <?php endif; ?>
104
+ <?php endif; ?>
105
+ </div>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ <?php if (($idx+1) % $column_count == 0 || ($idx+1) == $_collectionSize) echo '<div class="clear"></div>'; ?>
110
+ <?php $idx++; ?>
111
+ <?php endforeach; ?>
112
+
113
+ </div>
114
+ </div>
115
+ <div class="toolbar-bottom">
116
+ <?php echo $this->getToolbarHtml() ?>
117
+ </div>
118
+ <?php endif; ?>
119
+ </div>
120
+ </div>
app/design/frontend/default/default/template/ma2_featuredproducts/widget.phtml ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MagenMarket.com
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
+ *
12
+ * DISCLAIMER
13
+ *
14
+ * Edit or modify this file with yourown risk.
15
+ *
16
+ * @category Extensions
17
+ * @package Ma2_FeaturedProducts
18
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ **/
21
+ /* $Id: widget.phtml 4 2013-11-05 07:31:07Z linhnt $ */
22
+ ?>
23
+
24
+ <?php
25
+ $_helper = $this->helper('catalog/output');
26
+ $uniqId = Mage::helper('core')->uniqHash("ma2-featuredproducts-");
27
+ ?>
28
+ <div class="ma2-featuredproducts widget widget-featured-products <?php echo $list_type; ?>-view" id="<?php echo $uniqId; ?>">
29
+ <div class="widget-inner">
30
+ <?php if (isset($show_widget_title) && (int)$show_widget_title == 1): ?>
31
+ <h3 class="widget-title">
32
+ <span class="format-span">
33
+ <span><?php echo $widget_title;?></span>
34
+ </span>
35
+ </h3>
36
+ <?php endif; ?>
37
+
38
+ <?php if(!$WidgetProductProductCollection->count()): ?>
39
+ <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
40
+ <?php else: ?>
41
+
42
+ <div class="product-items">
43
+ <div class="product-items-inner">
44
+ <?php
45
+ $idx=0;
46
+ $_collectionSize = $WidgetProductProductCollection->count();
47
+ $inlineStyle = ($list_type == 'grid') ? 'style="width:'.$item_width.'%;"' : '';
48
+ if ($list_type == 'grid' && ($column_count == null || (int)$column_count == 0)) $column_count = 3;
49
+ if ($list_type == 'list') $column_count = 1;
50
+ if (!intval($thumbnail_width)) $thumbnail_width = 135;
51
+ if (!intval($thumbnail_height)) $thumbnail_height = 135;
52
+ ?>
53
+ <?php foreach ($WidgetProductProductCollection as $pid=> $_product): ?>
54
+ <div class="product-item product-<?php echo $pid; ?> <?php echo ($idx == 0) ? 'first' : (($idx+1) == $_collectionSize ? 'last' : ''); ?>" <?php echo $inlineStyle ?>>
55
+ <div class="product-item-inner">
56
+
57
+ <a class="product-image" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
58
+ <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(intval($thumbnail_width), intval($thumbnail_height)); ?>" width="<?php echo intval($thumbnail_width); ?>" height="<?php echo intval($thumbnail_height); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
59
+ </a>
60
+ <div class="product-info">
61
+ <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
62
+ <h4 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h4>
63
+ <?php if($_product->getRatingSummary()): ?>
64
+ <?php echo $this->getReviewsSummaryHtml($_product); ?>
65
+ <?php endif; ?>
66
+
67
+ <?php if($show_short_description == 1):?>
68
+ <div class="product-desc std">
69
+ <?php
70
+ $desc = $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description');
71
+ if(isset($short_description_limit) && !empty($short_description_limit)):
72
+ $shortDesc = explode('|', wordwrap($desc, $short_description_limit, '|'));
73
+ else:
74
+ $shortDesc = explode('|', wordwrap($desc, 88, '|'));
75
+ endif;
76
+ echo $shortDesc[0] . '...';
77
+ ?>
78
+ <?php if($show_details == 1): ?>
79
+ <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="view-detail"><?php echo $this->__('Details') ?></a>
80
+ <?php endif;?>
81
+ </div>
82
+ <?php endif;?>
83
+ <?php if($show_price == 1): ?>
84
+ <?php echo $this->getPriceHtml($_product, true) ?>
85
+ <?php endif;?>
86
+ <div class="actions">
87
+ <ul class="add-to-links">
88
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
89
+ <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
90
+ <?php endif; ?>
91
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
92
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
93
+ <?php endif; ?>
94
+ </ul>
95
+
96
+ <?php if($show_addtocart == 1): ?>
97
+ <?php if($_product->isSaleable()): ?>
98
+ <p><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></p>
99
+ <?php else: ?>
100
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
101
+ <?php endif; ?>
102
+ <?php endif; ?>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ </div>
107
+ <?php if (($idx+1) % $column_count == 0 || ($idx+1) == $_collectionSize) echo '<div class="clear"></div>'; ?>
108
+ <?php $idx++; ?>
109
+ <?php endforeach; ?>
110
+
111
+ </div>
112
+ </div>
113
+ <?php endif; ?>
114
+ </div>
115
+ </div>
app/etc/modules/Ma2_All.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_All>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Ma2_All>
8
+ </modules>
9
+ </config>
app/etc/modules/Ma2_FeaturedProducts.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ma2_FeaturedProducts>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Ma2_FeaturedProducts>
8
+ </modules>
9
+ </config>
js/ma2_all/ma2all.css ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /*# TABS - Default pure style #######################################*/
3
+ .tab-list { position:relative; }
4
+ .tab-list .tab { float:left; cursor:pointer; }
5
+ .tab-list .last {}
6
+ .tab-list .active { cursor:default }
7
+ .tab-list .tab-container { position:absolute; left:0; width:100%; }
8
+ .tab-list .tab-content {overflow: hidden;}
9
+
10
+ .tab-list { padding-bottom:15px; margin:0 0 15px; }
11
+ .tab-list .tab { position:relative; z-index:2; margin-right:3px; background:#EEE; border: 1px solid #C4C4C4; color:#888; padding:0 0 0 10px; font-size:14px; }
12
+ .tab-list .tab span { padding:0 10px 0 0; line-height:24px; float:left; font-weight: bold;}
13
+ .tab-list .last {}
14
+ .tab-list .active { color:#000; font-weight:bold; z-index:3; border-bottom:0; background:#fff;
15
+ background-image: -moz-linear-gradient(top, #CDCDCD, #FFFFFF);
16
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#CDCDCD), to(#FFFFFF));
17
+ background-image: -webkit-linear-gradient(top, #CDCDCD, #FFFFFF);
18
+ background-image: -o-linear-gradient(top, #CDCDCD, #FFFFFF);
19
+ background-image: linear-gradient(to bottom, #CDCDCD, #FFFFFF);
20
+
21
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFCDCDCD', endColorstr='#FFFFFFFF', GradientType=0);
22
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
23
+ }
24
+ .tab-list .active span { background-position:100% 0; padding-bottom:1px; }
25
+ .tab-list .tab-container { z-index:1; top:25px; background:#fff; }
26
+ .tab-list .tab-content { padding: 1.2em 1em; background:#fff; border:1px solid #c4c4c4; font-size:12px; }
27
+ .tab-list .tab-content object,
28
+ .tab-list .tab-content embed { width:100% !important; height:auto !important; }
29
+
30
+ /*# #######################################*/
js/ma2_all/ma2all.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if (!window.Ma2All) {
2
+ window.Ma2All = {};
3
+ }
4
+ Ma2All.templatesPattern = /(^|.|\r|\n)(\{\{(.*?)\}\})/;
5
+
6
+ /* Tabs */
7
+ Ma2All.Tabs = Class.create();
8
+ Object.extend(Ma2All.Tabs.prototype, {
9
+ initialize: function (container) {
10
+ this.container = $(container);
11
+ this.container.addClassName('tab-list');
12
+ this.tabs = this.container.select('dt.tab');
13
+ this.activeTab = this.tabs.first();
14
+ this.tabs.first().addClassName('first');
15
+ this.tabs.last().addClassName('last');
16
+ this.onTabClick = this.handleTabClick.bindAsEventListener(this);
17
+ for (var i = 0, l = this.tabs.length; i < l; i ++) {
18
+ this.tabs[i].observe('click', this.onTabClick);
19
+ }
20
+ this.select();
21
+ },
22
+ handleTabClick: function (evt) {
23
+ this.activeTab = Event.findElement(evt, 'dt');
24
+ this.select();
25
+ },
26
+ select: function () {
27
+ for (var i = 0, l = this.tabs.length; i < l; i ++) {
28
+ if (this.tabs[i] == this.activeTab) {
29
+ this.tabs[i].addClassName('active');
30
+ this.tabs[i].style.zIndex = this.tabs.length + 2;
31
+ /*this.tabs[i].next('dd').show();*/
32
+ new Effect.Appear (this.tabs[i].next('dd'), { duration:0.5 });
33
+ this.tabs[i].parentNode.style.height=this.tabs[i].next('dd').getHeight() + 15 + 'px';
34
+ } else {
35
+ this.tabs[i].removeClassName('active');
36
+ this.tabs[i].style.zIndex = this.tabs.length + 1 - i;
37
+ this.tabs[i].next('dd').hide();
38
+ }
39
+ }
40
+ }
41
+ });
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ma2_Featured_Products_Free</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Ma2 Featured Products helps you manage and display featured products in store frontend as a page, block and widget.</summary>
10
+ <description>Ma2 Featured Products helps you manage and display featured products in store frontend as a page, block and widget.</description>
11
+ <notes>Version number: 1.0.0&#xD;
12
+ Stability: Stable &#xD;
13
+ Compatibility: 1.7, 1.8</notes>
14
+ <authors><author><name>Magenmarket.com</name><user>Magen_Market</user><email>trungdt@omegatheme.com</email></author></authors>
15
+ <date>2013-12-16</date>
16
+ <time>07:33:11</time>
17
+ <contents><target name="magecommunity"><dir name="Ma2"><dir name="FeaturedProducts"><dir name="Block"><dir name="Adminhtml"><dir name="Edit"><file name="Grid.php" hash="ae37f45312fd41c2d5843e5181037181"/><dir name="Renderer"><file name="Name.php" hash="b364c639fd67541f58511d11e128d898"/><file name="Thumbnail.php" hash="475d4d1a80a24697c390fa3d7e88fb03"/><file name="Visibility.php" hash="d62bcb50131cfdf7eed8ca0b23a1417e"/></dir></dir><file name="Edit.php" hash="601249772cb0d7380388b4c8b944898b"/></dir><file name="Block.php" hash="cee7eaa42ed2de8e9af9d0bf50b1a8ef"/><dir name="Standalone"><file name="List.php" hash="8c90d09df75da709d4428764fe4a820a"/></dir><file name="Widget.php" hash="8a87807d73180e1d6773ba20660f61fb"/></dir><dir name="Helper"><file name="Data.php" hash="9c30a8cd6b4fbba1bdeda4df047ef0e7"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Listtype.php" hash="c514edef11b62b3d87473db7c66c95a1"/><file name="Sortby.php" hash="177f9e2760c3fdb53061480b33160ed3"/><file name="Sortdir.php" hash="bc6ebbfbab6a38b114f7f5ae08fa78aa"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FeaturedController.php" hash="4f942bb642e8a6c5a9b4d51c980746a6"/></dir><file name="IndexController.php" hash="3541706337d4d872e928bc8ca702e896"/></dir><dir name="etc"><file name="adminhtml.xml" hash="bc2752c6656df2f59228bf1b4282ce05"/><file name="config.xml" hash="759309e4a8ef710aac34344ffc23ebbc"/><file name="system.xml" hash="bd735f0377c40a316a1de65699b0bbf9"/><file name="widget.xml" hash="bbabda6dc8a0f9f32db7972271690810"/></dir><dir name="sql"><dir name="featuredproducts_setup"><file name="mysql4-install-1.0.0.php" hash="f7e8e84dec381087c97ef09cf9b2cca8"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Ma2"><dir name="All"><dir name="Helper"><file name="Data.php" hash="090f4bd5ef8f576332f30e6bfc007c5d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9e1f55ce0e5915b7b22d87e94d4da9ea"/><file name="config.xml" hash="be5bb5343d9525bb292c8e26d2aa68f7"/><file name="system.xml" hash="e687810f26218933731768f75c28e9d6"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ma2_all.xml" hash="f0f2088fe954efa17abc4c138d1c301a"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ma2_all.xml" hash="60da2a96f1c431e35c409190c269af68"/><file name="ma2_featuredproducts.xml" hash="62b7aa3327695fa153ad2ad31d0132c0"/></dir><dir name="template"><dir name="ma2_featuredproducts"><file name="block.phtml" hash="6cbeaaddae374641a7bbe0b3907c4890"/><file name="standalone.phtml" hash="5609584b7ea61686d0e04f33cbd7b93c"/><file name="standalone_list.phtml" hash="9c6977d451b5e83d36099c8a2bbf352e"/><file name="widget.phtml" hash="1452f66b5d2ec6c59661914c4c2652a3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ma2_All.xml" hash="1f6125faeadf108fc81b1a03b4574d59"/><file name="Ma2_FeaturedProducts.xml" hash="16d387ab5054356fbd463c53f66ac517"/></dir></target><target name="mage"><dir name="js"><dir name="ma2_all"><file name="ma2all.css" hash="9c4db2cea69d0b7e2a03c149dc21749e"/><file name="ma2all.js" hash="a0e4d21d363f5b9cdfc4c6c0731f6b69"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="ma2_featuredproducts"><file name="ma2_featuredproducts.css" hash="66a245ed5084280d1bda992bfef31263"/></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>
skin/frontend/default/default/ma2_featuredproducts/ma2_featuredproducts.css ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * MagenMarket.com
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Edit or modify this file with yourown risk.
14
+ *
15
+ * @category Extensions
16
+ * @package Ma2_FeaturedProducts
17
+ * @copyright Copyright (c) 2013 MagenMarket. (http://www.magenmarket.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ **/
20
+ /* $Id: ma2_featuredproducts.css 7 2013-11-08 02:21:45Z linhnt $ */
21
+
22
+
23
+ /* = COMMON ==================*/
24
+
25
+ .ma2-featuredproducts {
26
+ margin: 0 0 10px 0;
27
+ padding: 0 0 10px 0;
28
+ display: block; /**/
29
+ }
30
+
31
+ .ma2-featuredproducts .product-items{}
32
+ .ma2-featuredproducts .product-items-inner{}
33
+ .ma2-featuredproducts .product-item{}
34
+
35
+
36
+ /*- Grid view ---*/
37
+ .ma2-featuredproducts.grid-view .product-item{
38
+ float: left;
39
+ }
40
+ .rtl .ma2-featuredproducts.grid-view .product-item{
41
+ float: right;
42
+ }
43
+ .ma2-featuredproducts.grid-view .product-item .product-image img{
44
+ max-width: 100%;
45
+ }
46
+
47
+ /*- List view ---*/
48
+ .ma2-featuredproducts.list-view .product-item{
49
+ float: none;
50
+ clear: both;
51
+ border-bottom: 1px solid #EEE;
52
+ }
53
+ .ma2-featuredproducts.list-view .product-item.last{
54
+ /* border-bottom: 0 none; */
55
+ }
56
+ .ma2-featuredproducts.list-view .product-info {overflow: hidden;}
57
+ .ma2-featuredproducts.list-view .product-item .product-image{
58
+ float: left;
59
+ }
60
+ .rtl .ma2-featuredproducts.list-view .product-item .product-image{
61
+ float: right;
62
+ }
63
+
64
+ .ma2-featuredproducts .add-to-links{
65
+ list-style: none;
66
+ }
67
+ .clear{clear:both;}
68
+
69
+
70
+
71
+ /* = COMMON : BLOCK ==================*/
72
+
73
+ .ma2-featuredproducts .block-inner{}
74
+ .ma2-featuredproducts .block-title{}
75
+
76
+
77
+ /* = COMMON : WIDGET ==================*/
78
+
79
+ .ma2-featuredproducts .widget-inner{}
80
+ .ma2-featuredproducts .widget-title{}
81
+
82
+
83
+ /* = DEMO STYLES ==================*/
84
+ /*
85
+ Styles for demo only => For each theme, should style in theme's css file.
86
+ */
87
+ .ma2-featuredproducts .product-items-inner{overflow: hidden;}
88
+ .ma2-featuredproducts .product-item-inner {
89
+ padding: 8px;
90
+ }
91
+
92
+