Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
timoj committed Jul 9, 2018
1 parent a56c892 commit 3a7df31
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 33 deletions.
6 changes: 3 additions & 3 deletions assets/js/parcelshop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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),
Expand Down Expand Up @@ -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 = "<div id='parcelshopItem_logo'><img id='company_logo' src='../../wp-content/plugins/woocommerce-wuunder/assets/images/parcelshop/" + logo + "'></div>" +
node.innerHTML = "<div id='parcelshopItem_logo'><img id='company_logo' src='" + pluginPath + "/assets/images/parcelshop/" + logo + "'></div>" +
"<div id='parcelshopItem_text'><div id='company_info'><div id='company_name'><strong>" + capFirst(shops.company_name) + "</strong></div>" +
"<div id='street_name_and_number'>" + capFirst(shops[0].street_name) + " " + shops[0].house_number + "</div>" +
"<div id='zip_code_and_city'>" + shops[0].zip_code + " " + shops[0].city + "</div>" +
Expand Down
6 changes: 4 additions & 2 deletions includes/checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -64,6 +63,9 @@ function parcelshop_html()
</div>
</div>
<script>
var pluginPath = "$pluginPath";
</script>
<script type="text/javascript" data-cfasync="false" src="$pluginPathJS"></script>
EOT;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/parcelshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
19 changes: 10 additions & 9 deletions includes/wcwuunder-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
6 changes: 6 additions & 0 deletions includes/wcwuunder-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
21 changes: 3 additions & 18 deletions includes/wcwuunder-shipping-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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'),
Expand All @@ -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' => ""
),
);
}

Expand Down

0 comments on commit 3a7df31

Please sign in to comment.