Gift Certificate : wrong calculations


  • Default avatar
    nicolas4    
     4 years ago
    0

    Hi Seyi,


    I have a gift certifcate of 50$ that we apply after taxes. I attach 3 images. Order with 1 item : why is there 1,50$ to pay ? Order with 8 items : why the certificate was not applied in full (50$) ? Order with 10 items is OK.


    Can you please help ?


    https://drive.google.com/open?id=1JTsSS58q2tF7OkeJEqvIvj0G_Wd9oFc6

    https://drive.google.com/open?id=1F2taWeduOvKGljV5oytTK54NLpY-7XPw

    https://drive.google.com/open?id=1g_QKbDcya5WFUlJgW_98cCrYc7KXdJ5R


    Thanks !

    Nicolas

  • Your avatar
    seyi    
     4 years ago
    0

    Hello,

    How is the coupon set up?  Is it setup as a gift certificate without any restrictions?

    Just looking at the cart, cart and trying to understand:

    Product price no tax: $5
    Shipping cost: $10
    Tax 1 (9.975%): $15 * 0.0975 = $1.50
    Tax 2 (5%) : $15 * 0.05 = $0.75
    Total without coupon; $15 + $1.50 + $0.75 = $17.25

    You apply a $50 gift certificate:
    Discount: $15.75
    Total: $1.50

    So obviously it is not discounting Tax 1.  Is this a virtuemart shop?  How is tax 1 setup in the calculation rules?


  • Default avatar
    nicolas4    
     4 years ago
    0

    Thanks for your quick reply !


    I am trying to understand too. :) If you look at other pictures, the total is still 1,50$, even if the Tax 1 is higher -- so it's not as simple as "not discounting tax 1" to my opinion.


    Yes, it is a VM shop, not updated for a while. Awo is not updated neither. We fear updating all this, Joomla is 3.7.5, if we update it, OnePageCheckout stop working.


    Here's the tax setup : https://drive.google.com/open?id=10bCahIuPF_zgrLQGVjR3qkAnacfVDFM2


    So we don't know where to start looking in the files, maybe you can give us a hint, maybe it's solved in a newer version, whatever is it, thanks for helping us.


    Have a good day !



  • Your avatar
    seyi    
     4 years ago
    0

    Your version of AwoCoupon probably makes a difference depending on how old it is.  There have been lots of updates to better support the calculation rules.  What version fo AwoCoupon and Virtuemart are you using?
  • Default avatar
    nicolas4    
     4 years ago
    0

    2.5.1 et 3.0.18.
  • Your avatar
    seyi    
     4 years ago
    0

    That version of AwoCoupon is over 3 years old.  You really need to upgrade to the latest, more than likely any issues are fixed there.  Otherwise post back.
  • Default avatar
    nicolas4    
     4 years ago
    0

    Hi, I have upgraded AwoCoupon component and the issue is still present.


    See pic : https://drive.google.com/open?id=1L2fbs44smTRfMCCDrXTGOaZ6YwzxTRF8


    I give you some pics from actual orders :

    One is OK : https://drive.google.com/open?id=1JfJtvvc_GCripulvcoBJhhOFDs77sKF0

    One is NOT : https://drive.google.com/open?id=1frswt1CyVIQApDNebfgu_6J9XU1HoQXA

    One has no tax at all ? : https://drive.google.com/open?id=1Pqwl_pwZlCC3GYQuF3g3LLAKZRnZsqbu


    Kinda lost. Can you help please ?

    Thanks !


  • Your avatar
    seyi    
     4 years ago
    +1

    Hello,

    Is it possible to send a private message with temporary access to have a look directly?
  • Default avatar
    nicolas4    
     4 years ago
    0

    Hi !


    This is done. Thank you very much.

  • Your avatar
    seyi    
     4 years ago
    0

    There are too many problems with the test site, I cannot get it to work.  Going to the cart gave a blank screen, so disabled your one page checkout.  It now shows the cart, but never goes forward no matter how many times I hit confirm.
  • Default avatar
    nicolas4    
     4 years ago
    0

    Seyi,


    I must use PHP 5.4 for this old site. I will work now.

  • Your avatar
    seyi    
     4 years ago
    0

    Ok, great.  Was able to reproduce a problem, where the shipping tax is not taken into account.


    Here is the fix, in the file
    www\administrator\components\com_awocoupon\helper\estore\virtuemart\class-awocoupon-helper-estore-virtuemart-discount.php
    around line 400 is this:
    <?php
                $product_coupon_tax 
    $product_coupon_value $product_coupon_subtotal 0;
                $coupon_tax $coupon_value $coupon_subtotal 0;
                foreach ( $coupon_session->processed_coupons as $item ) {
                    if ( ! empty( $item->product_discount_tax ) ) {
                        $product_coupon_tax += $item->product_discount_tax;
                        $product_coupon_value += $item->product_discount_notax;
                        $product_coupon_subtotal += $item->product_discount_notax;
                    }
                    else {
                        $product_coupon_value += $item->product_discount;
                    }
                }

                $coupon_tax round$product_coupon_tax $coupon_session->shipping_discount_tax) * $negative_multiplier;
                $coupon_value round$product_coupon_value $coupon_session->shipping_discount_notax) * $negative_multiplier;
                $coupon_subtotal round$product_coupon_subtotal $coupon_session->shipping_discount_notax) * $negative_multiplier;
    ?>

    Change it to this:
    <?php
                $product_coupon_tax 
    $product_coupon_value $product_coupon_subtotal 0;
                $shipping_coupon_tax $shipping_coupon_value $shipping_coupon_subtotal 0;
                $coupon_tax $coupon_value $coupon_subtotal 0;
                foreach ( $coupon_session->processed_coupons as $item ) {
                    if ( ! empty( $item->product_discount_tax ) ) {
                        $product_coupon_tax += $item->product_discount_tax;
                        $product_coupon_value += $item->product_discount_notax;
                        $product_coupon_subtotal += $item->product_discount_notax;
                    }
                    else {
                        $product_coupon_value += $item->product_discount;
                    }
                    if ( ! empty( $item->shipping_discount_tax ) ) {
                        $shipping_coupon_tax += $item->shipping_discount_tax;
                        $shipping_coupon_value += $item->shipping_discount_notax;
                        $shipping_coupon_subtotal += $item->shipping_discount_notax;
                    }
                    else {
                        $shipping_coupon_value += $item->shipping_discount;
                    }
                }

                $coupon_tax round$product_coupon_tax $shipping_coupon_tax) * $negative_multiplier;
                $coupon_value round$product_coupon_value $shipping_coupon_value) * $negative_multiplier;
                $coupon_subtotal round$product_coupon_subtotal $shipping_coupon_subtotal) * $negative_multiplier;
    ?>


  • Default avatar
    nicolas4    
     4 years ago
    0

    That is perfect. Thank you very much. You still have one of the best customer service on Earth. Thanks !