Hello. Anyone knows which column in order_total is responsible for shipping price? Or where is it at all in db?
I have no knowledge in php or programming with sql, but I have been 24 hours without sleep reading everything, and I need something similar,Johnathan wrote: ↑Fri May 22, 2020 9:29 pmAll line items on the order are stored in the "order_total" table. You can find the relevant lines using the "order_id" column, then loop through the rows you find, and pick the one with code "shipping". The cost of the shipping will be stored in the "value" column.
I need to get the total value of a shipment using the CODE column finding the word "shipping" and assigning the "value" to be able to call this value or shipping cost and use it in a calculation formula in a market nucleus, there is something like a php line that can do this? I have looked at many lines that apparently can locate the CODE column by ORDER_ID but I don't know how they work.

I have this function that uses parameters other than opencart, but I found that maybe there is the key to get the shipping value of an order, looking at codes ...
Code: Select all
private function _getOrderTotals($order_id,$initial_order_total) {
// totals @todo
$order_info = $this->model_account_order->getOrder($order_id, 'seller');
$suborder_sub_total = $this->MsLoader->MsOrderData->getOrderTotal($order_id, array('seller_id' => $this->customer->getId()));
$suborder_shipping_total = $this->MsLoader->MsOrderData->getOrderShippingTotal($order_id, array('seller_id' => $this->customer->getId()));
$suborder_total = $suborder_sub_total + $suborder_shipping_total;
// Get oc order totals. Needed to keep sort_order in totals
$order_totals = $this->model_account_order->getOrderTotals($this->request->get['order_id']);
foreach ($order_totals as $key => &$total) {
if($total['code'] == 'mm_shipping_total') $total['value'] = $suborder_shipping_total;
if($total['code'] == 'total') $total['value'] = $suborder_total;
if($total['code'] == 'sub_total') {
if((float)$total['value'] !== (float)$initial_order_total)
$total['title'] .= '<!-- <span data-toggle="tooltip" title="Comision de tienda deducida"> <i class="fa fa-exclamation-circle" aria-hidden="true"></i></span>-->';
$total['value'] = $suborder_sub_total;
}
// if total is for taxes - unset it, because taxes are counted in product's price
// if total is for oc shipping - unset it, because this information is not related to seller
if($total['code'] == 'tax' || $total['code'] == 'shipping' || $total['code'] == 'coupon') {
unset($order_totals[$key]);
continue;
}
$total['text'] = $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']);
}
return $order_totals;
}
In this line I want to put the shipping cost of opencart, but I can't get it from the database, I don't know how to put together the code to get it.
but I found something interesting:
In this part I see that apparently it gets data from the database, I'm not sure, even if I try to modify it, it doesn't work.

Code: Select all
$suborder_total = $suborder_sub_total + $suborder_shipping_total;
In this part I see that apparently it gets data from the database, I'm not sure, even if I try to modify it, it doesn't work.
Code: Select all
// Get oc order totals. Needed to keep sort_order in totals
$order_totals = $this->model_account_order->getOrderTotals($this->request->get['order_id']);
foreach ($order_totals as $key => &$total) {
if($total['code'] == 'mm_shipping_total') $total['value'] = $suborder_shipping_total;
if($total['code'] == 'total') $total['value'] = $suborder_total;
Who is online
Users browsing this forum: paola_84 and 85 guests