Quantity of items in cart not update correctly


  • Default avatar
    darko7    
     3 months ago
    0

    Hi AwoDev team,

    I have problem with AwoCoupon.

    Problem exist only if user is registered. So if you are a guest all works fine as should.

    If you are logged in a website as registered put some item in the cart then you need go to cart checkout.

    In check out there you need try delete remove item from cart or update quantity of item.

    It will not work, you will get just a message, product quantity  is updated, or product is removed from cart, but item will still be in to the cart.

    Then without touching anything you just reload page second time and  item will update correctly, if you agean third time reload page item quantity will go back to old position.

    Is strange error but is wery troublesome, for quick solution I disabled System - AwoCoupon in plugin.

    Now check out work OK

    Please advise.

    Regards.


  • Your avatar
    seyi    
     3 months ago
    0

    Hello,

    What shopping cart and version are you using?

    Also, I do not understand why awocoupon will affect your product quantity, unless you are using automatic add to cart for buy x get y products.  Are you?
  • Default avatar
    darko7    
     3 months ago
    0

    Hi,

    I'm using VirtueMart 3.8.4 10335 native shopping cart in Joomla

    Where can I check if I using automatic add to cart for buy x get y products?

    I also don't understand  why awocoupon will affect your product quantity, I take me 4 hours to identify problem

    but now plugin is disabled and cart working without problem.


    https://tuamv.com/shop/liquor/wines/orange/povh-2018-orange-rebula-wine


    To register log in with name: registriran and pass: registriran

    Go shop -> check out and update product quantity in cart


    I will enable plugin for few hours till 17 PM +1 gtm


  • Your avatar
    seyi    
     3 months ago
    0

    Hmm, not sure.  I see you have some custom coding in the cart, gift cert section.  Wonder if somehow there are issues there.  In awocoupon > configuration > customer balance, do you have 'Automatically add balance to cart' set to 'yes'?  If so set it to 'no' and see if the problem persists.
  • Default avatar
    darko7    
     3 months ago
    0

    Hi Seyi

    I give in configuration to NO and work and was success.

    So without Automatically add balance to cart should people add balance manual now?

    Is true I did some coding in php to show people their balance.


  • Your avatar
    seyi    
     3 months ago
    0

    Ok, so here is the fix, in the file:
    \administrator\components\com_awocoupon\helper\estore\virtuemart\class-awocoupon-helper-estore-virtuemart-discount.php
    around line 306 is this:
    <?php
            $this
    ->coupon_code $this->coupon_code_balance;
    ?>

    Right before that add this:
    <?php
            $test 
    AC()->db->get_objectlist'
                SELECT c.id, (c.coupon_value-IFNULL(SUM(h.total_product+h.total_shipping),0)) as balance 
                  FROM #__awocoupon c
                  JOIN #__awocoupon_customer_balance cb ON cb.coupon_id=c.id
                  LEFT JOIN #__awocoupon_history h ON h.coupon_id=c.id AND h.estore=c.estore
                 WHERE c.estore="' 
    $this->estore '"
                   AND cb.user_id=' 
    . (int) AC()->helper->get_user()->id '
                   AND c.state="balance"
                 GROUP BY c.id
                HAVING balance>0
            ' 
    );
            if ( empty( $test ) ) {
                return false;
            }

            if ( ! $this->cart_object_is_initialized() ) {
                $orig_value $this->_disable_awocoupon;
                $this->_disable_awocoupon true;
                $this->o_cart->prepareCartData();
                $this->_disable_awocoupon $orig_value;
            }
    ?>

    That should fix the issue with updating/deleting in the cart
  • Default avatar
    darko7    
     3 months ago
    0

    Hi

    I tested and it is working. Great job.

    Will be added this fix to next update?

  • Your avatar
    seyi    
     3 months ago
    0

    Yes it will be.