-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcontroller.php
46 lines (38 loc) · 1.42 KB
/
controller.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
<?php
namespace Concrete\Package\CommunityStoreShippingTablerate;
use Concrete\Package\CommunityStore\Src\CommunityStore\Shipping\Method\ShippingMethodType as StoreShippingMethodType;
use Package;
use Page;
use Database;
use Whoops\Exception\ErrorException;
class controller extends Package{
protected $pkgHandle = 'community_store_shipping_tablerate';
protected $appVersionRequired = '8.0';
protected $pkgVersion = '2.1';
protected $pkgAutoloaderRegistries = array(
'src/CommunityStore' => 'Concrete\Package\CommunityStoreShippingTablerate\Src\CommunityStore',
);
public function getPackageDescription(){
return t("Adds the table rate shipping method to Concrete5 Community store.");
}
public function getPackageName(){
return t("Community Store Table Rate shipping");
}
public function install(){
$installed = Package::getInstalledHandles();
if(!(is_array($installed) && in_array('community_store',$installed)) ) {
throw new ErrorException(t('This package requires that Community Store be installed'));
} else {
$pkg = parent::install();
$sm = new StoreShippingMethodType();
$sm->add('tablerate','Table Rate',$pkg);
}
}
public function uninstall(){
StoreShippingMethodType::getByHandle('tablerate')->delete();
$db = Database::connection();
$db->Execute('drop table CommunityStoreTablerateConditions');
$pkg = parent::uninstall();
}
}
?>