diff --git a/includes/shortcodes/class-ecwid-shortcode-product.php b/includes/shortcodes/class-ecwid-shortcode-product.php index 90f3c0c6..43f9a529 100644 --- a/includes/shortcodes/class-ecwid-shortcode-product.php +++ b/includes/shortcodes/class-ecwid-shortcode-product.php @@ -73,7 +73,7 @@ public function render_placeholder() { $display_items[ $item ] = str_replace( '$name', $product->name, $display_items[ $item ] ); } - if ( $item == 'price' ) { + if ( $item == 'price' && ! empty( $product->price ) ) { $display_items[ $item ] = str_replace( '$price', $product->price, $display_items[ $item ] ); } diff --git a/lib/ecwid_catalog_entry.php b/lib/ecwid_catalog_entry.php index 376f19d7..76a6cc32 100644 --- a/lib/ecwid_catalog_entry.php +++ b/lib/ecwid_catalog_entry.php @@ -93,7 +93,13 @@ public function get_seo_link( $baseUrl = '' ) { $url .= '/'; } - $url .= $this->_linkify( $this->_data->name ) . '-' . $this->_link_prefix . $this->_data->id; + preg_match( '!([^\/]+-[p|c][0-9]+)$!', $this->_data->url, $slug ); + + if( ! empty( $slug[1] ) ) { + $url .= $slug[1]; + } else { + $url .= $this->_linkify( $this->_data->name ) . '-' . $this->_link_prefix . $this->_data->id; + } if ( ! empty( $query ) ) { $url .= '/?' . $query;