44 lines
2.2 KiB
PHP
44 lines
2.2 KiB
PHP
<?php
|
|
class CartController extends CartControllerCore
|
|
{
|
|
/*
|
|
* module: ets_promotion
|
|
* date: 2023-11-25 09:55:39
|
|
* version: 1.1.9
|
|
*/
|
|
public function postProcess()
|
|
{
|
|
parent::postProcess();
|
|
if(Tools::getIsset('addDiscount') && $this->errors && ($code = Tools::getValue('discount_name')) && Validate::isCleanHtml($code) && !CartRule::cartRuleExists($code)) {
|
|
Module::getInstanceByName('ets_promotion')->addCartRule($this->errors,$code);
|
|
}
|
|
if(Tools::isSubmit('deletePromotionDiscountRule') && ($id_ets_rule = Tools::getValue('deletePromotionDiscountRule')) && Validate::isUnsignedId($id_ets_rule) )
|
|
{
|
|
Module::getInstanceByName('ets_promotion')->deleteCartRule($id_ets_rule);
|
|
}
|
|
}
|
|
/*
|
|
* module: ets_promotion
|
|
* date: 2025-10-21 12:56:57
|
|
* version: 1.1.9
|
|
*/
|
|
public function displayAjaxRefresh()
|
|
{
|
|
if (Configuration::isCatalogMode()) {
|
|
return;
|
|
}
|
|
ob_end_clean();
|
|
header('Content-Type: application/json');
|
|
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
|
|
die(json_encode([
|
|
'cart_detailed' => Module::isEnabled('ets_extraoptions') ? $this->context->smarty->fetch(_PS_MODULE_DIR_.'ets_extraoptions/views/templates/hook/checkout/cart-detailed.tpl'): $this->render('checkout/_partials/cart-detailed'),
|
|
'cart_detailed_totals' => $this->render('checkout/_partials/cart-detailed-totals'),
|
|
'cart_summary_items_subtotal' => $this->render('checkout/_partials/cart-summary-items-subtotal'),
|
|
'cart_summary_subtotals_container' => $this->render('checkout/_partials/cart-summary-subtotals'),
|
|
'cart_summary_totals' => $this->render('checkout/_partials/cart-summary-totals'),
|
|
'cart_detailed_actions' => $this->render('checkout/_partials/cart-detailed-actions'),
|
|
'cart_voucher' => $this->context->smarty->fetch(_PS_MODULE_DIR_.'ets_promotion/views/templates/hook/checkout/cart-voucher.tpl'),
|
|
'cart_sumary_products' => $this->context->smarty->fetch(_PS_MODULE_DIR_.'ets_promotion/views/templates/hook/checkout/cart_sumary_products.tpl'),
|
|
]));
|
|
}
|
|
} |