-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathextension.driver.php
67 lines (60 loc) · 1.71 KB
/
extension.driver.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
66
<?php
Class extension_shopping_cart extends Extension
{
public function about(){
return array('name' => 'Shopping Cart',
'version' => '1.2',
'release-date' => '2010-10-17',
'author' => array('name' => 'Andrey Lubinov, Giel Berkers',
'website' => false,
'email' => '[email protected]')
);
}
public function getSubscribedDelegates(){
return array(
array(
'page' => '/blueprints/events/new/',
'delegate' => 'AppendEventFilter',
'callback' => 'addFilterToEventEditor'
),
array(
'page' => '/blueprints/events/edit/',
'delegate' => 'AppendEventFilter',
'callback' => 'addFilterToEventEditor'
),
array(
'page' => '/frontend/',
'delegate' => 'EventPostSaveFilter',
'callback' => 'processEventData'
)
);
}
public function addFilterToEventEditor($context){
$context['options'][] = array('cart-drop-all', @in_array('cart-drop-all', $context['selected']) , __('Cart: Drop All Items'));
}
public function processEventData($context){
if(!in_array('cart-drop-all', $context['event']->eParamFILTERS)) return;
$_SESSION[__SYM_COOKIE_PREFIX_ . 'cart'] = null;
}
public function install() {
try{
Symphony::Database()->query("CREATE TABLE IF NOT EXISTS `tbl_fields_price` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
)");
}
catch(Exception $e){
return false;
}
return true;
}
public function uninstall() {
if(parent::uninstall() == true){
Symphony::Database()->query("DROP TABLE `tbl_fields_price`");
return true;
}
return false;
}
}