Aaryasolutions_Specialdeals - Version 0.1.0

Version Notes

This extension helps to add special deals from backend. We can view the special deal on frontend

Download this release

Release Info

Developer AaryaSolutions
Extension Aaryasolutions_Specialdeals
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (24) hide show
  1. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals.php +14 -0
  2. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit.php +38 -0
  3. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Form.php +19 -0
  4. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/Form.php +69 -0
  5. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/List.php +93 -0
  6. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/List/Renderer/Listorders.php +27 -0
  7. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/List/Renderer/Order.php +25 -0
  8. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/Orders.php +113 -0
  9. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tabs.php +31 -0
  10. app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Grid.php +127 -0
  11. app/code/community/Aaryasolutions/Specialdeals/Block/Specialpriceproducts.php +39 -0
  12. app/code/community/Aaryasolutions/Specialdeals/Helper/Data.php +29 -0
  13. app/code/community/Aaryasolutions/Specialdeals/Model/Mysql4/Specialdeals.php +8 -0
  14. app/code/community/Aaryasolutions/Specialdeals/Model/Mysql4/Specialdeals/Collection.php +7 -0
  15. app/code/community/Aaryasolutions/Specialdeals/Model/Specialdeals.php +65 -0
  16. app/code/community/Aaryasolutions/Specialdeals/controllers/Adminhtml/SpecialdealsController.php +179 -0
  17. app/code/community/Aaryasolutions/Specialdeals/controllers/IndexController.php +7 -0
  18. app/code/community/Aaryasolutions/Specialdeals/etc/config.xml +128 -0
  19. app/code/community/Aaryasolutions/Specialdeals/sql/specialdeals_setup/mysql4-install-0.1.0.php +17 -0
  20. app/design/frontend/rwd/default/layout/specialdeals.xml +16 -0
  21. app/design/frontend/rwd/default/template/specialdeals/products.phtml +67 -0
  22. app/design/frontend/rwd/default/template/specialdeals/sproducts.phtml +121 -0
  23. app/etc/modules/Aaryasolutions_Specialdeals.xml +9 -0
  24. package.xml +18 -0
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals extends Mage_Adminhtml_Block_Widget_Grid_Container
5
+ {
6
+ public function __construct()
7
+ {
8
+ $this->_controller = 'adminhtml_specialdeals';
9
+ $this->_blockGroup = 'specialdeals';
10
+ $this->_headerText = Mage::helper('specialdeals')->__('Special Deals Manager');
11
+ $this->_addButtonLabel = Mage::helper('specialdeals')->__('Add Special Deal');
12
+ parent::__construct();
13
+ }
14
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
5
+ {
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+
10
+ $this->_objectId = 'id';
11
+ $this->_blockGroup = 'specialdeals';
12
+ $this->_controller = 'adminhtml_specialdeals';
13
+
14
+ $this->_updateButton('save', 'label', Mage::helper('specialdeals')->__('Save Deal'));
15
+ $this->_updateButton('delete', 'label', Mage::helper('specialdeals')->__('Delete Deal'));
16
+
17
+ $this->_addButton('saveandcontinue', array(
18
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
19
+ 'onclick' => 'saveAndContinueEdit()',
20
+ 'class' => 'save',
21
+ ), -100);
22
+
23
+ $this->_formScripts[] = "
24
+ function saveAndContinueEdit(){
25
+ editForm.submit($('edit_form').action+'back/edit/');
26
+ }
27
+ ";
28
+ }
29
+
30
+ public function getHeaderText()
31
+ {
32
+ if( Mage::registry('specialdeals_data') && Mage::registry('specialdeals_data')->getId() ) {
33
+ return Mage::helper('specialdeals')->__("Edit Deal");
34
+ } else {
35
+ return Mage::helper('specialdeals')->__('Add Deal');
36
+ }
37
+ }
38
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/Form.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+
8
+
9
+
10
+ $form = new Varien_Data_Form();
11
+ $this->setForm($form);
12
+ $fieldset = $form->addFieldset('specialdeals_form', array('legend'=>Mage::helper('specialdeals')->__('Special Deal information')));
13
+
14
+
15
+
16
+
17
+
18
+ $fieldset->addField('specialdeals_number', 'text', array(
19
+ 'label' => Mage::helper('specialdeals')->__('Deal Number'),
20
+ 'required' => true,
21
+ 'name' => 'specialdeals_number',
22
+ ));
23
+ $fieldset->addField('specialdeals_price', 'text', array(
24
+ 'label' => Mage::helper('specialdeals')->__('Deal Price'),
25
+ 'required' => true,
26
+ 'name' => 'specialdeals_price',
27
+ ));
28
+
29
+ $fieldset->addField('specialdeals_color', 'text', array(
30
+ 'label' => Mage::helper('specialdeals')->__('Deal Color'),
31
+ 'required' => true,
32
+ 'name' => 'specialdeals_color',
33
+ ));
34
+
35
+
36
+ $fieldset->addField('specialdeals_status', 'select', array(
37
+ 'label' => Mage::helper('specialdeals')->__('Status'),
38
+ 'name' => 'specialdeals_status',
39
+ 'values' => array(
40
+ array(
41
+ 'value' => 1,
42
+ 'label' => Mage::helper('specialdeals')->__('Enabled'),
43
+ ),
44
+ array(
45
+ 'value' => 2,
46
+ 'label' => Mage::helper('specialdeals')->__('Disabled'),
47
+ ),
48
+ ),
49
+ ));
50
+
51
+ $fieldset->addField('specialdeals_sort', 'text', array(
52
+ 'label' => Mage::helper('specialdeals')->__('Sort Order'),
53
+ 'required' => false,
54
+ 'name' => 'specialdeals_sort',
55
+ ));
56
+
57
+ $data = array();
58
+ if ( Mage::getSingleton('adminhtml/session')->getSpecialdealsData() )
59
+ {
60
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSpecialdealsData());
61
+ Mage::getSingleton('adminhtml/session')->getSpecialdealsData(null);
62
+ } elseif ( Mage::registry('specialdeals_data') ) {
63
+ $form->setValues(Mage::registry('specialdeals_data')->getData());
64
+ }
65
+
66
+
67
+ return parent::_prepareForm();
68
+ }
69
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/List.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit_Tab_List extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->_blockGroup = 'specialdeals';
10
+ $this->_controller = 'adminhtml_specialdeals_edit_tab_list';
11
+ $this->_headerText = Mage::helper('specialdeals')->__('Special Deal Products');
12
+ $this->setTemplate('specialdeals/list.phtml');
13
+ $this->setSaveParametersInSession(true);
14
+
15
+ }
16
+
17
+
18
+ protected function _prepareCollection()
19
+ {
20
+
21
+
22
+
23
+ $currentid=Mage::app()->getRequest()->getParam('id');
24
+ if(!empty($currentid))
25
+ {
26
+
27
+ $price=Mage::getModel('specialdeals/specialdeals')->getPriceFromId($currentid);
28
+
29
+
30
+ $bb = new Aaryasolutions_Specialdeals_Block_Specialpriceproducts();
31
+
32
+
33
+ $this->setCollection($bb->listSpecialProductsByPrice($price,true));
34
+ return parent::_prepareCollection();
35
+ }
36
+ else
37
+ {
38
+ return null;
39
+ }
40
+ }
41
+
42
+
43
+ protected function _prepareColumns()
44
+ {
45
+ $this->addColumn('entity_id', array(
46
+ 'header' => Mage::helper('specialdeals')->__('ID'),
47
+ 'align' =>'left',
48
+ 'width' => '50px',
49
+ 'index' => 'entity_id',
50
+ ));
51
+
52
+ $this->addColumn('name', array(
53
+ 'header' => Mage::helper('specialdeals')->__('Product Name'),
54
+ 'align' =>'left',
55
+ 'width' => '50px',
56
+ 'index' => 'name',
57
+ ));
58
+
59
+
60
+
61
+
62
+ $this->addColumn('order_count', array(
63
+ 'header' => Mage::helper('specialdeals')->__('Order Count'),
64
+ 'align' =>'left',
65
+ 'width' => '50px',
66
+ 'index' => 'entity_id',
67
+ 'renderer' => 'specialdeals/adminhtml_specialdeals_edit_tab_list_renderer_order'
68
+ ));
69
+
70
+
71
+ $this->addColumn('orders', array(
72
+ 'header' => Mage::helper('specialdeals')->__('Orders'),
73
+ 'align' =>'left',
74
+ 'width' => '50px',
75
+ 'index' => 'entity_id',
76
+ 'renderer' => 'specialdeals/adminhtml_specialdeals_edit_tab_list_renderer_listorders'
77
+ ));
78
+
79
+
80
+
81
+ return parent::_prepareColumns();
82
+ }
83
+
84
+ public function getRowUrl($row)
85
+ {
86
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
87
+
88
+ return Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => $row->getId()));
89
+ }
90
+
91
+
92
+
93
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/List/Renderer/Listorders.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit_Tab_List_Renderer_Listorders extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action {
3
+
4
+ public function render(Varien_Object $row)
5
+ {
6
+ return $this->_getValue($row);
7
+ }
8
+
9
+
10
+
11
+
12
+
13
+ public function _getValue(Varien_Object $row)
14
+ {
15
+ $val = $row->getData($this->getColumn()->getIndex());
16
+
17
+
18
+ return '<a href="'.Mage::helper("adminhtml")->getUrl("specialdeals/adminhtml_specialdeals/orders", array('pid'=>$val)).'">View</a> | <a href="'.Mage::helper("adminhtml")->getUrl("specialdeals/adminhtml_specialdeals/exportCsv", array('pid'=>$val)).'">Export</a>';
19
+
20
+
21
+
22
+
23
+ }
24
+
25
+ }
26
+
27
+ ?>
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/List/Renderer/Order.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit_Tab_List_Renderer_Order extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action {
3
+ public function render(Varien_Object $row)
4
+ {
5
+ return $this->_getValue($row);
6
+ }
7
+
8
+
9
+
10
+
11
+ public function _getValue(Varien_Object $row)
12
+ {
13
+ $val = $row->getData($this->getColumn()->getIndex());
14
+
15
+
16
+ return $results = Mage::helper('specialdeals')->getQtyTotal($val);
17
+
18
+
19
+
20
+ //return count($results);
21
+ }
22
+
23
+ }
24
+
25
+ ?>
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tab/Orders.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit_Tab_Orders extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->_blockGroup = 'specialdeals';
10
+ $this->_controller = 'adminhtml_specialdeals_edit_tab_orders';
11
+ $this->_headerText = Mage::helper('specialdeals')->__('Special Deal Orders');
12
+ /* $this->setDefaultSort('hb_specialdeals_id');
13
+ $this->setDefaultDir('ASC');*/
14
+
15
+
16
+ $this->setTemplate('specialdeals/orders.phtml');
17
+ $this->setSaveParametersInSession(true);
18
+
19
+ }
20
+
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+
25
+
26
+
27
+ $pid=Mage::app()->getRequest()->getParam('pid');
28
+
29
+ $items = Mage::getModel('sales/order_item')->getCollection();
30
+ $items->getSelect()->join( array('sales_order'=>Mage::getSingleton('core/resource')->getTableName('sales/order')), 'main_table.order_id = sales_order.entity_id', array('sales_order.*'));
31
+ $items->getSelect()->where('product_id=?', $pid);
32
+
33
+ $this->setCollection($items);
34
+
35
+
36
+
37
+
38
+
39
+ return parent::_prepareCollection();
40
+ }
41
+
42
+
43
+ protected function _prepareColumns()
44
+ {
45
+ $this->addColumn('order_id', array(
46
+ 'header' => Mage::helper('specialdeals')->__('Order ID'),
47
+ 'align' =>'left',
48
+ 'width' => '50px',
49
+ 'index' => 'order_id',
50
+ ));
51
+
52
+ $this->addColumn('increment_id', array(
53
+ 'header' => Mage::helper('specialdeals')->__('Order Code'),
54
+ 'align' =>'left',
55
+ 'width' => '50px',
56
+ 'index' => 'increment_id',
57
+ ));
58
+
59
+
60
+ $this->addColumn('created_at', array(
61
+ 'header' => Mage::helper('specialdeals')->__('Created Date'),
62
+ 'align' =>'left',
63
+ 'width' => '50px',
64
+ 'index' => 'created_at',
65
+ ));
66
+
67
+
68
+
69
+
70
+ $this->addColumn('qty_ordered', array(
71
+ 'header' => Mage::helper('specialdeals')->__('Qty Ordered'),
72
+ 'align' =>'left',
73
+ 'width' => '50px',
74
+ 'index' => 'qty_ordered',
75
+
76
+ ));
77
+
78
+ $this->addColumn('state', array(
79
+ 'header' => Mage::helper('specialdeals')->__('State'),
80
+ 'align' =>'left',
81
+ 'width' => '50px',
82
+ 'index' => 'state',
83
+
84
+ ));
85
+
86
+ $this->addColumn('status', array(
87
+ 'header' => Mage::helper('specialdeals')->__('Status'),
88
+ 'align' =>'left',
89
+ 'width' => '50px',
90
+ 'index' => 'status',
91
+
92
+ ));
93
+
94
+
95
+ $helper = Mage::helper('specialdeals');
96
+
97
+
98
+ $this->addExportType('specialdeals/adminhtml_specialdeals/exportCsv', $helper->__('CSV'));
99
+
100
+
101
+ return parent::_prepareColumns();
102
+ }
103
+
104
+ public function getRowUrl($row)
105
+ {
106
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
107
+
108
+ return Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => $row->getId()));
109
+ }
110
+
111
+
112
+
113
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Edit/Tabs.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
5
+ {
6
+
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setId('specialdeals_tabs');
11
+ $this->setDestElementId('edit_form');
12
+ $this->setTitle(Mage::helper('specialdeals')->__('Special Deals Information'));
13
+ }
14
+
15
+ protected function _beforeToHtml()
16
+ {
17
+ $this->addTab('form_section', array(
18
+ 'label' => Mage::helper('specialdeals')->__('Special Deals Information'),
19
+ 'title' => Mage::helper('specialdeals')->__('Special Deals Information'),
20
+ 'content' => $this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit_tab_form')->toHtml(),
21
+ ));
22
+
23
+ $this->addTab('products_list', array(
24
+ 'label' => Mage::helper('specialdeals')->__('Products List'),
25
+ 'title' => Mage::helper('specialdeals')->__('Products List'),
26
+ 'content' => $this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit_tab_list')->toHtml(),
27
+ ));
28
+
29
+ return parent::_beforeToHtml();
30
+ }
31
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Adminhtml/Specialdeals/Grid.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Aaryasolutions_Specialdeals_Block_Adminhtml_Specialdeals_Grid extends Mage_Adminhtml_Block_Widget_Grid
5
+ {
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('specialdealsGrid');
10
+ $this->setDefaultSort('specialdeals_id');
11
+ $this->setDefaultDir('ASC');
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel('specialdeals/specialdeals')->getCollection();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+
22
+ protected function _prepareColumns()
23
+ {
24
+ $this->addColumn('specialdeals_id', array(
25
+ 'header' => Mage::helper('specialdeals')->__('ID'),
26
+ 'align' =>'right',
27
+ 'width' => '50px',
28
+ 'index' => 'specialdeals_id',
29
+ ));
30
+
31
+
32
+
33
+ $this->addColumn('specialdeals_number', array(
34
+ 'header' => Mage::helper('specialdeals')->__('Deal'),
35
+ 'align' =>'left',
36
+ 'index' => 'specialdeals_number',
37
+ ));
38
+
39
+ $this->addColumn('specialdeals_color', array(
40
+ 'header' => Mage::helper('specialdeals')->__('Special Deal Color'),
41
+ 'align' =>'left',
42
+ 'index' => 'specialdeals_color',
43
+
44
+ ));
45
+
46
+ $this->addColumn('specialdeals_price', array(
47
+ 'header' => Mage::helper('specialdeals')->__('Special Price'),
48
+ 'align' =>'left',
49
+ 'index' => 'specialdeals_price',
50
+
51
+ ));
52
+
53
+ $this->addColumn('specialdeals_status', array(
54
+ 'header' => Mage::helper('specialdeals')->__('Status'),
55
+ 'align' => 'left',
56
+ 'width' => '80px',
57
+ 'index' => 'specialdeals_status',
58
+ 'type' => 'options',
59
+ 'options' => array(
60
+ 1 => 'Enabled',
61
+ 2 => 'Disabled',
62
+ ),
63
+ ));
64
+
65
+ $this->addColumn('specialdeals_sort', array(
66
+ 'header' => Mage::helper('specialdeals')->__('Sort Order'),
67
+ 'align' =>'left',
68
+ 'index' => 'specialdeals_sort',
69
+ ));
70
+
71
+ $this->addColumn('action',
72
+ array(
73
+ 'header' => Mage::helper('specialdeals')->__('Action'),
74
+ 'width' => '100',
75
+ 'type' => 'action',
76
+ 'getter' => 'getId',
77
+ 'actions' => array(
78
+ array(
79
+ 'caption' => Mage::helper('specialdeals')->__('Edit'),
80
+ 'url' => array('base'=> '*/*/edit'),
81
+ 'field' => 'id'
82
+ )
83
+ ),
84
+ 'filter' => false,
85
+ 'sortable' => false,
86
+ 'index' => 'stores',
87
+ 'is_system' => true,
88
+ ));
89
+
90
+ return parent::_prepareColumns();
91
+ }
92
+
93
+
94
+
95
+ protected function _afterLoadCollection()
96
+ {
97
+ $this->getCollection()->walk('afterLoad');
98
+ parent::_afterLoadCollection();
99
+ }
100
+
101
+ protected function _filterStoreCondition($collection, $column)
102
+ {
103
+ if (!$value = $column->getFilter()->getValue()) {
104
+ return;
105
+ }
106
+
107
+ $this->getCollection()->addStoreFilter($value);
108
+ }
109
+
110
+ protected function _prepareMassaction()
111
+ {
112
+ $this->setMassactionIdField('specialdeals_id');
113
+ $this->getMassactionBlock()->setFormFieldName('specialdeals');
114
+
115
+ $this->getMassactionBlock()->addItem('delete', array(
116
+ 'label' => Mage::helper('specialdeals')->__('Delete'),
117
+ 'url' => $this->getUrl('*/*/massDelete'),
118
+ 'confirm' => Mage::helper('specialdeals')->__('Are you sure?')
119
+ ));
120
+ }
121
+
122
+ public function getRowUrl($row)
123
+ {
124
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
125
+ }
126
+
127
+ }
app/code/community/Aaryasolutions/Specialdeals/Block/Specialpriceproducts.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Aaryasolutions_Specialdeals_Block_Specialpriceproducts extends Mage_Core_Block_Template {
3
+ protected function _construct() {
4
+ parent::_construct ();
5
+ $this->_blockGroup = 'specialdeals';
6
+
7
+ $this->setTemplate ( 'specialdeals/homewidget.phtml' );
8
+ }
9
+ protected function _toHtml() {
10
+ return parent::_toHtml ();
11
+ }
12
+ public function listSpecialProductsByPrice($price, $admin = null) {
13
+
14
+
15
+
16
+ $_productCollection = Mage::getModel ('catalog/product')->getCollection ()->setStoreId(1);
17
+
18
+ $_productCollection->addAttributeToSelect ('*');
19
+ $_productCollection->addAttributeToSelect ('name');
20
+
21
+ $_productCollection->addFieldToFilter ('visibility', array (
22
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
23
+ Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
24
+ )); // showing just products visible in catalog or both search and catalog
25
+
26
+
27
+
28
+ $_productCollection->addFinalPrice()->getSelect()
29
+ ->where ('price_index.final_price < price_index.price and price_index.final_price=' . $price)
30
+ ->group ('e.entity_id');
31
+
32
+ return $_productCollection;
33
+ }
34
+ public function getPerTabhtml($bin) {
35
+ $this->getChild ('specialproducts')->setData ('bin', $bin);
36
+
37
+ return $this->getChildHtml('specialproducts', false );
38
+ }
39
+ }
app/code/community/Aaryasolutions/Specialdeals/Helper/Data.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Aaryasolutions_Specialdeals_Helper_Data extends Mage_Core_Helper_Abstract {
3
+ public function getOrdersList($val) {
4
+ $resource = Mage::getSingleton ( 'core/resource' );
5
+ $readConnection = $resource->getConnection ( 'core_read' );
6
+ $query = "SELECT o.entity_id, i.order_id, o.increment_id, i.product_id, o.status, i.qty_ordered FROM sales_flat_order o inner join sales_flat_order_item i on o.entity_id = i.order_id WHERE i.product_id=" . $val . " AND o.status='complete'";
7
+
8
+ $results = $readConnection->fetchAll ( $query );
9
+
10
+ return $results;
11
+ }
12
+ public function getQtyTotal($val) {
13
+ $qty = 0;
14
+
15
+ $resource = Mage::getSingleton ( 'core/resource' );
16
+ $readConnection = $resource->getConnection ( 'core_read' );
17
+ $query = "SELECT o.entity_id, i.order_id, o.increment_id, i.product_id, o.status, i.qty_ordered FROM sales_flat_order o inner join sales_flat_order_item i on o.entity_id = i.order_id WHERE i.product_id=" . $val;
18
+
19
+ $results = $readConnection->fetchAll ( $query );
20
+
21
+ foreach ( $results as $results ) {
22
+
23
+ $qty = $qty + $results ['qty_ordered'];
24
+ // code...
25
+ }
26
+
27
+ return $qty;
28
+ }
29
+ }
app/code/community/Aaryasolutions/Specialdeals/Model/Mysql4/Specialdeals.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Aaryasolutions_Specialdeals_Model_Mysql4_Specialdeals extends Mage_Core_Model_Mysql4_Abstract {
3
+ public function _construct() {
4
+ $this->_init ('specialdeals/specialdeals', 'specialdeals_id');
5
+ }
6
+ }
7
+
8
+ ?>
app/code/community/Aaryasolutions/Specialdeals/Model/Mysql4/Specialdeals/Collection.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Aaryasolutions_Specialdeals_Model_Mysql4_Specialdeals_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
3
+ public function _construct() {
4
+ parent::_construct ();
5
+ $this->_init ('specialdeals/specialdeals');
6
+ }
7
+ }
app/code/community/Aaryasolutions/Specialdeals/Model/Specialdeals.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Aaryasolutions_Specialdeals_Model_Specialdeals extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('specialdeals/specialdeals');
9
+ }
10
+
11
+
12
+ public function getBargainBins(){
13
+
14
+ $collection1 = Mage::getModel('specialdeals/specialdeals')->getCollection();
15
+ $collection1-> addFieldToFilter('specialdeals_status', array('eq' => 1));
16
+ $collection1-> getSelect()->order('specialdeals_sort' , 'ASC');
17
+
18
+ return $collection1;
19
+
20
+
21
+
22
+ }
23
+
24
+
25
+ public function getPriceFromBinNumber($num){
26
+
27
+
28
+ $collection = Mage::getModel('specialdeals/specialdeals')->getCollection();
29
+ $collection-> addFieldToFilter('specialdeals_number', array('eq' => $num));
30
+
31
+ foreach($collection as $c){
32
+
33
+ return $c->getspecialdeals_price();
34
+
35
+ }
36
+ }
37
+
38
+
39
+ public function getPriceFromId($num){
40
+
41
+
42
+ $collection = Mage :: getModel('specialdeals/specialdeals')->getCollection();
43
+ $collection-> addFieldToFilter('specialdeals_id', array('eq' => $num));
44
+
45
+ foreach($collection as $c){
46
+
47
+ return $c->getspecialdeals_price();
48
+
49
+ }
50
+ }
51
+
52
+ public function getColorFromBinNumber($num){
53
+
54
+
55
+ $collection = Mage :: getModel('specialdeals/specialdeals')->getCollection();
56
+ $collection-> addFieldToFilter('specialdeals_number', array('eq' => $num));
57
+
58
+ foreach($collection as $c){
59
+
60
+ return $c->getspecialdeals_color();
61
+
62
+ }
63
+ }
64
+
65
+ }
app/code/community/Aaryasolutions/Specialdeals/controllers/Adminhtml/SpecialdealsController.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Aaryasolutions_Specialdeals_Adminhtml_SpecialdealsController extends Mage_Adminhtml_Controller_Action
5
+
6
+ {
7
+
8
+ public function indexAction() {
9
+ $this->_initAction()
10
+ ->_addContent($this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals'))
11
+ ->renderLayout();
12
+ }
13
+
14
+ public function ordersAction(){
15
+
16
+ $this->_initAction()
17
+ ->_addContent($this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit_tab_orders'))
18
+ ->renderLayout();
19
+ }
20
+
21
+ protected function _initAction() {
22
+ $this->loadLayout();
23
+
24
+ return $this;
25
+ }
26
+
27
+ public function newAction() {
28
+
29
+ //$this->_forward('edit');
30
+ $this->_initAction();
31
+ $this->_addContent($this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit'))
32
+ ->_addLeft($this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit_tabs'));
33
+
34
+ $this->renderLayout();
35
+ }
36
+
37
+
38
+ public function editAction() {
39
+
40
+
41
+ $id = $this->getRequest()->getParam('id');
42
+ $model = Mage::getModel('specialdeals/specialdeals')->load($id);
43
+
44
+ if ($model->getId() || $id == 0) {
45
+
46
+ $this->_initAction();
47
+
48
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
49
+ if (!empty($data)) {
50
+ $model->setData($data);
51
+ }
52
+
53
+ Mage::register('specialdeals_data', $model);
54
+
55
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
56
+
57
+ $this->_addContent($this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit'))
58
+ ->_addLeft($this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit_tabs'));
59
+
60
+ $this->renderLayout();
61
+ } else {
62
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('specialdeals')->__('Deal does not exist'));
63
+ $this->_redirect('*/*/');
64
+ }
65
+ }
66
+
67
+ public function deleteAction() {
68
+ if( $this->getRequest()->getParam('id') > 0 ) {
69
+ try {
70
+ $model = Mage::getModel('specialdeals/specialdeals');
71
+
72
+ $model->setId($this->getRequest()->getParam('id'))
73
+ ->delete();
74
+
75
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Deal was successfully deleted'));
76
+ $this->_redirect('*/*/');
77
+ } catch (Exception $e) {
78
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
79
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
80
+ }
81
+ }
82
+ $this->_redirect('*/*/');
83
+ }
84
+
85
+ public function massDeleteAction() {
86
+ $specialdealsIds = $this->getRequest()->getParam('specialdeals');
87
+ if(!is_array($specialdealsIds)) {
88
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select deal(s)'));
89
+ } else {
90
+ try {
91
+ foreach ($specialdealsIds as $specialdealsId) {
92
+ $hbb = Mage::getModel('specialdealss/specialdeals')->load($specialdealsId);
93
+ $hbb->delete();
94
+ }
95
+ Mage::getSingleton('adminhtml/session')->addSuccess(
96
+ Mage::helper('adminhtml')->__(
97
+ 'Total of %d record(s) were successfully deleted', count($specialdealsIds)
98
+ )
99
+ );
100
+ } catch (Exception $e) {
101
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
102
+ }
103
+ }
104
+ $this->_redirect('*/*/index');
105
+ }
106
+
107
+
108
+ public function gridAction()
109
+ {
110
+ $this->loadLayout();
111
+ $this->getResponse()->setBody(
112
+ $this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit_tab_orders')->toHtml()
113
+ );
114
+ }
115
+
116
+ public function exportCsvAction() {
117
+
118
+ $pid=Mage::app()->getRequest()->getParam('pid');
119
+ $fileName = 'special_deal'.$pid.'.csv';
120
+ $content = $this->getLayout()->createBlock('specialdeals/adminhtml_specialdeals_edit_tab_orders')
121
+ ->getCsv();
122
+ $this->_sendUploadResponse($fileName, $content);
123
+ }
124
+
125
+ public function saveAction() {
126
+ if ($data = $this->getRequest()->getPost()) {
127
+
128
+
129
+
130
+
131
+
132
+
133
+ $model = Mage::getModel('specialdeals/specialdeals');
134
+ $model->setData($data)
135
+ ->setId($this->getRequest()->getParam('id'));
136
+
137
+ try {
138
+
139
+
140
+ $model->save();
141
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('specialdeals')->__('Specialdeal was successfully saved'));
142
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
143
+
144
+ if ($this->getRequest()->getParam('back')) {
145
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
146
+ return;
147
+ }
148
+ $this->_redirect('*/*/');
149
+ return;
150
+ } catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
153
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
154
+ return;
155
+ }
156
+ }
157
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('specialdeals')->__('Unable to find item to save'));
158
+ $this->_redirect('*/*/');
159
+ }
160
+
161
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
162
+ $response = $this->getResponse();
163
+ $response->setHeader('HTTP/1.1 200 OK', '');
164
+ $response->setHeader('Pragma', 'public', true);
165
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
166
+ $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
167
+ $response->setHeader('Last-Modified', date('r'));
168
+ $response->setHeader('Accept-Ranges', 'bytes');
169
+ $response->setHeader('Content-Length', strlen($content));
170
+ $response->setHeader('Content-type', $contentType);
171
+ $response->setBody($content);
172
+ $response->sendResponse();
173
+ die;
174
+ }
175
+
176
+
177
+ }
178
+
179
+ ?>
app/code/community/Aaryasolutions/Specialdeals/controllers/IndexController.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Aaryasolutions_Specialdeals_IndexController extends Mage_Core_Controller_Front_Action {
3
+ public function indexAction() {
4
+ $this->loadLayout ();
5
+ $this->renderLayout ();
6
+ }
7
+ }
app/code/community/Aaryasolutions/Specialdeals/etc/config.xml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Aaryasolutions_Specialdeals>
5
+ <version>0.1.0</version>
6
+ </Aaryasolutions_Specialdeals>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <specialdeals>
11
+ <class>Aaryasolutions_Specialdeals_Block</class>
12
+ </specialdeals>
13
+ </blocks>
14
+ <models>
15
+
16
+ <specialdeals>
17
+ <class>Aaryasolutions_Specialdeals_Model</class>
18
+ <resourceModel>specialdeals_mysql4</resourceModel>
19
+ </specialdeals>
20
+
21
+ <specialdeals_mysql4>
22
+ <class>Aaryasolutions_Specialdeals_Model_Mysql4</class>
23
+ <entities>
24
+ <specialdeals>
25
+ <table>aarya_specialdeals</table>
26
+ </specialdeals>
27
+ </entities>
28
+ </specialdeals_mysql4>
29
+ </models>
30
+ <resources>
31
+ <specialdeals_setup>
32
+ <setup>
33
+ <module>Aaryasolutions_Specialdeals</module>
34
+ <class>Mage_Eav_Model_Entity_Setup</class>
35
+ </setup>
36
+ <connection>
37
+ <use>core_setup</use>
38
+ </connection>
39
+ </specialdeals_setup>
40
+ <specialdeals_write>
41
+ <connection>
42
+ <use>core_write</use>
43
+ </connection>
44
+ </specialdeals_write>
45
+ <specialdeals_read>
46
+ <connection>
47
+ <use>core_read</use>
48
+ </connection>
49
+ </specialdeals_read>
50
+ </resources>
51
+
52
+ <helpers>
53
+ <specialdeals>
54
+ <class>Aaryasolutions_Specialdeals_Helper</class>
55
+ </specialdeals>
56
+ </helpers>
57
+ </global>
58
+ <frontend>
59
+ <layout>
60
+ <updates>
61
+ <specialdeals>
62
+ <file>specialdeals.xml</file>
63
+ </specialdeals>
64
+ </updates>
65
+ </layout>
66
+ <routers>
67
+ <specialdeals>
68
+ <use>standard</use>
69
+ <args>
70
+ <module>Aaryasolutions_Specialdeals</module>
71
+ <frontName>specialdeals</frontName>
72
+ </args>
73
+ </specialdeals>
74
+ </routers>
75
+ </frontend>
76
+ <adminhtml>
77
+ <menu>
78
+ <aaryasolutions>
79
+ <title>Aaryasolutions</title>
80
+ <sort_order>100</sort_order>
81
+ <children>
82
+ <specialdeals>
83
+ <title>Special Deals</title>
84
+ <sort_order>10</sort_order>
85
+ <action>specialdeals/adminhtml_specialdeals</action>
86
+ </specialdeals>
87
+
88
+ </children>
89
+ </aaryasolutions>
90
+ </menu>
91
+ <acl>
92
+ <resources>
93
+ <all>
94
+ <title>Allow Everything</title> .
95
+ </all>
96
+ <admin>
97
+ <children>
98
+ <system>
99
+ <children>
100
+ <config>
101
+ <children>
102
+ <specialdeals>
103
+ <title>Special Deals</title>
104
+ </specialdeals>
105
+ </children>
106
+ </config>
107
+ </children>
108
+ </system>
109
+ <aaryasolutions>
110
+ <title>Aaryasolutions</title>
111
+ <children>
112
+ <deal>
113
+ <title>Aarya</title>
114
+ <children>
115
+ <specialdeals>
116
+ <title>Special Deals</title>
117
+ </specialdeals>
118
+ </children>
119
+ </deal>
120
+ </children>
121
+ </aaryasolutions>
122
+ </children>
123
+ </admin>
124
+ </resources>
125
+ </acl>
126
+ </adminhtml>
127
+ </config>
128
+
app/code/community/Aaryasolutions/Specialdeals/sql/specialdeals_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $installer->run("
6
+ CREATE TABLE IF NOT EXISTS `aarya_specialdeals` (
7
+ `specialdeals_id` int(11) NOT NULL AUTO_INCREMENT,
8
+ `specialdeals_number` int(11) NOT NULL,
9
+ `specialdeals_price` double(11,2) NOT NULL,
10
+ `specialdeals_color` varchar(10) NOT NULL,
11
+ `specialdeals_status` tinyint(1) NOT NULL,
12
+ `specialdeals_sort` int(11) NOT NULL,
13
+ PRIMARY KEY (`specialdeals_id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12;
15
+ ");
16
+
17
+ $installer->endSetup();
app/design/frontend/rwd/default/layout/specialdeals.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <specialdeals_index_index>
4
+ <reference name="root">
5
+ <action method="setTemplate"><template>page/3columns.phtml</template></action>
6
+ </reference>
7
+ <reference name="content">
8
+
9
+ <block type="specialdeals/specialpriceproducts" name="specialdeals.bin" as="sproducts" template="specialdeals/sproducts.phtml">
10
+ <block type="specialdeals/specialpriceproducts" name="specialproducts" template="specialdeals/products.phtml" />
11
+ </block>
12
+ </reference>
13
+ </specialdeals_index_index>
14
+
15
+
16
+ </layout>
app/design/frontend/rwd/default/template/specialdeals/products.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ $bin=$this->getBin();
5
+
6
+ $price=Mage::getModel('specialdeals/specialdeals')->getPriceFromBinNumber($bin);
7
+ $color=Mage::getModel('specialdeals/specialdeals')->getColorFromBinNumber($bin);
8
+
9
+ ?>
10
+ <ul class="pagination">
11
+ <?php
12
+
13
+
14
+
15
+
16
+ foreach ($this->listSpecialProductsByPrice($price) as $_product): ?>
17
+
18
+
19
+
20
+
21
+ <li class="bargain_bin_product" style="margin-top:5px; width:100%; border:3px solid #ccc; float: left; background: <?php echo $color; ?>">
22
+ <a href="<?php echo $_product->getProductUrl() ?>" style="width:100%; float: left; color:#fff; background: none">
23
+ <div class="col-md-2">
24
+ <img src="<?php echo $_product->getImageUrl(); ?>" style="width:100%;" />
25
+
26
+
27
+ </div>
28
+ <div class="col-md-8">
29
+
30
+ <h4><?php echo $this->stripTags($_product->getName()); ?></h4>
31
+
32
+ <?php
33
+
34
+ $finalPrice=$_product->getFinalPrice();
35
+ $wasPrice=$_product->getPrice();
36
+ $save=$wasPrice-$finalPrice;
37
+
38
+ ?>
39
+
40
+
41
+ <p class="now"> Now <?php echo Mage::helper('core')->currency(number_format($_product->getFinalPrice(),2), true, false); ?></p>
42
+ <p class="was"> Was <?php echo Mage::helper('core')->currency(number_format($_product->getPrice(),2), true, false); ?></p>
43
+ </div>
44
+
45
+ <div class="col-md-2 bargin_bin_save">
46
+
47
+ <center>
48
+ <span>
49
+ Save <?php echo Mage::helper('core')->currency($save, true, false); ?>
50
+ </span>
51
+ </center>
52
+
53
+ <h3>BUY NOW!</h3>
54
+
55
+ </div>
56
+
57
+ </a>
58
+ </li>
59
+
60
+ <?php
61
+
62
+
63
+ endforeach;
64
+
65
+ ?>
66
+ </ul>
67
+
app/design/frontend/rwd/default/template/specialdeals/sproducts.phtml ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
4
+
5
+ $breadcrumbs->addCrumb('home', array(
6
+ 'label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'),
7
+ 'link'=>Mage::getBaseUrl()));
8
+
9
+ $breadcrumbs->addCrumb('bargain', array(
10
+ 'label'=>Mage::helper('core')->__('Special Deal'), 'title'=>Mage::helper('core')->__('Special Deal')));
11
+
12
+ echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();
13
+ $products = new Aaryasolutions_Specialdeals_Block_Specialpriceproducts();
14
+
15
+ ?>
16
+ <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.css" media="all" />
17
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.js" type="text/javascript"></script>
18
+
19
+
20
+ <div class="clearfix"></div>
21
+ <div class="special_deals">
22
+ <h2><?php echo Mage::helper('core')->__('Special Deals') ?></h2>
23
+
24
+
25
+ <ul class="bxslider">
26
+
27
+ <?php
28
+
29
+ $products = new Aaryasolutions_Specialdeals_Block_Specialpriceproducts();
30
+
31
+ $binArray= Mage::getModel('specialdeals/specialdeals')->getCollection();
32
+ $urlparam=1;
33
+
34
+
35
+
36
+ foreach ($binArray as $bin): ?>
37
+ <li class="<?php if($urlparam==$bin->getspecialdeals_number()) echo 'active'; ?>" style="background:<?php echo $bin->getspecialdeals_color(); ?>">
38
+
39
+ <a data-toggle="tab" role="tab" href="#bin<?php echo $bin->getspecialdeals_number(); ?>">
40
+ <small><?php echo Mage::helper('core')->__('PRODUCTS FOR') ?></small>
41
+ <br>
42
+ <h1>$<?php echo $bin->getspecialdeals_price(); ?></h1>
43
+
44
+ <br>
45
+
46
+ <?php if(Mage::app()->getStore()->getCurrentCurrencyCode()!='USD'){
47
+ ?>
48
+
49
+ <span><?php echo Mage::helper('core')->currency(number_format($bin->getspecialdeals_price(),2), true, false); ?></span>
50
+ <br>
51
+ <?php
52
+ } ?>
53
+
54
+ <h5 class="view-all">
55
+ <?php echo Mage::helper('core')->__('View all') ?>
56
+ </h5>
57
+ </a>
58
+ <div class="clearfix"></div>
59
+ </li>
60
+ <?php endforeach; ?>
61
+ </ul>
62
+ </div>
63
+
64
+
65
+
66
+
67
+ <div class="tab-content">
68
+
69
+ <?php
70
+ foreach($binArray as $bin){
71
+
72
+
73
+
74
+ ?>
75
+
76
+ <div class="tab-pane <?php if($urlparam==$bin->getspecialdeals_number()) echo 'active'; ?>" id="bin<?php echo $bin->getspecialdeals_number(); ?>">
77
+
78
+ <?php echo $this->getPerTabhtml($bin->getspecialdeals_number()); ?>
79
+
80
+ </div>
81
+
82
+
83
+ <?php
84
+ }
85
+
86
+ ?>
87
+
88
+ </div>
89
+
90
+
91
+
92
+
93
+
94
+ <style type="text/css">
95
+
96
+ .bxslider li{
97
+ float: left;
98
+ padding:10px;
99
+ text-align: center;
100
+ border: 2px solid #fff;
101
+ }
102
+ .bxslider li a{
103
+ text-decoration: none;
104
+ }
105
+
106
+ .slide small {
107
+ color: #cfc;
108
+ }
109
+
110
+ .slide h1 {
111
+ color: #cfc;
112
+ }
113
+
114
+ .view-all {
115
+ font-size:18px;
116
+ color: #999;
117
+ }
118
+ .bxslider li a{
119
+ display: block !important;
120
+ }
121
+ </style>
app/etc/modules/Aaryasolutions_Specialdeals.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Aaryasolutions_Specialdeals>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Aaryasolutions_Specialdeals>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Aaryasolutions_Specialdeals</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Aaryasolutions_Specialdeals</summary>
10
+ <description>This extension helps to add special deals from backend. We can view the special deal on frontend</description>
11
+ <notes>This extension helps to add special deals from backend. We can view the special deal on frontend</notes>
12
+ <authors><author><name>AaryaSolutions</name><user>aaryasolutions</user><email>info@aaryasolutions.com</email></author></authors>
13
+ <date>2015-01-18</date>
14
+ <time>09:13:03</time>
15
+ <contents><target name="magecommunity"><dir name="Aaryasolutions"><dir name="Specialdeals"><dir name="Block"><dir name="Adminhtml"><dir name="Specialdeals"><dir name="Edit"><file name="Form.php" hash="5b186760005fe99f7d3e2d56bba5be16"/><dir name="Tab"><file name="Form.php" hash="363f62aa18ef3140ebba5dea30041dd7"/><dir name="List"><dir name="Renderer"><file name="Listorders.php" hash="292772b59c94ed31a3a9e7028f6154f8"/><file name="Order.php" hash="1a213d44f4bed5608c19275e70f1dce5"/></dir></dir><file name="List.php" hash="8bad52ec8128f601bca0ab719b648a0f"/><file name="Orders.php" hash="708eb74361bf6a8dc579a91be82b5b07"/></dir><file name="Tabs.php" hash="840e358d951f1aeec04db06efb420814"/></dir><file name="Edit.php" hash="3f717ec1f861bd4def99342c97466987"/><file name="Grid.php" hash="6ae87e2888612ec9f73940b177810c07"/></dir><file name="Specialdeals.php" hash="cd19a01b7f496ed4e10173656800f5e7"/></dir><file name="Specialpriceproducts.php" hash="4e8a3ba76b04609214b8ef277594adf1"/></dir><dir name="Helper"><file name="Data.php" hash="d3c3e80a9302105960134c6a33d8b6b6"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Specialdeals"><file name="Collection.php" hash="600d0d48805c91a52fb0b8d27139257b"/></dir><file name="Specialdeals.php" hash="5af089e166308d746c1ac4a4ea8a2222"/></dir><file name="Specialdeals.php" hash="35dd0aa934551001c250f8c15b38ee70"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SpecialdealsController.php" hash="b5959a9d6b058e78fc8e5e060853a49b"/></dir><file name="IndexController.php" hash="10f3a7209f7c2f4f525fe8594e8887b9"/></dir><dir name="etc"><file name="config.xml" hash="a5c790a1737ddd2e59947760f6c46fda"/></dir><dir name="sql"><dir name="specialdeals_setup"><file name="mysql4-install-0.1.0.php" hash="f2c6b8beeffc1662d5fe71e7fc87aa8c"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="layout"><file name="specialdeals.xml" hash="84bb5d4e6d6b5918bb3d665c50e34b62"/></dir><dir name="template"><dir name="specialdeals"><file name="products.phtml" hash="194f17a08cc13f583c8911dc6a88c79e"/><file name="sproducts.phtml" hash="b0af9fc20a9370e581de142edcede6a8"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aaryasolutions_Specialdeals.xml" hash="153712e67c609a2ad726d457463fa5fb"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>5.6.4</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.8.0</min><max>1.9.0.1</max></package></required></dependencies>
18
+ </package>