Skip to content

Commit 0725405

Browse files
committed
PLUGINS-7031
1 parent 35a6f41 commit 0725405

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

includes/class-ec-store-oembed.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function get_content() {
4040
if ( ! empty( $categories->items ) ) {
4141
foreach ( $categories->items as $category ) {
4242
$category = Ecwid_Category::get_by_id( $category->id );
43-
$items[ $category->link ] = $category->name;
43+
$items[ $category->url ] = $category->name;
4444
if ( count( $items ) >= $max_items ) {
4545
$see_more = true;
4646
break;
@@ -71,7 +71,7 @@ public static function get_content() {
7171
if ( $products->items ) {
7272
foreach ( $products->items as $product ) {
7373
$product = Ecwid_Product::get_by_id( $product->id );
74-
$items[ $product->link ] = $product->name;
74+
$items[ $product->url ] = $product->name;
7575
if ( count( $items ) >= $max_items ) {
7676
$see_more = true;
7777
break;
@@ -102,15 +102,21 @@ public static function ecwid_oembed_url( $url, $permalink, $format ) {
102102
return $url;
103103
}
104104

105-
$params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
106-
107-
if ( $params['mode'] == 'product' ) {
108-
$product = Ecwid_Product::get_by_id( $params['id'] );
109-
$permalink = $product->link;
110-
} elseif ( $params['mode'] == 'category' ) {
111-
$category = Ecwid_Category::get_by_id( $params['id'] );
112-
$permalink = $category->link;
113-
}
105+
if( Ecwid_Seo_Links::is_slugs_without_ids_enabled() ) {
106+
$permalink = trailingslashit( $permalink );
107+
$slug = Ecwid_Static_Page::get_current_storefront_page_slug();
108+
$permalink .= $slug;
109+
} else {
110+
$params = Ecwid_Seo_Links::maybe_extract_html_catalog_params();
111+
112+
if ( $params['mode'] == 'product' ) {
113+
$product = Ecwid_Product::get_by_id( $params['id'] );
114+
$permalink = $product->link;
115+
} elseif ( $params['mode'] == 'category' ) {
116+
$category = Ecwid_Category::get_by_id( $params['id'] );
117+
$permalink = $category->link;
118+
}
119+
}
114120

115121
$url = add_query_arg(
116122
array(

0 commit comments

Comments
 (0)