| @@ -4,9 +4,8 @@ | ||
| 4 | 4 | |
| 5 | 5 | use FluentCart\App\Helpers\Helper; |
| 6 | 6 | use FluentCart\App\Models\Cart; |
| 7 | 7 | use FluentCart\Framework\Support\Arr; |
| 8 | -use FluentCart\App\Vite; | |
| 9 | 8 | |
| 10 | 9 | class CartItemRenderer |
| 11 | 10 | { |
| 12 | 11 | protected $item = []; |
| @@ -106,10 +105,14 @@ | ||
| 106 | 105 | { |
| 107 | 106 | $href = Arr::get($this->item, 'view_url', ''); |
| 108 | 107 | |
| 109 | 108 | $mainTitle = (string) Arr::get($this->item, 'post_title', ''); |
| 110 | - $subtitle = (string) Arr::get($this->item, 'title', ''); | |
| 111 | 109 | |
| 110 | + // The Cart model already resolves & appends variation_display_title on | |
| 111 | + // every cart item (Cart::getCartDataAttribute); fall back to the raw | |
| 112 | + // variation title for items it didn't decorate. | |
| 113 | + $subtitle = (string) Arr::get($this->item, 'variation_display_title', (string) Arr::get($this->item, 'title', '')); | |
| 114 | + | |
| 112 | 115 | $quantity = Arr::get($this->item, 'quantity', 1); |
| 113 | 116 | |
| 114 | 117 | ?> |
| 115 | 118 | <div class="fct_item_title"> |
| @@ -149,11 +152,10 @@ | ||
| 149 | 152 | |
| 150 | 153 | public function renderImage() |
| 151 | 154 | { |
| 152 | 155 | $image = Arr::get($this->item, 'featured_media'); |
| 153 | - if (!$image) { | |
| 154 | - $image = Vite::getAssetUrl('images/placeholder.svg'); | |
| 155 | - } | |
| 156 | + // Also maps the old generic icon a pre-existing cart row may still store. | |
| 157 | + $image = Helper::productImageOrPlaceholder($image); | |
| 156 | 158 | $href = Arr::get($this->item, 'view_url', ''); |
| 157 | 159 | $altText = sprintf( |
| 158 | 160 | /* translators: %s: product title */ |
| 159 | 161 | __('Image of %s', 'fluent-cart'), Arr::get($this->item, 'title', __('product', 'fluent-cart'))); |