pbpo Posted September 22, 2014 Posted September 22, 2014 (edited) Powiedzcie mi, jak w formularzu kontaktowym ustalić pozycję konkretnych maili. PRESTASHOP 1.6.0.9 Aktualnie zauważyłem, że sortowanie odbywa się alfabetycznie. jednak w bazie jest jeszcze kolumna position. Jak zmusić formularz żeby sortował po tej kolumnie ? cały kod odpowiadający za wybór do kogo napisać to: {if isset($customerThread.id_contact)} {foreach from=$contacts item=contact} {if $contact.id_contact == $customerThread.id_contact} <input type="text" class="form-control" id="contact_name" name="contact_name" value="{$contact.name|escape:'html':'UTF-8'}" readonly="readonly" /> <input type="hidden" name="id_contact" value="{$contact.id_contact}" /> {/if} {/foreach} {else} <select id="id_contact" class="form-control" name="id_contact"> <option value="0">{l s='-- Choose --'}</option> {foreach from=$contacts item=contact} <option value="{$contact.id_contact|intval}" {if isset($smarty.request.id_contact) && $smarty.request.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'html':'UTF-8'}</option> {/foreach} </select> </div> <p id="desc_contact0" class="desc_contact"> </p> {foreach from=$contacts item=contact} <p id="desc_contact{$contact.id_contact|intval}" class="desc_contact contact-title" style="display:none;"> <i class="icon-comment-alt"></i>{$contact.description|escape:'html':'UTF-8'} </p> {/foreach} {/if} Edited September 22, 2014 by pbpo (see edit history) Share this post Link to post Share on other sites More sharing options...
pbpo Posted September 22, 2014 Posted September 22, 2014 #ref Share this post Link to post Share on other sites More sharing options...
vekia Posted September 22, 2014 Posted September 22, 2014 sorotowanie po nazwie jest z góry narzucone w klasie contact.php /classes/Contact.php public static function getContacts($id_lang) { $shop_ids = Shop::getContextListShopID(); $sql = 'SELECT * FROM `'._DB_PREFIX_.'contact` c '.Shop::addSqlAssociation('contact', 'c', false).' LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`) WHERE cl.`id_lang` = '.(int)$id_lang.' AND contact_shop.`id_shop` IN ('.implode(', ', array_map('intval', $shop_ids)).') GROUP BY c.`id_contact` ORDER BY `name` ASC'; return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); } ORDER BY `name` ASC'; zmieniamy np. na ORDER BY `position` ASC'; Share this post Link to post Share on other sites More sharing options...
pbpo Posted September 22, 2014 Posted September 22, 2014 Dzięki wielkie, właśnie tego szukałem . A może by tak w przyszłości w kolejnych odsłonach ps umożliwić ustawianie z BO ? Mała modyfikacja, a jednak pomogła by Share this post Link to post Share on other sites More sharing options...
Recommended Posts