-
Notifications
You must be signed in to change notification settings - Fork 26
/
Observer.php
65 lines (62 loc) · 2.03 KB
/
Observer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
class Dotdigitalgroup_Email_Model_Observer
{
/**
* Before block to html observer.
*
* @param Varien_Event_Observer $observer
*/
public function beforeBlockToHtml(Varien_Event_Observer $observer)
{
$grid = $observer->getBlock();
/**
* Mage_Adminhtml_Block_Customer_Grid
*/
if ($grid instanceof Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Coupons_Grid) {
$grid->addColumnAfter(
'expiration_date',
array(
'header' => Mage::helper('salesrule')->__('Expiration date'),
'index' => 'expiration_date',
'type' => 'datetime',
'default' => '-',
'align' => 'center',
'width' => '160'
),
'created_at'
)->addColumnAfter(
'generated_by_dotmailer',
array(
'header' => Mage::helper('salesrule')->__('Generated By dotmailer'),
'index' => 'generated_by_dotmailer',
'type' => 'options',
'options' => array('null' => 'No', '1' => 'Yes'),
'width' => '30',
'align' => 'center',
'filter_condition_callback' => array(
$this,
'filterCallbackContact'
)
),
'expiration_date'
);
}
}
/**
* Callback action for.
*
* @param $collection
* @param $column
*/
public function filterCallbackContact($collection, $column)
{
$field = $column->getFilterIndex() ? $column->getFilterIndex()
: $column->getIndex();
$value = $column->getFilter()->getValue();
if ($value == 'null') {
$collection->addFieldToFilter($field, array('null' => true));
} else {
$collection->addFieldToFilter($field, array('notnull' => true));
}
}
}