Gift certificate changes shipping amount


  • Default avatar
    ashley    
     12 years ago
    0

    Take the following order:

    Products Total: $10
    Shipping: $5

    A user applies a $20 gift certificate to the order. Looking at the order in Virtuemart administration will show:

    Products Total: $10
    Coupon Discount: $10
    Shipping: $0

    I looked through ps_coupon_process.php and this appears to be the intended behavior. However, this makes it appear as though the shipping was free. I would rather the discount be applied like so:

    Products Total: $10
    Coupon Discount: $15
    Shipping $5

    This would be a more accurate reflection of what actually went on in the transaction. I'm guessing that it isn't done this way because of some limitation in the Virtuemart core that won't allow the Coupon Discount to be greater than the Products Total.

    Seyi, could you please shed some light on this? I don't mind implementing a hack if necessary. Also, note that we are using a custom shipping module if that has anything to do with it.

    Thanks

    P.S. - Great extension, it has been really useful for us. And as a fellow PHP'er, thanks for writing code that is actually understandable without reading it 50 times :)
  • Your avatar
    seyi    
     12 years ago
    0

    Hi,

    You are very welcome, glad your like.

    For your specific issue, view this forum topic:
    https://awodev.com/forum/awocoupon/help-section/shipping-amount-after-gift-certificate-000

    Posts 3 and 6 should have what you need.
  • Default avatar
    ashley    
     12 years ago
    0

    Seyi,
    Thanks for the update. I read through the code there and it looks like it fixes what is displayed to the customer in the email and account details page, but it doesn't look like it fixes what is shown in the administrator back end.

    The bigger problem is that we have an ordering system that pulls down orders from Virtuemart that relies on the core Virtuemart tables having accurate information. It seems like the only place the shipping discount is stored is in the AwoCoupon tables. I'm trying to avoid modifying the ordering system to read the AwoCoupon tables to grab the shipping discount unless I just have to.

    What I would like to do is just have the coupon processor apply the discount correctly. For the order shown in my original post, it would give an order discount of $15 instead of an order discount of $10 and reducing the shipping to $0. I can probably implement the hack myself.

    So my question to you is: Is there something in the Virtuemart core that prevents us from just setting the discount to the correct value?

    Thanks again for your help.
  • Your avatar
    seyi    
     12 years ago
    0

    I see, I have not tried it but you should be able to do this. The code that controls what is entered in the database is found in
    www/administrator/components/com_virtuemart/clasess/ps_checkout.php, function calc_order_totals, variable $totals.