feat: WIP add yandex metrika goals

This commit is contained in:
2025-10-26 14:35:39 +03:00
parent fbccd50675
commit 4e59c4e788
19 changed files with 219 additions and 38 deletions

View File

@@ -547,17 +547,18 @@ HTML,
],
'orders' => [
'module_tgshop_order_customer_group_id' => [
'type' => 'select',
'options' => $this->getCustomerGroups(),
'help' => 'Группа покупателей, которая будет назначена для заказов, оформленных через Telegram-магазин.',
],
'module_tgshop_order_default_status_id' => [
'type' => 'select',
'options' => $this->getOrderStatuses(),
'help' => 'Статус, с которым будут создаваться заказы через Telegram по умолчанию.',
],
'module_tgshop_order_customer_group_id' => [
'hidden' => true,
'type' => 'select',
'options' => $this->getCustomerGroups(),
'help' => 'Группа покупателей, которая будет назначена для заказов, оформленных через Telegram-магазин.',
],
],
];
}

View File

@@ -45,8 +45,7 @@ class ControllerExtensionTgshopHandle extends Controller
'app_debug' => $appDebug,
'oc_config_tax' => $this->config->get('config_tax'),
'oc_default_currency' => $this->config->get('config_currency'),
// ID группы покупателей, которая будет использоаваться в заказах через Телеграм.
'oc_customer_group_id' => $this->config->get('module_tgshop_order_customer_group_id'),
'oc_customer_group_id' => $this->config->get('config_customer_group_id'),
// ID магазина, для которого будут создаваться заказы из Телеграм
'oc_store_id' => 0,
// Название магазина, для которого будут создаваться заказы из Телеграм

View File

@@ -177,6 +177,7 @@ class OrderCreateService
$this->cartService->flush();
$orderData['order_id'] = $orderId;
$orderData['total_numeric'] = $orderData['total'] ?? 0;
$orderData['total'] = $cart['total_text'] ?? '';
$this->sendNotifications($orderData, $data['tgData']);
@@ -192,6 +193,8 @@ class OrderCreateService
'id' => $orderData['order_id'],
'created_at' => $dateTimeFormatted,
'total' => $orderData['total'],
'final_total_numeric' => $orderData['total_numeric'],
'currency' => $currencyCode,
];
}

View File

@@ -214,6 +214,7 @@ class ProductsService
$configTax = $this->oc->config->get('config_tax');
$product_info = $this->oc->model_catalog_product->getProduct($productId);
$currency = $this->oc->session->data['currency'];
if (! $product_info) {
throw new EntityNotFoundException('Product with id ' . $productId . ' not found');
@@ -280,24 +281,24 @@ class ProductsService
$data['images'] = $images;
$data['price'] = $this->currency->format(
$this->tax->calculate(
$product_info['price'],
$product_info['tax_class_id'],
$configTax,
),
$this->oc->session->data['currency']
$productPrice = $this->tax->calculate(
$product_info['price'],
$product_info['tax_class_id'],
$configTax,
);
$data['price'] = $this->currency->format($productPrice, $currency);
$data['currency'] = $currency;
$data['final_price_numeric'] = $productPrice;
if (! is_null($product_info['special']) && (float) $product_info['special'] >= 0) {
$data['special'] = $this->currency->format(
$this->tax->calculate(
$product_info['special'],
$product_info['tax_class_id'],
$configTax,
),
$this->oc->session->data['currency']
$productSpecialPrice = $this->tax->calculate(
$product_info['special'],
$product_info['tax_class_id'],
$configTax,
);
$data['special'] = $this->currency->format($productSpecialPrice, $currency);
$data['final_price_numeric'] = $productSpecialPrice;
$tax_price = (float) $product_info['special'];
} else {
$data['special'] = false;
@@ -305,7 +306,7 @@ class ProductsService
}
if ($configTax) {
$data['tax'] = $this->currency->format($tax_price, $this->oc->session->data['currency']);
$data['tax'] = $this->currency->format($tax_price, $currency);
} else {
$data['tax'] = false;
}
@@ -323,7 +324,7 @@ class ProductsService
$product_info['tax_class_id'],
$configTax,
),
$this->oc->session->data['currency']
$currency
)
);
}
@@ -341,7 +342,7 @@ class ProductsService
$product_info['tax_class_id'],
$configTax ? 'P' : false
),
$this->oc->session->data['currency']
$currency
);
$product_option_value_data[] = array(