fix: totals

This commit is contained in:
Nikita Kiselev
2025-07-23 19:39:50 +03:00
parent f5cac7d566
commit eb1f1dc9c1
3 changed files with 59 additions and 36 deletions

View File

@@ -224,8 +224,6 @@ class Controllerextensiontgshophandle extends Controller
'total' => &$total
);
// Display prices
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$sort_order = array();
$results = $this->model_setting_extension->getExtensions('total');
@@ -252,7 +250,6 @@ class Controllerextensiontgshophandle extends Controller
}
array_multisort($sort_order, SORT_ASC, $totals);
}
$data['totals'] = array();
@@ -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'] = [];

View File

@@ -10,6 +10,7 @@
:navigation="true"
:modules="modules"
class="mySwiper w-full min-h-[200px]"
@touchMove="onTouchMove"
>
<swiper-slide v-for="image in images">
<img
@@ -34,6 +35,7 @@ import 'swiper/css/pagination';
import {Pagination} from 'swiper/modules';
export default {
components: {
Swiper,
@@ -48,12 +50,37 @@ export default {
},
setup() {
const throttle = (func, delay) => {
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, // ← вот это добавь
};
},
};

View File

@@ -77,16 +77,16 @@
</div>
</div>
<div class="fixed bottom-0 left-0 w-full px-4 pb-10 pt-4 bg-base-200 z-50 border-t-1 border-t-base-300">
<!-- <div>-->
<!-- <div v-if="lastTotal">-->
<!-- <span class="text-xs text-base-content mr-2">{{ lastTotal.title }}:</span><br>-->
<!-- <span v-if="cart.isLoading" class="loading loading-spinner loading-xs"></span>-->
<!-- <span v-else class="text-accent font-bold">{{ lastTotal.text }}</span>-->
<!-- </div>-->
<!-- </div>-->
<div class="fixed px-4 pb-10 pt-4 bottom-0 left-0 w-full bg-base-200 z-50 flex justify-between items-center gap-2 border-t-1 border-t-base-300">
<div>
<div v-if="lastTotal">
<span class="text-xs text-base-content mr-2">{{ lastTotal.title }}:</span><br>
<span v-if="cart.isLoading" class="loading loading-spinner loading-xs"></span>
<span v-else class="text-accent font-bold">{{ lastTotal.text }}</span>
</div>
</div>
<button class="btn btn-primary w-full" :disabled="cart.canCheckout === false">Перейти к оформлению</button>
<button class="btn btn-primary" :disabled="cart.canCheckout === false">Перейти к оформлению</button>
</div>
</div>