diff --git a/Makefile b/Makefile index 7edb17f5deebeacdacaea33b35d78f30566dd5a0..d2ed83ea70ee12236863aa50cec5c75d1352124d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BASE=shipping-by-rules PLATTFORM=woocommerce VENDOR=opentools -VERSION=2.0.4 +VERSION=2.0.5 DIR = $(shell pwd) SVNDIR=wordpress-plugin-svn diff --git a/includes/rules_shipping_framework_woocommerce.php b/includes/rules_shipping_framework_woocommerce.php index 330746c4e62f6f421702f2746ff2b4ca55792458..0c6fd95de016f1df57f65df5196a81796d007c74 100644 --- a/includes/rules_shipping_framework_woocommerce.php +++ b/includes/rules_shipping_framework_woocommerce.php @@ -195,6 +195,7 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework { } protected function getOrderListProperties ($cart, $products, $method) { +// $this->warning("<pre>Cart: ".print_r($cart,1)."</pre>"); $categories = array(); $skus = array(); $tags = array(); @@ -229,7 +230,6 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework { ); // THIRD-PARTY SUPPORT - // "WC Vendors" support (vendors stored as post author) if (class_exists("WC_Vendors")) { $vendorids = array(); @@ -258,6 +258,34 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework { $data['vendors'] = array_unique($vendors); } + // "Dokan Marketplace" support (vendors stored as post author) + if (class_exists("WeDevs_Dokan")) { + $vendorids = array(); + foreach ($products as $product) { + // Variations inherit the vendor from their parent product + if (!isset($product['variation_id'])) { + // "Normal" product, not a variation + $vendorids[] = $product['data']->post->post_author; + } else { + // A variation => load the parent product instead and use its vendor + $vendorids[] = get_post_field('post_author', $product['product_id']); + } + } + $data['vendorids'] = array_unique($vendorids); + + $vendors = array(); // Requires "WC Vendors" or "WooThemes Product Vendors" plugin + $vendornames = array(); + foreach ($data['vendorids'] as $v) { + $vnd = get_user_by('id', $v); // Get user name by user id + if (is_object($vnd)) { + $vendornames[] = $vnd->display_name; + $vendors[] = $vnd->user_login; + } + } + $data['vendornames'] = array_unique($vendornames); + $data['vendors'] = array_unique($vendors); + } + // "WooThemes Vendor Products" <2.0 support (vendors stored in its own taxonomy) if (class_exists("WooCommerce_Product_Vendors") && function_exists("get_product_vendors")) { $vendors = array(); diff --git a/readme.txt b/readme.txt index a979f27b49ef9e7bdedd857b5f0612a14c969be9..73295df5725e0bb4cf742c89f90f2ca3e3b97525 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: opentools Tags: WooCommerce, Shipment, Shipping, Rules shipping Requires at least: 4.0 -Tested up to: 4.9.2 -Stable tag: 2.0.4 +Tested up to: 4.9.4 +Stable tag: 2.0.5 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl.html @@ -69,6 +69,9 @@ Please see our support forum at http://open-tools.net/forum/. It might also be a == Changelog == += 2.0.5 = +* Basic support for Dokan Marketplace (vendors lists are properly filled) + = 2.0.4 = * Compatibility with WC vendors in combination with product variations * Fix PHP warnings diff --git a/releases/opentools-woocommerce-advanced-shipping-by-rules_v2.0.5.zip b/releases/opentools-woocommerce-advanced-shipping-by-rules_v2.0.5.zip new file mode 100644 index 0000000000000000000000000000000000000000..9d54829a28b7bc793d8da24ea8122a3013f279d7 Binary files /dev/null and b/releases/opentools-woocommerce-advanced-shipping-by-rules_v2.0.5.zip differ diff --git a/releases/opentools-woocommerce-shipping-by-rules_v2.0.5.zip b/releases/opentools-woocommerce-shipping-by-rules_v2.0.5.zip new file mode 100644 index 0000000000000000000000000000000000000000..7de99e4b5a861be1bbce523a2c5e1f8bbbaabc6b Binary files /dev/null and b/releases/opentools-woocommerce-shipping-by-rules_v2.0.5.zip differ diff --git a/woocommerce-advanced-shipping-by-rules.php b/woocommerce-advanced-shipping-by-rules.php index 7598e277722b8542da157a557450f3de7572b000..d0d21e2d6c3000c000cbe4e4a302f89cb227e7e5 100644 --- a/woocommerce-advanced-shipping-by-rules.php +++ b/woocommerce-advanced-shipping-by-rules.php @@ -3,14 +3,14 @@ * Plugin Name: WooCommerce Advanced Shipping By Rules * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html * Description: Define Shipping cost by very general and flexible (text-based) rules. The advanced version also provides mathematical expressions and functions - * Version: 2.0.4 + * Version: 2.0.5 * Author: Open Tools, Reinhold Kainhofer * Author URI: http://open-tools.net * Text Domain: woocommerce-advanced-shipping-by-rules * Domain Path: woocommerce-shipping-by-rules * License: GPL2+ * WC requires at least: 2.2 - * WC tested up to: 3.2.6 + * WC tested up to: 3.3.3 * Copyright (C) 2015 Reinhold Kainhofer @@ -75,7 +75,7 @@ class WooCommerce_Shipping_By_Rules_Advanced { * @since 1.0.0 * @var string $version Plugin version number. */ - public $version = '2.0.3'; + public $version = '2.0.5'; /** diff --git a/woocommerce-shipping-by-rules.php b/woocommerce-shipping-by-rules.php index 255d58c6d37151e02ca68b9e715b888d641f9be3..7263261b0f6dd4cdf0ab0ddb7ed5d5ddc60cf387 100644 --- a/woocommerce-shipping-by-rules.php +++ b/woocommerce-shipping-by-rules.php @@ -3,14 +3,14 @@ * Plugin Name: WooCommerce Shipping By Rules * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html * Description: Define Shipping cost by very general and flexible (text-based) rules. - * Version: 2.0.4 + * Version: 2.0.5 * Author: Open Tools, Reinhold Kainhofer * Author URI: http://open-tools.net * Text Domain: woocommerce-shipping-by-rules * Domain Path: * License: GPL2+ * WC requires at least: 2.2 - * WC tested up to: 3.2.6 + * WC tested up to: 3.3.3 * Copyright (C) 2015 Reinhold Kainhofer @@ -48,7 +48,7 @@ class WooCommerce_Shipping_By_Rules { * @since 1.0.0 * @var string $version Plugin version number. */ - public $version = '2.0.3'; + public $version = '2.0.5'; /**