| 1: | <?php
|
| 2: | namespace Opencart\Catalog\Model\Extension\Opencart\Total;
|
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: |
|
| 8: | class LowOrderFee extends \Opencart\System\Engine\Model {
|
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: |
|
| 18: | public function getTotal(array &$totals, array &$taxes, float &$total): void {
|
| 19: | if ($this->cart->getSubTotal() && ($this->cart->getSubTotal() < (float)$this->config->get('total_low_order_fee_total'))) {
|
| 20: | $this->load->language('extension/opencart/total/low_order_fee');
|
| 21: |
|
| 22: | $totals[] = [
|
| 23: | 'extension' => 'opencart',
|
| 24: | 'code' => 'low_order_fee',
|
| 25: | 'title' => $this->language->get('text_low_order_fee'),
|
| 26: | 'value' => (float)$this->config->get('total_low_order_fee_fee'),
|
| 27: | 'sort_order' => (int)$this->config->get('total_low_order_fee_sort_order')
|
| 28: | ];
|
| 29: |
|
| 30: | if ($this->config->get('total_low_order_fee_tax_class_id')) {
|
| 31: | $tax_rates = $this->tax->getRates($this->config->get('total_low_order_fee_fee'), $this->config->get('total_low_order_fee_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 += $this->config->get('total_low_order_fee_fee');
|
| 43: | }
|
| 44: | }
|
| 45: | }
|
| 46: | |