feat(telecart): add vouchers and coupons (#9)
This commit is contained in:
@@ -348,11 +348,24 @@ TEXT,
|
||||
'module_tgshop_mini_app_url' => rtrim(HTTPS_CATALOG, '/') . '/image/catalog/tgshopspa/#/',
|
||||
'module_tgshop_mainpage_categories' => 'latest10',
|
||||
'module_tgshop_enable_store' => 1,
|
||||
'module_tgshop_feature_coupons' => 0,
|
||||
'module_tgshop_feature_vouchers' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
private function getSettingsConfig(): array
|
||||
{
|
||||
$ocCouponsLink = $this->url->link(
|
||||
'marketing/coupon',
|
||||
'user_token=' . $this->session->data['user_token'],
|
||||
true
|
||||
);
|
||||
$ocVouchersLink = $this->url->link(
|
||||
'sale/voucher',
|
||||
'user_token=' . $this->session->data['user_token'],
|
||||
true
|
||||
);
|
||||
|
||||
return [
|
||||
'general' => [
|
||||
'module_tgshop_status' => [
|
||||
@@ -486,6 +499,28 @@ HTML,
|
||||
'type' => 'categories',
|
||||
'help' => 'На главной странице будут отображаться эти категории, если вы выберете этот вариант в настройке “Категории на главной”.',
|
||||
],
|
||||
|
||||
'module_tgshop_feature_coupons' => [
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
0 => 'Выключено',
|
||||
1 => 'Включено',
|
||||
],
|
||||
'help' => <<<HTML
|
||||
Позволяет использовать стандартные <a href="{$ocCouponsLink}" target="_blank">купоны OpenCart</a> для предоставления скидок при оформлении заказа.
|
||||
HTML,
|
||||
],
|
||||
|
||||
'module_tgshop_feature_vouchers' => [
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
0 => 'Выключено',
|
||||
1 => 'Включено',
|
||||
],
|
||||
'help' => <<<HTML
|
||||
Позволяет покупателям использовать <a href="{$ocVouchersLink}" target="_blank">подарочные сертификаты OpenCart</a> при оформлении заказа.
|
||||
HTML,
|
||||
],
|
||||
],
|
||||
|
||||
'orders' => [
|
||||
|
||||
@@ -30,6 +30,8 @@ $_['lbl_module_tgshop_mini_app_url'] = 'Ссылка на Telegram Mini App';
|
||||
$_['lbl_module_tgshop_mainpage_categories'] = 'Категории на главной';
|
||||
$_['lbl_module_tgshop_featured_categories'] = 'Избранные категории';
|
||||
$_['lbl_module_tgshop_enable_store'] = 'Разрешить покупки';
|
||||
$_['lbl_module_tgshop_feature_coupons'] = 'Промокоды';
|
||||
$_['lbl_module_tgshop_feature_vouchers'] = 'Подарочные сертификаты';
|
||||
|
||||
// Entry
|
||||
$_['entry_status'] = 'Статус';
|
||||
|
||||
@@ -83,23 +83,30 @@ class ControllerExtensionTgshopHandle extends Controller
|
||||
],
|
||||
'cache_categories_main' => 60 * 10,
|
||||
'cache_products_main' => 60 * 10,
|
||||
'feature_coupons' => filter_var(
|
||||
$this->config->get('module_tgshop_feature_coupons'),
|
||||
FILTER_VALIDATE_BOOLEAN
|
||||
),
|
||||
'feature_vouchers' => filter_var(
|
||||
$this->config->get('module_tgshop_feature_vouchers'),
|
||||
FILTER_VALIDATE_BOOLEAN
|
||||
),
|
||||
]);
|
||||
|
||||
$app->bind(OcModelCatalogProductAdapter::class, function () {
|
||||
|
||||
return new OcModelCatalogProductAdapter($this->model_catalog_product);
|
||||
});
|
||||
|
||||
$app->bind(Url::class, fn () => $this->url);
|
||||
$app->bind(Currency::class, fn () => $this->currency);
|
||||
$app->bind(Tax::class, fn () => $this->tax);
|
||||
$app->bind(ImageToolInterface::class, fn () => new ImageTool(DIR_IMAGE, HTTPS_SERVER));
|
||||
$app->bind(Cart::class, fn () => $this->cart);
|
||||
$app->bind(OcRegistryDecorator::class, fn () => new OcRegistryDecorator($this->registry));
|
||||
$app->singleton(Log::class, fn () => $this->log);
|
||||
$app->bind(Url::class, fn() => $this->url);
|
||||
$app->bind(Currency::class, fn() => $this->currency);
|
||||
$app->bind(Tax::class, fn() => $this->tax);
|
||||
$app->bind(ImageToolInterface::class, fn() => new ImageTool(DIR_IMAGE, HTTPS_SERVER));
|
||||
$app->bind(Cart::class, fn() => $this->cart);
|
||||
$app->bind(OcRegistryDecorator::class, fn() => new OcRegistryDecorator($this->registry));
|
||||
$app->singleton(Log::class, fn() => $this->log);
|
||||
|
||||
$app
|
||||
->withLogger(fn () => new OpenCartLogAdapter($this->log, 'TeleCart'))
|
||||
->withLogger(fn() => new OpenCartLogAdapter($this->log, 'TeleCart'))
|
||||
->bootAndHandleRequest();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ class SettingsHandler
|
||||
'ya_metrika_enabled' => $this->settings->get('ya_metrika_enabled'),
|
||||
'app_enabled' => $this->settings->get('app_enabled'),
|
||||
'store_enabled' => $this->settings->get('store_enabled'),
|
||||
'feature_coupons' => $this->settings->get('feature_coupons') ?? false,
|
||||
'feature_vouchers' => $this->settings->get('feature_vouchers') ?? false,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
0
module/oc_telegram_shop/upload/oc_telegram_shop/tests/fixtures/criteria_builder/product_category/contains/output.sql
vendored
Normal file → Executable file
0
module/oc_telegram_shop/upload/oc_telegram_shop/tests/fixtures/criteria_builder/product_category/contains/output.sql
vendored
Normal file → Executable file
0
module/oc_telegram_shop/upload/oc_telegram_shop/tests/fixtures/criteria_builder/product_category/not_contains/output.sql
vendored
Normal file → Executable file
0
module/oc_telegram_shop/upload/oc_telegram_shop/tests/fixtures/criteria_builder/product_category/not_contains/output.sql
vendored
Normal file → Executable file
Reference in New Issue
Block a user