Saludo
En otro fichero aquí muestro la coparación entre las variables
Código:
$this->tpl_view_vars = array(
'customer' => $customer,
'gender' => $gender,
'gender_image' => $gender_image,
'customerLanguage' => $customerLanguage,
// Add a Private note
'customer_note' => Tools::htmlentitiesUTF8($customer->note),
Y aquí la variable que usa para guardar una nota privada otro fichero php:
Código:
public function ajaxProcessUpdateCustomerNote()
{
if ($this->tabAccess['edit'] === '1') {
$note = Tools::htmlentitiesDecodeUTF8(Tools::getValue('note'));
$customer = new Customer((int)Tools::getValue('id_customer'));
if (!Validate::isLoadedObject($customer)) {
die('error:update');
}
if (!empty($note) && !Validate::isCleanHtml($note)) {
die('error:validation');
}
$customer->note = $note;
if (!$customer->update()) {
die('error:update');
}
die('ok');
}
}
En el fichero donde añadi la nota a mostrar en una columna la muestra correctamente únicamente con el código:
Código PHP:
'note' => array(
'title' => $this->l('Note'),
),
Lo primero que estoy intentando es lo que en teoría debería ser más facil que sería añadir la etiqueta ALT la cual en
$genders_icon[$gender->id] = array('src' => '../'.$gender_file, 'alt' => $gender->name); se está mostrando correctamente con el $gender->name, pues esa misma variable que funciona la añado a cualquier otro código y no funciona:
$note_icon[] = array('src' => '../genders/Unknown.jpg', 'alt' => $gender->name);
$test_icon[] = array('src' => '../genders/Unknown.jpg', 'alt' => $customer->note);
En resumén, el código que debería funcionar copiando la lógica de gender debería ser:
Código PHP:
$notes = array();
$notes_icon = array();
$notes_icon[] = array('src' => '../genders/Unknown.jpg', 'alt' => '');
foreach ($notes as $note)
{
$note_file = 'genders/'.$gender->id.'.jpg';
if (file_exists(_PS_IMG_DIR_.$note_file))
$notes_icon[$customer->id] = array('src' => '../'.$note_file, 'alt' => $customer->note);
else
$notes_icon[$customer->id] = array('src' => '../genders/Unknown.jpg', 'alt' => $customer->note);
$notes[$customer->id] = $customer->note;
}
y aquí la columna a mostrar:
Código PHP:
'note' => array(
'title' => $this->l('Title'),
'width' => 70,
'align' => 'center',
'icon' => $notes_icon,
'orderby' => false,
'type' => 'select',
'list' => $notes,
'filter_key' => 'c!note',
),
¿Creeís que debería añadir alguna variable adicional para que se pueda mostrar cualquier variable en el ALT y cualquier icono en NOTE ?
gracias