From eb1f1dc9c1de7c4733d0117257f7902f145614b2 Mon Sep 17 00:00:00 2001 From: Nikita Kiselev Date: Wed, 23 Jul 2025 19:39:50 +0300 Subject: [PATCH] fix: totals --- .../controller/extension/tgshop/handle.php | 50 +++++++++---------- spa/src/components/ProductImageSwiper.vue | 27 ++++++++++ spa/src/views/Cart.vue | 18 +++---- 3 files changed, 59 insertions(+), 36 deletions(-) diff --git a/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php b/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php index e964c02..1905271 100755 --- a/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php +++ b/module/oc_telegram_shop/upload/catalog/controller/extension/tgshop/handle.php @@ -224,36 +224,33 @@ class Controllerextensiontgshophandle extends Controller 'total' => &$total ); - // Display prices - if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { - $sort_order = array(); + $sort_order = array(); - $results = $this->model_setting_extension->getExtensions('total'); + $results = $this->model_setting_extension->getExtensions('total'); - foreach ($results as $key => $value) { - $sort_order[$key] = $this->config->get('total_' . $value['code'] . '_sort_order'); - } - - array_multisort($sort_order, SORT_ASC, $results); - - foreach ($results as $result) { - if ($this->config->get('total_' . $result['code'] . '_status')) { - $this->load->model('extension/total/' . $result['code']); - - // We have to put the totals in an array so that they pass by reference. - $this->{'model_extension_total_' . $result['code']}->getTotal($total_data); - } - } - - $sort_order = array(); - - foreach ($totals as $key => $value) { - $sort_order[$key] = $value['sort_order']; - } - - array_multisort($sort_order, SORT_ASC, $totals); + foreach ($results as $key => $value) { + $sort_order[$key] = $this->config->get('total_' . $value['code'] . '_sort_order'); } + array_multisort($sort_order, SORT_ASC, $results); + + foreach ($results as $result) { + if ($this->config->get('total_' . $result['code'] . '_status')) { + $this->load->model('extension/total/' . $result['code']); + + // We have to put the totals in an array so that they pass by reference. + $this->{'model_extension_total_' . $result['code']}->getTotal($total_data); + } + } + + $sort_order = array(); + + foreach ($totals as $key => $value) { + $sort_order[$key] = $value['sort_order']; + } + + array_multisort($sort_order, SORT_ASC, $totals); + $data['totals'] = array(); foreach ($totals as $total) { @@ -264,7 +261,6 @@ class Controllerextensiontgshophandle extends Controller } $data['total_products_count'] = $this->cart->countProducts(); - $data['total'] = $this->cart->getTotal(); } else { $data['text_error'] = $this->language->get('text_empty'); $data['totals'] = []; diff --git a/spa/src/components/ProductImageSwiper.vue b/spa/src/components/ProductImageSwiper.vue index 06963b9..97bae48 100644 --- a/spa/src/components/ProductImageSwiper.vue +++ b/spa/src/components/ProductImageSwiper.vue @@ -10,6 +10,7 @@ :navigation="true" :modules="modules" class="mySwiper w-full min-h-[200px]" + @touchMove="onTouchMove" > { + let lastCall = 0; + return (...args) => { + const now = Date.now(); + if (now - lastCall >= delay) { + lastCall = now; + func(...args); + } + }; + }; + + const hapticTick = throttle(() => { + const haptic = window?.Telegram?.WebApp?.HapticFeedback; + if (haptic?.selectionChanged) { + haptic.selectionChanged(); + } else if (haptic?.impactOccurred) { + haptic.impactOccurred('light'); + } + }, 100); + + const onTouchMove = () => { + hapticTick(); + }; + return { pagination: { clickable: true, dynamicBullets: true, }, modules: [Pagination], + onTouchMove, // ← вот это добавь }; }, }; diff --git a/spa/src/views/Cart.vue b/spa/src/views/Cart.vue index 058c5d4..f7ffa53 100644 --- a/spa/src/views/Cart.vue +++ b/spa/src/views/Cart.vue @@ -77,16 +77,16 @@ -
- - - - - - - +
+
+
+ {{ lastTotal.title }}:
+ + {{ lastTotal.text }} +
+
- +