private function applyGift() {
$key = $this->input->post('gift');
$aplyGift = false;
foreach ($this->baseDiscount->discountType['certificate'] as $disc) {
if ($disc['key'] == $key and $disc['is_gift']) {
///Расчет
$value = $this->baseDiscount->getDiscountValue ($disc, $this->baseDiscount->cart->getTotalPrice );
$this->baseDiscount->cart->gift_info = $disc['key'];
$this->baseDiscount->cart->gift_value = Currency::create()->convertFloor($value);
if (\ShopCore::app()->SSettings->getPricePrecision() == 0) {
$this->baseDiscount->cart->gift_value = floor($value); }
$cartTotalPrice = $this->baseDiscount->cart->getTotalPrice() - $value;
//Выводит конечную сумму
$this->baseDiscount->cart->setTotalPrice($cartTotalPrice > 0 ? $cartTotalPrice : BaseCart::MIN_ORDER_PRICE);
$aplyGift = true;
break;
}
}