Premmerce Permalink Manager for WooCommerce - Version 2.0.1

Version Description

Release Date: May 18, 2018

  • Fixed payment redirect
  • Fixed undefined index when product has no category
Download this release

Release Info

Developer premmerce
Plugin Icon 128x128 Premmerce Permalink Manager for WooCommerce
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0 to 2.0.1

freemius/assets/img/woo-permalink-manager.png DELETED
Binary file
premmerce-url-manager.php CHANGED
@@ -11,7 +11,7 @@ use Premmerce\UrlManager\UrlManagerPlugin;
11
  * Plugin Name: WooCommerce Permalink Manager
12
  * Plugin URI: https://premmerce.com/woocommerce-permalink-manager-remove-shop-product-product-category-url/
13
  * Description: Premmerce WooCommerce Permalink Manager allows you to change WooCommerce permalink and remove product and product_category slugs from the URL.
14
- * Version: 2.0
15
  * Author: premmerce
16
  * Author URI: https://premmerce.com/
17
  * License: GPL-2.0+
11
  * Plugin Name: WooCommerce Permalink Manager
12
  * Plugin URI: https://premmerce.com/woocommerce-permalink-manager-remove-shop-product-product-category-url/
13
  * Description: Premmerce WooCommerce Permalink Manager allows you to change WooCommerce permalink and remove product and product_category slugs from the URL.
14
+ * Version: 2.0.1
15
  * Author: premmerce
16
  * Author URI: https://premmerce.com/
17
  * License: GPL-2.0+
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === WooCommerce Permalink Manager ===
2
- Contributors: premmerce
3
  Tags: woocommerce url, remove product, remove product_category, woocommerce permalink, woocommerce, woocommerce seo
4
  Requires at least: 4.8
5
- Tested up to: 4.9.5
6
- Stable tag: 2.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -151,3 +151,9 @@ Release Date: Apr 19, 2018
151
  * Added remove tag base to premium version
152
  * Added redirects to premium version
153
 
 
 
 
 
 
 
1
  === WooCommerce Permalink Manager ===
2
+ Contributors: premmerce, freemius
3
  Tags: woocommerce url, remove product, remove product_category, woocommerce permalink, woocommerce, woocommerce seo
4
  Requires at least: 4.8
5
+ Tested up to: 4.9.6
6
+ Stable tag: 2.0.1
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
151
  * Added remove tag base to premium version
152
  * Added redirects to premium version
153
 
154
+ = 2.0.1 =
155
+
156
+ Release Date: May 18, 2018
157
+
158
+ * Fixed payment redirect
159
+ * Fixed undefined index when product has no category
src/PermalinkListener.php CHANGED
@@ -151,8 +151,12 @@ class PermalinkListener
151
  return $permalink;
152
  }
153
  $term = $this->getProductCategory( $post );
154
- $slug = $this->buildTermPath( $term, $hierarchical );
155
- $permalink = str_replace( '%product_cat%', $slug, $permalink );
 
 
 
 
156
  return $permalink;
157
  }
158
 
@@ -200,6 +204,9 @@ class PermalinkListener
200
  private function getWcPrimaryTerm( $product )
201
  {
202
  $terms = get_the_terms( $product->ID, 'product_cat' );
 
 
 
203
 
204
  if ( function_exists( 'wp_list_sort' ) ) {
205
  $terms = wp_list_sort( $terms, 'term_id', 'ASC' );
151
  return $permalink;
152
  }
153
  $term = $this->getProductCategory( $post );
154
+
155
+ if ( $term ) {
156
+ $slug = $this->buildTermPath( $term, $hierarchical );
157
+ $permalink = str_replace( '%product_cat%', $slug, $permalink );
158
+ }
159
+
160
  return $permalink;
161
  }
162
 
204
  private function getWcPrimaryTerm( $product )
205
  {
206
  $terms = get_the_terms( $product->ID, 'product_cat' );
207
+ if ( empty($terms) ) {
208
+ return null;
209
+ }
210
 
211
  if ( function_exists( 'wp_list_sort' ) ) {
212
  $terms = wp_list_sort( $terms, 'term_id', 'ASC' );