Skip to content
Snippets Groups Projects
Commit 2c029632 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V2.0.5: Add basic support for Dokan Marketplace

parent a7dfd5a0
No related branches found
No related tags found
No related merge requests found
BASE=shipping-by-rules
PLATTFORM=woocommerce
VENDOR=opentools
VERSION=2.0.4
VERSION=2.0.5
DIR = $(shell pwd)
SVNDIR=wordpress-plugin-svn
......
......@@ -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();
......
......@@ -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
......
File added
File added
......@@ -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';
/**
......
......@@ -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';
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment