| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | use FluentCart\App\Hooks\Handlers\CPTHandler; |
| 7 | 7 | use FluentCart\App\Modules\Data\ProductDataSetup; |
| 8 | +use FluentCart\App\Modules\Templating\AssetLoader; | |
| 8 | 9 | use FluentCart\App\Services\Renderer\ProductCardRender; |
| 9 | 10 | |
| 10 | 11 | class DynamicData |
| 11 | 12 | { |
| @@ -78,9 +79,12 @@ | ||
| 78 | 79 | if ($productModel) { |
| 79 | 80 | ob_start(); |
| 80 | 81 | (new ProductCardRender($productModel))->renderProductImage(); |
| 81 | 82 | $content = ob_get_clean(); |
| 82 | - return '<span data-fct-field="product-image">' . $content . '</span>'; | |
| 83 | + | |
| 84 | + $badgesHtml = BricksHelper::renderProductBadges($productModel, BricksHelper::$imageBadgeSettings); | |
| 85 | + | |
| 86 | + return '<span data-fct-field="product-image">' . $content . $badgesHtml . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- renderProductBadges() escapes its own output | |
| 83 | 87 | } |
| 84 | 88 | break; |
| 85 | 89 | case 'fct_product_excerpt': |
| 86 | 90 | $excerpt = $post->post_excerpt; |
| @@ -90,8 +94,11 @@ | ||
| 90 | 94 | return ''; |
| 91 | 95 | case 'fct_product_price': |
| 92 | 96 | $productModel = ProductDataSetup::getProductModel($post->ID); |
| 93 | 97 | if ($productModel) { |
| 98 | + // Price markup relies on the .fct-sr-only rule shipped with the | |
| 99 | + // single product styles; without it the labels render visibly. | |
| 100 | + AssetLoader::loadSingleProductAssets(); | |
| 94 | 101 | ob_start(); |
| 95 | 102 | (new ProductCardRender($productModel))->renderPrices(); |
| 96 | 103 | $content = ob_get_clean(); |
| 97 | 104 | return '<span data-fct-field="product-price">' . $content . '</span>'; |