From aaa3100d8a4f7280e5d9503c6e2e624153814e0e Mon Sep 17 00:00:00 2001 From: Timo Janssen Date: Wed, 10 Oct 2018 13:24:37 +0200 Subject: [PATCH] upd parcelshop locator settings --- includes/parcelshop.php | 13 ++++++++++--- includes/wcwuunder-create.php | 2 +- includes/wcwuunder-shipping-method.php | 26 +++++++++++++++----------- woocommerce-wuunder.php | 4 ++-- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/includes/parcelshop.php b/includes/parcelshop.php index 8e66338..f2e560a 100644 --- a/includes/parcelshop.php +++ b/includes/parcelshop.php @@ -1,9 +1,12 @@ setLanguage("NL"); $parcelshopsRequest = $connector->getParcelshopsByAddress(); $parcelshopsConfig = new \Wuunder\Api\Config\ParcelshopsConfig(); - $parcelshopsConfig->setProviders(array("DHL_PARCEL", "DPD", "POST_NL")); + + $logger = wc_get_logger(); + $context = array('source' => "wuunder_connector"); + + $parcelshopsConfig->setProviders(get_option('woocommerce_wuunder_parcelshop_settings')['select_carriers']); $parcelshopsConfig->setAddress($shipping_address); if ($parcelshopsConfig->validate()) { diff --git a/includes/wcwuunder-create.php b/includes/wcwuunder-create.php index edac7ea..fce1c4e 100644 --- a/includes/wcwuunder-create.php +++ b/includes/wcwuunder-create.php @@ -13,7 +13,7 @@ public function __construct() $this->version_obj = array( "product" => "Woocommerce extension", "version" => array( - "build" => "2.5.0", + "build" => "2.5.1", "plugin" => "2.0"), "platform" => array( "name" => "Woocommerce", diff --git a/includes/wcwuunder-shipping-method.php b/includes/wcwuunder-shipping-method.php index faff8f9..bbdf842 100644 --- a/includes/wcwuunder-shipping-method.php +++ b/includes/wcwuunder-shipping-method.php @@ -29,6 +29,7 @@ public function __construct($instance_id = 0) $this->title = "Wuunder Parcelshop Locator"; $this->supports = array( 'shipping-zones', + 'settings', 'instance-settings', 'instance-settings-modal' ); @@ -57,6 +58,19 @@ function init() function init_form_fields() { + $this->form_fields = array( + 'select_carriers' => array( + 'title' => __('Welke Carriers', 'woocommerce'), + 'type' => 'multiselect', + 'description' => __('Geef aan uit welke carriers de klant kan kiezen (cmd/ctrl + muis om meerdere te kiezen)', 'woocommerce'), + 'options' => array( + 'DHL_PARCEL' => __("DHL"), + 'DPD' => __("DPD"), + 'POST_NL' => __("PostNL") + ) + ) + ); + $this->instance_form_fields = array( 'cost' => array( 'title' => __('Kosten', 'woocommerce'), @@ -69,17 +83,7 @@ function init_form_fields() 'type' => 'number', 'description' => __('Vanaf welk bestelbedrag is de verzending gratis. Als 0 dan nooit.', 'woocommerce'), 'default' => 0.0 - ), - 'select_carriers' => array( - 'title' => __('Welke Carriers', 'woocommerce'), - 'type' => 'multiselect', - 'description' => __('Geef aan uit welke carriers de klant kan kiezen (cmd/ctrl + muis om meerdere te kiezen)', 'woocommerce'), - 'options' => array( - 'DHL' => __("DHL"), - 'DPD' => __("DPD"), - 'PostNL' => __("PostNL") - ) - ), + ) ); } diff --git a/woocommerce-wuunder.php b/woocommerce-wuunder.php index 9d8822d..1f4b2d4 100644 --- a/woocommerce-wuunder.php +++ b/woocommerce-wuunder.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Wuunder * Plugin URI: http://wearewuunder.com * Description: Wuunder shipping plugin - * Version: 2.5.0 + * Version: 2.5.1 * Author: Wuunder * Author URI: http://wearewuunder.com */ @@ -51,7 +51,7 @@ class Woocommerce_Wuunder public static $plugin_path; public static $plugin_basename; - const VERSION = '2.5.0'; + const VERSION = '2.5.1'; public function __construct() {