Version Notes
This extension create deals on the basis of price. We can add deals at backend.
Download this release
Release Info
Developer | AaryaSolutions |
Extension | Aaryasolutions_Dailydeals |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Aaryasolutions/Dailydeals/Block/Adminhtml/Dailydeals/Deals.php +18 -0
- app/code/local/Aaryasolutions/Dailydeals/Block/Adminhtml/Dailydeals/Deals/Grid.php +181 -0
- app/code/local/Aaryasolutions/Dailydeals/Block/Adminhtml/Dailydeals/Deals/Renderer/Dealsrenderer.php +33 -0
- app/code/local/Aaryasolutions/Dailydeals/Block/Dealsfront.php +14 -0
- app/code/local/Aaryasolutions/Dailydeals/Helper/Data.php +6 -0
- app/code/local/Aaryasolutions/Dailydeals/Model/Dailydeals.php +108 -0
- app/code/local/Aaryasolutions/Dailydeals/Model/Mysql4/Dailydeals.php +15 -0
- app/code/local/Aaryasolutions/Dailydeals/Model/Mysql4/Dailydeals/Collection.php +12 -0
- app/code/local/Aaryasolutions/Dailydeals/controllers/Adminhtml/DailydealsController.php +64 -0
- app/code/local/Aaryasolutions/Dailydeals/controllers/IndexController.php +7 -0
- app/code/local/Aaryasolutions/Dailydeals/etc/adminhtml.xml +27 -0
- app/code/local/Aaryasolutions/Dailydeals/etc/config.xml +98 -0
- app/code/local/Aaryasolutions/Dailydeals/sql/dailydeals_setup/mysql4-install-0.1.0.php +17 -0
- app/code/local/Aaryasolutions/Dailydeals/sql/dailydeals_setup/mysql4-upgrade-0.1.0-0.1.1.php +17 -0
- app/design/adminhtml/default/default/template/dailydeals/grid.phtml +335 -0
- app/design/frontend/rwd/default/layout/dailydeals.xml +12 -0
- app/etc/modules/Aaryasolutions_Dailydeals.xml +10 -0
- package.xml +18 -0
app/code/local/Aaryasolutions/Dailydeals/Block/Adminhtml/Dailydeals/Deals.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aaryasolutions_Dailydeals_Block_Adminhtml_Dailydeals_Deals extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_blockGroup = 'dailydeals';
|
8 |
+
$this->_controller = 'adminhtml_dailydeals_deals';
|
9 |
+
$this->_headerText = Mage::helper('dailydeals')->__('Daily Deals');
|
10 |
+
|
11 |
+
parent::__construct();
|
12 |
+
$this->_removeButton('add');
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/Block/Adminhtml/Dailydeals/Deals/Grid.php
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Aaryasolutions_Dailydeals_Block_Adminhtml_Dailydeals_Deals_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
3 |
+
public function __construct() {
|
4 |
+
parent::__construct ();
|
5 |
+
$this->setId ( 'dailydeals_deals_grid' );
|
6 |
+
$this->setDefaultSort ( 'dailydeals_id' );
|
7 |
+
$this->setDefaultDir ( 'DESC' );
|
8 |
+
$this->setSaveParametersInSession ( true );
|
9 |
+
$this->setUseAjax ( true );
|
10 |
+
|
11 |
+
$this->settemplate ('dailydeals/grid.phtml' );
|
12 |
+
}
|
13 |
+
protected function _getProduct() {
|
14 |
+
return Mage::getModel ('catalog/product')->load (5);
|
15 |
+
}
|
16 |
+
protected function _addColumnFilterToCollection($column) {
|
17 |
+
|
18 |
+
// Set custom filter for in product flag
|
19 |
+
if ($column->getId () == 'in_products') {
|
20 |
+
$productIds = $this->_getSelectedProducts ();
|
21 |
+
if (empty ( $productIds )) {
|
22 |
+
$productIds = 0;
|
23 |
+
}
|
24 |
+
if ($column->getFilter ()->getValue ()) {
|
25 |
+
$this->getCollection ()->addFieldToFilter ( 'entity_id', array (
|
26 |
+
'in' => $productIds
|
27 |
+
) );
|
28 |
+
} else {
|
29 |
+
if ($productIds) {
|
30 |
+
$this->getCollection ()->addFieldToFilter ( 'entity_id', array (
|
31 |
+
'nin' => $productIds
|
32 |
+
) );
|
33 |
+
}
|
34 |
+
}
|
35 |
+
} elseif ($column->getId () == 'dailydeals_date') {
|
36 |
+
|
37 |
+
$val = $column->getFilter ()->getValue ();
|
38 |
+
|
39 |
+
if ($val) {
|
40 |
+
|
41 |
+
$from = date ( "Y-m-d", strtotime ( $val ['orig_from'] ) );
|
42 |
+
$to = date ( "Y-m-d", strtotime ( $val ['orig_to'] ) );
|
43 |
+
|
44 |
+
$this->getCollection ()->getSelect ()->where ( "dl.dailydeals_date <= '" . $to . "' AND dl.dailydeals_date >= '" . $from . "'" );
|
45 |
+
}
|
46 |
+
|
47 |
+
// code...
|
48 |
+
} else {
|
49 |
+
|
50 |
+
parent::_addColumnFilterToCollection ( $column );
|
51 |
+
}
|
52 |
+
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
protected function _prepareCollection() {
|
56 |
+
$collection = Mage::getResourceModel ( 'catalog/product_collection' )->
|
57 |
+
|
58 |
+
addAttributeToSelect ( '*' );
|
59 |
+
|
60 |
+
$productIds = $this->_getSelectedProducts ();
|
61 |
+
if (empty ( $productIds )) {
|
62 |
+
$productIds = array (
|
63 |
+
0
|
64 |
+
);
|
65 |
+
}
|
66 |
+
// $collection->addFieldToFilter('entity_id', array('in' => $productIds));
|
67 |
+
|
68 |
+
$collection->getSelect ()->joinLeft ( array (
|
69 |
+
'dl' => 'dailydeals'
|
70 |
+
), 'e.entity_id = dl.dailydeals_product', array (
|
71 |
+
'dl.*'
|
72 |
+
) );
|
73 |
+
|
74 |
+
$this->setCollection ( $collection );
|
75 |
+
return parent::_prepareCollection ();
|
76 |
+
}
|
77 |
+
public function getSelectedproductsIdsString() {
|
78 |
+
$selectedIds = $this->_getSelectedProducts ();
|
79 |
+
return implode ( ',', $selectedIds );
|
80 |
+
}
|
81 |
+
public function _getSelectedProducts() {
|
82 |
+
$prepareSelect = array ();
|
83 |
+
$selectedproducts = Mage::getModel ('dailydeals/dailydeals')->getCollection ();
|
84 |
+
foreach ( $selectedproducts as $rr ) {
|
85 |
+
|
86 |
+
array_push ( $prepareSelect, $rr->getdailydeals_product () );
|
87 |
+
}
|
88 |
+
|
89 |
+
return $prepareSelect;
|
90 |
+
}
|
91 |
+
protected function _myCustomFilter($collection, $column) {
|
92 |
+
if ($value == 0) {
|
93 |
+
|
94 |
+
$collection1 = Mage::getModel ( 'cataloginventory/stock' )->getItemCollection ()->addFieldToFilter ( 'is_in_stock' );
|
95 |
+
|
96 |
+
$product_ids = array ();
|
97 |
+
foreach ( $collection1 as $item ) {
|
98 |
+
$product_ids [] = $item->getProductId ();
|
99 |
+
}
|
100 |
+
|
101 |
+
$collection->addFieldToFilter ( 'entity_id', array (
|
102 |
+
'in' => $product_ids
|
103 |
+
) );
|
104 |
+
// out of stock
|
105 |
+
} elseif ($value == 1) {
|
106 |
+
|
107 |
+
Mage::getSingleton ( 'cataloginventory/stock' )->addInStockFilterToCollection ( $collection );
|
108 |
+
|
109 |
+
// code...
|
110 |
+
}
|
111 |
+
|
112 |
+
return $this;
|
113 |
+
}
|
114 |
+
protected function _prepareColumns() {
|
115 |
+
$helper = Mage::helper ( 'dailydeals' );
|
116 |
+
|
117 |
+
$this->addColumn ( 'in_products', array (
|
118 |
+
'header_css_class' => 'a-center',
|
119 |
+
'type' => 'checkbox',
|
120 |
+
'name' => 'in_products',
|
121 |
+
'values' => $this->_getSelectedProducts (),
|
122 |
+
'align' => 'center',
|
123 |
+
'index' => 'entity_id'
|
124 |
+
) );
|
125 |
+
|
126 |
+
|
127 |
+
$this->addColumn ('dailydeals_date', array (
|
128 |
+
'header' => Mage::helper ( 'catalog' )->__ ( 'Date Selected' ),
|
129 |
+
'name' => 'position',
|
130 |
+
'type' => 'date',
|
131 |
+
'validate_class' => 'validate-number',
|
132 |
+
'index' => 'dailydeals_date',
|
133 |
+
'width' => 200,
|
134 |
+
'editable' => ! $this->_getProduct ()->getRelatedReadonly (),
|
135 |
+
'edit_only' => ! $this->_getProduct ()->getId (),
|
136 |
+
|
137 |
+
'renderer' => 'dailydeals/adminhtml_dailydeals_deals_renderer_dealsrenderer'
|
138 |
+
)
|
139 |
+
);
|
140 |
+
|
141 |
+
$this->addColumn ( 'entity_id', array (
|
142 |
+
'header' => Mage::helper ( 'catalog' )->__ ( 'Product ID' ),
|
143 |
+
'sortable' => true,
|
144 |
+
'width' => 60,
|
145 |
+
'index' => 'entity_id'
|
146 |
+
) );
|
147 |
+
|
148 |
+
$this->addColumn ( 'name', array (
|
149 |
+
'header' => Mage::helper ( 'catalog' )->__ ( 'Name' ),
|
150 |
+
'index' => 'name'
|
151 |
+
) );
|
152 |
+
|
153 |
+
$this->addColumn ( 'entity_id', array (
|
154 |
+
'header' => Mage::helper ( 'catalog' )->__ ( 'Stock' ),
|
155 |
+
'index' => 'stock_check',
|
156 |
+
'type' => 'options',
|
157 |
+
'renderer' => 'dailydeals/adminhtml_dailydeals_deals_renderer_dealsrenderer',
|
158 |
+
'filter_condition_callback' => array (
|
159 |
+
$this,
|
160 |
+
'_myCustomFilter'
|
161 |
+
),
|
162 |
+
'options' => array (
|
163 |
+
0 => 'Out of Stock',
|
164 |
+
1 => 'In Stock'
|
165 |
+
)
|
166 |
+
)
|
167 |
+
);
|
168 |
+
|
169 |
+
$this->addExportType('*/*/exportCsv',
|
170 |
+
Mage::helper('dailydeals')->__('CSV'));
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
return parent::_prepareColumns ();
|
175 |
+
}
|
176 |
+
public function getGridUrl() {
|
177 |
+
return $this->getUrl ( '*/*/grid', array (
|
178 |
+
'_current' => true
|
179 |
+
) );
|
180 |
+
}
|
181 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/Block/Adminhtml/Dailydeals/Deals/Renderer/Dealsrenderer.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Aaryasolutions_Dailydeals_Block_Adminhtml_Dailydeals_Deals_Renderer_Dealsrenderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action {
|
3 |
+
public function render(Varien_Object $row) {
|
4 |
+
if ($this->getColumn ()->getIndex () == 'dailydeals_date') {
|
5 |
+
return $this->_getValue ( $row );
|
6 |
+
} elseif ($this->getColumn ()->getIndex () == 'stock_check') {
|
7 |
+
|
8 |
+
$val = $row->getData ( 'entity_id' );
|
9 |
+
|
10 |
+
$product = Mage::getModel ( 'catalog/product' )->load ( $val );
|
11 |
+
$stock = $product->getStockItem ();
|
12 |
+
if ($stock->getIsInStock ()) {
|
13 |
+
return "IN STOCK";
|
14 |
+
} else {
|
15 |
+
return "OUT OF STOCK";
|
16 |
+
}
|
17 |
+
|
18 |
+
// code...
|
19 |
+
}
|
20 |
+
}
|
21 |
+
public function _getValue(Varien_Object $row) {
|
22 |
+
$val = $row->getData ( 'entity_id' );
|
23 |
+
|
24 |
+
$getDailyDate = Mage::getModel ( 'dailydeals/dailydeals' )->getDailyDealsDateByProductId ( $val );
|
25 |
+
|
26 |
+
if (! is_null ( $getDailyDate )) {
|
27 |
+
return $getDailyDate;
|
28 |
+
} else {
|
29 |
+
|
30 |
+
return '-';
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/Block/Dealsfront.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Aaryasolutions_Dailydeals_Block_Dealsfront extends Mage_Core_Block_Template {
|
3 |
+
protected function _construct() {
|
4 |
+
parent::_construct ();
|
5 |
+
$this->_blockGroup = 'dailydeals';
|
6 |
+
|
7 |
+
}
|
8 |
+
protected function _toHtml() {
|
9 |
+
return parent::_toHtml ();
|
10 |
+
}
|
11 |
+
public function getToShowProductId() {
|
12 |
+
return Mage::getModel ('dailydeals/dailydeals')->getProductIdForHomepage ();
|
13 |
+
}
|
14 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Aaryasolutions_Dailydeals_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
|
6 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/Model/Dailydeals.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Aaryasolutions_Dailydeals_Model_dailydeals extends Mage_Core_Model_Abstract {
|
3 |
+
public function _construct() {
|
4 |
+
parent::_construct ();
|
5 |
+
$this->_init ('dailydeals/dailydeals');
|
6 |
+
}
|
7 |
+
public function getDailyDealsDateByProductId($pid) {
|
8 |
+
$toreturn = null;
|
9 |
+
$collection = $this->getCollection ();
|
10 |
+
$collection->addFieldToFilter ('dailydeals_product', array (
|
11 |
+
'eq' => $pid
|
12 |
+
) );
|
13 |
+
|
14 |
+
if ($collection->count () == 1) {
|
15 |
+
|
16 |
+
foreach ( $collection as $rr ) {
|
17 |
+
$toreturn = $rr->getdailydeals_date ();
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
return $toreturn;
|
22 |
+
}
|
23 |
+
public function getNearestDateFromToday() {
|
24 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
25 |
+
$readConnection = $resource->getConnection ( 'core_read' );
|
26 |
+
$table = 'dailydeals';
|
27 |
+
|
28 |
+
$query = "SELECT * FROM {$table} WHERE dailydeals_date < now() ORDER BY ABS( DATEDIFF( NOW( ) , dailydeals_date ) ) LIMIT 1";
|
29 |
+
$results = $readConnection->fetchAll ( $query );
|
30 |
+
|
31 |
+
foreach ( $results as $result ) {
|
32 |
+
|
33 |
+
return $result ['dailydeals_product'];
|
34 |
+
}
|
35 |
+
}
|
36 |
+
public function getProductIdForHomepage() {
|
37 |
+
$toreturn = null;
|
38 |
+
$currentDate = Mage::getModel ( 'core/date' )->date ( 'Y-m-d' );
|
39 |
+
|
40 |
+
$collection = $this->getCollection ();
|
41 |
+
$collection->addFieldToFilter ( 'dailydeals_date', array (
|
42 |
+
'eq' => $currentDate
|
43 |
+
) );
|
44 |
+
|
45 |
+
if ($collection->count () > 0) {
|
46 |
+
|
47 |
+
foreach ( $collection as $rr ) {
|
48 |
+
$toreturn = $rr->getdailydeals_product ();
|
49 |
+
}
|
50 |
+
} else {
|
51 |
+
|
52 |
+
$toreturn = $this->getNearestDateFromToday ();
|
53 |
+
}
|
54 |
+
|
55 |
+
return $toreturn;
|
56 |
+
}
|
57 |
+
public function deleteDailyDeal($pid) {
|
58 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Retrieve the write connection
|
62 |
+
*/
|
63 |
+
$writeConnection = $resource->getConnection ( 'core_write' );
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Retrieve our table name
|
67 |
+
*/
|
68 |
+
$table = 'dailydeals';
|
69 |
+
|
70 |
+
$query = "DELETE FROM {$table} WHERE dailydeals_product = " . ( int ) $pid;
|
71 |
+
|
72 |
+
$writeConnection->query ( $query );
|
73 |
+
}
|
74 |
+
public function ifProductIdExists($pid) {
|
75 |
+
$toreturn = null;
|
76 |
+
$collection = $this->getCollection ();
|
77 |
+
$collection->addFieldToFilter ( 'dailydeals_product', array (
|
78 |
+
'eq' => $pid
|
79 |
+
) );
|
80 |
+
|
81 |
+
if ($collection->count () == 1) {
|
82 |
+
|
83 |
+
foreach ( $collection as $rr ) {
|
84 |
+
$toreturn = $rr->getdailydeals_id ();
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
return $toreturn;
|
89 |
+
}
|
90 |
+
public function addDailyDeals($data) {
|
91 |
+
$model = $this->setData ( $data );
|
92 |
+
try {
|
93 |
+
$insertId = $model->save ()->getId ();
|
94 |
+
|
95 |
+
} catch ( Exception $e ) {
|
96 |
+
echo $e->getMessage ();
|
97 |
+
}
|
98 |
+
}
|
99 |
+
function updateDailyDeals($data, $id) {
|
100 |
+
$model = $this->load ( $id )->addData ( $data );
|
101 |
+
try {
|
102 |
+
$model->setId ( $id )->save ();
|
103 |
+
|
104 |
+
} catch ( Exception $e ) {
|
105 |
+
// echo $e->getMessage();
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/Model/Mysql4/Dailydeals.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aaryasolutions_Dailydeals_Model_Mysql4_Dailydeals extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the dailydeals_id refers to the key field in your database table.
|
8 |
+
$this->_init('dailydeals/dailydeals', 'dailydeals_id');
|
9 |
+
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/Model/Mysql4/Dailydeals/Collection.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aaryasolutions_Dailydeals_Model_Mysql4_Dailydeals_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('dailydeals/dailydeals');
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/controllers/Adminhtml/DailydealsController.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Aaryasolutions_Dailydeals_Adminhtml_DailydealsController extends Mage_Adminhtml_Controller_Action {
|
3 |
+
public function indexAction() {
|
4 |
+
$this->_title ( $this->__ ('Daily deals') )->_title ( $this->__ ( 'Daily deals' ) );
|
5 |
+
$this->loadLayout ();
|
6 |
+
$this->_setActiveMenu ('aarayasolutions');
|
7 |
+
$this->_addContent ( $this->getLayout ()->createBlock ( 'dailydeals/adminhtml_dailydeals_deals' ) );
|
8 |
+
$this->renderLayout ();
|
9 |
+
}
|
10 |
+
public function gridAction() {
|
11 |
+
$this->loadLayout ();
|
12 |
+
$this->getResponse ()->setBody ( $this->getLayout ()->createBlock ('dailydeals/adminhtml_dailydeals_deals_grid' )->toHtml () );
|
13 |
+
}
|
14 |
+
public function saveAction() {
|
15 |
+
$dates = Mage::app ()->getrequest ()->getPost ('date_selected' );
|
16 |
+
|
17 |
+
|
18 |
+
$bb = new Aaryasolutions_Dailydeals_Block_Adminhtml_Dailydeals_Deals_Grid ();
|
19 |
+
$previousarray = $bb->_getSelectedProducts ();
|
20 |
+
|
21 |
+
$nowarray = explode ( ',', Mage::app ()->getrequest ()->getPost ('main_product_select_dailydeals' ));
|
22 |
+
|
23 |
+
|
24 |
+
foreach ( $previousarray as $pr_id ) {
|
25 |
+
|
26 |
+
if (in_array ( $pr_id, $nowarray )) {
|
27 |
+
} else {
|
28 |
+
|
29 |
+
Mage::getModel ('dailydeals/dailydeals' )->deleteDailyDeal ( $pr_id );
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
foreach ($dates as $productid => $selectedarray ) {
|
34 |
+
|
35 |
+
$ifproductExists = Mage::getModel ('dailydeals/dailydeals' )->ifProductIdExists ( $productid );
|
36 |
+
|
37 |
+
$data ['dailydeals_date'] = $selectedarray [0];
|
38 |
+
$data ['dailydeals_product'] = $productid;
|
39 |
+
|
40 |
+
if (! is_null ( $ifproductExists )) {
|
41 |
+
|
42 |
+
$dailydealsId = $ifproductExists;
|
43 |
+
|
44 |
+
Mage::getModel ('dailydeals/dailydeals' )->updateDailyDeals ( $data, $dailydealsId );
|
45 |
+
} else {
|
46 |
+
Mage::getModel ( 'dailydeals/dailydeals' )->addDailyDeals ( $data );
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
$this->_redirect ('dailydeals/adminhtml_dailydeals' );
|
51 |
+
}
|
52 |
+
|
53 |
+
public function exportCsvAction()
|
54 |
+
{
|
55 |
+
$fileName = 'dailydeals.csv';
|
56 |
+
$content = $this->getLayout()->createBlock('dailydeals/adminhtml_dailydeals_deals_grid')->getCsvFile();
|
57 |
+
$this->_prepareDownloadResponse($fileName, $content);
|
58 |
+
}
|
59 |
+
|
60 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
61 |
+
{
|
62 |
+
$this->_prepareDownloadResponse($fileName, $content, $contentType);
|
63 |
+
}
|
64 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/controllers/IndexController.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Aaryasolutions_Dailydeals_IndexController extends Mage_Core_Controller_Front_Action {
|
3 |
+
public function indexAction() {
|
4 |
+
$this->loadLayout ();
|
5 |
+
$this->renderLayout ();
|
6 |
+
}
|
7 |
+
}
|
app/code/local/Aaryasolutions/Dailydeals/etc/adminhtml.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<aaryasolutions translate="title" module="dailydeals">
|
5 |
+
<title>Aaryasolutions</title>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</aaryasolutions>
|
8 |
+
<aaryasolutions>
|
9 |
+
|
10 |
+
<children>
|
11 |
+
<dailydeals translate="title" module="dailydeals">
|
12 |
+
<title>Daily Deals</title>
|
13 |
+
<sort_order>120</sort_order>
|
14 |
+
<action>dailydeals/adminhtml_dailydeals</action>
|
15 |
+
</dailydeals>
|
16 |
+
</children>
|
17 |
+
</aaryasolutions>
|
18 |
+
</menu>
|
19 |
+
|
20 |
+
<acl>
|
21 |
+
<resources>
|
22 |
+
<all>
|
23 |
+
<title>Allow Everything</title>
|
24 |
+
</all>
|
25 |
+
</resources>
|
26 |
+
</acl>
|
27 |
+
</config>
|
app/code/local/Aaryasolutions/Dailydeals/etc/config.xml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Aaryasolutions_Dailydeals>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Aaryasolutions_Dailydeals>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<dailydeals>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Aaryasolutions_Dailydeals</module>
|
14 |
+
<frontName>dailydeals</frontName>
|
15 |
+
</args>
|
16 |
+
</dailydeals>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<dailydeals>
|
21 |
+
<file>dailydeals.xml</file>
|
22 |
+
</dailydeals>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<adminhtml>
|
29 |
+
<args>
|
30 |
+
<modules>
|
31 |
+
<Aaryasolutions_Dailydeals before="Mage_Adminhtml">Aaryasolutions_Dailydeals</Aaryasolutions_Dailydeals>
|
32 |
+
</modules>
|
33 |
+
</args>
|
34 |
+
</adminhtml>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
|
38 |
+
|
39 |
+
<global>
|
40 |
+
<blocks>
|
41 |
+
<dailydeals>
|
42 |
+
<class>Aaryasolutions_Dailydeals_Block</class>
|
43 |
+
</dailydeals>
|
44 |
+
</blocks>
|
45 |
+
<helpers>
|
46 |
+
<dailydeals>
|
47 |
+
<class>Aaryasolutions_Dailydeals_Helper</class>
|
48 |
+
</dailydeals>
|
49 |
+
</helpers>
|
50 |
+
<models>
|
51 |
+
<dailydeals>
|
52 |
+
<class>Aaryasolutions_Dailydeals_Model</class>
|
53 |
+
<resourceModel>dailydeals_mysql4</resourceModel>
|
54 |
+
</dailydeals>
|
55 |
+
<dailydeals_mysql4>
|
56 |
+
<class>Aaryasolutions_Dailydeals_Model_Mysql4</class>
|
57 |
+
<entities>
|
58 |
+
<dailydeals>
|
59 |
+
<table>dailydeals</table>
|
60 |
+
</dailydeals>
|
61 |
+
</entities>
|
62 |
+
</dailydeals_mysql4>
|
63 |
+
</models>
|
64 |
+
<resources>
|
65 |
+
<dailydeals_setup>
|
66 |
+
<setup>
|
67 |
+
<module>Aaryasolutions_Dailydeals</module>
|
68 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
69 |
+
</setup>
|
70 |
+
<connection>
|
71 |
+
<use>core_setup</use>
|
72 |
+
</connection>
|
73 |
+
</dailydeals_setup>
|
74 |
+
<dailydeals_write>
|
75 |
+
<connection>
|
76 |
+
<use>core_write</use>
|
77 |
+
</connection>
|
78 |
+
</dailydeals_write>
|
79 |
+
<dailydeals_read>
|
80 |
+
<connection>
|
81 |
+
<use>core_read</use>
|
82 |
+
</connection>
|
83 |
+
</dailydeals_read>
|
84 |
+
</resources>
|
85 |
+
</global>
|
86 |
+
|
87 |
+
<adminhtml>
|
88 |
+
<layout>
|
89 |
+
<updates>
|
90 |
+
<dailydeals>
|
91 |
+
<file>dailydeals/dailydeals.xml</file>
|
92 |
+
</dailydeals>
|
93 |
+
</updates>
|
94 |
+
</layout>
|
95 |
+
</adminhtml>
|
96 |
+
|
97 |
+
|
98 |
+
</config>
|
app/code/local/Aaryasolutions/Dailydeals/sql/dailydeals_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
$installer = $this;
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
CREATE TABLE IF NOT EXISTS `dailydeals` (
|
9 |
+
`dailydeals_id` int(11) NOT NULL AUTO_INCREMENT,
|
10 |
+
`dailydeals_date` date NOT NULL,
|
11 |
+
`dailydeals_product` int(11) NOT NULL,
|
12 |
+
PRIMARY KEY (`dailydeals_id`)
|
13 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=23;
|
14 |
+
");
|
15 |
+
|
16 |
+
$installer->endSetup();
|
17 |
+
|
app/code/local/Aaryasolutions/Dailydeals/sql/dailydeals_setup/mysql4-upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
$installer = $this;
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
CREATE TABLE IF NOT EXISTS `dailydeals` (
|
9 |
+
`dailydeals_id` int(11) NOT NULL AUTO_INCREMENT,
|
10 |
+
`dailydeals_date` date NOT NULL,
|
11 |
+
`dailydeals_product` int(11) NOT NULL,
|
12 |
+
PRIMARY KEY (`dailydeals_id`)
|
13 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=23;
|
14 |
+
");
|
15 |
+
|
16 |
+
$installer->endSetup();
|
17 |
+
|
app/design/adminhtml/default/default/template/dailydeals/grid.phtml
ADDED
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Template for Mage_Adminhtml_Block_Widget_Grid
|
30 |
+
*
|
31 |
+
* getId()
|
32 |
+
* getCollection()
|
33 |
+
* getColumns()
|
34 |
+
* getPagerVisibility()
|
35 |
+
* getVarNamePage()
|
36 |
+
*/
|
37 |
+
$numColumns = sizeof($this->getColumns());
|
38 |
+
|
39 |
+
?>
|
40 |
+
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
|
41 |
+
<script type="text/javascript">
|
42 |
+
jQuery.noConflict();
|
43 |
+
</script>
|
44 |
+
<?php echo $this->_getProduct ()->getId () ?>
|
45 |
+
<form method="post" action="<?php echo Mage::helper("adminhtml")->getUrl("dailydeals/adminhtml_dailydeals/save"); ?>" id="hbdaily_form">
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
<?php if($this->getCollection()): ?>
|
50 |
+
<?php if($this->canDisplayContainer()): ?>
|
51 |
+
<?php if($this->getGridHeader()): ?>
|
52 |
+
<div class="content-header">
|
53 |
+
<table cellspacing="0">
|
54 |
+
<tr>
|
55 |
+
<td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
|
56 |
+
</tr>
|
57 |
+
</table>
|
58 |
+
</div>
|
59 |
+
<?php endif ?>
|
60 |
+
|
61 |
+
<div id="<?php echo $this->getId() ?>">
|
62 |
+
<?php else: ?>
|
63 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
64 |
+
<?php endif; ?>
|
65 |
+
<?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
|
66 |
+
|
67 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
|
68 |
+
|
69 |
+
<input type="hidden" id="main_product_select_dailydeals" name="main_product_select_dailydeals" value="<?php echo $this->getSelectedproductsIdsString(); ?>">
|
70 |
+
<div style="text-align:right;">
|
71 |
+
<button id="hbdaily_form_submit_btn" class="scalable save" style="" type="submit" title="Save and Continue Edit">
|
72 |
+
<span>
|
73 |
+
<span>
|
74 |
+
<span>Save and Continue Edit</span>
|
75 |
+
</span>
|
76 |
+
</span>
|
77 |
+
</button>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
<table cellspacing="0" class="actions">
|
81 |
+
<tr>
|
82 |
+
<?php if($this->getPagerVisibility()): ?>
|
83 |
+
<td class="pager">
|
84 |
+
<?php echo $this->__('Page') ?>
|
85 |
+
|
86 |
+
<?php $_curPage = $this->getCollection()->getCurPage() ?>
|
87 |
+
<?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
|
88 |
+
<?php if($_curPage>1): ?>
|
89 |
+
<a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getJsObjectName() ?>.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
|
90 |
+
<?php else: ?>
|
91 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
92 |
+
<?php endif; ?>
|
93 |
+
|
94 |
+
<input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getJsObjectName() ?>.inputPage(event, '<?php echo $_lastPage ?>')"/>
|
95 |
+
|
96 |
+
<?php if($_curPage < $_lastPage): ?>
|
97 |
+
<a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getJsObjectName() ?>.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
|
98 |
+
<?php else: ?>
|
99 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
100 |
+
<?php endif; ?>
|
101 |
+
|
102 |
+
<?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
|
103 |
+
<span class="separator">|</span>
|
104 |
+
<?php echo $this->__('View') ?>
|
105 |
+
<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getJsObjectName() ?>.loadByElement(this)">
|
106 |
+
<option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
|
107 |
+
<option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
|
108 |
+
<option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
|
109 |
+
<option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
|
110 |
+
<option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
|
111 |
+
</select>
|
112 |
+
<?php echo $this->__('per page') ?><span class="separator">|</span>
|
113 |
+
<?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
|
114 |
+
<span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
|
115 |
+
<?php if($this->getRssLists()): ?>
|
116 |
+
<?php foreach ($this->getRssLists() as $_rss): ?>
|
117 |
+
<span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
|
118 |
+
<?php endforeach ?>
|
119 |
+
<?php endif; ?>
|
120 |
+
</td>
|
121 |
+
<?php endif ?>
|
122 |
+
<?php if($this->getExportTypes()): ?>
|
123 |
+
<td class="export a-right">
|
124 |
+
<img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/> <?php echo $this->__('Export to:') ?>
|
125 |
+
<select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
|
126 |
+
<?php foreach ($this->getExportTypes() as $_type): ?>
|
127 |
+
<option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
|
128 |
+
<?php endforeach; ?>
|
129 |
+
</select>
|
130 |
+
<?php echo $this->getExportButtonHtml() ?>
|
131 |
+
</td>
|
132 |
+
<?php endif; ?>
|
133 |
+
<td class="filter-actions a-right">
|
134 |
+
<?php echo $this->getMainButtonsHtml() ?>
|
135 |
+
</td>
|
136 |
+
</tr>
|
137 |
+
</table>
|
138 |
+
<?php endif; ?>
|
139 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
140 |
+
<?php echo $this->getMassactionBlockHtml() ?>
|
141 |
+
<?php endif ?>
|
142 |
+
<div class="grid">
|
143 |
+
<div class="hor-scroll">
|
144 |
+
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
|
145 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
146 |
+
<col <?php echo $_column->getHtmlProperty() ?> />
|
147 |
+
<?php endforeach; ?>
|
148 |
+
<?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
|
149 |
+
<thead>
|
150 |
+
<?php if ($this->getHeadersVisibility()): ?>
|
151 |
+
<tr class="headings">
|
152 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
153 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
|
154 |
+
<?php endforeach; ?>
|
155 |
+
</tr>
|
156 |
+
<?php endif; ?>
|
157 |
+
<?php if ($this->getFilterVisibility()): ?>
|
158 |
+
<tr class="filter">
|
159 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
160 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
|
161 |
+
<?php endforeach; ?>
|
162 |
+
</tr>
|
163 |
+
<?php endif ?>
|
164 |
+
</thead>
|
165 |
+
<?php endif; ?>
|
166 |
+
<?php if ($this->getCountTotals()): ?>
|
167 |
+
<tfoot>
|
168 |
+
<tr class="totals">
|
169 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
170 |
+
<th class="<?php echo $_column->getCssProperty() ?>"><?php echo ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?> </th>
|
171 |
+
<?php endforeach; ?>
|
172 |
+
</tr>
|
173 |
+
</tfoot>
|
174 |
+
<?php endif; ?>
|
175 |
+
|
176 |
+
<tbody>
|
177 |
+
<?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
|
178 |
+
<?php foreach ($this->getCollection() as $_index=>$_item): ?>
|
179 |
+
<tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
|
180 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
181 |
+
|
182 |
+
<?php if ($this->shouldRenderCell($_item, $_column)):?>
|
183 |
+
<?php $_rowspan = $this->getRowspan($_item, $_column);?>
|
184 |
+
<td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
|
185 |
+
<?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?>
|
186 |
+
</td>
|
187 |
+
<?php if ($this->shouldRenderEmptyCell($_item, $_column)):?>
|
188 |
+
<td colspan="<?php echo $this->getEmptyCellColspan($_item)?>" class="last"><?php echo $this->getEmptyCellLabel()?></td>
|
189 |
+
<?php endif;?>
|
190 |
+
<?php endif;?>
|
191 |
+
|
192 |
+
<?php endforeach; ?>
|
193 |
+
</tr>
|
194 |
+
<?php if ($_multipleRows = $this->getMultipleRows($_item)):?>
|
195 |
+
<?php foreach ($_multipleRows as $_i):?>
|
196 |
+
<tr>
|
197 |
+
<?php $i=0;foreach ($this->getMultipleRowColumns($_i) as $_column): ?>
|
198 |
+
<td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns-1?'last':'' ?>">
|
199 |
+
<?php echo (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?>
|
200 |
+
</td>
|
201 |
+
<?php endforeach; ?>
|
202 |
+
</tr>
|
203 |
+
<?php endforeach;?>
|
204 |
+
<?php endif;?>
|
205 |
+
|
206 |
+
<?php if ($this->shouldRenderSubTotal($_item)): ?>
|
207 |
+
<tr class="subtotals">
|
208 |
+
<?php $i = 0; foreach ($this->getSubTotalColumns() as $_column): ?>
|
209 |
+
<td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i == $numColumns ? 'last' : '' ?>">
|
210 |
+
<?php echo ($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() :
|
211 |
+
$_column->getRowField($this->getSubTotalItem($_item))
|
212 |
+
);
|
213 |
+
?>
|
214 |
+
</td>
|
215 |
+
<?php endforeach; ?>
|
216 |
+
</tr>
|
217 |
+
<?php endif; ?>
|
218 |
+
<?php endforeach; ?>
|
219 |
+
<?php elseif ($this->getEmptyText()): ?>
|
220 |
+
<tr>
|
221 |
+
<td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="<?php echo $numColumns ?>"><?php echo $this->getEmptyText() ?></td>
|
222 |
+
</tr>
|
223 |
+
<?php endif; ?>
|
224 |
+
</tbody>
|
225 |
+
|
226 |
+
</table>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
<?php if($this->canDisplayContainer()): ?>
|
230 |
+
</div>
|
231 |
+
|
232 |
+
|
233 |
+
|
234 |
+
|
235 |
+
|
236 |
+
</form>
|
237 |
+
|
238 |
+
<script type="text/javascript">
|
239 |
+
//<![CDATA[
|
240 |
+
<?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
|
241 |
+
<?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
|
242 |
+
<?php if($this->getRowClickCallback()): ?>
|
243 |
+
<?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
|
244 |
+
<?php endif; ?>
|
245 |
+
<?php if($this->getCheckboxCheckCallback()): ?>
|
246 |
+
<?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
|
247 |
+
<?php endif; ?>
|
248 |
+
<?php if($this->getRowInitCallback()): ?>
|
249 |
+
<?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
|
250 |
+
<?php echo $this->getJsObjectName() ?>.initGridRows();
|
251 |
+
<?php endif; ?>
|
252 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
253 |
+
<?php echo $this->getMassactionBlock()->getJavaScript() ?>
|
254 |
+
<?php endif ?>
|
255 |
+
<?php echo $this->getAdditionalJavaScript(); ?>
|
256 |
+
//]]>
|
257 |
+
</script>
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
<!-- <input id="hbking_hbdeals_input_date" class="input-text no-changes" type="text" value="" name="position[from]"> -->
|
262 |
+
|
263 |
+
|
264 |
+
|
265 |
+
<script type="text/javascript">
|
266 |
+
|
267 |
+
jQuery(document).on("click", ".checkbox", function(event) {
|
268 |
+
|
269 |
+
if(jQuery(this).is(":checked")){
|
270 |
+
|
271 |
+
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
+
|
276 |
+
var pid=jQuery(this).val();
|
277 |
+
|
278 |
+
|
279 |
+
|
280 |
+
|
281 |
+
pid=jQuery.trim(pid);
|
282 |
+
|
283 |
+
|
284 |
+
var splitedarray=jQuery('#main_product_select_dailydeals').val().split(',');
|
285 |
+
splitedarray.push(pid);
|
286 |
+
var commalist=splitedarray.join(",");
|
287 |
+
jQuery('#main_product_select_dailydeals').val(commalist);
|
288 |
+
|
289 |
+
|
290 |
+
|
291 |
+
var originaldate=jQuery.trim(jQuery(this).parent().next().html());
|
292 |
+
|
293 |
+
|
294 |
+
|
295 |
+
jQuery(this).parent().next('.editable').html('<input class="hbking_hbdeals_input_date'+pid+'" class="input-text no-changes" type="text" value="'+originaldate+'" name="date_selected['+pid+'][]" required />');
|
296 |
+
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
|
301 |
+
}else{
|
302 |
+
|
303 |
+
jQuery(this).parent().next('.editable').html('');
|
304 |
+
var pid=jQuery(this).parent().next().next().html();
|
305 |
+
|
306 |
+
|
307 |
+
|
308 |
+
|
309 |
+
pid=jQuery.trim(pid);
|
310 |
+
|
311 |
+
var splitedarray=jQuery('#main_product_select_dailydeals').val().split(',');
|
312 |
+
splitedarray.splice(jQuery.inArray(pid, splitedarray),1);
|
313 |
+
var commalist=splitedarray.join(",");
|
314 |
+
jQuery('#main_product_select_dailydeals').val(commalist);
|
315 |
+
|
316 |
+
//alert('not checked');
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
});
|
321 |
+
|
322 |
+
/*Calendar.setup({
|
323 |
+
inputField : "hbking_hbdeals_input_date",
|
324 |
+
ifFormat : "%m/%e/%Y",
|
325 |
+
button : "hbking__hbdailydels_deals_grid_filter_position1417171391.4382_from_trig",
|
326 |
+
align : "Bl",
|
327 |
+
singleClick : true
|
328 |
+
});*/
|
329 |
+
|
330 |
+
|
331 |
+
|
332 |
+
|
333 |
+
</script>
|
334 |
+
<?php endif; ?>
|
335 |
+
<?php endif ?>
|
app/design/frontend/rwd/default/layout/dailydeals.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<dailydeals_index_index>
|
4 |
+
<reference name="root">
|
5 |
+
<action method="setTemplate"><template>page/3columns.phtml</template> </action>
|
6 |
+
</reference>
|
7 |
+
<reference name="content">
|
8 |
+
<block type="dailydeals/dealsfront" template="dailydeals/dealsfront.phtml" name="dailydeals.dealsfront"/>
|
9 |
+
</reference>
|
10 |
+
</dailydeals_index_index>
|
11 |
+
|
12 |
+
</layout>
|
app/etc/modules/Aaryasolutions_Dailydeals.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Aaryasolutions_Dailydeals>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Aaryasolutions_Dailydeals>
|
8 |
+
</modules>
|
9 |
+
</config>
|
10 |
+
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Aaryasolutions_Dailydeals</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>This extension create deals on the basis of price.</summary>
|
10 |
+
<description>This extension create deals on the basis of price. We can add deals at backend.</description>
|
11 |
+
<notes>This extension create deals on the basis of price. We can add deals at backend.</notes>
|
12 |
+
<authors><author><name>AaryaSolutions</name><user>aaryasolutions</user><email>info@aaryasolutions.com</email></author></authors>
|
13 |
+
<date>2015-01-16</date>
|
14 |
+
<time>09:31:01</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Aaryasolutions"><dir name="Dailydeals"><dir name="Block"><dir name="Adminhtml"><dir name="Dailydeals"><dir name="Deals"><file name="Grid.php" hash="920a8e77ae125528f88f5a0cb3fd71c8"/><dir name="Renderer"><file name="Dealsrenderer.php" hash="9a35a255c515c601cb2fdba2fdc7c46f"/></dir></dir><file name="Deals.php" hash="04f2e4920a18cfb44319faaae74705b7"/></dir></dir><file name="Dealsfront.php" hash="9f5b95aad4f1d6ba36c5fbffd245116e"/></dir><dir name="Helper"><file name="Data.php" hash="1160a96b69e1b9c1d63549813787bf44"/></dir><dir name="Model"><file name="Dailydeals.php" hash="0fd2d131607c7ce17e8b3087f5e8faa3"/><dir name="Mysql4"><dir name="Dailydeals"><file name="Collection.php" hash="ff53b1c1b2d72f49adfe3e2b9a6dc5b2"/></dir><file name="Dailydeals.php" hash="709d990aef222796a70e25994dfce52b"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DailydealsController.php" hash="6be42e0d3437e8d9cabfd7d2bd95de0c"/></dir><file name="IndexController.php" hash="1dfd79bd811bd4f888f979ab984c0d5f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a6a6a5301c2a9fbf9dbddf7004ab3986"/><file name="config.xml" hash="622671008bce400db1811acdf9a1fae1"/></dir><dir name="sql"><dir name="dailydeals_setup"><file name="mysql4-install-0.1.0.php" hash="fd9ea7a706e159d66b2f5c98b5c20af9"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="fd9ea7a706e159d66b2f5c98b5c20af9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="dailydeals"><file name="grid.phtml" hash="00d2e0fa2430d30234bfd6e53358ac40"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="layout"><file name="dailydeals.xml" hash="e4dd2ec2307a36ce334c9883b4160020"/></dir><dir name="template"><file name="dealsfront.phtml" hash=""/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aaryasolutions_Dailydeals.xml" hash="df6511746a446e95c16eac51c6eabfef"/></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.1</min><max>2.0.0</max></package></required></dependencies>
|
18 |
+
</package>
|