S
S
Sergey Miller2021-05-15 15:33:33
opencart
Sergey Miller, 2021-05-15 15:33:33

Where is the final price calculated in the confirm.php checkout?

v 3.0.3.3

Hello guys, can you please tell me where in confirm.php the final price is calculated (not the amount, but the total - how can a discount coupon be applied)?
I need this in order to add the shipping cost to the total if the total is less than 5K.

Found f-th

$this->cart->getSubTotal();
// или
$this->cart->getTotal();

But this only returns the amount excluding coupons.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
opencartbot, 2021-05-19
@opencartbot

Before line:

$this->{'model_extension_total_' . $result['code']}->getTotal($total_data);

you can add something like this crutch:
if ($result['code'] =='total' && $total_data['total'] < 5000) {
  $this->session->data['shipping_method'] = array(
    'code'     => 'flat',
    'title'      => 'Доставка',
    'quote'    => '100 грн',
    'cost'       => '100',
    'sort_order' => 1,
    'error'      => ''
  );

  $total_data['totals'][] = array(
    'code'       => 'shipping',
    'title'      => $this->session->data['shipping_method']['title'],
    'value'      => $this->session->data['shipping_method']['cost'],
    'sort_order' => 8
  );

  $total_data['total'] += $this->session->data['shipping_method']['cost'];
    
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question