forked from apeisa/Shop-for-ProcessWire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShippingFixedCost.module
41 lines (32 loc) · 1.13 KB
/
ShippingFixedCost.module
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
<?php
require_once(dirname(__FILE__) . '/ShippingAbstract.php');
class ShippingFixedCost extends ShippingAbstract implements ConfigurableModule {
public static function getModuleInfo()
{
return array(
'title' => 'Fixed cost shipping',
'version' => 001,
'summary' => 'Simple shipping option, which sets fixed shipping cost for all orders.',
'singular' => false,
'autoload' => false
);
}
public function init() {
$this->title = $this->_("Fixed shipping cost");
}
public function calculateShippingCost() {
return $this->shippingCost;
}
static public function getModuleConfigInputfields(Array $data) {
// this is a container for fields, basically like a fieldset
$fields = new InputfieldWrapper();
// since this is a static function, we can't use $this->modules, so get them from the global wire() function
$modules = wire('modules');
$field = $modules->get("InputfieldFloat");
$field->attr('name', 'shippingCost');
$field->attr('value', $data['shippingCost']);
$field->label = "Shipping cost for all orders";
$fields->add($field);
return $fields;
}
}