Доработка раздела пользователей в Simpla

Когда постоянных покупателей становится много, появляется задача по их сегментации.

В моём случае потребовалось:

  • отобразить сумму покупок
  • реализовать сортировку по сумме покупок


switch ($filter['sort'])
    case 'top_price':
        $order = 'o.total_price DESC';
$query = $this->db->placehold("SELECT
    u.id, u.email, u.name, u.password, u.address, u.phone, u.group_id, u.enabled, u.last_ip, u.created, g.discount, g.name as group_name, o.total_price FROM __users u
    LEFT JOIN __groups g ON u.group_id=g.id 
                SUM(total_price) total_price, user_id FROM __orders
                WHERE paid = 1 AND closed = 1 AND user_id <> 0 group by user_id) o
    ON o.user_id = u.id
    WHERE 1 $group_id_filter $keyword_filter $name_empty_filter ORDER BY $order $sql_limit");


{if $sort!='name'}<a href="{url sort=name}">имени</a>{else}имени{/if} или
{if $sort!='top_price'}<a href="{url sort=top_price}">сумме покупок</a>{else}сумме покупок{/if} или
<div class="price cell">
    {if $user->total_price}{$user->total_price} {$currency->sign}{/if}
<div class="user_group cell">


#list .user_group {
    text-align: right;
    color: #707070;
#list .price {
    text-align: left;
    color: #707070;
4 комментария

<a href=https://srpskainfo.com>XXX PORN</a>


To determine internal swelling is difficult enough, therefore, consequently, they influence the body for a long time, which threatens the normal fetus. Fluids are dangerous because they break blood circulation. Similar situation leads to worsening feeding and the breath baby, formed hypoxia.
Fighting such a pathology should be done with the help of correction feeding and special procedures so that water does not stay tissues. If expectant mother is resting, then under the feet preferably put a cushion or pillow to improve the blood circulation of tired legs. Prohibited long time to sit or stand, as this leads to stagnation in the body. It is recommended that the knee-elbow position several times a day in order to increase blood flow.
[url=http://pregnancyplus.info/how-to-relieve-breast-pain-during-pregnancy-useful-tips]how to relieve breast pain during pregnancy[/url]


Peels help to escape from the greater part age changes dermatological layer. exfoliation efficient at any age, intended for skin of any type. After superficial exfoliation disappear minor wrinkles, skin turns out smooth, without wrinkles. Adaptation — three days. an Average peeling effectively copes wrinkles (expression, old, affects little pits, eliminates freckles.
Rehabilitation — 7 days. Deep peeling doing in the beauty medical facilities. This is maximum effective procedure, although requires long term regeneration — up to one month.
[url=http://chemicalpeel.in/chemical-peel]benefits of a chemical peel[/url]


My unheard of trap contract:

Ваш комментарий
адрес не будет опубликован

ХТМЛ не работает

Ctrl + Enter