| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | use FluentCart\App\Helpers\Helper; |
| 11 | 11 | //use FluentCart\App\Hooks\Handlers\ShortCodes\Buttons\AddToCartShortcode; |
| 12 | 12 | use FluentCart\App\Models\ProductDetail; |
| 13 | 13 | use FluentCart\App\Modules\Templating\AssetLoader; |
| 14 | +use FluentCart\App\Services\Renderer\RenderContext; | |
| 14 | 15 | use FluentCart\App\Services\Renderer\ShopAppRenderer; |
| 15 | 16 | use FluentCart\App\Services\TemplateService; |
| 16 | -use FluentCart\App\Vite; | |
| 17 | 17 | use FluentCart\Framework\Support\Arr; |
| 18 | 18 | use FluentCart\Framework\Support\Str; |
| 19 | 19 | |
| 20 | 20 | class ShopAppHandler |
| @@ -44,9 +44,17 @@ | ||
| 44 | 44 | $this->enqueueStyles(); |
| 45 | 45 | } |
| 46 | 46 | }, 5); |
| 47 | 47 | add_shortcode(static::SHORT_CODE, function ($shortcodeAttributes, $content, $block) { |
| 48 | - return $this->handelShortcodeCall($shortcodeAttributes); | |
| 48 | + // The shop shortcode registers its own closure rather than going | |
| 49 | + // through ShortCode::register(), so it declares itself separately. | |
| 50 | + return RenderContext::declaring( | |
| 51 | + RenderContext::SOURCE_SHORTCODE, | |
| 52 | + static::SHORT_CODE, | |
| 53 | + function () use ($shortcodeAttributes) { | |
| 54 | + return $this->handelShortcodeCall($shortcodeAttributes); | |
| 55 | + } | |
| 56 | + ); | |
| 49 | 57 | }); |
| 50 | 58 | } |
| 51 | 59 | |
| 52 | 60 | public function handelShortcodeCall($shortcodeAttributes) |
| @@ -104,10 +112,8 @@ | ||
| 104 | 112 | 'ids' => '', |
| 105 | 113 | 'exclude_ids' => '', |
| 106 | 114 | 'category' => '', |
| 107 | 115 | 'category_id' => '', |
| 108 | - 'tag' => '', | |
| 109 | - 'tag_id' => '', | |
| 110 | 116 | 'fulfillment_type' => '', |
| 111 | 117 | 'product_type' => '', |
| 112 | 118 | 'on_sale' => '', |
| 113 | 119 | 'sort_by' => '', |
| @@ -238,9 +244,9 @@ | ||
| 238 | 244 | |
| 239 | 245 | $allProducts = $this->getInitialProducts(); |
| 240 | 246 | $this->defaultViewData = [ |
| 241 | 247 | 'products' => Arr::get($allProducts, 'products', []), |
| 242 | - 'placeholder_image' => Vite::getAssetUrl('images/placeholder.svg'), | |
| 248 | + 'placeholder_image' => Helper::getProductPlaceholderUrl(), | |
| 243 | 249 | 'paginator' => $this->shortcodeAttributes['paginator'], |
| 244 | 250 | 'view_mode' => $this->shortcodeAttributes['view_mode'], |
| 245 | 251 | 'price_format' => $this->shortcodeAttributes['price_format'], |
| 246 | 252 | 'per_page' => $this->shortcodeAttributes['per_page'], |
| @@ -357,21 +363,12 @@ | ||
| 357 | 363 | $existing = Arr::get($mergedTerms, 'product-categories', []); |
| 358 | 364 | $mergedTerms['product-categories'] = array_unique(array_merge($existing, $categoryTermIds)); |
| 359 | 365 | } |
| 360 | 366 | |
| 361 | - // --- Shortcode attribute: tag (by slug) and tag_id --- | |
| 362 | - $tagTermIds = []; | |
| 363 | - if (!empty($this->shortcodeAttributes['tag'])) { | |
| 364 | - $tagTermIds = Taxonomy::getTermIdsBySlugs($this->shortcodeAttributes['tag'], 'product-tags'); | |
| 365 | - } | |
| 366 | - if (!empty($this->shortcodeAttributes['tag_id'])) { | |
| 367 | - $tIds = array_values(array_filter(array_map('intval', array_map('trim', explode(',', $this->shortcodeAttributes['tag_id']))))); | |
| 368 | - $tagTermIds = array_unique(array_merge($tagTermIds, $tIds)); | |
| 369 | - } | |
| 370 | - if (!empty($tagTermIds)) { | |
| 371 | - $existing = Arr::get($mergedTerms, 'product-tags', []); | |
| 372 | - $mergedTerms['product-tags'] = array_unique(array_merge($existing, $tagTermIds)); | |
| 373 | - } | |
| 367 | + // The former tag= / tag_id= attributes filtered on the product-tags | |
| 368 | + // taxonomy, which FluentCart does not register (won't-ship decision | |
| 369 | + // 2026-08-06). They never matched anything — worse, tag_id= filtered | |
| 370 | + // every product out. Unknown attributes are now simply ignored. | |
| 374 | 371 | |
| 375 | 372 | // --- Shortcode attribute: sort_by --- |
| 376 | 373 | if (!empty($this->shortcodeAttributes['sort_by'])) { |
| 377 | 374 | $filters['sort_by'] = sanitize_text_field($this->shortcodeAttributes['sort_by']); |