coupon discount amount incorrect


  • Default avatar
    rick26    
     7 years ago
    0

    Seyi,

    I R E A L L Y appreciate your support and patience, everything works like a charm!

    Just looking forward as I will be a long term customer of AWO, if I update Virtuemart or AWO will the past issues reappear?

    If so what is the solution?

    Thanks again

    Best regard

    Rick
  • Your avatar
    seyi    
     7 years ago
    0

    Hi Rick,

    You are welcome. Moving forward, the edits mentioned in this topic will be part of the core of AwoCoupon, so you would not have to re-add anything on update.
  • Default avatar
    rick26    
     7 years ago
    0

    Perfect!

    You're the best!
  • Default avatar
    rick26    
     6 years ago
    0

    Seyi,

    I am having the same issue after recent update as before with discounts not being calculated properly, you mentioned that you would change the core code so that in future upgrades this would not happen but I a facing the same problem again!

    How should I go about resolving this?

    Here is an example:

    $196.33 Total
    $11.09 Discount - should be $9.82
    $25.52 Tax - should be $24.25
    $210.76 - Correct in both right and wrong calculations

    Look forward to hearing back from you

    Rick
  • Your avatar
    seyi    
     6 years ago
    0

    Hi,

    Problek with the last version, 2.3.7, where the tax rate in AwoCoupon does not take into account tax per bill.

    So here is the fix.

    In www/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php, around line 892 is this:
    <?php
                $tax_rate 
    = ($this->vmcartPrices[$cartpricekey]['salesPrice']-$this->vmcartPrices[$cartpricekey]['priceWithoutTax'])/$this->vmcartPrices[$cartpricekey]['priceWithoutTax'];
                
    $product_price $this->vmcartPrices[$cartpricekey]['salesPrice']*(1+$billtaxrate);
    ?>


    Right after that add this:
    <?php
                $tax_rate 
    = ($product_price-$this->vmcartPrices[$cartpricekey]['priceWithoutTax'])/$this->vmcartPrices[$cartpricekey]['priceWithoutTax'];
    ?>


    That should fix it.
  • Default avatar
    rick26    
     6 years ago
    0

    Seyi,

    Perfect, Thanks

    Will this fix need to be inserted by me in future updates?

    Rick
  • Default avatar
    rick26    
     6 years ago
    0

    Seyi,

    Well......... your fix works perfectly IF the product is not on sale, if the item is on sale (price overide in Virtuemart) then the discount coupon and tax are still calculated from the pre sale price (before price override)

    Rick
  • Your avatar
    seyi    
     6 years ago
    0

    Hi,

    In the above code, I gave you the new tax code of
    <?php
        $tax_rate 
    = ($product_price-$this->vmcartPrices[$cartpricekey]['priceWithoutTax'])/$this->vmcartPrices[$cartpricekey]['priceWithoutTax'];
    ?>


    Change it to
    <?php
        $tax_rate 
    = ($product_price-$this->vmcartPrices[$cartpricekey]['discountedPriceWithoutTax'])/$this->vmcartPrices[$cartpricekey]['discountedPriceWithoutTax'];
    ?>


    That should fix it.
  • Default avatar
    rick26    
     6 years ago
    0

    Seyi,

    Thanks again, seems to have the problem resolved

    Appreciate the prompt and accurate service!

    Best regards

    Rick
  • Default avatar
    rick26    
     5 years ago
    0

    Seyi,

    I just updated AWO to your last edition, unfortunately I am facing the same issues with discounts, it takes discount from pre discounted price, not discounted price. I tried to add the fix you gave me but it seems you have made many changes to the php file

    Rick
  • Your avatar
    seyi    
     5 years ago
    0

    Hello,

    I just checked the code for the latest version of AwoCoupon, 2.4.4, and the edits are there. What version of Virtuemart are you using now?