Coupon added to final price not base price


  • Default avatar
    petamazon    
     9 years ago
    0

    Hello there,

    I use vm 2.6.10 with joomla 2.5.x and awo coupon pro.

    I have created a discount to a product category from inside virtuemart. Then i try to use a 2% coupon i created from your component and this discount is added to the final price not base price.

    How is that possible? How can i make the discount to apply to the base price and not already discounted price?

    Please answer me this as soon as possible because website is live!

    Thank you in advance
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Not sure I understand.

    Firstly AwoCoupon will only discount what is there.

    So if for example a product normally costs $25 and within virtuemart you have discounted it to $10, if a customer uses a coupon that is worth $15, for that product only $10 would be discounted.

    Now I think what you are trying to say is you want the whole $15 to be discounted?
  • Default avatar
    petamazon    
     9 years ago
    0

    What i say is this:

    Assume we have a product with base price: $100. Inside virtuemart calculations & taxes rules you put a 30% discount to the category that this product is in to.

    So, base price $100 and after default virtuemart calculation rules you have final price: $70.

    Now, assume that you create a coupon for 10%. At the moment, if you use the coupon, the discount is occured on $70 (final price) not $100 that is the base price
  • Your avatar
    seyi    
     9 years ago
    0

    Ok, I understand now. So potentially you want to be able to discount more than is available. The above example I posted is also relevant if you created an amount discount. Here is a solution, but it would work for all coupons you create within AwoCoupon, so use it at your own risk:

    in www/administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php, around line 824 is this:

    <?php
                            $product_price 
    $this->vmcartPrices[$cartpricekey]['salesPrice']*(1+$billtaxrate);
                            
    $product_price_notax $this->vmcartPrices[$cartpricekey]['salesPrice']-$this->vmcartPrices[$cartpricekey]['taxAmount'];
    ?>


    Change to this:
    <?php
                            $product_price 
    = empty($this->vmcartPrices[$cartpricekey]['basePriceWithTax']) ? $this->vmcartPrices[$cartpricekey]['basePrice'] : $this->vmcartPrices[$cartpricekey]['basePriceWithTax'];
                            
    $product_price_notax $this->vmcartPrices[$cartpricekey]['basePrice'];
    ?>

  • Default avatar
    AntonioS30    
     7 years ago
    0

    Hi,

    how to do the same changes on awocoupon  2.0.26 ?
    Thanks

  • Your avatar
    seyi    
     7 years ago
    0

    Hello,

    In the free version, the file is in
    www/administrator/components/com_awocoupon/helpers/vm_coupon.php

    In that file, you should find these lines which you can alter:
    <?php
                        
    'product_price' => $this->vmcartPrices[$cartpricekey]['salesPrice'],
                        'product_price_notax' => $this->vmcartPrices[$cartpricekey]['priceWithoutTax'],
    ?>




  • Default avatar
    AntonioS30    
     7 years ago
    0

    alterate how?
  • Your avatar
    seyi    
     7 years ago
    0

    <?php
                            
    </span></span><span style="color:#000000;"><span style="color:#0000BB;"><span style="color:#000000;"><span style="color:#DD0000;">'product_price' </span><span style="color:#007700;">=></span></span></span><span style="color:#007700;"> empty(</span><span style="color:#0000BB;">$this</span><span style="color:#007700;">-></span><span style="color:#0000BB;">vmcartPrices</span><span style="color:#007700;">[</span><span style="color:#0000BB;">$cartpricekey</span><span style="color:#007700;">][</span><span style="color:#DD0000;">'basePriceWithTax'</span><span style="color:#007700;">]) ? </span><span style="color:#0000BB;">$this</span><span style="color:#007700;">-></span><span style="color:#0000BB;">vmcartPrices</span><span style="color:#007700;">[</span><span style="color:#0000BB;">$cartpricekey</span><span style="color:#007700;">][</span><span style="color:#DD0000;">'basePrice'</span><span style="color:#007700;">] : </span><span style="color:#0000BB;">$this</span><span style="color:#007700;">-></span><span style="color:#0000BB;">vmcartPrices</span><span style="color:#007700;">[</span><span style="color:#0000BB;">$cartpricekey</span><span style="color:#007700;">][</span><span style="color:#DD0000;">'basePriceWithTax'</span><span style="color:#007700;">];

                            </span><span style="color:#0000BB;"></span></span><span style="color:#000000;"><span style="color:#0000BB;"><span style="color:#000000;"><span style="color:#DD0000;">'product_price_notax' </span><span style="color:#007700;">=></span></span></span><span style="color:#007700;"> </span><span style="color:#0000BB;">$this</span><span style="color:#007700;">-></span><span style="color:#0000BB;">vmcartPrices</span><span style="color:#007700;">[</span><span style="color:#0000BB;">$cartpricekey</span><span style="color:#007700;">][</span><span style="color:#DD0000;">'basePrice'</span><span style="color:#007700;">];
    </
    span><span style="color:#0000BB;">
    ?>
  • Default avatar
    AntonioS30    
     7 years ago
    0

    no, it doesn't work.

    if i've a product sold 11,90euro, than i use a discount of 15% so it is sold 10,12 euro 
    but if i use a coupon of 20% (create with awo) i must have 9,52euro with 2,38 euro of discount but it is not! Because the system calculate 10,12 (discounted price) - 20% .... i hope i explained well.

  • Your avatar
    seyi    
     7 years ago
    0

    Hello,

    The above solution only gets the amount AwoCoupon should use for discount, in your case, this is 11.90 at 20% this is 2.38.  But it discounts this on the the cart.  So if the cart total is 10.12, then with discount it becomes 10.12-2.38 = 7.74.  The second part is alot more complicated, and you would need customization.  But for something like that, I would charge. 

    Another option is to just exclude discounted products from being discounted by the coupon.  This is available in the pro version of AwoCoupon.
  • Default avatar
    AntonioS30    
     7 years ago
    0

    i do not understand. "But for something like that, I would charge"
  • Your avatar
    seyi    
     7 years ago
    0

    It means it is customization that would take me time, so would charge money for it