diff --git a/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php b/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php
index 931525e..111635b 100755
--- a/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php
+++ b/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php
@@ -531,7 +531,7 @@ HTML,
'type' => 'select',
'options' => $this->getBannersList(),
'help' => <<Стандартный OpenCart баннер отображаемый на главной странице магазина. Рекомендуемая максимальная высота изображения для баннера - 200 пикселей.
+Стандартный OpenCart баннер отображаемый на главной странице магазина. Рекомендуемое соотношение сторон для изображений - 2.5:1 (например 500×200).
HTML,
],
],
diff --git a/spa/src/main.js b/spa/src/main.js
index 46882c7..eb6135b 100644
--- a/spa/src/main.js
+++ b/spa/src/main.js
@@ -42,7 +42,7 @@ settings.load()
}
})
.then(() => {
- console.log('Set theme attributes');
+ console.debug('[Init] Set theme attributes');
document.documentElement.setAttribute('data-theme', settings.theme[window.Telegram.WebApp.colorScheme]);
if (settings.night_auto) {
window.Telegram.WebApp.onEvent('themeChanged', function () {
@@ -55,7 +55,7 @@ settings.load()
}
})
.then(() => {
- console.log('Load front page categories and products.');
+ console.debug('[Init] Load front page categories and products.');
const categoriesStore = useCategoriesStore();
categoriesStore.fetchTopCategories();
})
diff --git a/spa/src/router.js b/spa/src/router.js
index aff146d..2ef525c 100644
--- a/spa/src/router.js
+++ b/spa/src/router.js
@@ -8,6 +8,7 @@ import Checkout from "@/views/Checkout.vue";
import OrderCreated from "@/views/OrderCreated.vue";
import Search from "@/views/Search.vue";
import Filters from "@/views/Filters.vue";
+import {useYaMetrikaStore} from "@/stores/yaMetrikaStore.js";
const routes = [
{
diff --git a/spa/src/stores/yaMetrikaStore.js b/spa/src/stores/yaMetrikaStore.js
new file mode 100644
index 0000000..5df1ebc
--- /dev/null
+++ b/spa/src/stores/yaMetrikaStore.js
@@ -0,0 +1,56 @@
+import {defineStore} from "pinia";
+import {useSettingsStore} from "@/stores/SettingsStore.js";
+
+export const useYaMetrikaStore = defineStore('ya_metrika', {
+ state: () => ({
+ queue: [],
+ }),
+
+ actions: {
+ pushHit(url, params = {}) {
+ const settings = useSettingsStore();
+ if (!settings.ya_metrika_enabled) {
+ console.debug('[ym] Yandex Metrika disabled in settings.');
+ return;
+ }
+
+ const fullUrl = `/#${url}`;
+
+ if (typeof window.ym === 'function' && window.YA_METRIKA_ID !== undefined) {
+ console.debug('[ym] Hit ', fullUrl);
+ console.debug('[ym] ID ', window.YA_METRIKA_ID);
+ console.debug('[ym] params ', params);
+ window.ym(window.YA_METRIKA_ID, 'hit', fullUrl, params);
+ } else {
+ console.debug('[ym] Yandex Metrika is not initialized. Pushed to queue.');
+ this.queue.push({
+ event: 'hit',
+ payload: {
+ fullUrl,
+ params,
+ }
+ });
+ }
+ },
+
+ processQueue() {
+ if (this.queue.length === 0) {
+ return;
+ }
+
+ console.debug('[ym] Start processing queue. Size: ', this.queue.length);
+
+ while (this.queue.length > 0) {
+ const item = this.queue.shift();
+ if (item.event === 'hit') {
+ console.debug('[ym] Queue ', item);
+ window.ym(window.YA_METRIKA_ID, item.event, item.payload.url, item.payload.params);
+ } else {
+ console.error('[ym] Unsupported queue event: ', item.event);
+ }
+ }
+
+ console.debug('[ym] Queue processing complete. Size: ', this.queue.length);
+ },
+ },
+});
diff --git a/spa/src/utils/yaMetrika.js b/spa/src/utils/yaMetrika.js
index a59c282..3a516ee 100644
--- a/spa/src/utils/yaMetrika.js
+++ b/spa/src/utils/yaMetrika.js
@@ -1,7 +1,28 @@
+import {useYaMetrikaStore} from "@/stores/yaMetrikaStore.js";
+
+function getMetrikaId() {
+ // Пробуем найти все элементы