33 lines
803 B
PHP
33 lines
803 B
PHP
<?php
|
|
/**
|
|
* bootstrap.php
|
|
*
|
|
* @copyright 2022 opencart.cn - All Rights Reserved
|
|
* @link http://www.guangdawangluo.com
|
|
* @author Edward Yang <yangjin@opencart.cn>
|
|
* @created 2022-07-20 15:35:59
|
|
* @modified 2022-07-20 15:35:59
|
|
*/
|
|
|
|
namespace Plugin\FlatShipping;
|
|
|
|
class Bootstrap
|
|
{
|
|
/**
|
|
* @return float
|
|
*/
|
|
public function getShippingFee($totalService)
|
|
{
|
|
$amount = $totalService->amount;
|
|
$shippingType = plugin_setting('flat_shipping.type', 'fixed');
|
|
$shippingValue = plugin_setting('flat_shipping.value', 0);
|
|
if ($shippingType == 'fixed') {
|
|
return $shippingValue;
|
|
} elseif ($shippingType == 'rate') {
|
|
return $amount * $shippingValue / 100;
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|
|
}
|