1: | <?php
2: | namespace Opencart\Catalog\Model\Extension\Opencart\Total;
3: | /**
4: | * Class Handling
5: | *
6: | * @package Opencart\Catalog\Model\Extension\Opencart\Total
7: | */
8: | class Handling extends \Opencart\System\Engine\Model {
9: | /**
10: | * Get Total
11: | *
12: | * @param array<int, array<string, mixed>> $totals
13: | * @param array<int, float> $taxes
14: | * @param float $total
15: | *
16: | * @return void
17: | */
18: | public function getTotal(array &$totals, array &$taxes, float &$total): void {
19: | if (($this->cart->getSubTotal() > (float)$this->config->get('total_handling_total')) && ($this->cart->getSubTotal() > 0)) {
20: | $this->load->language('extension/opencart/total/handling');
21: |
22: | $totals[] = [
23: | 'extension' => 'opencart',
24: | 'code' => 'handling',
25: | 'title' => $this->language->get('text_handling'),
26: | 'value' => (float)$this->config->get('total_handling_fee'),
27: | 'sort_order' => (int)$this->config->get('total_handling_sort_order')
28: | ];
29: |
30: | if ($this->config->get('total_handling_tax_class_id')) {
31: | $tax_rates = $this->tax->getRates((float)$this->config->get('total_handling_fee'), (int)$this->config->get('total_handling_tax_class_id'));
32: |
33: | foreach ($tax_rates as $tax_rate) {
34: | if (!isset($taxes[$tax_rate['tax_rate_id']])) {
35: | $taxes[$tax_rate['tax_rate_id']] = $tax_rate['amount'];
36: | } else {
37: | $taxes[$tax_rate['tax_rate_id']] += $tax_rate['amount'];
38: | }
39: | }
40: | }
41: |
42: | $total += (float)$this->config->get('total_handling_fee');
43: | }
44: | }
45: | }
46: |

OpenCart API API documentation generated by ApiGen dev-master