show order total price without the user gift certificate balance discount


  • Default avatar
    micha    
     4 years ago
    0

    Hello, could you help me to modify the calculations to show order total price without the user gift certificate balance discount. In the VM 2.6 it was quite simple. I've commented out the salesPriceCoupon in the calculationh.php.


    $this->_cartPrices['billTotal'] = $this->_cartPrices['salesPriceShipment'] + $this->_cartPrices['salesPricePayment'] + $this->_cartPrices['withTax']; //+ $this->_cartPrices['salesPriceCoupon'];


    But in VM 3.4 it's more tricky. I could comment the


    $dispatcher->trigger('plgVmUpdateTotals', array(&$this->_cart->cartData, &$this->_cart->cartPrices));


    line (also found in the calculationh.php) but then the VM Standard Payment won't let me finalize the order because I'm using the 0.1 maximum amount condition.

    I'm using AwooCoupon as my only payment method, so discounts are 100% (I don't want to have 0s, I need the order total for reports). Users "buys" products using their account balances (gift certificates).


    I have Virtuemart 3.4.2

    Regards

  • Your avatar
    seyi    
     4 years ago
    0

    You can retrieve the AwoCoupon session like this:
    <?php
    if ( ! class_exists'awocoupon' ) ) {
            require JPATH_ADMINISTRATOR '/components/com_awocoupon/helper/awocoupon.php';
    }
    AwoCoupon::instance();
    AC()->init();
    $coupon_session AC()->storediscount->get_coupon_session();
    ?>

    The coupon entered id for balance coupons are set to -3.  So for example you could do something like this:
    <?php
    $balance_total 
    0;

    foreach ( 
    $coupon_session->processed_coupons as $c_data ) {
            if ( $c_data->coupon_id_entered != -) {
                    // not a balance but a normal coupon

                    continue;
            }
            $balance_total += $c_data->product_discount $c_data->shipping_discount;
    }
    ?>

    Then you can subtract out $balance_total.

  • Default avatar
    micha    
     4 years ago
    0

    Thanks! Can I apply it somwhere in the calculationh.php or maybe it should go elsewhere?
  • Your avatar
    seyi    
     4 years ago
    0

    I do not really know what you are doing.  Just though you needed a way to get the balance discount in the cart.
  • Default avatar
    micha    
     4 years ago
    0

    I wrote you PM. Regards