On 7/19/2016 at 2:33 AM, fortuner said:Hello!
I'm stuck with getting Carrier name for order in Backoffice.
I've got order id and carrier id and I need to get carreir name.
I've wrote a query in Order.php as follows:
public static function getCarrierName($id_order) { return Db::getInstance()->executeS(' SELECT cl.`name` as `carrier_name` FROM `'._DB_PREFIX_.'order_carrier` oc LEFT JOIN `'._DB_PREFIX_.'carrier` cl ON (oc.`id_carrier` = cl.`id_carrier`) WHERE oc.`id_order` = '.(int)$id_order); }when I use this in module like this:
$orders = Order::getOrdersWithInformations($limit); $body = array(); foreach ($orders as $order) { $id_order = $order['id_order']; $carrier = array(); $carrier = Order::getCarrierName((int)$id_order); $tr = array(); $tr[] = array( 'id' => 'status', 'value' => $carrier, 'class' => 'text-center', ); }it throws [object Object] error.
And if I use
$carrier['carrier_name']
it throws null
I assume my mistake is in calling array value.
Please help somebody, i'm desperate
not oc.`id_carrier`
but a.`id_carrier`
regarding to AdminOrdersConstroller constructor.