gpt4 book ai didi

php - 如何在 Prestashop 1.6 后台列出未分配地址的订单

转载 作者:行者123 更新时间:2023-11-29 11:09:47 31 4
gpt4 key购买 nike

我有一个 prestashop,我修改了订购系统,无需为订单分配地址。这样地址字段的值为 0。问题是后台没有列出它,尽管所有数据都保存在数据库中。我怎样才能把这些也列出来呢?也许我需要修改 sql 查询,但我不知道在哪里进行修改以及如何修改。

最佳答案

与表 address 的左联接无法找到行,因为您将表 orders 中的 id_address_delivery 设置为 0。

$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
LEFT JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery
LEFT JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country
LEFT JOIN `'._DB_PREFIX_.'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';

您可以在使用 actionControllerNameListingFieldsModifier 生成列表之前使用模块 Hook 来修改此设置,以删除地址连接部分。

/*  AdminController getList() method

Hook::exec('action'.$this->controller_name.'ListingFieldsModifier', array(
'select' => &$this->_select,
'join' => &$this->_join,
'where' => &$this->_where,
'group_by' => &$this->_group,
'order_by' => &$this->_orderBy,
'order_way' => &$this->_orderWay,
'fields' => &$this->fields_list,
));
*/
public function hookActionAdminOrdersListingFieldsModifier($params) {
// Remove address and country join clauses
$params['join'] = '
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';
}

关于php - 如何在 Prestashop 1.6 后台列出未分配地址的订单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40799737/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com