diff --git a/assets/js/parcelshop.js b/assets/js/parcelshop.js
index 58fcc7d..241dc11 100644
--- a/assets/js/parcelshop.js
+++ b/assets/js/parcelshop.js
@@ -157,7 +157,7 @@ function getLogo(carrier_name) {
case "GLS":
logo = "GLS-locator.png";
break;
- case "POST_NL":
+ case "POSTNL":
logo = "POSTNL-locator.png";
break;
default:
@@ -169,7 +169,7 @@ function getLogo(carrier_name) {
// Adds a marker for the respective parcelshop
function addMarkerToMap(lat, lng, logo, index) {
var markerImage = {
- url: "../../wp-content/plugins/woocommerce-wuunder/assets/images/parcelshop/" + logo,
+ url: pluginPath + "/assets/images/parcelshop/" + logo,
size: new google.maps.Size(81, 101),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(17, 34),
@@ -275,7 +275,7 @@ function addParcelshopList(data) {
var node = document.createElement("div");
node.className += "parcelshopItem parcelshopItem" + i;
node.onclick = parcelshopItemCallbackClosure(shops.latitude, shops.longitude);
- node.innerHTML = "
" + capFirst(shops.company_name) + "
" +
"
" + capFirst(shops[0].street_name) + " " + shops[0].house_number + "
" +
"
" + shops[0].zip_code + " " + shops[0].city + "
" +
diff --git a/includes/checkout.php b/includes/checkout.php
index ac56c6e..9a61b7f 100644
--- a/includes/checkout.php
+++ b/includes/checkout.php
@@ -9,8 +9,7 @@ function callback_for_setting_up_scripts()
{
if (class_exists('WC_wuunder_parcelshop')) {
$style_file = dirname(plugin_dir_url(__FILE__)) . "/assets/css/parcelshop.css";
- $shipping_method = new WC_wuunder_parcelshop();
- $google_api_key = $shipping_method->get_option('google_api_key');
+ $google_api_key = get_option("wc_wuunder_google_maps_api_key");
$script_file = "//maps.googleapis.com/maps/api/js?key=" . $google_api_key;
wp_register_style('wuunderCSS', $style_file);
wp_enqueue_style('wuunderCSS');
@@ -64,6 +63,9 @@ function parcelshop_html()
+
EOT;
}
diff --git a/includes/parcelshop.php b/includes/parcelshop.php
index e93863a..fce6d58 100644
--- a/includes/parcelshop.php
+++ b/includes/parcelshop.php
@@ -21,7 +21,7 @@ function parcelShopLocator()
$connector->setLanguage("NL");
$parcelshopsRequest = $connector->getParcelshopsByAddress();
$parcelshopsConfig = new \Wuunder\Api\Config\ParcelshopsConfig();
- $parcelshopsConfig->setProviders(array("DHL_PARCEL", "DPD"));
+ $parcelshopsConfig->setProviders(array("DHL_PARCEL", "DPD", "POST_NL"));
$parcelshopsConfig->setAddress($shipping_address);
if ($parcelshopsConfig->validate()) {
diff --git a/includes/wcwuunder-create.php b/includes/wcwuunder-create.php
index 4792751..b049bc6 100644
--- a/includes/wcwuunder-create.php
+++ b/includes/wcwuunder-create.php
@@ -6,18 +6,19 @@
class WC_Wuunder_Create
{
public $order_id;
- private $version_obj = array(
- "product" => "Woocommerce extension",
- "version" => array(
- "build" => "2.4.0",
- "plugin" => "2.0"),
- "platform" => array(
- "name" => "OpenCart",
- "build" => VERSION
- ));
+ private $version_obj;
public function __construct()
{
+ $this->version_obj = array(
+ "product" => "Woocommerce extension",
+ "version" => array(
+ "build" => "2.4.0",
+ "plugin" => "2.0"),
+ "platform" => array(
+ "name" => "Woocommerce",
+ "build" => WC()->version
+ ));
add_action('load-edit.php', array(&$this, 'generateBookingUrl'));
add_action('load-edit.php', array(&$this, 'test'));
add_action('woocommerce_admin_order_actions_end', array(&$this, 'add_listing_actions'));
diff --git a/includes/wcwuunder-settings.php b/includes/wcwuunder-settings.php
index d2c0bf8..11fe253 100644
--- a/includes/wcwuunder-settings.php
+++ b/includes/wcwuunder-settings.php
@@ -137,6 +137,12 @@ public static function get_settings()
'options' => $mappedStatuses,
'id' => 'wc_wuunder_post_booking_status'
),
+ 'google_maps_api_key' => array(
+ 'name' => __('Google maps api key, for parcelshop locator:', 'woocommerce-wuunder'),
+ 'type' => 'text',
+ 'options' => $mappedStatuses,
+ 'id' => 'wc_wuunder_google_maps_api_key'
+ ),
'section_end' => array(
'type' => 'sectionend',
'id' => 'wc_wuunder_section_end'
diff --git a/includes/wcwuunder-shipping-method.php b/includes/wcwuunder-shipping-method.php
index caf968a..29ebedb 100644
--- a/includes/wcwuunder-shipping-method.php
+++ b/includes/wcwuunder-shipping-method.php
@@ -30,14 +30,12 @@ public function __construct($instance_id = 0)
$this->supports = array(
'shipping-zones',
'instance-settings',
- 'instance-settings-modal',
- 'settings'
+ 'instance-settings-modal'
);
// These are the options set by the user
$this->cost = $this->get_option('cost');
$this->carriers = $this->get_option('select_carriers');
- $this->google_api_key = $this->get_option('google_api_key');
$this->init();
}
@@ -59,19 +57,12 @@ function init()
function init_form_fields()
{
- $this->form_fields = array(
- // Commented for now until its working.
- // 'enabled' => array(
- // 'title' => __( 'Enable/Disable', 'woocommerce' ),
- // 'type' => 'checkbox',
- // 'description' => __( 'Enable this shipping.', 'woocommerce' ),
- // 'default' => 'yes'
- // ),
+ $this->instance_form_fields = array(
'cost' => array(
'title' => __('Kosten', 'woocommerce'),
'type' => 'number',
'description' => __('Kosten voor gebruik Parcelshop pick-up', 'woocommerce'),
- 'default' => 5.0
+ 'default' => 0.0
),
'select_carriers' => array(
'title' => __('Welke Carriers', 'woocommerce'),
@@ -83,12 +74,6 @@ function init_form_fields()
'PostNL' => __("PostNL")
)
),
- 'google_api_key' => array(
- 'title' => __('Google API key', 'woocommerce'),
- 'type' => 'text',
- 'description' => __('Google maps api key', 'woocommerce'),
- 'default' => ""
- ),
);
}