如何获得行政销售订单列表中的附属名称?

gojuced7  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(328)

我需要在销售订单的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";

我不知道如何添加查询联属帮助我哥们。

332nm8kg

332nm8kg1#

试试这个:

`$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";`

相关问题