VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Arkadiy on October 29, 2015, 05:25:10 AM

Title: Coupon not checked when you change the items in your shopping cart
Post by: Arkadiy on October 29, 2015, 05:25:10 AM
The situation:
Type of goods on 3000, into database there a coupon, valid from 3000, enter this coupon. After that, reduce the number of goods. The purchase amount is less, but the coupon is not removed.

Solution:

In the function checkoutData() of the class VirtueMartCart when you change the goods in the cart the coupon will not be checked. To ensure that the coupon was checked before

if (!empty($this->couponCode)) {

insert

if (empty($this->couponCode) && !empty(self::$_cart->cartData["couponCode"])) {
   $this->couponCode = self::$_cart->cartData["couponCode"];
}

and in the redirect

if (!empty($redirectMsg)) {
    $this->couponCode = '';
    $this->_inCheckOut = false;
    $this->setCartIntoSession();

//doesn't work the first time
    //return $this->redirecter('index.php?option=com_virtuemart&view=cart'.$layoutName , $redirectMsg);
//its work
     JFactory::getApplication()->redirect('index.php?option=com_virtuemart&view=cart'.$layoutName , $redirectMsg);
   }

The modified file can provide.
Title: Re: Coupon not checked when you change the items in your shopping cart
Post by: Arkadiy on November 05, 2015, 10:37:16 AM
UP
Title: Re: Coupon not checked when you change the items in your shopping cart
Post by: jjk on November 05, 2015, 23:48:52 PM
Which version of VM do you use?
Title: Re: Coupon not checked when you change the items in your shopping cart
Post by: Arkadiy on November 07, 2015, 08:28:16 AM
VirtueMart 3.0.10