Plugin Directory

Changeset 3092020


Ignore:
Timestamp:
05/24/2024 09:59:55 AM (23 months ago)
Author:
robokassa
Message:

1.6.0

Location:
robokassa/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • robokassa/trunk/main_settings_rb.php

    r3062478 r3092020  
    5858        'robokassa_culture',
    5959        'robokassa_iframe',
     60        'robokassa_marking',
    6061        'robokassa_country_code',
    6162        'robokassa_out_currency',
     
    431432                    </tr>
    432433
     434                    <tr valign="top">
     435                        <th scope="row">Включить для попозиционной маркировки</th>
     436                        <td>
     437                            <select name="robokassa_marking">
     438                                <?php if (get_option('robokassa_marking') == 1) { ?>
     439                                    <option selected="selected" value="1">Включено</option>
     440                                    <option value="0">Отключено</option>
     441                                <?php } else { ?>
     442                                    <option value="1">Включено</option>
     443                                    <option selected="selected" value="0">Отключено</option>
     444                                <?php } ?>
     445                            </select><br/>
     446                            <span class="text-description">При активированной функции, товары, количество которых больше одного в корзине, автоматически будут разбиты на отдельные позиции для чека<span>
     447                        </td>
     448                    </tr>
     449
    433450                    <!--                    <tr valign="top" id="payment-method-rk">
    434451                        <th scope="row">Выбор способа оплаты</th>
  • robokassa/trunk/readme.txt

    r3062478 r3092020  
    22Tags: robokassa payment gateway, robokassa, robokassa woocommerce, ecommerce, payment gateway, woo-commerce, woocommerce ===
    33Requires at least: 5.7
    4 Tested up to: 6.4.3
    5 Stable tag: 1.5.0
     4Tested up to: 6.5.3
     5Stable tag: 1.6.0
    66Requires PHP: 5.6.32
    77License: GPLv2 or later
     
    7777== Changelog ==
    7878
     79= 1.6.0 =
     80* Добавлена поддержка плагина ["WooCommerce Checkout Add-Ons"](https://woocommerce.com/products/woocommerce-checkout-add-ons/)
     81* Добавлена новая функция, позволяющая автоматически разбивать товары в корзине на отдельные позиции при количестве больше одного
     82
    7983= 1.5.9 =
    8084* Исправлены незначительные ошибки
  • robokassa/trunk/wp_robokassa.php

    r3062478 r3092020  
    66 * Author: Robokassa
    77 * Author URI: https://robokassa.com
    8  * Version: 1.5.9
     8 * Version: 1.6.0
    99 */
    1010
     
    174174        $debug .= "order_id = $order_id \r\n";
    175175
    176         $roboDataBase = new RoboDataBase(mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME));
     176        $roboDataBase = new RoboDataBase(mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME));
    177177        $robokassa = new RobokassaPayAPI($mrhLogin, get_option('robokassa_payment_shoppass1'), get_option('robokassa_payment_shoppass2'));
    178178
     
    312312
    313313                        (new RobokassaSms(
    314                             (new RoboDataBase(mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME))),
     314                            (new RoboDataBase(mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME))),
    315315                            (new RobokassaPayAPI(
    316316                                get_option('robokassa_payment_MerchantLogin'),
     
    742742
    743743    foreach ($cart as $item) {
    744 
    745744        $product = wc_get_product($item['product_id']);
    746 
    747         $current['name'] = $product->get_title();
    748         $current['quantity'] = (float)$item['quantity'];
    749 
    750         $tax_per_item = ($taxes / $woocommerce->cart->get_cart_contents_count()) * $current['quantity'];
    751 
    752         $current['cost'] = ($item['line_total'] + $tax_per_item) / $current['quantity'];
    753         $current['sum'] = $current['cost'] * $current['quantity'];
    754 
    755         if (get_option('robokassa_country_code') == 'KZ') {
     745        $quantity = (float)$item['quantity'];
     746
     747        // Проверяем, если функция включена, то разбиваем на дополнительные объекты
     748        if (get_option('robokassa_marking') == 1) {
     749            for ($i = 1; $i <= $quantity; $i++) {
     750                $current = [];
     751                $current['name'] = $product->get_title();
     752                $current['quantity'] = 1;
     753
     754                $tax_per_item = ($taxes / $woocommerce->cart->get_cart_contents_count());
     755
     756                $current['cost'] = ($item['line_total'] + $tax_per_item);
     757                $current['sum'] = $current['cost'];
     758
     759                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');
     762                }
     763
     764                if (isset($receipt['sno']) && ($receipt['sno'] == 'osn') || (get_option('robokassa_country_code') == 'KZ')) {
     765                    $current['tax'] = $tax;
     766                } else {
     767                    $current['tax'] = 'none';
     768                }
     769
     770                $receipt['items'][] = $current;
     771            }
    756772        } else {
    757             $current['payment_object'] = \get_option('robokassa_payment_paymentObject');
    758             $current['payment_method'] = \get_option('robokassa_payment_paymentMethod');
    759         }
    760 
    761         if (isset($receipt['sno']) && ($receipt['sno'] == 'osn') || (get_option('robokassa_country_code') == 'KZ')) {
    762             $current['tax'] = $tax;
    763         } else {
    764             $current['tax'] = 'none';
    765         }
    766 
    767 
    768         $receipt['items'][] = $current;
     773            $current['name'] = $product->get_title();
     774            $current['quantity'] = (float)$item['quantity'];
     775
     776            $tax_per_item = ($taxes / $woocommerce->cart->get_cart_contents_count()) * $current['quantity'];
     777
     778            $current['cost'] = ($item['line_total'] + $tax_per_item) / $current['quantity'];
     779            $current['sum'] = $current['cost'] * $current['quantity'];
     780
     781            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');
     784            }
     785
     786            if (isset($receipt['sno']) && ($receipt['sno'] == 'osn') || (get_option('robokassa_country_code') == 'KZ')) {
     787                $current['tax'] = $tax;
     788            } else {
     789                $current['tax'] = 'none';
     790            }
     791
     792
     793            $receipt['items'][] = $current;
     794        }
     795    }
     796
     797
     798    // Проверяем, активен ли плагин WooCommerce Checkout Add-Ons
     799    if (is_plugin_active('woocommerce-checkout-add-ons/woocommerce-checkout-add-ons.php')) {
     800        $fees = $order->get_items('fee');
     801        foreach ($fees as $fee) {
     802
     803            $fee_name = $fee->get_name();
     804            $fee_total = floatval($fee->get_total());
     805
     806            $fee_data = array(
     807                'name' => $fee_name,
     808                'quantity' => 1,
     809                'cost' => $fee_total,
     810                'sum' => $fee_total,
     811                'payment_object' => \get_option('robokassa_payment_paymentObject'),
     812                'payment_method' => \get_option('robokassa_payment_paymentMethod'),
     813                'tax' => \get_option('robokassa_payment_tax'),
     814            );
     815
     816            $receipt['items'][] = $fee_data;
     817        }
    769818    }
    770819
     
    806855
    807856
    808         if (get_option('robokassa_country_code') == 'KZ') {
    809         } else {
     857        if (get_option('robokassa_country_code') == 'RU') {
    810858            $current['payment_object'] = \get_option('robokassa_payment_paymentObject');
    811859            $current['payment_method'] = \get_option('robokassa_payment_paymentMethod');
     
    12821330    }
    12831331}
    1284 
Note: See TracChangeset for help on using the changeset viewer.