Jump to content

Edit History

Marcellog19

Marcellog19

You can override class Contact.php

Copy /classes/Contact.php in /override/classes and write

/**
 * Class Contact
 */
class Contact extends ContactCore
{
    /**
     * Return available contacts
     * @param int $idLang Language ID
     * @return array Contacts
     */
    public static function getContacts($idLang)
    {
        $shopIds = 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) $idLang.'
				AND contact_shop.`id_shop` IN ('.implode(', ', array_map('intval', $shopIds)).')
				GROUP BY c.`id_contact`
				ORDER BY `name` ASC';

        return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
    }
}

By default, order is by name. I replace by position and in Database > "ps_contact" table I change value for position column.

PS : clear cache (remove all cache in /var/cache)

Marcellog19

Marcellog19

You can override class Contact.php

Copy /classes/Contact.php in /override/classes and write

/**
 * Class Contact
 */
class Contact extends ContactCore
{
    /**
     * Return available contacts
     * @param int $idLang Language ID
     * @return array Contacts
     */
    public static function getContacts($idLang)
    {
        $shopIds = 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) $idLang.'
				AND contact_shop.`id_shop` IN ('.implode(', ', array_map('intval', $shopIds)).')
				GROUP BY c.`id_contact`
				ORDER BY `name` ASC';

        return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
    }
}

By default, order is by name. I replace by position and in Database > "ps_contact" table I change value for position column.

×
×
  • Create New...