Commit 2c3cfea0 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

V1.3: Support for third-party vendor plugins

parent f11c85a5
BASE=ordernumbers BASE=ordernumbers
PLATTFORM=woocommerce PLATTFORM=woocommerce
VENDOR=opentools VENDOR=opentools
VERSION=1.2.2 VERSION=1.3
DIR = $(shell pwd) DIR = $(shell pwd)
SVNDIR=wordpress-plugin-svn SVNDIR=wordpress-plugin-svn
......
...@@ -234,6 +234,7 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic { ...@@ -234,6 +234,7 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
$categories = array(); $categories = array();
$tags = array(); $tags = array();
$shippingclasses = array(); $shippingclasses = array();
$vendors = array();
foreach ($lineitems as $l) { foreach ($lineitems as $l) {
$p = $order->get_product_from_item($l); $p = $order->get_product_from_item($l);
$skus[$p->get_sku()] = 1; $skus[$p->get_sku()] = 1;
...@@ -244,11 +245,30 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic { ...@@ -244,11 +245,30 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
$tags[$c->slug] = 1; $tags[$c->slug] = 1;
} }
$shippingclasses[$p->get_shipping_class()] = 1; $shippingclasses[$p->get_shipping_class()] = 1;
// THIRD-PARTY SUPPORT
// "WC Vendors" support (vendors stored as post author)
if (class_exists("WC_Vendors")) {
$vendor = $p->post->post_author;
$vnd = get_user_by('id', $vendor); // Get user name by user id
$vendors[] = $vendor;
$vendors[] = $vnd->user_login;
}
// "WooThemes Vendor Products" support (vendors stored in its own taxonomy)
if (class_exists("WooCommerce_Product_Vendors") && function_exists("get_product_vendors")) {
foreach (get_product_vendors($p->id) as $vendor) {
$vendors[] = $vendor->slug;
$vendors[] = $vendor->ID;
}
}
// END THIRD-PARTY SUPPORT
} }
$reps["[skus]"] = array_keys($skus); $reps["[skus]"] = array_keys($skus);
$reps["[categories]"] = array_keys($categories); $reps["[categories]"] = array_keys($categories);
$reps["[tags]"] = array_keys($tags); $reps["[tags]"] = array_keys($tags);
$reps["[shippingclasses]"] = array_keys($shippingclasses); $reps["[shippingclasses]"] = array_keys($shippingclasses);
$reps["[vendors]"] = array_unique($vendors);
} }
public function setupUserReplacements (&$reps, $details, $nrtype) { public function setupUserReplacements (&$reps, $details, $nrtype) {
......
...@@ -4,7 +4,7 @@ Contributors: opentools ...@@ -4,7 +4,7 @@ Contributors: opentools
Tags: WooCommerce, Order numbers, orders Tags: WooCommerce, Order numbers, orders
Requires at least: 4.0 Requires at least: 4.0
Tested up to: 4.4 Tested up to: 4.4
Stable tag: 1.2.2 Stable tag: 1.3
License: GPLv3 or later License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl.html License URI: http://www.gnu.org/licenses/gpl.html
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Plugin Name: Woocommerce Advanced Ordernumbers * Plugin Name: Woocommerce Advanced Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html * Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Lets the user freely configure the order numbers in WooCommerce. * Description: Lets the user freely configure the order numbers in WooCommerce.
* Version: 1.2.2 * Version: 1.3
* Author: Open Tools * Author: Open Tools
* Author URI: http://open-tools.net * Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers * Text Domain: woocommerce-advanced-ordernumbers
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* License: GPL2+ * License: GPL2+
* Network: true * Network: true
WC requires at least: 2.2 WC requires at least: 2.2
WC tested up to: 2.3 WC tested up to: 2.5
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
* Plugin Name: WooCommerce Basic Ordernumbers * Plugin Name: WooCommerce Basic Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html * Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Configure WooCommerce ordernumbers to have a running counter and arbitrary, fixed text (prefix / postfix). * Description: Configure WooCommerce ordernumbers to have a running counter and arbitrary, fixed text (prefix / postfix).
* Version: 1.2.2 * Version: 1.3
* Author: Open Tools * Author: Open Tools
* Author URI: http://open-tools.net * Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers * Text Domain: woocommerce-advanced-ordernumbers
* License: GPL2+ * License: GPL2+
* Network: true * Network: true
WC requires at least: 2.2 WC requires at least: 2.2
WC tested up to: 2.3 WC tested up to: 2.5
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment