Jump to content

Formularz kontaktowy i sortowanie.


Recommended Posts

Powiedzcie mi, jak w formularzu kontaktowym ustalić pozycję konkretnych maili.

 

PRESTASHOP 1.6.0.9

Aktualnie zauważyłem, że sortowanie odbywa się alfabetycznie.

 

4la89h.jpg

jednak w bazie jest jeszcze kolumna position. Jak zmusić formularz żeby sortował po tej kolumnie ? 

 

c08uyz.jpg

 

 

 

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 by pbpo (see edit history)
Link to comment
Share on other sites

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';

Link to comment
Share on other sites

×
×
  • Create New...