Fixed: older product selection is saved in cart rule restriction if a specific room type option is selected

This commit is contained in:
vishalsingh.qlo325
2025-06-17 11:13:04 +05:30
parent 72e3b529ae
commit da19c37888

View File

@@ -277,7 +277,10 @@ class AdminCartRulesControllerCore extends AdminController
// If the reduction is associated to a specific product, then it must be part of the product restrictions
if ((int)Tools::getValue('reduction_product') && Tools::getValue('apply_discount_to') == 'specific' && Tools::getValue('apply_discount') != 'off') {
$reduction_product = (int)Tools::getValue('reduction_product');
// In case the product_restriction was unchecked then remove the older products.
if (!Tools::getValue('product_restriction')) {
$_POST['product_rule_group'] = array();
}
// First, check if it is not already part of the restrictions
$already_restricted = false;
if (is_array($rule_group_array = Tools::getValue('product_rule_group')) && count($rule_group_array) && Tools::getValue('product_restriction')) {