payment fees doesnt refresh in the cart


  • Default avatar
    viktor    
     3 years ago  last edited 3 years ago
    0

    When I have a product in my cart. The 85.41€ the calculated payment fees are 2.81€ but its actually 2.65€ how displayed and also not updated in the sum



    When I switch to PayPal it displays 2.75€ but in the price column the 2.91€ from the price without the coupon code

    hvEpPOr.jpg


    How can I change or fix this problem?

  • Your avatar
    seyi    
     3 years ago
    0

    Hello,

    A little confused.  First of all how did you set up your payment method fees?
  • Default avatar
    viktor    
     3 years ago
    0

    in the payment


    PayPal: 2.9% + 0.35 cent
    Stripe: 2.9% + 0.25 cent

    PayPal is the included payment delivered with Virtuemart
    Stripe is a seperate installed plugin

  • Your avatar
    seyi    
     3 years ago
    0

    I guess my first issue is with the calculation of the fee before a coupon is used.  You say for paypal it should be 2.91, when the product total is 85.41.

    In my calculation:

    ( 85.42 * 0.029 ) + 0.35 = 2.83

    What am I doing wrong in the calculations?

    Secondly, I see you have the fee displayed in both the image and the totals column.  How did you set that up to work like that?  Are you using a checkout extension?  If you refresh the page does the totals show correctly?
  • Default avatar
    viktor    
     3 years ago
    0

    Hi,


    I agree the calculations are weird. Thats what I also saw. The fees automaticly display if I use more then 1 payment system. So if I disable PayPal for example the fees display disappear. But the calculations are still the same as in the pictures shown. 
    The calculations are made by virtuemart. Pls dont ask me how the heck they do their calculations to display like that.

    I dont use a checkout system. Just joomla, virtueamart and a template I bought.

    If I refresh the site only the stripe amount is the same as shown under the logo but still wrong amount in the totals.

  • Your avatar
    seyi    
     3 years ago
    0

    Ok, will not worry about how it is calculated, that is a Virtuemart thing.  But yes, the total is not adjusted when there is a coupon with AwoCoupon.  Here is how to fix it.  In the file
    \administrator\components\com_awocoupon\helper\estore\virtuemart\class-awocoupon-helper-estore-virtuemart-discount.php, around line 466 is this:
    <?php
            
    else {
                // update cart objects
                $coupon_taxbill 0;
                $this->vmcartPrices['couponTax'] = round$coupon_session->product_discount_tax $coupon_session->shipping_discount_tax $coupon_taxbill,) * $negative_multiplier;
                $this->vmcartPrices['couponValue'] = round$coupon_session->product_discount_notax $coupon_session->shipping_discount_notax,) * $negative_multiplier;
                $this->vmcartPrices['salesPriceCoupon'] = round$coupon_session->product_discount $coupon_session->shipping_discount $coupon_taxbill,) * $negative_multiplier;
                $this->vmcartPrices['billSub'] -= $this->vmcartPrices['couponValue'] * $negative_multiplier;
                $this->vmcartPrices['billTaxAmount'] -= $this->vmcartPrices['couponTax'] * $negative_multiplier;
                $this->vmcartPrices['billTotal'] -= $this->vmcartPrices['salesPriceCoupon'] * $negative_multiplier;
            }
    ?>

    Right after that add this
    <?php
            
    // adjust for payment method
            if ( ! empty( $this->vmcartPrices['salesPricePayment'] ) ) {
                $percent_discount $this->vmcartPrices['salesPriceCoupon'] / ( $this->vmcartPrices['salesPriceShipment'] + $this->vmcartPrices['withTax'] );
                $payment_adjust absround$this->vmcartPrices['salesPricePayment'] * $percent_discount) );
                $this->vmcartPrices['billTotal'] -= $payment_adjust;
            }
    ?>

    That should do it.
  • Default avatar
    viktor    
     3 years ago
    0

    Thank you. It kinda helped out. Now I have 3 different amounts. Same example like the screens above

    OXf7Fui.jpg
  • Your avatar
    seyi    
     3 years ago
    0

    I am not getting any issues, using VirtueMart 3.8.4 10335

    Before:


    After

  • Your avatar
    seyi    
     3 years ago  last edited 3 years ago
    0

    Try this code instead:
    <?php
            
    // adjust for payment method
            if ( ! empty( $this->vmcartPrices['salesPricePayment'] ) ) {
                $orig_sales_price $this->vmcartPrices['salesPricePayment'];
                if ( ! class_exists'calculationHelper' ) ) {
                    require JPATH_VM_ADMINISTRATOR '/helpers/calculationh.php';
                }
                $calculator calculationHelper::getInstance();
                $calculator->_cart unserializeserialize$calculator->_cart ) ); // cannot use clone because it does not deep clone
                if ( method_exists$calculator'calculatePaymentPrice' ) ) {
                    $_new_cart_prices =  version_compare$this->vmversion'2.9.8''>=' ) ? $calculator->calculatePaymentPrice() : $calculator->calculatePaymentPrice$this->o_cart$obj->payment_id );                
                    $this
    ->vmcartPrices['billTotal'] -= ( $this->vmcartPrices['salesPricePayment'] - $_new_cart_prices['salesPricePayment'] );
                }
            }
    ?>

    This is to fix the order total.
  • Default avatar
    viktor    
     3 years ago  last edited 3 years ago
    0

    To be honest the first version was better. whats curious its always the first row. first payment that shows up the wrong amount.

    when I open the cart first time. its the 2.64. fees stays at 2.47 
    when i switch payment to stripe it shows the correct fees of 2.47 but switching back to paypal it shows 2.64 again.

    Version 1 


    The updated code had again 3 different effects. 3 different results. If I change the payment it stays at 2.64. Removing the coupon code fees r shown the right way.

    Version 2 


    So its something with the coupon code and the 1st payment. I changed the fees only to percentage. so its now 3% and not 2.9% + 0.35 cent

    My Version:  VirtueMart 3.8.4 10335

  • Your avatar
    seyi    
     3 years ago
    0

    I cannot produce your scenario.  So to further look at this, would need temp admin/ftp access to the site.  You can send me a private message.