WooCommerce Germanized - Version 1.8.1

Version Description

  • Fix - Parent product data inherit
  • Fix - Only manipulate price display if sale_price_labels are applicable
  • Fix - REST API saving free_shipping parameter
Download this release

Release Info

Developer vendidero
Plugin Icon 128x128 WooCommerce Germanized
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8.0 to 1.8.1

includes/abstracts/abstract-wc-gzd-product.php CHANGED
@@ -105,7 +105,7 @@ class WC_GZD_Product {
105
  if ( $this->child->is_type( 'variation' ) && in_array( $key, array_keys( $this->gzd_variation_level_meta ) ) ) {
106
  return metadata_exists( 'post', wc_gzd_get_crud_data( $this->child, 'id' ), '_' . $key );
107
  } else if ( $this->child->is_type( 'variation' ) && in_array( $key, array_keys( $this->gzd_variation_inherited_meta_data ) ) ) {
108
- return metadata_exists( 'post', wc_gzd_get_crud_data( $this->child, 'parent' ), '_' . $key );
109
  } else {
110
  return metadata_exists( 'post', wc_gzd_get_crud_data( $this->child, 'id' ), '_' . $key );
111
  }
@@ -150,6 +150,10 @@ class WC_GZD_Product {
150
 
151
  $sale_label = $this->get_sale_price_label();
152
  $sale_regular_label = $this->get_sale_price_regular_label();
 
 
 
 
153
 
154
  preg_match( "/<del>(.*?)<\\/del>/si", $price_html, $match_regular );
155
  preg_match( "/<ins>(.*?)<\\/ins>/si", $price_html, $match_sale );
@@ -406,7 +410,7 @@ class WC_GZD_Product {
406
  if ( empty( $terms ) && $this->child->is_type( 'variation' ) ) {
407
 
408
  $parent_terms = get_the_terms( wc_gzd_get_crud_data( $this->child, 'parent' ), 'product_delivery_time' );
409
-
410
  if ( ! empty( $parent_terms ) && ! is_wp_error( $parent_terms ) )
411
  $terms = $parent_terms;
412
  }
105
  if ( $this->child->is_type( 'variation' ) && in_array( $key, array_keys( $this->gzd_variation_level_meta ) ) ) {
106
  return metadata_exists( 'post', wc_gzd_get_crud_data( $this->child, 'id' ), '_' . $key );
107
  } else if ( $this->child->is_type( 'variation' ) && in_array( $key, array_keys( $this->gzd_variation_inherited_meta_data ) ) ) {
108
+ return metadata_exists( 'post', wc_gzd_get_crud_data( $this->child, 'id' ), '_' . $key ) || metadata_exists( 'post', wc_gzd_get_crud_data( $this->child, 'parent' ), '_' . $key );
109
  } else {
110
  return metadata_exists( 'post', wc_gzd_get_crud_data( $this->child, 'id' ), '_' . $key );
111
  }
150
 
151
  $sale_label = $this->get_sale_price_label();
152
  $sale_regular_label = $this->get_sale_price_regular_label();
153
+
154
+ // Do not manipulate if there is no label to be added.
155
+ if ( empty( $sale_label ) && empty( $sale_regular_label ) )
156
+ return $price_html;
157
 
158
  preg_match( "/<del>(.*?)<\\/del>/si", $price_html, $match_regular );
159
  preg_match( "/<ins>(.*?)<\\/ins>/si", $price_html, $match_sale );
410
  if ( empty( $terms ) && $this->child->is_type( 'variation' ) ) {
411
 
412
  $parent_terms = get_the_terms( wc_gzd_get_crud_data( $this->child, 'parent' ), 'product_delivery_time' );
413
+
414
  if ( ! empty( $parent_terms ) && ! is_wp_error( $parent_terms ) )
415
  $terms = $parent_terms;
416
  }
includes/admin/class-wc-gzd-admin-welcome.php CHANGED
@@ -123,10 +123,11 @@ class WC_GZD_Admin_Welcome {
123
  <a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="button button-primary">Upgrade zur Pro Version</a>
124
  </p>
125
  <div class="changelog new-feature">
126
- <h3>Dienstleistungen</h3>
127
- <p>Mit Version 1.7 werden Dienstleistungen nativ unterstützt. Dafür haben wir den auswählbaren Produkttyp "Dienstleistung" hinzugefügt. Ähnlich wie "virtuell" oder "herunterladbar" kann der Produkttyp für Produkte explizit angewählt werden.</p>
128
- <p>Für den Produkttyp können in den Einstellungen unter Anzeige individiuelle Hinweistexte für die Kasse (d.h. Checkbox) ähnlich wie bei digitalen Produkten hinterlegt werden, um mit der Ausführung der Dienstleistung vor Ablauf der Widerrufsfrist zu beginnen.</p>
129
- </div>
 
130
  <div class="changelog vendipro new-feature">
131
  <h3>Neu: Rechtliche Hinweistexte als PDF-Anhang <span class="wc-gzd-pro">pro</span></h3>
132
  <div class="left">
123
  <a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="button button-primary">Upgrade zur Pro Version</a>
124
  </p>
125
  <div class="changelog new-feature">
126
+ <h3>WooCommerce 2.7 & neue Infopflichten am 01.02.17</h3>
127
+ <p>Mit Version 1.8 ist Germanized bereits vorbereitet auf das bald anstehende Major Update von WooCommerce auf Version 2.7. Das Update wird viele Änderungen mit sich bringen, insbesondere bei der Datenstruktur. Dafür mussten auch in Germanized viele Anpassungen gemacht werden und vor allem Aufwand zur Gewährleistung der Rückwärtskompatibilität mit älteren WC Versionen betrieben werden.</p>
128
+ <p>Zudem gibt es mit dem 01.02.17 neue Informationspflichten (s.h. <a href="http://shopbetreiber-blog.de/2017/01/13/streitschlichtung-neue-infopflichten-fuer-alle-online-haendler-ab-1-februar/" target="_blank">Trusted Shops</a>). Die nötigen Informationen werden in Form des Shortcodes [gzd_complaints] zum Impressum (und falls hinterlegt zu den AGB) hinzugefügt. Dafür wurden
129
+ neue Optionen in den Einstellungen hinterlegt, da je nach Geschäftsmodell u.U. andere Informationen einzufügen sind. Die empfohlenen Mustertexte von Trusted Shops haben wir bereits eingearbeitet. Bitte kontrolliere deine <a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=germanized#woocommerce_gzd_alternative_complaints_text_none' ); ?>">Einstellungen</a>.</p>
130
+ </div>
131
  <div class="changelog vendipro new-feature">
132
  <h3>Neu: Rechtliche Hinweistexte als PDF-Anhang <span class="wc-gzd-pro">pro</span></h3>
133
  <div class="left">
includes/api/class-wc-gzd-rest-products-controller.php CHANGED
@@ -400,6 +400,10 @@ class WC_GZD_REST_Products_Controller {
400
  $data[ '_free_shipping' ] = get_post_meta( $real_product_id, '_free_shipping', false );
401
  }
402
 
 
 
 
 
403
  WC_Germanized_Meta_Box_Product_Data::save_product_data( $real_product_id, $data );
404
  }
405
 
400
  $data[ '_free_shipping' ] = get_post_meta( $real_product_id, '_free_shipping', false );
401
  }
402
 
403
+ // Do only add free_shipping if is set so saving works (checkbox-style).
404
+ if ( empty( $data[ '_free_shipping' ] ) || ! $data[ '_free_shipping' ] )
405
+ unset( $data[ '_free_shipping' ] );
406
+
407
  WC_Germanized_Meta_Box_Product_Data::save_product_data( $real_product_id, $data );
408
  }
409
 
includes/wc-gzd-legacy-functions.php CHANGED
@@ -21,9 +21,13 @@ function wc_gzd_get_crud_data( $object, $key ) {
21
  $getter = substr( $key, 0, 3 ) === "get" ? $key : "get_$key";
22
  $key = substr( $key, 0, 3 ) === "get" ? substr( $key, 3 ) : $key;
23
 
24
- if ( 'id' === $key && is_a( $object, 'WC_Product_Variation' ) && ! WC_GZD_Dependencies::instance()->woocommerce_version_supports_crud() ) {
25
  $key = 'variation_id';
26
- }
 
 
 
 
27
 
28
  $getter_mapping = array(
29
  'parent' => 'get_parent_id',
21
  $getter = substr( $key, 0, 3 ) === "get" ? $key : "get_$key";
22
  $key = substr( $key, 0, 3 ) === "get" ? substr( $key, 3 ) : $key;
23
 
24
+ if ( 'id' === $key && is_callable( array( $object, 'is_type' ) ) && $object->is_type( 'variation' ) && ! WC_GZD_Dependencies::instance()->woocommerce_version_supports_crud() ) {
25
  $key = 'variation_id';
26
+ } else if ( 'parent' === $key && is_callable( array( $object, 'is_type' ) ) && $object->is_type( 'variation' ) && ! WC_GZD_Dependencies::instance()->woocommerce_version_supports_crud() ) {
27
+ // Set getter to parent so that it is not being used for pre 2.7
28
+ $key = 'id';
29
+ $getter = 'parent';
30
+ }
31
 
32
  $getter_mapping = array(
33
  'parent' => 'get_parent_id',
includes/wc-gzd-template-functions.php CHANGED
@@ -556,20 +556,6 @@ if ( ! function_exists( 'woocommerce_gzd_template_digital_delivery_time_text' )
556
 
557
  }
558
 
559
- if ( ! function_exists( 'woocommerce_gzd_template_sale_price_label' ) ) {
560
-
561
- function woocommerce_gzd_template_sale_price_label( $price, $from, $to, $product ) {
562
-
563
- if ( ! is_product() && get_option( 'woocommerce_gzd_display_listings_sale_price_labels' ) === 'no' )
564
- return $price;
565
- else if ( is_product() && get_option( 'woocommerce_gzd_display_product_detail_sale_price_labels' ) === 'no' )
566
- return $price;
567
-
568
- return wc_gzd_get_gzd_product( $product )->get_price_html_from_to( $from, $to );
569
- }
570
-
571
- }
572
-
573
  if ( ! function_exists( 'woocommerce_gzd_template_sale_price_label_html' ) ) {
574
 
575
  function woocommerce_gzd_template_sale_price_label_html( $price, $product ) {
@@ -584,37 +570,4 @@ if ( ! function_exists( 'woocommerce_gzd_template_sale_price_label_html' ) ) {
584
 
585
  }
586
 
587
- if ( ! function_exists( 'woocommerce_gzd_template_variation_sale_price_label' ) ) {
588
-
589
- function woocommerce_gzd_template_variation_sale_price_label( $price, $product ) {
590
-
591
- if ( ! is_product() && get_option( 'woocommerce_gzd_display_listings_sale_price_labels' ) === 'no' )
592
- return $price;
593
- else if ( is_product() && get_option( 'woocommerce_gzd_display_product_detail_sale_price_labels' ) === 'no' )
594
- return $price;
595
-
596
- $display_regular_price = $product->get_display_price( $product->get_regular_price() );
597
- $display_sale_price = $product->get_display_price( $product->get_sale_price() );
598
-
599
- return wc_gzd_get_gzd_product( $product )->get_price_html_from_to( $display_regular_price, $display_sale_price );
600
- }
601
-
602
- }
603
-
604
- if ( ! function_exists( 'woocommerce_gzd_template_show_variation_price' ) ) {
605
-
606
- function woocommerce_gzd_template_show_variation_price( $show, $product, $variation ) {
607
-
608
- $gzd_product = wc_gzd_get_gzd_product( $product );
609
- $gzd_product_variation = wc_gzd_get_gzd_product( $variation );
610
-
611
- if ( ( $gzd_product_variation->get_sale_price_label() !== $gzd_product->get_sale_price_label() ) || ( $gzd_product_variation->get_sale_price_regular_label() !== $gzd_product->get_sale_price_regular_label() ) )
612
- return true;
613
-
614
- return $show;
615
-
616
- }
617
-
618
- }
619
-
620
  ?>
556
 
557
  }
558
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  if ( ! function_exists( 'woocommerce_gzd_template_sale_price_label_html' ) ) {
560
 
561
  function woocommerce_gzd_template_sale_price_label_html( $price, $product ) {
570
 
571
  }
572
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  ?>
includes/wc-gzd-template-hooks.php CHANGED
@@ -17,6 +17,8 @@ if ( get_option( 'woocommerce_gzd_display_digital_delivery_time_text' ) !== '' )
17
  add_filter( 'woocommerce_germanized_empty_delivery_time_text', 'woocommerce_gzd_template_digital_delivery_time_text', 10, 2 );
18
 
19
  add_filter( 'woocommerce_get_price_html', 'woocommerce_gzd_template_sale_price_label_html', 50, 2 );
 
 
20
 
21
  /**
22
  * Single Product
17
  add_filter( 'woocommerce_germanized_empty_delivery_time_text', 'woocommerce_gzd_template_digital_delivery_time_text', 10, 2 );
18
 
19
  add_filter( 'woocommerce_get_price_html', 'woocommerce_gzd_template_sale_price_label_html', 50, 2 );
20
+ // WC pre 2.7
21
+ add_filter( 'woocommerce_get_variation_price_html', 'woocommerce_gzd_template_sale_price_label_html', 50, 2 );
22
 
23
  /**
24
  * Single Product
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vendidero
3
  Tags: woocommerce, german market, german, germany, deutsch, deutschland, de, de_DE, shop, commerce, e-commerce, ecommerce, woothemes, sepa, invoice
4
  Requires at least: 3.8
5
  Tested up to: 4.7
6
- Stable tag: 1.8.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -157,6 +157,11 @@ Bug reports may be filed via our [GitHub repository](https://github.com/vendider
157
 
158
  == Changelog ==
159
 
 
 
 
 
 
160
  = 1.8.0 =
161
  * Feature - WooCommerce 2.7 beta compatibility (CRUD)
162
  * Feature - gzd_complaints Shortcode extended to meet newest law requirements
3
  Tags: woocommerce, german market, german, germany, deutsch, deutschland, de, de_DE, shop, commerce, e-commerce, ecommerce, woothemes, sepa, invoice
4
  Requires at least: 3.8
5
  Tested up to: 4.7
6
+ Stable tag: 1.8.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
157
 
158
  == Changelog ==
159
 
160
+ = 1.8.1 =
161
+ * Fix - Parent product data inherit
162
+ * Fix - Only manipulate price display if sale_price_labels are applicable
163
+ * Fix - REST API saving free_shipping parameter
164
+
165
  = 1.8.0 =
166
  * Feature - WooCommerce 2.7 beta compatibility (CRUD)
167
  * Feature - gzd_complaints Shortcode extended to meet newest law requirements
woocommerce-germanized.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce Germanized
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Extends WooCommerce to become a legally compliant store for the german market.
6
- * Version: 1.8.0
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
@@ -28,7 +28,7 @@ final class WooCommerce_Germanized {
28
  *
29
  * @var string
30
  */
31
- public $version = '1.8.0';
32
 
33
  /**
34
  * Single instance of WooCommerce Germanized Main Class
3
  * Plugin Name: WooCommerce Germanized
4
  * Plugin URI: https://www.vendidero.de/woocommerce-germanized
5
  * Description: Extends WooCommerce to become a legally compliant store for the german market.
6
+ * Version: 1.8.1
7
  * Author: Vendidero
8
  * Author URI: https://vendidero.de
9
  * Requires at least: 3.8
28
  *
29
  * @var string
30
  */
31
+ public $version = '1.8.1';
32
 
33
  /**
34
  * Single instance of WooCommerce Germanized Main Class