Skip to content

Instantly share code, notes, and snippets.

@ichaykin
Created April 6, 2020 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ichaykin/94343e374708e599b87aae1fe71d42db to your computer and use it in GitHub Desktop.
Save ichaykin/94343e374708e599b87aae1fe71d42db to your computer and use it in GitHub Desktop.
diff --git a/app/addons/rus_ruble/config.php b/app/addons/rus_ruble/config.php
index dae65e2..3c22b08 100644
--- a/app/addons/rus_ruble/config.php
+++ b/app/addons/rus_ruble/config.php
@@ -15,7 +15,7 @@
if (!defined('BOOTSTRAP')) { die('Access denied'); }
fn_define('CRON_IMPORT_KEY_LENGTH', 16);
-fn_define('SYMBOL_RUBL', '<span class="ty-rub">Р</span>');
+fn_define('SYMBOL_RUBL', '₽');
fn_define('SYMBOL_RUBL_TEXT', ' Руб.');
fn_define('CURRENCY_RUB', 'RUB');
diff --git a/app/controllers/backend/profiles.php b/app/controllers/backend/profiles.php
index 299722d..9b0b1d1 100644
--- a/app/controllers/backend/profiles.php
+++ b/app/controllers/backend/profiles.php
@@ -537,6 +537,7 @@ if ($mode == 'manage') {
$user_data = fn_get_user_info($user_id, false);
} else {
$user_data = fn_get_user_info($user_id, true, $profile_id);
+
$orders_statistics = fn_get_user_order_statistics([$user_id]);
}
diff --git a/app/functions/fn.users.php b/app/functions/fn.users.php
index 24d1180..751beb1 100644
--- a/app/functions/fn.users.php
+++ b/app/functions/fn.users.php
@@ -4105,7 +4105,9 @@ function fn_get_user_order_statistics($user_ids)
$total_settled_orders = db_get_hash_array('SELECT COUNT(DISTINCT (?:orders.order_id)) as total_settled_orders, ?:orders.user_id FROM ?:orders ?p WHERE 1 ?p ?p', 'user_id', $orders_join, $orders_condition, $orders_group_by);
$total_spend = db_get_hash_array('SELECT SUM(total) as total_spend, ?:orders.user_id FROM ?:orders ?p WHERE ?:orders.status IN (?a) ?p ?p', 'user_id', $orders_join, $paid_statuses, $orders_condition, $orders_group_by);
- $result = fn_array_merge($total_orders, $total_settled_orders, $total_spend, true);
+ $paid_statuses = fn_get_order_paid_statuses();
+ $orders_data = db_get_hash_array('SELECT MIN(order_id) as first_order_id, MIN(timestamp) as first_order_timestamp, MAX(order_id) as last_order_id, MAX(timestamp) as last_order_timestamp, user_id FROM ?:orders WHERE user_id IN (?n) AND status IN (?a)', 'user_id', $user_ids, $paid_statuses);
+ $result = fn_array_merge($total_orders, $total_settled_orders, $total_spend, $orders_data, true);
return $result;
}
\ No newline at end of file
diff --git a/design/backend/templates/views/profiles/components/profile_orders.tpl b/design/backend/templates/views/profiles/components/profile_orders.tpl
index d20ead0..bdf4831 100644
--- a/design/backend/templates/views/profiles/components/profile_orders.tpl
+++ b/design/backend/templates/views/profiles/components/profile_orders.tpl
@@ -2,9 +2,19 @@
<div class="sidebar-row">
<h6>{__("orders")}</h6>
<ul class="unstyled">
+ <li>{__("registration_date")} <span class="pull-right">{$user_data.timestamp|date_format:"`$settings.Appearance.date_format`"}</span></li>
+ {if $orders_stats[$user_data.user_id].first_order_id}
+ <li>{__("first_order")} <span><a class="pull-right" href="{"orders.details&order_id=`$orders_stats[$user_data.user_id].first_order_id`"|fn_url}">{$orders_stats[$user_data.user_id].first_order_timestamp|date_format:"`$settings.Appearance.date_format`"}</a></span></li>
+ {/if}
<li>{__("total_orders")} <span><a class="pull-right" href="{"orders.manage?is_search=Y&user_id=`$user_data.user_id`"|fn_url}">{$orders_stats[$user_data.user_id].total_orders|default: 0}</a></span></li>
<li>{__("total_paid_orders")} <span><a class="pull-right" href="{"orders.manage?is_search=Y&user_id=`$user_data.user_id`&{http_build_query(["status" => $settled_statuses|array_values])}"|fn_url}">{$orders_stats[$user_data.user_id].total_settled_orders|default: 0}</a></span></li>
<li>{__("total_spent_money")} <a class="pull-right" href="{"orders.manage?is_search=Y&user_id=`$user_data.user_id`&{http_build_query(["status" => $settled_statuses|array_values])}"|fn_url}">{$orders_stats[$user_data.user_id].total_spend|format_price:$currencies.$secondary_currency|default: 0 nofilter}</a></li>
+ {if $orders_stats[$user_data.user_id].last_order_id}
+ <li>{__("last_order")} <span><a class="pull-right" href="{"orders.details&order_id=`$orders_stats[$user_data.user_id].last_order_id`"|fn_url}">{$orders_stats[$user_data.user_id].last_order_timestamp|date_format:"`$settings.Appearance.date_format`"}</a></span></li>
+ {/if}
+ {if $user_data.last_login}
+ <li>{__("last_login")} <span class="pull-right">{$user_data.last_login|date_format:"`$settings.Appearance.date_format`"}</span></li>
+ {/if}
</ul>
</div>
{/if}
\ No newline at end of file
diff --git a/var/builds/ru/database/data/data/data.sql b/var/builds/ru/database/data/data/data.sql
index fe3c792..a22c64d 100644
--- a/var/builds/ru/database/data/data/data.sql
+++ b/var/builds/ru/database/data/data/data.sql
@@ -11,7 +11,7 @@ Currencies
UPDATE cscart_currencies SET is_primary = 'N', coefficient = '45' WHERE currency_code = 'USD';
UPDATE cscart_currencies SET coefficient = '50' WHERE currency_code = 'EUR';
UPDATE cscart_currencies SET coefficient = '65' WHERE currency_code = 'GBP';
-INSERT INTO cscart_currencies (currency_id, currency_code, after, symbol, coefficient, is_primary, position, decimals_separator, thousands_separator, decimals, status) VALUES (4, 'RUB', 'Y', '<span class=\"ty-rub\">Р</span>', '1.000', 'Y', '10', '.', '&nbsp;', '2', 'A');
+INSERT INTO cscart_currencies (currency_id, currency_code, after, symbol, coefficient, is_primary, position, decimals_separator, thousands_separator, decimals, status) VALUES (4, 'RUB', 'Y', '₽', '1.000', 'Y', '10', '.', '&nbsp;', '2', 'A');
/*
Tax
diff --git a/var/langs/en/core.po b/var/langs/en/core.po
index f14dd9d..d97c902 100644
--- a/var/langs/en/core.po
+++ b/var/langs/en/core.po
@@ -5141,6 +5141,14 @@ msgctxt "Languages::last_order"
msgid "Last order"
msgstr "Last order"
+msgctxt "Languages::first_order"
+msgid "First order"
+msgstr "First order"
+
+msgctxt "Languages::registration_date"
+msgid "Registration date"
+msgstr "Registration date"
+
msgctxt "Languages::latitude"
msgid "Latitude"
msgstr "Latitude"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment