diff --git a/CHANGELOG.md b/CHANGELOG.md index fa54213..c391388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Un-released +## 2019-08-20 + +### Fix + +- Checkout validation parcelshop locator bugfixed [@timoj](https://github.com/timoj) [WWE-97](https://wuunder.atlassian.net/secure/RapidBoard.jspa?rapidView=6&projectKey=WWE&modal=detail&selectedIssue=WWE-97) +- Code styling [@timoj](https://github.com/timoj) [WWE-97](https://wuunder.atlassian.net/secure/RapidBoard.jspa?rapidView=6&projectKey=WWE&modal=detail&selectedIssue=WWE-97) + ## Released ## [2.7.0](https://github.com/kabisa/wuunder-webshopplugin-woocommerce/tag/2.7.0) - 2019-04-01 diff --git a/assets/js/parcelshop.js b/assets/js/parcelshop.js index 03534bd..7e18f63 100644 --- a/assets/js/parcelshop.js +++ b/assets/js/parcelshop.js @@ -3,6 +3,7 @@ var parcelshopShippingMethodElem = document.getElementById('shipping_method_0_wu var shippingAddress; var parcelshopAddress; +var rawParcelshopAddress; var baseUrl; var baseUrlApi; @@ -45,6 +46,7 @@ function _printParcelshopAddress() { currentParcelshop.className += 'parcelshopInfo'; currentParcelshop.innerHTML = '
Ophalen in parcelshop:
' + parcelshopAddress; window.parent.document.getElementById('parcelshopsSelectedContainer').appendChild(currentParcelshop); + window.parent.document.getElementById('parcelshop_country').value = rawParcelshopAddress.address.alpha2; } } @@ -52,8 +54,10 @@ function _printParcelshopAddress() { function _showParcelshopLocator() { var address = ""; - jQuery.post( baseUrl + "admin-ajax.php", {action: 'wuunder_parcelshoplocator_get_address', address: address}, function( data ) { - console.log(data); + jQuery.post(baseUrl + "admin-ajax.php", { + action: 'wuunder_parcelshoplocator_get_address', + address: address + }, function (data) { shippingAddress = data; _openIframe(); }); @@ -105,12 +109,15 @@ function _openIframe() { } function _loadSelectedParcelshopAddress(id) { - jQuery.post( baseUrl + "admin-ajax.php", {action: 'wuunder_parcelshoplocator_get_parcelshop_address', parcelshop_id: id}, function( data ) { + jQuery.post(baseUrl + "admin-ajax.php", { + action: 'wuunder_parcelshoplocator_get_parcelshop_address', + parcelshop_id: id + }, function (data) { data = JSON.parse(data); + rawParcelshopAddress = data; var parcelshopInfoHtml = _capFirst(data.company_name) + "
" + _capFirst(data.address.street_name) + " " + data.address.house_number + "
" + data.address.city; parcelshopInfoHtml = parcelshopInfoHtml.replace(/"/g, '\\"').replace(/'/g, "\\'"); - console.log(parcelshopInfoHtml); parcelshopAddress = parcelshopInfoHtml; _printParcelshopAddress(); }); diff --git a/includes/checkout.php b/includes/checkout.php index 87ca381..cd36303 100644 --- a/includes/checkout.php +++ b/includes/checkout.php @@ -3,11 +3,11 @@ exit; } // Exit if accessed directly -add_action('wp_enqueue_scripts', 'callback_for_setting_up_scripts'); +add_action('wp_enqueue_scripts', 'wcwp_callback_for_setting_up_scripts'); // add_action('woocommerce_review_order_before_submit', 'parcelshop_html'); add_action('woocommerce_review_order_after_submit', 'parcelshop_html'); -function callback_for_setting_up_scripts() { +function wcwp_callback_for_setting_up_scripts() { if ( class_exists('WC_wuunder_parcelshop' ) ) { $style_file = dirname ( plugin_dir_url( __FILE__ ) ) . '/assets/css/parcelshop.css'; $google_api_key = get_option( 'wc_wuunder_google_maps_api_key' ); @@ -21,7 +21,7 @@ function callback_for_setting_up_scripts() { } -function parcelshop_html() +function wcwp_parcelshop_html() { $pluginPath = dirname(plugin_dir_url(__FILE__)); $pluginPathJS = $pluginPath . "/assets/js/parcelshop.js"; @@ -30,11 +30,13 @@ function parcelshop_html() $tmpEnvironment = new \Wuunder\Api\Environment(get_option('wc_wuunder_api_status') === 'staging' ? 'staging' : 'production'); $baseApiUrl = substr($tmpEnvironment->getStageBaseUrl(), 0, -3); - $carrierList = implode(',', get_option('woocommerce_wuunder_parcelshop_settings')['select_carriers']); + $carrierConfigList = get_option('woocommerce_wuunder_parcelshop_settings')['select_carriers'] ? get_option('woocommerce_wuunder_parcelshop_settings')['select_carriers'] : []; + $carrierList = implode(',', $carrierConfigList); if ( 0 !== strlen($carrierList) ) { $availableCarriers = $carrierList; } else { - $availableCarriers = implode(',', array_keys(get_option('default_carrier_list'))); + $defaultCarrierConfig = get_option('default_carrier_list') ? get_option('default_carrier_list') : []; + $availableCarriers = implode(',', array_keys($defaultCarrierConfig)); } echo << 'text', 'class' => array( @@ -64,28 +66,24 @@ function add_parcelshop_id_field( $checkout ) { } // Save / Send the parcelshop id -add_action( 'woocommerce_checkout_update_order_meta', 'update_parcelshop_id' ); -function update_parcelshop_id( $order_id ) { +add_action( 'woocommerce_checkout_update_order_meta', 'wcwp_update_parcelshop_id' ); +function wcwp_update_parcelshop_id( $order_id ) { if ( ! empty( $_POST['parcelshop_id'] ) ) { update_post_meta( $order_id, 'parcelshop_id', sanitize_text_field( $_POST['parcelshop_id'] ) ); } } -//<<<<<<< HEAD -//// Check to see if a parcelshop is selected when parcel method is selected && Check if shipping country == parcelshop country -//add_action( 'woocommerce_checkout_process', 'check_parcelshop_selection' ); -//function check_parcelshop_selection() { -// if ( 'wuunder_parcelshop' === $_POST['shipping_method'][0] ) { -// if ( !$_POST['parcelshop_id'] ) { -// wc_add_notice( __( 'Kies eerst een parcelshop' ), 'error' ); -// } -// -// if ( $_POST['shipping_country'] != $_POST['parcelshop_country'] ) { -// wc_add_notice( __( 'Het land van de verzendgegevens moet overeenkomen met het land van de parcelshop' ), 'error' ); -// } -// } -//} -// -//======= -//>>>>>>> f4bbe1748e986e61957972fe442458b9c2dfccc8 +// Check to see if a parcelshop is selected when parcel method is selected && Check if shipping country == parcelshop country +add_action( 'woocommerce_checkout_process', 'wcwp_check_parcelshop_selection' ); +function wcwp_check_parcelshop_selection() { + if ( 'wuunder_parcelshop' === $_POST['shipping_method'][0] ) { + if ( !$_POST['parcelshop_id'] ) { + wc_add_notice( __( 'Kies eerst een parcelshop' ), 'error' ); + } + + if ( $_POST['shipping_country'] != $_POST['parcelshop_country'] ) { + wc_add_notice( __( 'Het land van de verzendgegevens moet overeenkomen met het land van de parcelshop '), 'error' ); + } + } +} ?> diff --git a/includes/logger.php b/includes/logger.php index 8f1b3ca..c8bc9b2 100644 --- a/includes/logger.php +++ b/includes/logger.php @@ -1,6 +1,6 @@ 'wuunder_connector' ); if ( WP_DEBUG ) { diff --git a/includes/parcelshop.php b/includes/parcelshop.php index ed1768d..35c0296 100644 --- a/includes/parcelshop.php +++ b/includes/parcelshop.php @@ -1,6 +1,6 @@ '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' ) ); - add_action( 'add_meta_boxes_shop_order', array( &$this, 'add_meta_boxes' ) ); - add_action( 'admin_notices', array( &$this, 'sample_admin_notice__error' ) ); + add_action( 'load-edit.php', array(&$this, 'wcwp_generateBookingUrl' ) ); + add_action( 'woocommerce_admin_order_actions_end', array( &$this, 'wcwp_add_listing_actions' ) ); + add_action( 'add_meta_boxes_shop_order', array( &$this, 'wcwp_add_meta_boxes' ) ); + add_action( 'admin_notices', array( &$this, 'wcwp_sample_admin_notice__error' ) ); wp_enqueue_style( 'wuunder-admin', ( dirname( plugin_dir_url( __FILE__ ) ) . '/assets/css/wuunder-admin.css' ) ); } /** * Creates an error message for the admin order page */ - public function sample_admin_notice__error() { + public function wcwp_sample_admin_notice__error() { if ( 'error' == isset( $_GET['notice'] ) && $_GET['notice'] ) { @@ -60,10 +59,10 @@ public function sample_admin_notice__error() { * @param $orderId * @return $bookingConfig */ - private function setBookingConfig( $orderId ) { - wuunder_log( 'info', 'Filling the booking config' ); + private function wcwp_setBookingConfig($orderId ) { + wcwp_log( 'info', 'Filling the booking config' ); - $orderItems = $this->get_order_items( $orderId ); + $orderItems = $this->wcwp_get_order_items( $orderId ); $order = new WC_Order( $orderId ); $orderPicture = null; @@ -79,15 +78,15 @@ private function setBookingConfig( $orderId ) { if (is_null($orderPicture ) ) { foreach ( $orderItems['images'] as $image ) { if ( !is_null( $image ) ) { - $orderPicture = $this->get_base64_image( $image ); + $orderPicture = $this->wcwp_get_base64_image( $image ); break; } } } // Get WooCommerce Wuunder Address from options page - $company = $this->get_company_address(); - $customer = $this->get_customer_address( $orderId ); + $company = $this->wcwp_get_company_address(); + $customer = $this->wcwp_get_customer_address( $orderId ); $totalWeight = 0; $dimensions = null; @@ -124,12 +123,12 @@ private function setBookingConfig( $orderId ) { $bookingConfig->setPicture( $orderPicture ); $bookingConfig->setKind( $totalWeight > 23000 ? 'pallet' : 'package' ); $bookingConfig->setValue( $value ? $value : null ); - $bookingConfig->setLength( $this->roundButNull( $dimensions[0] ) ); - $bookingConfig->setWidth( $this->roundButNull( $dimensions[1] ) ); - $bookingConfig->setHeight( $this->roundButNull( $dimensions[2] ) ); + $bookingConfig->setLength( $this->wcwp_roundButNull( $dimensions[0] ) ); + $bookingConfig->setWidth( $this->wcwp_roundButNull( $dimensions[1] ) ); + $bookingConfig->setHeight( $this->wcwp_roundButNull( $dimensions[2] ) ); $bookingConfig->setWeight( $totalWeight ? $totalWeight : null ); $bookingConfig->setCustomerReference( $orderId ); - $bookingConfig->setPreferredServiceLevel((count( $order->get_items( 'shipping' ) ) > 0) ? $this->get_filter_from_shippingmethod( reset( $order->get_items( 'shipping' ) )->get_method_id() ) : '' ); + $bookingConfig->setPreferredServiceLevel((count( $order->get_items( 'shipping' ) ) > 0) ? $this->wcwp_get_filter_from_shippingmethod( reset( $order->get_items( 'shipping' ) )->get_method_id() ) : '' ); $bookingConfig->setSource( $this->version_obj ); $orderMeta = get_post_meta( $orderId ); @@ -147,9 +146,9 @@ private function setBookingConfig( $orderId ) { * Generates the booking url that takes the user to Wuunder. * Returns the user to the original order page with the redirect. */ - public function generateBookingUrl() { + public function wcwp_generateBookingUrl() { if (isset($_REQUEST['order']) && $_REQUEST['action'] === "bookorder") { - wuunder_log( 'info', 'Generating the booking url' ); + wcwp_log( 'info', 'Generating the booking url' ); $order_id = $_REQUEST['order']; $status = get_option( 'wc_wuunder_api_status' ); @@ -158,21 +157,21 @@ public function generateBookingUrl() { $connector = new Wuunder\Connector( $apiKey, 'productie' !== $status ); $booking = $connector->createBooking(); - $bookingConfig = $this->setBookingConfig( $order_id ); + $bookingConfig = $this->wcwp_setBookingConfig( $order_id ); if ( $bookingConfig->validate() ) { $booking->setConfig( $bookingConfig ); - wuunder_log( 'info', 'Going to fire for bookingurl' ); + wcwp_log( 'info', 'Going to fire for bookingurl' ); if ( $booking->fire() ) { $url = $booking->getBookingResponse()->getBookingUrl(); } else { - wuunder_log( 'error', $booking->getBookingResponse()->getError() ); + wcwp_log( 'error', $booking->getBookingResponse()->getError() ); } } else { - wuunder_log( 'error', 'Bookingconfig not complete' ); + wcwp_log( 'error', 'Bookingconfig not complete' ); } - wuunder_log( 'info', 'Handling response' ); + wcwp_log( 'info', 'Handling response' ); if (isset( $url ) ) { update_post_meta( $order_id, '_wuunder_label_booking_url', $url ); @@ -184,16 +183,13 @@ public function generateBookingUrl() { } } - public function test() { - } - /** * Returns rounded value, or null * * @param $val * @return float|null */ - private function roundButNull( $val ) { + private function wcwp_roundButNull($val ) { if ( empty( $val ) ) { return null; } @@ -207,7 +203,7 @@ private function roundButNull( $val ) { * @param $shipping_method * @return */ - private function get_filter_from_shippingmethod( $shipping_method ) { + private function wcwp_get_filter_from_shippingmethod($shipping_method ) { if ( false !== strpos( $shipping_method, ':' ) ) { $shipping_method = explode( ':', $shipping_method )[0]; } @@ -229,7 +225,7 @@ private function get_filter_from_shippingmethod( $shipping_method ) { * * @return $pickupAddress */ - public function get_company_address() { + public function wcwp_get_company_address() { $pickupAddress = new \Wuunder\Api\Config\AddressConfig(); $pickupAddress->setEmailAddress(get_option( 'wc_wuunder_company_email' ) ); $pickupAddress->setFamilyName(get_option( 'wc_wuunder_company_lastname' ) ); @@ -244,7 +240,7 @@ public function get_company_address() { if ( $pickupAddress->validate() ) { return $pickupAddress; } else { - wuunder_log( 'error', 'Invalid pickup address. There are mistakes or missing fields.' ); + wcwp_log( 'error', 'Invalid pickup address. There are mistakes or missing fields.' ); return $pickupAddress; } } @@ -255,7 +251,7 @@ public function get_company_address() { * @param $addressLine * @return array containing 2 values: streetName and streetNumber */ - private function separateAddressLine( $addressLine ) { + private function wcwp_separateAddressLine($addressLine ) { if ( preg_match( '/^([^\d]*[^\d\s]) *(\d.*)$/', $addressLine, $result ) ) { if ( count( $result ) >= 2 ) { $streetName = $result[1]; @@ -270,7 +266,7 @@ private function separateAddressLine( $addressLine ) { } - private function get_customer_address_street_and_housenumber( $order_meta, $suffix ) { + private function wcwp_get_customer_address_street_and_housenumber($order_meta, $suffix ) { if ( isset( $order_meta['_shipping' . $suffix]) && ! empty( $order_meta['_shipping' . $suffix][0] ) ) { return $order_meta['_shipping' . $suffix][0]; } else if ( isset( $order_meta['_shipping_address_1'] ) && ! empty( $order_meta['_shipping_address_1'] ) ) { @@ -288,7 +284,7 @@ private function get_customer_address_street_and_housenumber( $order_meta, $suff * @param $order_meta , $suffix * @return $order_meta */ - private function get_customer_address_part( $order_meta, $suffix ) { + private function wcwp_get_customer_address_part($order_meta, $suffix ) { if ( isset($order_meta['_shipping' . $suffix] ) && ! empty( $order_meta['_shipping' . $suffix][0] ) ) { return $order_meta['_shipping' . $suffix][0]; } else if ( isset($order_meta['_billing' . $suffix] ) && ! empty( $order_meta['_billing' . $suffix][0] ) ) { @@ -304,11 +300,11 @@ private function get_customer_address_part( $order_meta, $suffix ) { * @param $order_meta * @return array containing 2 values: streetName and streetNumber */ - private function get_customer_address_from_address_line( $order_meta ) { + private function wcwp_get_customer_address_from_address_line($order_meta ) { if ( isset( $order_meta['_shipping_address_1'] ) && ! empty( $order_meta['_shipping_address_1'] ) ) { - return $this->separateAddressLine( $order_meta['_shipping_address_1'][0] ); + return $this->wcwp_separateAddressLine( $order_meta['_shipping_address_1'][0] ); } else if ( isset( $order_meta['_billing_address_1'] ) && ! empty( $order_meta['_billing_address_1'] ) ) { - return $this->separateAddressLine( $order_meta['_billing_address_1'][0] ); + return $this->wcwp_separateAddressLine( $order_meta['_billing_address_1'][0] ); } else { return ''; } @@ -320,31 +316,31 @@ private function get_customer_address_from_address_line( $order_meta ) { * @param $orderid * @return $deliveryAddress */ - public function get_customer_address( $orderid ) { + public function wcwp_get_customer_address($orderid ) { // Get customer address from order $order_meta = get_post_meta( $orderid ); $deliveryAddress = new \Wuunder\Api\Config\AddressConfig(); - $street_name = $this->get_customer_address_street_and_housenumber( $order_meta, '_street_name' ); + $street_name = $this->wcwp_get_customer_address_street_and_housenumber( $order_meta, '_street_name' ); if ( empty( $street_name ) ) { - $street_name = $this->get_customer_address_from_address_line( $order_meta )[0]; + $street_name = $this->wcwp_get_customer_address_from_address_line( $order_meta )[0]; } - $house_number = $this->get_customer_address_street_and_housenumber( $order_meta, '_house_number' ) . $this->get_customer_address_street_and_housenumber( $order_meta, '_house_number_suffix' ); + $house_number = $this->wcwp_get_customer_address_street_and_housenumber( $order_meta, '_house_number' ) . $this->wcwp_get_customer_address_street_and_housenumber( $order_meta, '_house_number_suffix' ); if ( empty( $house_number ) ) { - $house_number = $this->get_customer_address_from_address_line( $order_meta )[1]; + $house_number = $this->wcwp_get_customer_address_from_address_line( $order_meta )[1]; } - $deliveryAddress->setEmailAddress( $this->get_customer_address_part( $order_meta, '_email' ) ); - $deliveryAddress->setFamilyName( $this->get_customer_address_part( $order_meta, '_last_name' ) ); - $deliveryAddress->setGivenName( $this->get_customer_address_part( $order_meta, '_first_name' ) ); - $deliveryAddress->setLocality( $this->get_customer_address_part( $order_meta, '_city' ) ); + $deliveryAddress->setEmailAddress( $this->wcwp_get_customer_address_part( $order_meta, '_email' ) ); + $deliveryAddress->setFamilyName( $this->wcwp_get_customer_address_part( $order_meta, '_last_name' ) ); + $deliveryAddress->setGivenName( $this->wcwp_get_customer_address_part( $order_meta, '_first_name' ) ); + $deliveryAddress->setLocality( $this->wcwp_get_customer_address_part( $order_meta, '_city' ) ); $deliveryAddress->setStreetName( $street_name ); $deliveryAddress->setHouseNumber( $house_number ); - $deliveryAddress->setZipCode(str_replace( ' ', '', $this->get_customer_address_part( $order_meta, '_postcode' ) ) ); + $deliveryAddress->setZipCode(str_replace( ' ', '', $this->wcwp_get_customer_address_part( $order_meta, '_postcode' ) ) ); $deliveryAddress->setPhoneNumber( $order_meta['_billing_phone'][0] ); - $deliveryAddress->setCountry( $this->get_customer_address_part( $order_meta, '_country' ) ); + $deliveryAddress->setCountry( $this->wcwp_get_customer_address_part( $order_meta, '_country' ) ); if ( $deliveryAddress->validate() ) { return $deliveryAddress; } else { - wuunder_log( 'error', 'Invalid delivery address. There are mistakes or missing fields.' ); + wcwp_log( 'error', 'Invalid delivery address. There are mistakes or missing fields.' ); return $deliveryAddress; } } @@ -355,12 +351,12 @@ public function get_customer_address( $orderid ) { * @param $imagepath * @return $image */ - public function get_base64_image( $imagepath ) { + public function wcwp_get_base64_image($imagepath ) { try { - $fileSize = ( 'http' === substr( $imagepath, 0, 4 ) ) ? $this->remote_filesize( $imagepath ) : filesize( $imagepath ); - wuunder_log( 'info', 'Handling a image of size: ' . $fileSize ); + $fileSize = ( 'http' === substr( $imagepath, 0, 4 ) ) ? $this->wcwp_remote_filesize( $imagepath ) : filesize( $imagepath ); + wcwp_log( 'info', 'Handling a image of size: ' . $fileSize ); if ( $fileSize > 0 && $fileSize <= 2097152 ) { //smaller or equal to 2MB - wuunder_log( 'info', 'Base64 encoding image' ); + wcwp_log( 'info', 'Base64 encoding image' ); $imagedata = file_get_contents( $imagepath ); $image = base64_encode( $imagedata ); } else { @@ -368,12 +364,12 @@ public function get_base64_image( $imagepath ) { } return $image; } catch ( Exception $e ) { - wuunder_log( 'error', $e ); + wcwp_log( 'error', $e ); return ''; } } - function curl_get_file_size( $url ) { + function wcwp_curl_get_file_size($url ) { // Assume failure. $result = -1; @@ -417,8 +413,8 @@ function curl_get_file_size( $url ) { * @param $url * @return string */ - private function remote_filesize( $url ) { - $remoteFilesize = $this->curl_get_file_size( $url ); + private function wcwp_remote_filesize($url ) { + $remoteFilesize = $this->wcwp_curl_get_file_size( $url ); return $remoteFilesize; } @@ -426,7 +422,7 @@ private function remote_filesize( $url ) { * * @param $order */ - public function add_listing_actions( $order ) { + public function wcwp_add_listing_actions($order ) { // do not show buttons for trashed orders if ( 'trash' == $order->get_status() ) { return; @@ -485,7 +481,7 @@ public function add_listing_actions( $order ) { /** * Add the meta box on the single order page */ - public function add_meta_boxes() { + public function wcwp_add_meta_boxes() { // create PDF buttons add_meta_box( 'wpo_wcpdf-box', @@ -500,17 +496,17 @@ public function add_meta_boxes() { /** * Create the meta box content on the single order page */ - public function sidebar_box_content( $post ) { + public function wcwp_sidebar_box_content($post ) { global $post_id; $order = new WC_Order( $post_id ); - $this->add_listing_actions( $order ); + $this->wcwp_add_listing_actions( $order ); } /** * * */ - public function get_order_items( $order_id ) { + public function wcwp_get_order_items($order_id ) { global $woocommerce; $order = new WC_Order( $order_id ); diff --git a/includes/wcwuunder-export-html.php b/includes/wcwuunder-export-html.php index 356c685..cf81249 100644 --- a/includes/wcwuunder-export-html.php +++ b/includes/wcwuunder-export-html.php @@ -35,64 +35,63 @@ +if (empty($check_company)) { ?>

Uw instellingen zijn niet volledig ingevuld

Controleer de gegevens van uw "Standaard afhaaladres".

- Controleer + Controleer uw instellingen
- +

Retourlabel + src="/assets/images/create-icon.png"> Retourlabel aanmaken

Verzendlabel + src="/assets/images/create-icon.png"> Verzendlabel aanmaken

- - +
@@ -136,12 +136,12 @@ function check_phone() {
- + @@ -149,32 +149,32 @@ function check_phone() {
- + $straat ) { + foreach ($available_addresses as $pickup_address => $straat) { echo '
Deze order bevat geen geldige straatnaam- en huisnummergegevens, en kan daarom niet worden ge-exporteerd! Waarschijnlijk is deze order geplaatst voordat de Wuunder plugin werd geactiveerd. De gegevens kunnen wel handmatig worden ingevoerd in het order scherm.
@@ -198,12 +198,12 @@ function check_phone() {
- + @@ -212,7 +212,7 @@ function check_phone() {
- +
t.n.v.
@@ -223,24 +223,24 @@ function check_phone() {
$straat ) { + foreach ($available_addresses as $pickup_address => $straat) { echo '
'; - if ( 0 == $pickup_address ) { + if (0 == $pickup_address) { // Get Woocommerce Wuunder Settings - echo get_option( 'wc_wuunder_company_name' ) . '
'; - echo get_option( 'wc_wuunder_company_firstname' ) . ' ' . get_option( 'wc_wuunder_company_lastname' ) . '
'; - echo get_option( 'wc_wuunder_company_street' ) . ' ' . get_option( 'wc_wuunder_company_housenumber' ) . '
'; - echo get_option( 'wc_wuunder_company_postode' ) . ' ' . get_option( 'wc_wuunder_company_city' ) . ' ' . get_option( 'wc_wuunder_company_country' ) . '
'; - echo get_option( 'wc_wuunder_company_email' ) . '
'; - echo get_option( 'wc_wuunder_company_phone' ) . '
'; + echo get_option('wc_wuunder_company_name') . '
'; + echo get_option('wc_wuunder_company_firstname') . ' ' . get_option('wc_wuunder_company_lastname') . '
'; + echo get_option('wc_wuunder_company_street') . ' ' . get_option('wc_wuunder_company_housenumber') . '
'; + echo get_option('wc_wuunder_company_postode') . ' ' . get_option('wc_wuunder_company_city') . ' ' . get_option('wc_wuunder_company_country') . '
'; + echo get_option('wc_wuunder_company_email') . '
'; + echo get_option('wc_wuunder_company_phone') . '
'; } else { - echo get_option( 'wc_wuunder_company_name_' . $pickup_address ) . '
'; - echo get_option( 'wc_wuunder_company_firstname_' . $pickup_address ) . ' ' . get_option( 'wc_wuunder_company_lastname_' . $pickup_address ) . '
'; - echo get_option( 'wc_wuunder_company_street_' . $pickup_address ) . ' ' . get_option( 'wc_wuunder_company_housenumber_' . $pickup_address ) . '
'; - echo get_option( 'wc_wuunder_company_postode_' . $pickup_address ) . ' ' . get_option( 'wc_wuunder_company_city_' . $pickup_address ) . ' ' . get_option( 'wc_wuunder_company_country_' . $pickup_address ) . '
'; - echo get_option( 'wc_wuunder_company_email_' . $pickup_address ) . '
'; - echo get_option( 'wc_wuunder_company_phone_' . $pickup_address ) . '
'; + echo get_option('wc_wuunder_company_name_' . $pickup_address) . '
'; + echo get_option('wc_wuunder_company_firstname_' . $pickup_address) . ' ' . get_option('wc_wuunder_company_lastname_' . $pickup_address) . '
'; + echo get_option('wc_wuunder_company_street_' . $pickup_address) . ' ' . get_option('wc_wuunder_company_housenumber_' . $pickup_address) . '
'; + echo get_option('wc_wuunder_company_postode_' . $pickup_address) . ' ' . get_option('wc_wuunder_company_city_' . $pickup_address) . ' ' . get_option('wc_wuunder_company_country_' . $pickup_address) . '
'; + echo get_option('wc_wuunder_company_email_' . $pickup_address) . '
'; + echo get_option('wc_wuunder_company_phone_' . $pickup_address) . '
'; } echo '
'; } @@ -259,7 +259,7 @@ function check_phone() { ( Gebruik de opmaak: +31612345678 ) " + value="" required="">
@@ -279,7 +279,7 @@ function check_phone() { @@ -289,7 +289,7 @@ function check_phone() { @@ -311,26 +311,26 @@ function check_phone() {
+ class="text-primary">*
+ class="text-primary">*
@@ -349,7 +349,7 @@ class="text-primary">*
cm
@@ -359,7 +359,7 @@ class="text-primary">*
+ class="text-primary">*
@@ -369,12 +369,12 @@ class="text-primary">*
+ class="text-primary">* " required=""> @@ -387,7 +387,7 @@ class="text-primary">*
- + diff --git a/includes/wcwuunder-settings.php b/includes/wcwuunder-settings.php index 02f5f1f..e9c24ce 100644 --- a/includes/wcwuunder-settings.php +++ b/includes/wcwuunder-settings.php @@ -8,18 +8,18 @@ class WC_Wuunder_Settings { public function __construct() { // Add setting tab "Reatiler" on woocommerce settings page - add_filter( 'woocommerce_settings_tabs_array', array( &$this, 'add_settings_tab' ), 50 ); - add_action( 'woocommerce_settings_tabs_wuunder', array( &$this, 'settings_tab' ) ); - add_action( 'woocommerce_update_options_wuunder', array(&$this, 'update_settings' ) ); + add_filter( 'woocommerce_settings_tabs_array', array( &$this, 'wcwp_add_settings_tab' ), 50 ); + add_action( 'woocommerce_settings_tabs_wuunder', array( &$this, 'wcwp_settings_tab' ) ); + add_action( 'woocommerce_update_options_wuunder', array(&$this, 'wcwp_update_settings' ) ); } - public static function add_settings_tab( $settings_tabs ) { + public static function wcwp_add_settings_tab($settings_tabs ) { $settings_tabs['wuunder'] = __( 'Wuunder', 'woocommerce-wuunder' ); return $settings_tabs; } - public static function settings_tab() { + public static function wcwp_settings_tab() { ?>