Jump to content

informations.tpl & employee list


Recommended Posts

Hi.

My problem:

I need to make an employee list in admin\themes\default\template\controllers\products\informations.tpl:

1111111111.png

 

So i pasted code in:

\override\classes\Product.php

 

<?php
class Product extends ProductCore
{
public static function getEmployees()
{
 return Db::getInstance()->executeS('
  SELECT `id_employee`, `firstname`, `lastname`
  FROM `'._DB_PREFIX_.'employee`
  WHERE `active` = 1
  ORDER BY `lastname` ASC
 ');
}

}
?>

 

&&

admin\themes\default\template\controllers\products\informations.tpl :

 

<select name="id_employee_forward" style="vertical-align: middle;">
 <option value="-1">{l s='-- Choose --'}</option>
 {foreach $employees as $employee}
  <option value="{$employee.id_employee}"> {Tools::substr($employee.firstname, 0, 1)}. {$employee.lastname}</option>
 {/foreach}
 <option value="0">{l s='Someone else'}</option>
</select>

 

It is not working :(

I presume that i need to induce this code somewhere.

 

$employees = Product::getEmployees();

 

But hell will freeze before i figure it out by myself. So there it is. Quest 4 the best.

Please help me !

Link to comment
Share on other sites

×
×
  • Create New...