Récemment
-
Aperçu de l'activité dans le dashboard vide
Bugs & Améliorations29 -
Tri par code de réduction (Commandes) [RÉSOLU]
Bugs & Améliorations5 -
Uncaught Error: Call to a member function rowCount() on bool [RÉSOLU]
Bugs & Améliorations4 -
Navigation à facettes
Bugs & Améliorations8 -
Calcul des règles paniers HT/TTC [RÉSOLU]
Bugs & Améliorations44 -
Erreur lors d'une nouvelle installation depuis 0
Questions relatives à l'installation/upgrade24 -
Bug avec le module de paiement epayment
Bugs & Améliorations2 -
Changement statut de commande [RÉSOLU]
Bugs & Améliorations3 -
Prévisions sur le tableau de bord vide [RÉSOLU]
Bugs & Améliorations8 -
Nouvelle attaque ?
Discussion générale10 -
À partir de (from_price) [RÉSOLU]
Bugs & Améliorations11 -
Override AdminCustomersController [RÉSOLU]
Bugs & Améliorations11 -
Logo Phenix erreur 404 en BO
Bugs & Améliorations8 -
Bug Preventing eMail Delivery in at least 1.6.2.16 up to 1.6.2.19 (Probably much more)
Bugs & Améliorations3 -
1.6.2.19 - Erreur sur le module Editeur de page d'accueil
Bugs & Améliorations4 -
warning SQL ( debug activé ) dans Search.php
PhenixSuite6 -
Module PSitechecklist Facilitez la compréhension des retours clients.
Modules1 -
module moneticoPaiement
PhenixSuite2 -
Copieurs-Colleurs
Discussion générale3 -
règle prix catalogue et mise à jour panier
Bugs & Améliorations7
Override AdminCustomersController [RÉSOLU]
-
Bonjour,
avant de passer à PhenixSuite, nous étions en 1.6.1.24 et avions un override (toujours effectif) d'AdminCustomersController (ajout de champs phone, postcode,...). Désormais il existe des options dans ce controller pour ajouter diverses champs (Siret, Ape,...). Il existe donc des configurations dans la table ps_configuration (PS_COLUMNS_CUSTOMER_x) avec les indications des modifications (ex: "firstname":{"selected":1,"title":"Pr\u00e9nom"}). Mais comment et d'où sont générées ces config' ?
Merci d'avance.
-
Bonjour,
Vous avez une icone engrenage en haut à droite de la liste
-
Oui, merci, j'avais bien compris ça. Ce n'était pas le sens de ma question. Au cas où je voudrais y ajouter des champs (override select, left join pour avoir le numéro de tèl, le code postal...) et ajout dans la fields_list (en gardant le "if") + ajout dans $available, je n'ai pas la traduction (les boutons apparaissent comme choix, mais une fois ajoutés il n'y a pas de titre - petits carrés verts).
Édith : override de la fonction __construct
-
Une fois votre override installée, réinitialisez le choix des colonnes pour recharger l'ensemble.
Si votre code est conforme, les traductions doivent apparaitre.
-
Merci, m'en vais tester tout ça ;)
-
Alors en testant :
ajout $available -> 'phone' => array('selected' => 0, 'title' => $this->l('Telephone')),
ajout dans la boucle foreach (columns) ->
if($key == 'phone') {
$this->fields_list['phone'] = array(
'title' => $column['title'],
);
}mes colonnes s'affichent bien avec les résultats, mais les titres sont vides (ainsi que dans les boutons séléctionnés, les titres sont présents si non activés). Dans la BDD (PS_COLUMNS_CUSTOMER_x) j'ai "phone":{"selected":1}, sans l'ajout du titre.
-
Vous pourriez m'envoyer votre override, il y a un truc qui m'échappe^^
-
<?php class AdminCustomersController extends AdminCustomersControllerCore { /* * module: alinkmodadminpanels * date: 2023-11-17 07:51:35 * version: 0.1 */ public function __construct() { parent::__construct(); $this->shopLinkType = ( Shop::isFeatureActive() && !$this->context->shop->getGroup()->share_customer && (Shop::getContext() != Shop::CONTEXT_SHOP) ? 'shop' : false ); $this->_select = ' a.ape, a.id_risk, a.id_default_group, a.siret, a.birthday, a.note, a.date_add, gl.name as title, ( SELECT SUM(total_paid_real / conversion_rate) FROM '._DB_PREFIX_.'orders o WHERE o.id_customer = a.id_customer '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' AND o.valid = 1 ) as total_spent, ( SELECT c.date_add FROM '._DB_PREFIX_.'guest g LEFT JOIN '._DB_PREFIX_.'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'; $this->_join = ' LEFT JOIN '._DB_PREFIX_.'gender_lang gl ON(a.id_gender = gl.id_gender AND gl.id_lang = '.(int)$this->context->language->id.') LEFT JOIN ( SELECT MAX(id_address) as last_add, id_customer FROM '._DB_PREFIX_.'address GROUP BY id_customer ) last ON last.id_customer = a.id_customer LEFT JOIN ( SELECT city, phone, phone_mobile, postcode, id_address FROM '._DB_PREFIX_.'address ) adr ON adr.id_address = last.last_add '; $this->_use_found_rows = false; // Check if we can add a customer if(Shop::isFeatureActive() && (Shop::getContext() == Shop::CONTEXT_ALL || Shop::getContext() == Shop::CONTEXT_GROUP) ) { $this->can_add_customer = false; } $titles_array = array(); $genders = Gender::getGenders($this->context->language->id); foreach($genders as $gender) { $titles_array[$gender->id_gender] = $gender->name; } $columns_key = 'PS_COLUMNS_CUSTOMER_'.(int)$this->context->employee->id; $default_selected = array( 'title' => array('selected' => 1, 'title' => $this->l('Social title')), 'firstname' => array('selected' => 1, 'title' => $this->l('First name')), 'lastname' => array('selected' => 1, 'title' => $this->l('Last name')), 'email' => array('selected' => 1, 'title' => $this->l('Email address')), 'total_spent' => array('selected' => 1, 'title' => $this->l('Sales')), 'active' => array('selected' => 1, 'title' => $this->l('Enabled')), 'newsletter' => array('selected' => 1, 'title' => $this->l('Newsletter')), 'optin' => array('selected' => 1, 'title' => $this->l('Opt-in')), 'date_add' => array('selected' => 1, 'title' => $this->l('Registration')), 'connect' => array('selected' => 1, 'title' => $this->l('Last visit')), ); $available = array( 'phone' => array('selected' => 0, 'title' => $this->l('Telephone')), 'phone_mobile' => array('selected' => 0, 'title' => $this->l('Mobile')), 'city' => array('selected' => 0, 'title' => $this->l('Ville')), 'postcode' => array('selected' => 0, 'title' => $this->l('Postcode')), 'id_risk' => array('selected' => 0, 'title' => $this->l('Risk')), 'siret' => array('selected' => 0, 'title' => $this->l('Siret')), 'ape' => array('selected' => 0, 'title' => $this->l('APE')), 'birthday' => array('selected' => 0, 'title' => $this->l('Birthday')), 'note' => array('selected' => 0, 'title' => $this->l('Note')), ); if(Configuration::get('PS_B2B_ENABLE')) { $available['company'] = array('selected' => 0, 'title' => $this->l('Company')); } if(Group::isFeatureActive()) { $available['id_default_group'] = array('selected' => 0, 'title' => $this->l('Group')); } $defaults = array_merge($default_selected, $available); if(Tools::isSubmit('resetColumns'.$this->table) || !Configuration::get($columns_key)) { Configuration::updateValue($columns_key, json_encode($defaults)); $this->processResetFilters(); $this->redirect_after = $this->currentLink.'&conf=4'; } if(Tools::isSubmit('submitColumns'.$this->table)) { $selected_columns = Tools::getValue('columns'.$this->table); $choice = explode(',', $selected_columns); if(is_array($choice) && !empty($choice[0])) { $columns = array(); foreach($choice as $field) { $this->columns[$field] = $defaults[$field]; $this->columns[$field]['selected'] = 1; } foreach($defaults as $key => $default) { if(!isset($this->columns[$key])) { $this->columns[$key] = $default; $this->columns[$key]['selected'] = 0; } } Configuration::updateValue($columns_key, json_encode($this->columns)); $this->processResetFilters(); $this->redirect_after = $this->currentLink.'&conf=4'; } else { $this->columns = json_decode(Configuration::get($columns_key), 1); } } else { $this->columns = json_decode(Configuration::get($columns_key), 1); } foreach($defaults as $key => $default) { if(!isset($this->columns[$key])) { $this->columns[$key] = $default; } } $this->fields_list = array(); $this->fields_list['id_customer'] = array( 'title' => $this->l('ID'), 'align' => 'text-center', 'class' => 'fixed-width-sm' ); foreach($this->columns as $key => $column) { if($column['selected']) { if($key == 'title') { $this->fields_list['title'] = array( 'title' => $column['title'], 'filter_key' => 'a!id_gender', 'type' => 'select', 'list' => $titles_array, 'filter_type' => 'int', 'order_key' => 'gl!name' ); } if($key == 'firstname') { $this->fields_list['firstname'] = array( 'title' => $column['title'], 'filter_key' => 'a!firstname', ); } if($key == 'lastname') { $this->fields_list['lastname'] = array( 'title' => $column['title'], 'filter_key' => 'a!lastname', ); } if($key == 'email') { $this->fields_list['email'] = array( 'title' => $column['title'], 'filter_key' => 'a!email', ); } if($key == 'phone') { $this->fields_list['phone'] = array( 'title' => $this->l('Téléphone'), ); } if($key == 'phone_mobile') { $this->fields_list['phone_mobile'] = array( 'title' => $this->l('Mobile'), ); } if($key == 'city') { $this->fields_list['city'] = array( 'title' => $this->l('Ville'), ); } if($key == 'postcode') { $this->fields_list['postcode'] = array( 'title' => $this->l('Code postal'), ); } if($key == 'company') { $this->fields_list['company'] = array( 'title' => $column['title'], 'filter_key' => 'a!company', ); } if($key == 'total_spent') { $this->fields_list['total_spent'] = array( 'title' => $column['title'], 'type' => 'price', 'search' => false, 'havingFilter' => true, 'align' => 'text-right', 'badge_success' => true ); } if($key == 'active') { $this->fields_list['active'] = array( 'title' => $column['title'], 'align' => 'text-center', 'active' => 'status', 'type' => 'bool', 'filter_key' => 'a!active' ); } if($key == 'newsletter') { $this->fields_list['newsletter'] = array( 'title' => $column['title'], 'align' => 'text-center', 'type' => 'bool', 'callback' => 'printNewsIcon' ); } if($key == 'optin') { $this->fields_list['optin'] = array( 'title' => $column['title'], 'align' => 'text-center', 'type' => 'bool', 'callback' => 'printOptinIcon' ); } if($key == 'date_add') { $this->fields_list['date_add'] = array( 'title' => $column['title'], 'type' => 'date', ); } if($key == 'connect') { $this->fields_list['connect'] = array( 'title' => $column['title'], 'type' => 'datetime', ); } if($key == 'id_risk') { $risks = Risk::getRisks((int)$this->context->language->id); $risks_array = array(); foreach($risks as $risk) { $risks_array[$risk->id_risk] = $risk->name; } $this->fields_list['id_risk'] = array( 'title' => $column['title'], 'type' => 'select', 'list' => $risks_array, 'filter_type' => 'int', 'filter_key' => 'a!id_risk', 'callback' => 'displayRisk' ); } if($key == 'siret') { $this->fields_list['siret'] = array( 'title' => $column['title'], 'type' => 'text', ); } if($key == 'ape') { $this->fields_list['ape'] = array( 'title' => $column['title'], 'type' => 'text', ); } if($key == 'birthday') { $this->fields_list['connect'] = array( 'title' => $column['title'], 'type' => 'date', ); } if($key == 'note') { $this->fields_list['note'] = array( 'title' => $column['title'], 'type' => 'text', ); } if($key == 'id_default_group') { $groups = Group::getGroups((int)$this->context->language->id, false, true); $groups_array = array(); foreach($groups as $group) { $groups_array[$group['id_group']] = $group['name']; } $this->fields_list['id_default_group'] = array( 'title' => $column['title'], 'type' => 'select', 'list' => $groups_array, 'filter_type' => 'int', 'filter_key' => 'a!id_default_group', 'callback' => 'displayGroup' ); } } } self::$meaning_status = array( 'open' => $this->l('Open'), 'closed' => $this->l('Closed'), 'pending1' => $this->l('Pending 1'), 'pending2' => $this->l('Pending 2') ); } }
Édith : j'ai modifié les titres des fields_list pour les champs ajoutés par rapport à la dernière image (le titre est vide pour la colonne, j'avais laissé $column['title']).
-
J'ai d($defaults) après array_merge et il m'a pourtant bien sorti les clés et valeurs "title", mais updateValue n'a pas inclus les titres pour mes ajouts. Uniquement les "selected". (Même après avoir supprimer l'entrée dans ps_config).
-
Vous faites l'override d'un constructeur donc vous ne pouvez pas appeler parent::__construct() il faut directement appeler l'AdminController.
Ci-joint le fichier complet de l'override ;)
AdminCustomersController.php
-
Bon sang mais où avais-je la tête. Merci encore !