| @@ -3,11 +3,9 @@ | ||
| 3 | 3 | namespace FluentCart\App\Services\Renderer; |
| 4 | 4 | |
| 5 | 5 | use FluentCart\Api\StoreSettings; |
| 6 | 6 | use FluentCart\Framework\Support\Arr; |
| 7 | -use FluentCart\App\Vite; | |
| 8 | 7 | use FluentCart\App\Helpers\Helper; |
| 9 | -use FluentCart\App\Helpers\AttributeHelper; | |
| 10 | 8 | use FluentCart\App\Helpers\CartCheckoutHelper; |
| 11 | 9 | use FluentCart\App\Models\Product; |
| 12 | 10 | |
| 13 | 11 | class CartRenderer |
| @@ -143,11 +141,10 @@ | ||
| 143 | 141 | { |
| 144 | 142 | $image = Arr::get($this->currentCartItem, 'featured_media'); |
| 145 | 143 | $title = Arr::get($this->currentCartItem, 'title', __('Product Image', 'fluent-cart')); |
| 146 | 144 | |
| 147 | - if (!$image) { | |
| 148 | - $image = Vite::getAssetUrl('images/placeholder.svg'); | |
| 149 | - } | |
| 145 | + // Also maps the old generic icon a pre-existing cart row may still store. | |
| 146 | + $image = Helper::productImageOrPlaceholder($image); | |
| 150 | 147 | |
| 151 | 148 | ?> |
| 152 | 149 | |
| 153 | 150 | <div class="fct-cart-item-image"> |
| @@ -197,20 +194,13 @@ | ||
| 197 | 194 | |
| 198 | 195 | public function renderTitles() |
| 199 | 196 | { |
| 200 | 197 | $postTitle = Arr::get($this->currentCartItem, 'post_title', ''); |
| 201 | - $variationTitle = Arr::get($this->currentCartItem, 'title', ''); | |
| 198 | + // The Cart model already resolves & appends variation_display_title on | |
| 199 | + // every cart item (Cart::getCartDataAttribute), so just read it. | |
| 200 | + $variationTitle = (string) Arr::get($this->currentCartItem, 'variation_display_title', Arr::get($this->currentCartItem, 'title', '')); | |
| 202 | 201 | $variationType = Arr::get($this->currentCartItem, 'variation_type', 'simple'); |
| 203 | 202 | |
| 204 | - // Prefer the labeled attribute combination when the item has a snapshot. | |
| 205 | - $itemAttributes = (array) Arr::get($this->currentCartItem, 'other_info.item_attributes', []); | |
| 206 | - if ($itemAttributes) { | |
| 207 | - $attributesText = AttributeHelper::getDisplayAttributesString($itemAttributes, $this->currentCartItem, 'cart'); | |
| 208 | - if ($attributesText !== '') { | |
| 209 | - $variationTitle = $attributesText; | |
| 210 | - } | |
| 211 | - } | |
| 212 | - | |
| 213 | 203 | $aria_label = sprintf( |
| 214 | 204 | /* translators: 1: Post or product title */ |
| 215 | 205 | esc_attr__('View %1$s', 'fluent-cart'), |
| 216 | 206 | esc_attr($postTitle) |
| @@ -411,9 +401,17 @@ | ||
| 411 | 401 | class="fct-cart-total-wrapper" |
| 412 | 402 | role="region" |
| 413 | 403 | aria-label="<?php esc_attr_e('Cart Total', 'fluent-cart'); ?>" |
| 414 | 404 | > |
| 415 | - <span><?php echo esc_html__('Total', 'fluent-cart'); ?>:</span> | |
| 405 | + <span><?php | |
| 406 | + /** | |
| 407 | + * Filters the cart total label. Lets a caller relabel it without | |
| 408 | + * reimplementing this markup; the default renders exactly as before. | |
| 409 | + * | |
| 410 | + * @param string $label | |
| 411 | + */ | |
| 412 | + echo esc_html(apply_filters('fluent_cart/cart/total_label', __('Total', 'fluent-cart'))); | |
| 413 | + ?></span> | |
| 416 | 414 | <span |
| 417 | 415 | data-fluent-cart-cart-total-price |
| 418 | 416 | aria-live="polite" |
| 419 | 417 | aria-label="<?php echo esc_attr($aria_label); ?>" |
| @@ -456,13 +454,21 @@ | ||
| 456 | 454 | public function renderCheckoutButton() |
| 457 | 455 | { |
| 458 | 456 | ?> |
| 459 | 457 | |
| 460 | - <a class="checkout-button" | |
| 458 | + <a class="checkout-button fct-primary-btn" | |
| 461 | 459 | href="<?php echo esc_attr($this->storeSettings->getCheckoutPage()); ?>" |
| 462 | 460 | role="button" |
| 463 | 461 | aria-label="<?php esc_attr_e('Go to checkout page', 'fluent-cart'); ?>"> |
| 464 | - <?php esc_html_e('Go to Checkout', 'fluent-cart'); ?> | |
| 462 | + <?php | |
| 463 | + /** | |
| 464 | + * Filters the cart checkout button text. Lets a caller relabel it | |
| 465 | + * without reimplementing this markup; the default is unchanged. | |
| 466 | + * | |
| 467 | + * @param string $text | |
| 468 | + */ | |
| 469 | + echo esc_html(apply_filters('fluent_cart/cart/checkout_button_text', __('Go to Checkout', 'fluent-cart'))); | |
| 470 | + ?> | |
| 465 | 471 | </a> |
| 466 | 472 | |
| 467 | 473 | <?php |
| 468 | 474 | |