Commit ee9c21b9 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

V1.3.7: Add various shipping method variables (list variables)

  * [Shipping] (shipping costs)
  * [ShippingMethods] (user-readable string)
  * [ShippingMethodIDs] (internal, unique IDs for shiping methods, like shipping_by_rules:31)
  * [ShippingMethodTypes] (shipping plugin names)
  * [ShippingInstanceIDs] (unique identifiers for shipping instance when using zones)

Fixes #13
parent c14241ed
......@@ -23,6 +23,7 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '')
{
parent::__construct($metadataUrl, $pluginFile, $slug, $checkPeriod, $optionName, $muPluginFile);
// $this->debugMode = true;
$this->installOTHooks();
}
public function declareCredentials($credential_def) {
......
......@@ -329,7 +329,25 @@ class OpenToolsOrdernumbers extends OpenToolsOrdernumbersBasic {
}
public function setupShippingReplacements(&$reps, $order, $nrtype) {
// $reps["[shippingmethod]"] = $order->getShippingMethod();
$reps["[shipping]"] = $order->get_total_shipping();
$smethods = array();
$reps["[shippingmethodids]"] = array();
$reps["[shippingmethodtypes]"] = array();
$reps["[shippinginstanceids]"] = array();
foreach ($order->get_shipping_methods() as $ship) {
$smethods[] = $ship['name'];
$reps["[shippingmethodids]"][] = $ship['method_id'];
// With the shipping zones introduced in WC 2.6, the method_id
// contains the shipping method type and the instance ID separated
// by a :. If the ":" is not present, it is a legacy method and
// has no instance ID.
$ids = explode(':', $ship['method_id'], 2);
$reps["[shippingmethodtypes]"][] = $ids[0];
if (isset($ids[1])) {
$reps["[shippinginstanceids]"][] = $ids[1];
}
}
$reps["[shippingmethods]"] = implode(", ", $smethods);
}
/*public function setupInvoiceReplacements (&$reps, $invoice, $order, $nrtype) {
......
......@@ -80,6 +80,13 @@ The Advanced Ordernumbers for WooCommerce plugin supports some invoicing plugins
= 1.3.7 =
* Add support for PayPal payment method
* Add variables:
* [UserRoles] (list of all WordPress user rules for the customer)
* [Shipping] (shipping costs)
* [ShippingMethods] (user-readable string)
* [ShippingMethodIDs] (internal, unique IDs for shiping methods, like shipping_by_rules:31)
* [ShippingMethodTypes] (shipping plugin names)
* [ShippingInstanceIDs] (unique identifiers for shipping instance when using zones)
= 1.3.6 =
* Fix order number display for old orders
......
......@@ -3,7 +3,7 @@
* Plugin Name: Woocommerce Advanced Ordernumbers
* Plugin URI: http://open-tools.net/woocommerce/advanced-ordernumbers-for-woocommerce.html
* Description: Lets the user freely configure the order numbers in WooCommerce.
* Version: 1.3.6
* Version: 1.3.7
* Author: Open Tools
* Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-ordernumbers
......@@ -31,6 +31,8 @@ $myUpdateChecker = new OpenToolsPluginUpdateChecker(
__FILE__,
'woocommerce-advanced-ordernumbers'
);
// $myUpdateChecker ->debugMode = true;
$myUpdateChecker->declareCredentials(array(
'order_number' => __('Order Number:'),
'order_pass' => __('Order Password:'),
......
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