Skip to content

Commit d015bc8

Browse files
committed
Merge branch 'release/1.1.2'
2 parents 840e6d8 + 43841ca commit d015bc8

File tree

9 files changed

+41
-27
lines changed

9 files changed

+41
-27
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
**Requires at least:** 5.8
66
**Tested up to:** 6.4.2
77
**WC tested up to:** 8.4.0
8-
**Requires PHP:** 7.3
9-
**Stable tag:** 1.1.0
8+
**Requires PHP:** 7.4
9+
**Stable tag:** 1.1.2
1010
**License:** GPLv2 or later
1111
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
1212

dokan-migrator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
/**
33
* Plugin Name: Dokan Migrator
4-
* Plugin URI: http://WeDevs.com/
4+
* Plugin URI: https://dokan.co/wordpress/
55
* Description: An e-commerce marketplace migration plugin for WordPress. Powered by WooCommerce and WeDevs.
6-
* Version: 1.1.1
7-
* Author: WeDevs
8-
* Author URI: https://WeDevs.com/
6+
* Version: 1.1.2
7+
* Author: weDevs
8+
* Author URI: https://dokan.co/
99
* Domain Path: /languages/
1010
* License: GPL2
1111
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@@ -56,7 +56,7 @@ final class Dokan_Migrator {
5656
*
5757
* @var string
5858
*/
59-
public $version = '1.1.1';
59+
public $version = '1.1.2';
6060

6161
/**
6262
* Instance of self

includes/Helpers/MigrationHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,13 @@ public static function split_parent_order_shipping( $applied_shipping_method, $o
203203

204204
$applied_shipping_method = reset( $parent_order->get_shipping_methods() );
205205
$vendors = dokan_get_sellers_by( $parent_order->get_id() );
206+
$vendors_count = empty( count( $vendors ) ) ? 1 : count( $vendors );
206207

207208
// Here we are dividing the shipping and shipping-tax amount of parent order into the vendors suborders.
208209
$shipping_tax_amount = [
209-
'total' => [ $applied_shipping_method->get_total_tax() / count( $vendors ) ],
210+
'total' => [ $applied_shipping_method->get_total_tax() / $vendors_count ],
210211
];
211-
$shipping_amount = $applied_shipping_method->get_total() / count( $vendors );
212+
$shipping_amount = $applied_shipping_method->get_total() / $vendors_count;
212213

213214
// Generating the shipping for vendor.
214215
$item = new WC_Order_Item_Shipping();

includes/Integrations/WcVendors/OrderMigrator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ public function get_dokan_order_data( $parent_order_id, $seller_id ) {
119119
'created' => $order->time,
120120
];
121121

122-
$unit_commissin_rate_vendor = ( $order->total_due / $wc_order->get_subtotal() ) * 100;
122+
$non_zero_sub_total_amount = empty( $wc_order->get_subtotal() ) || $wc_order->get_subtotal() < 1 ? 1 : $wc_order->get_subtotal();
123+
124+
$unit_commissin_rate_vendor = ( $order->total_due / $non_zero_sub_total_amount ) * 100;
123125
$unit_commissin_rate_admin = 100 - $unit_commissin_rate_vendor;
124126
$new_admin_commissin = ( $wc_order->get_subtotal() * $unit_commissin_rate_admin ) / 100;
125127

includes/Integrations/Wcfm/OrderMigrator.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ public function get_dokan_order_data( $parent_order_id, $seller_id ) {
117117
'created' => $order->created,
118118
];
119119

120-
$unit_commissin_rate_vendor = ( $order->commission_amount / $order->item_sub_total ) * 100;
120+
$non_zero_item_sub_total_amount = empty( $order->item_sub_total ) || $order->item_sub_total < 1 ? 1 : $order->item_sub_total;
121+
122+
$unit_commissin_rate_vendor = ( $order->commission_amount / $non_zero_item_sub_total_amount ) * 100;
121123
$unit_commissin_rate_admin = 100 - $unit_commissin_rate_vendor;
122124
$new_admin_commissin = ( $order->item_sub_total * $unit_commissin_rate_admin ) / 100;
123125

@@ -217,7 +219,7 @@ public function process_refund( $child_order, $seller_id, $from_suborder = true
217219
$shipping_item_id = $vendor_shipping[ $vendor_id ]['shipping_item_id'];
218220
$package_qty = absint( $vendor_shipping[ $vendor_id ]['package_qty'] );
219221

220-
! $package_qty ? $package_qty = $line_item->get_quantity() : '';
222+
! $package_qty ? $package_qty = $line_item->get_quantity() : 1;
221223

222224
$shipping_item = new \WC_Order_Item_Shipping( $shipping_item_id );
223225
$refund_shipping_tax = $shipping_item->get_taxes();
@@ -410,12 +412,13 @@ public function split_parent_order_shipping( $applied_shipping_method, $order_id
410412

411413
$applied_shipping_method = reset( $parent_order->get_shipping_methods() );
412414
$vendors = $this->get_seller_by_order( $parent_order->get_id() );
415+
$vendors_count = empty( count( $vendors ) ) ? 1 : count( $vendors );
413416

414417
// Here we are dividing the shipping and shipping-tax amount of parent order into the vendors suborders.
415418
$shipping_tax_amount = [
416-
'total' => [ $applied_shipping_method->get_total_tax() / count( $vendors ) ],
419+
'total' => [ $applied_shipping_method->get_total_tax() / $vendors_count ],
417420
];
418-
$shipping_amount = $applied_shipping_method->get_total() / count( $vendors );
421+
$shipping_amount = $applied_shipping_method->get_total() / $vendors_count;
419422

420423
// Generating the shipping for vendor.
421424
$item = new WC_Order_Item_Shipping();

includes/Migrator/Manager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ public function migrate( $import_type, $plugin, $data ) {
204204
'paged' => $this->paged,
205205
];
206206

207-
$progress = ( $args['total_migrated'] * 100 ) / $this->total_count;
207+
$total_count = empty( $this->total_count ) ? 1 : $this->total_count;
208+
209+
$progress = ( $args['total_migrated'] * 100 ) / $total_count;
208210

209211
if ( $progress < 100 ) {
210212
$this->update_migration_status( $args, $import_type );

languages/dokan-migrator.pot

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Copyright (c) 2023 weDevs Pte. Ltd. All Rights Reserved.
1+
# Copyright (c) 2024 weDevs Pte. Ltd. All Rights Reserved.
22
msgid ""
33
msgstr ""
4-
"Project-Id-Version: Dokan Migrator 1.1.1\n"
4+
"Project-Id-Version: Dokan Migrator 1.1.2\n"
55
"Report-Msgid-Bugs-To: https://github.com/weDevsOfficial/dokan-migrator/issues\n"
66
"Last-Translator: [email protected]\n"
77
"Language-Team: LANGUAGE <[email protected]>\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=UTF-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"
11-
"POT-Creation-Date: 2023-12-15T04:54:27+00:00\n"
11+
"POT-Creation-Date: 2024-09-19T09:37:59+00:00\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13-
"X-Generator: WP-CLI 2.8.1\n"
13+
"X-Generator: WP-CLI 2.9.0\n"
1414
"X-Domain: dokan-migrator\n"
1515

1616
#. Plugin Name of the plugin
@@ -20,19 +20,19 @@ msgid "Dokan Migrator"
2020
msgstr ""
2121

2222
#. Plugin URI of the plugin
23-
msgid "http://WeDevs.com/"
23+
msgid "https://dokan.co/wordpress/"
2424
msgstr ""
2525

2626
#. Description of the plugin
2727
msgid "An e-commerce marketplace migration plugin for WordPress. Powered by WooCommerce and WeDevs."
2828
msgstr ""
2929

3030
#. Author of the plugin
31-
msgid "WeDevs"
31+
msgid "weDevs"
3232
msgstr ""
3333

3434
#. Author URI of the plugin
35-
msgid "https://WeDevs.com/"
35+
msgid "https://dokan.co/"
3636
msgstr ""
3737

3838
#: includes/Helpers/MigrationHelper.php:70
@@ -63,7 +63,7 @@ msgstr ""
6363
msgid "Nonce verification failed!"
6464
msgstr ""
6565

66-
#: includes/Migrator/Manager.php:232
66+
#: includes/Migrator/Manager.php:234
6767
msgid "Invalid import type"
6868
msgstr ""
6969

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dokan-migrator",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "An e-commerce marketplace migration plugin for WordPress.",
55
"author": "WeDevs",
66
"license": "GPL",

readme.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Tags: dokan, dokan migrator, multivendor marketplace
55
Requires at least: 5.8
66
Tested up to: 6.4.2
77
WC tested up to: 8.4.0
8-
Stable tag: 1.1.1
9-
Requires PHP: 7.3
8+
Stable tag: 1.1.2
9+
Requires PHP: 7.4
1010
License: GPLv2 or later
1111
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1212

@@ -68,7 +68,7 @@ Note: Ensure you click the “Activate Dokan Vendor Dashboard” button. It wil
6868
**CONTACT US**
6969

7070
- Get free help from us [here](https://wedevs.com/contact/)
71-
- Report a bug or request a feature through [GitHub](https://github.com/weDevsOfficial/dokan).
71+
- Report a bug or request a feature through [GitHub](https://github.com/getdokan/dokan-migrator/issues).
7272
- Check out all functions of Dokan.
7373

7474
== Installation ==
@@ -83,6 +83,12 @@ Extract the zip file and just drop the contents in the wp-content/plugins/ direc
8383

8484
== Changelog ==
8585

86+
= v1.1.2 ( Sep 19, 2024 ) =
87+
88+
- **update:** Revised contact information in the readme for reporting bugs and feature requests.
89+
- **fix:** Safeguards implemented to ensure accurate financial calculations.
90+
- **fix:** Fixed calculations for vendor commission rates and shipping amounts to prevent division by zero errors.
91+
8692
= v1.1.1 ( Dec 15, 2023 ) =
8793

8894
- **fix:** Vendor folder was missing from the build process

0 commit comments

Comments
 (0)