我使用的Prestashop v 1.6.1.1的Prestashop添加地址欄,客戶後臺
我試圖讓
我想一個名爲DNI列添加到我的客戶節在後臺。
我試圖
我知道文件做這個被稱爲AdminCustomersController.php,它位於控制器/管理什麼/ AdminCustomersController.php
我也知道,這個查詢我可以獲取數據庫中的數據:
SELECT ps_address.dni, ps_customer. *
FROM ps_customer
INNER JOIN ps_address ON ps_customer.id_customer = ps_address.id_customer
LIMIT 0,30
的CURR在客戶節耳鼻喉科查詢:
SELECT a.`id_customer`, `firstname`, `lastname`, `email`, a.`active` AS `active`, `newsletter`, `optin` , a.date_add, gl.name as title, (SELECT SUM(total_paid_real/conversion_rate) FROM ps_orders o WHERE o.id_customer = a.id_customer AND o.id_shop IN (2, 1) AND o.valid = 1) as total_spent, (SELECT c.date_add FROM ps_guest g LEFT JOIN ps_connections c ON c.id_guest = g.id_guest WHERE g.id_customer = a.id_customer ORDER BY c.date_add DESC LIMIT 1) as connect, shop.name as shop_name FROM `ps_customer` a LEFT JOIN ps_gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = 1) LEFT JOIN ps_shop shop ON a.id_shop = shop.id_shop WHERE 1 AND a.`deleted` = 0 AND a.id_shop IN (2, 1) ORDER BY `date_add` DESC LIMIT 0, 50
我不知道
我不知道如何更改查詢並增加只是ps_address.dni,也得到了其他列。
感謝
編輯部分解決
好了,最後我沒有改變AdminCustomersController.php我已經改變AdminAddressesController.php這意味着改變客戶/路線後臺。
我剛纔說這個線和它的工作般的魅力:
$this->fields_list = array(
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'),
'firstname' => array('title' => $this->l('First Name'), 'filter_key' => 'a!firstname'),
'lastname' => array('title' => $this->l('Last Name'), 'filter_key' => 'a!lastname'),
'address1' => array('title' => $this->l('Address')),
'postcode' => array('title' => $this->l('Zip/Postal Code'), 'align' => 'right'),
'dni' => array('title' => $this->l('DNI'), 'align' => 'right'),
'city' => array('title' => $this->l('City')),
'country' => array('title' => $this->l('Country'), 'type' => 'select', 'list' => $this->countries_array, 'filter_key' => 'cl!id_country'));
現在我有一個地方搜索DNI客戶的
dni是ps_address(地址模型的地址)字段,因爲您應該爲每個客戶擁有更多的一個地址,因此每個客戶應該有一個dni。從邏輯上講,你不能這樣做。 – sarcom
@sarcom這是一個很好的答案,但是,如果我只想總是獲得第一個地址呢?這可能是一個1-1 – nanaki
@sarcom我剛剛編輯我的帖子與我的部分解決方案謝謝。 – nanaki