Plugin Directory

Changeset 3096888


Ignore:
Timestamp:
06/03/2024 04:54:34 PM (22 months ago)
Author:
robokassa
Message:

1.6.0 fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • robokassa/trunk/wp_robokassa.php

    r3092020 r3096888  
    752752                $current['quantity'] = 1;
    753753
     754                // Получаем цену каждого товара
     755                $item_price = $product->get_price();
     756
     757                // Рассчитываем налог на единицу товара
    754758                $tax_per_item = ($taxes / $woocommerce->cart->get_cart_contents_count());
    755759
    756                 $current['cost'] = ($item['line_total'] + $tax_per_item);
     760                // Устанавливаем цену и сумму для текущего товара
     761                $current['cost'] = $item_price + $tax_per_item;
    757762                $current['sum'] = $current['cost'];
    758763
    759764                if (get_option('robokassa_country_code') == 'RU') {
    760                     $current['payment_object'] = \get_option('robokassa_payment_paymentObject');
    761                     $current['payment_method'] = \get_option('robokassa_payment_paymentMethod');
     765                    $current['payment_object'] = get_option('robokassa_payment_paymentObject');
     766                    $current['payment_method'] = get_option('robokassa_payment_paymentMethod');
    762767                }
    763768
    764                 if (isset($receipt['sno']) && ($receipt['sno'] == 'osn') || (get_option('robokassa_country_code') == 'KZ')) {
     769                if (isset($receipt['sno']) && $receipt['sno'] == 'osn' || get_option('robokassa_country_code') == 'KZ') {
    765770                    $current['tax'] = $tax;
    766771                } else {
     
    771776            }
    772777        } else {
     778            $current = [];
    773779            $current['name'] = $product->get_title();
    774780            $current['quantity'] = (float)$item['quantity'];
    775781
     782            // Получаем цену каждого товара
     783            $item_price = $product->get_price();
     784
     785            // Рассчитываем налог на все количество текущего товара
    776786            $tax_per_item = ($taxes / $woocommerce->cart->get_cart_contents_count()) * $current['quantity'];
    777787
    778             $current['cost'] = ($item['line_total'] + $tax_per_item) / $current['quantity'];
     788            // Устанавливаем цену и сумму для текущего товара
     789            $current['cost'] = $item_price + ($tax_per_item / $current['quantity']);
    779790            $current['sum'] = $current['cost'] * $current['quantity'];
    780791
    781792            if (get_option('robokassa_country_code') == 'RU') {
    782                 $current['payment_object'] = \get_option('robokassa_payment_paymentObject');
    783                 $current['payment_method'] = \get_option('robokassa_payment_paymentMethod');
     793                $current['payment_object'] = get_option('robokassa_payment_paymentObject');
     794                $current['payment_method'] = get_option('robokassa_payment_paymentMethod');
    784795            }
    785796
    786             if (isset($receipt['sno']) && ($receipt['sno'] == 'osn') || (get_option('robokassa_country_code') == 'KZ')) {
     797            if (isset($receipt['sno']) && $receipt['sno'] == 'osn' || get_option('robokassa_country_code') == 'KZ') {
    787798                $current['tax'] = $tax;
    788799            } else {
    789800                $current['tax'] = 'none';
    790801            }
    791 
    792802
    793803            $receipt['items'][] = $current;
Note: See TracChangeset for help on using the changeset viewer.