3

can someone help me about this at OpenCart 3?

I need add below iFrames Pixel Code into Confirmation/Thank You Page for order tracking.

<!-- Offer Conversion: -->

<iframe src="https://marktamerica.go2cloud.org/aff_l?offer_id=13763&adv_sub=<ORDER_ID>&amount=<SALE_AMT>" width="1" height="1" /></iframe>

<!-- // End Offer Conversion -->

You should replace the following tags in the pixel code as follows:

<ORDER_ID> = Replace this value with your parameter that results as the order confirmation number.

<SALE_AMT> = Replace this value with your parameter that has the Subtotal amount of the transaction that excludes tax and shipping charges.


But got someone give me a code as below

In catalog/controller/checkout/success.php

Before Unset session

$order_id=$this->session->data['order_id'];
                $this->load->model('checkout/order');

              $order_info = $this->model_checkout_order->getOrder($order_id);
              $data['total'] =  $order_info['total'];
              $data['order_id'] =  $order_id;

And Then Use

{{order_id}} instead of <ORDER_ID>

{{total}} instead of <SALE_AMT>


The code I already try, is work, but the {{total}} I need <SALE_AMT> = Replace this value with your parameter that has the Subtotal amount of the transaction that excludes tax and shipping charges.

focus.style
  • 5,674
  • 4
  • 18
  • 34

1 Answers1

0

Seems like you want to use sub_total. Here you have to use another method from catalog/model/checkout/success.php, the getOrderTotals instead of getOrder.

In catalog/controller/checkout/success.php

Use following code

$order_id = $this->session->data['order_id'];
$this->load->model('checkout/order');

$data['order_id'] =  $order_id;

$totals = $this->model_checkout_order->getOrderTotals($order_id);

foreach ($totals as $total) {
  if ($total['code'] == 'sub_total') {
    $data['total'] = $total['value'];
    break; 
  }
}

Now you will get subtotal in {{total}} in your success.twig file.

focus.style
  • 5,674
  • 4
  • 18
  • 34