diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 7d45019..4f05fbe 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -74,8 +74,8 @@ class ProductController extends Controller return view($product->view_template, compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); } - // Use landing page template if landing_page_data exists and product type is 'product' - if ($product->type === 'product' && !empty($product->landing_page_data)) { + // Use landing page template if landing_page_data exists + if (!empty($product->landing_page_data)) { return view('front.products.landing', compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); } diff --git a/resources/views/front/products/landing.blade.php b/resources/views/front/products/landing.blade.php index 098cc14..60bad3d 100644 --- a/resources/views/front/products/landing.blade.php +++ b/resources/views/front/products/landing.blade.php @@ -18,8 +18,7 @@ use Illuminate\Support\Facades\Storage; $currentLang = app()->getLocale(); // Helper function to get translated value with fallback - $getTranslated = function($item, $key, $default = '') { - global $currentLang; + $getTranslated = function($item, $key, $default = '') use ($currentLang) { if (isset($item["{$key}_{$currentLang}"])) { return $item["{$key}_{$currentLang}"]; } @@ -34,13 +33,13 @@ use Illuminate\Support\Facades\Storage;
{{ $hero['sub_slogan'] }}
+ @if($subSlogan = $getTranslated($hero, 'sub_slogan')) +{{ $subSlogan }}
@endif{{ $step['description'] }}
+ @if($stepDescription = $getTranslated($step, 'description')) +{{ $stepDescription }}
@endif{{ $step['description'] }}
+ @if($stepDescription = $getTranslated($step, 'description')) +{{ $stepDescription }}
@endif{!! nl2br(e($faq['answer'] ?? '')) !!}
+{!! nl2br(e($getTranslated($faq, 'answer'))) !!}