spirits999 Posted March 11, 2013 Share Posted March 11, 2013 (edited) I want to create some vouchers that will allow customers to buy discounted and non discounted products. However I want to restrict the minimum amount of 500 to only non-discounted products. Following is the code that I modified in the cart.php file. Could someone verify if this will work correctly. MODIFIED CODE if (($discountObj->id_customer OR $discountObj->id_group) AND ((($this->id_customer != $discountObj->id_customer) OR ($this->id_customer == 0)) AND !in_array($discountObj->id_group, $groups))) { if (!$cookie->isLogged()) return Tools::displayError('You cannot use this voucher.').' - '.Tools::displayError('Please log in.'); return Tools::displayError('You cannot use this voucher.'); } $total_cart = 0; $categories = Discount::getCategories($discountObj->id); $returnErrorNoProductCategory = true; EARLIER CODE if (($discountObj->id_customer OR $discountObj->id_group) AND ((($this->id_customer != $discountObj->id_customer) OR ($this->id_customer == 0)) AND !in_array($discountObj->id_group, $groups))) { if (!$cookie->isLogged()) return Tools::displayError('You cannot use this voucher.').' - '.Tools::displayError('Please log in.'); return Tools::displayError('You cannot use this voucher.'); } $onlyProductWithDiscount = false; if (!$discountObj->cumulable_reduction) { foreach ($products as $product) if ($product['reduction_applies'] OR $product['on_sale']) $onlyProductWithDiscount = true; } if (!$discountObj->cumulable_reduction AND $onlyProductWithDiscount) return Tools::displayError('This voucher is not valid for marked or reduced products.'); $total_cart = 0; $categories = Discount::getCategories($discountObj->id); $returnErrorNoProductCategory = true; Edited March 11, 2013 by spirits999 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts