Skip to content

Commit

Permalink
Merge branch 'release/1.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Aunshon committed Sep 19, 2024
2 parents 840e6d8 + 43841ca commit d015bc8
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
**Requires at least:** 5.8
**Tested up to:** 6.4.2
**WC tested up to:** 8.4.0
**Requires PHP:** 7.3
**Stable tag:** 1.1.0
**Requires PHP:** 7.4
**Stable tag:** 1.1.2
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down
10 changes: 5 additions & 5 deletions dokan-migrator.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Plugin Name: Dokan Migrator
* Plugin URI: http://WeDevs.com/
* Plugin URI: https://dokan.co/wordpress/
* Description: An e-commerce marketplace migration plugin for WordPress. Powered by WooCommerce and WeDevs.
* Version: 1.1.1
* Author: WeDevs
* Author URI: https://WeDevs.com/
* Version: 1.1.2
* Author: weDevs
* Author URI: https://dokan.co/
* Domain Path: /languages/
* License: GPL2
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Expand Down Expand Up @@ -56,7 +56,7 @@ final class Dokan_Migrator {
*
* @var string
*/
public $version = '1.1.1';
public $version = '1.1.2';

/**
* Instance of self
Expand Down
5 changes: 3 additions & 2 deletions includes/Helpers/MigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,13 @@ public static function split_parent_order_shipping( $applied_shipping_method, $o

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

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

// Generating the shipping for vendor.
$item = new WC_Order_Item_Shipping();
Expand Down
4 changes: 3 additions & 1 deletion includes/Integrations/WcVendors/OrderMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public function get_dokan_order_data( $parent_order_id, $seller_id ) {
'created' => $order->time,
];

$unit_commissin_rate_vendor = ( $order->total_due / $wc_order->get_subtotal() ) * 100;
$non_zero_sub_total_amount = empty( $wc_order->get_subtotal() ) || $wc_order->get_subtotal() < 1 ? 1 : $wc_order->get_subtotal();

$unit_commissin_rate_vendor = ( $order->total_due / $non_zero_sub_total_amount ) * 100;
$unit_commissin_rate_admin = 100 - $unit_commissin_rate_vendor;
$new_admin_commissin = ( $wc_order->get_subtotal() * $unit_commissin_rate_admin ) / 100;

Expand Down
11 changes: 7 additions & 4 deletions includes/Integrations/Wcfm/OrderMigrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public function get_dokan_order_data( $parent_order_id, $seller_id ) {
'created' => $order->created,
];

$unit_commissin_rate_vendor = ( $order->commission_amount / $order->item_sub_total ) * 100;
$non_zero_item_sub_total_amount = empty( $order->item_sub_total ) || $order->item_sub_total < 1 ? 1 : $order->item_sub_total;

$unit_commissin_rate_vendor = ( $order->commission_amount / $non_zero_item_sub_total_amount ) * 100;
$unit_commissin_rate_admin = 100 - $unit_commissin_rate_vendor;
$new_admin_commissin = ( $order->item_sub_total * $unit_commissin_rate_admin ) / 100;

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

! $package_qty ? $package_qty = $line_item->get_quantity() : '';
! $package_qty ? $package_qty = $line_item->get_quantity() : 1;

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

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

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

// Generating the shipping for vendor.
$item = new WC_Order_Item_Shipping();
Expand Down
4 changes: 3 additions & 1 deletion includes/Migrator/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ public function migrate( $import_type, $plugin, $data ) {
'paged' => $this->paged,
];

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

$progress = ( $args['total_migrated'] * 100 ) / $total_count;

if ( $progress < 100 ) {
$this->update_migration_status( $args, $import_type );
Expand Down
16 changes: 8 additions & 8 deletions languages/dokan-migrator.pot
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) 2023 weDevs Pte. Ltd. All Rights Reserved.
# Copyright (c) 2024 weDevs Pte. Ltd. All Rights Reserved.
msgid ""
msgstr ""
"Project-Id-Version: Dokan Migrator 1.1.1\n"
"Project-Id-Version: Dokan Migrator 1.1.2\n"
"Report-Msgid-Bugs-To: https://github.com/weDevsOfficial/dokan-migrator/issues\n"
"Last-Translator: [email protected]\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-12-15T04:54:27+00:00\n"
"POT-Creation-Date: 2024-09-19T09:37:59+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Generator: WP-CLI 2.9.0\n"
"X-Domain: dokan-migrator\n"

#. Plugin Name of the plugin
Expand All @@ -20,19 +20,19 @@ msgid "Dokan Migrator"
msgstr ""

#. Plugin URI of the plugin
msgid "http://WeDevs.com/"
msgid "https://dokan.co/wordpress/"
msgstr ""

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

#. Author of the plugin
msgid "WeDevs"
msgid "weDevs"
msgstr ""

#. Author URI of the plugin
msgid "https://WeDevs.com/"
msgid "https://dokan.co/"
msgstr ""

#: includes/Helpers/MigrationHelper.php:70
Expand Down Expand Up @@ -63,7 +63,7 @@ msgstr ""
msgid "Nonce verification failed!"
msgstr ""

#: includes/Migrator/Manager.php:232
#: includes/Migrator/Manager.php:234
msgid "Invalid import type"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dokan-migrator",
"version": "1.1.1",
"version": "1.1.2",
"description": "An e-commerce marketplace migration plugin for WordPress.",
"author": "WeDevs",
"license": "GPL",
Expand Down
12 changes: 9 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Tags: dokan, dokan migrator, multivendor marketplace
Requires at least: 5.8
Tested up to: 6.4.2
WC tested up to: 8.4.0
Stable tag: 1.1.1
Requires PHP: 7.3
Stable tag: 1.1.2
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

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

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

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

== Changelog ==

= v1.1.2 ( Sep 19, 2024 ) =

- **update:** Revised contact information in the readme for reporting bugs and feature requests.
- **fix:** Safeguards implemented to ensure accurate financial calculations.
- **fix:** Fixed calculations for vendor commission rates and shipping amounts to prevent division by zero errors.

= v1.1.1 ( Dec 15, 2023 ) =

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

0 comments on commit d015bc8

Please sign in to comment.