如何在管理销售订单列表中获取关联名称?

时间:2018-04-18 10:42:44

标签: php mysql mysqli opencart

我需要在opencart上的相应订单的销售订单列表中的附属名称。

我在 admin / model / sale / order.php

上查看查询
$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";

我不知道如何为联盟会员添加查询帮助我。

1 个答案:

答案 0 :(得分:0)

试试这个:

`$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT CONCAT(a.firstname, ' ', a.lastname) FROM ". DB_PREFIX."affiliate a WHERE a.affiliate_id = o.affiliate_id ) as affiliate_name,  (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS order_status, o.shipping_code, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";`