Skip to content

Commit

Permalink
upd parcelshop locator settings
Browse files Browse the repository at this point in the history
  • Loading branch information
timoj committed Oct 10, 2018
1 parent f94c91a commit aaa3100
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
13 changes: 10 additions & 3 deletions includes/parcelshop.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
error_reporting(E_ALL);
ini_set('display_errors', 1);

function parcelShopLocator()
{
include_once('wcwuunder-shipping-method.php');
error_reporting(E_ALL);
ini_set('display_errors', 1);
$status = get_option('wc_wuunder_api_status');
$apiKey = ($status == 'productie' ? get_option('wc_wuunder_api') : get_option('wc_wuunder_test_api'));

Expand All @@ -21,7 +24,11 @@ function parcelShopLocator()
$connector->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()) {
Expand Down
2 changes: 1 addition & 1 deletion includes/wcwuunder-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 15 additions & 11 deletions includes/wcwuunder-shipping-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down Expand Up @@ -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'),
Expand All @@ -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")
)
),
)
);
}

Expand Down
4 changes: 2 additions & 2 deletions woocommerce-wuunder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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()
{
Expand Down

0 comments on commit aaa3100

Please sign in to comment.