Skip to content

Commit

Permalink
PLUGINS-6950 added fix for Buy Now button urls with non-latin characters
Browse files Browse the repository at this point in the history
  • Loading branch information
meteor-ec committed Nov 7, 2024
1 parent 3b4191e commit 2eafca5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/shortcodes/class-ecwid-shortcode-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
}

Expand Down
8 changes: 7 additions & 1 deletion lib/ecwid_catalog_entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2eafca5

Please sign in to comment.