0 użytkowników i 1 Gość przegląda ten wątek.
\override\classes\Product.php
<?phpclass 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>
$employees = Product::getEmployees();
rece opadaja
DOKŁADNIE!Zawsze się znajdzie taki który ma za dużo do powiedzenia a za mało doświadczenia. Pomyśl nad zagadnieniem a nie nad komentowaniem mojego życia zawodowego.
Mój problem:Potrzebuję zrobić listę pracowników w dodawaniu produktu:Więc dodałem kod do:Kod: [Zaznacz]<?phpclass 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 ');}}?>&&Kod: [Zaznacz] <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>
renderForm()
$this->context->smarty->assign("employees", Product::getEmployees());