{{-- Note: front/products/detail.blade.php is the page that opens when you click on a product in the FRONT home page --}} {{-- $productDetails, categoryDetails and $totalStock are passed in from detail() method in Front/ProductsController.php --}} @extends('front.layout.layout') @section('content') {{-- Star Rating (of a Product) (in the "Reviews" tab) --}}

Detail

{{-- EasyZoom plugin for zooming product images upon hover --}} {{-- My EasyZoom (jQuery image zoom plugin): https://i-like-robots.github.io/EasyZoom/ --}}
{{-- EasyZoom plugin --}}
{{-- EasyZoom plugin --}} {{-- Show the product Alternative images (`image` in `products_images` table) --}} @foreach ($productDetails['images'] as $image) {{-- EasyZoom plugin --}} @endforeach
{{-- My Bootstrap error code in case of wrong current password or the new password and confirm password are not matching: --}} {{-- Determining If An Item Exists In The Session (using has() method): https://laravel.com/docs/9.x/session#determining-if-an-item-exists-in-the-session --}} @if (Session::has('error_message')) @endif {{-- Displaying Laravel Validation Errors: https://laravel.com/docs/9.x/validation#quick-displaying-the-validation-errors --}} @if ($errors->any()) @endif {{-- Displaying The Validation Errors: https://laravel.com/docs/9.x/validation#quick-displaying-the-validation-errors AND https://laravel.com/docs/9.x/blade#validation-errors --}} {{-- Determining If An Item Exists In The Session (using has() method): https://laravel.com/docs/9.x/session#determining-if-an-item-exists-in-the-session --}} {{-- My Bootstrap success message in case of updating admin password is successful: --}} @if (Session::has('success_message')) @endif

{{ $productDetails['product_name'] }} {{-- $productDetails is passed in from detail() method in Front/ProductsController.php --}}

{{-- Breadcrumb --}} {{-- Breadcrumb --}}
{{-- Show/Display the Rating Stars --}} @if ($avgStarRating > 0) {{-- If the product has been rated at least once, show the "Stars" HTML Entities --}} @php $star = 1; while ($star < $avgStarRating): @endphp @php $star++; endwhile; @endphp ({{ $avgRating }}) @endif
Description:

{{ $productDetails['description'] }}

@php $getDiscountPrice = \App\Models\Product::getDiscountPrice($productDetails['id']) @endphp {{-- this will be used by jQuery for getting the respective `price` and `stock` depending on the selected `size` in the {{-- Add to Cart
--}}
{{-- Managing Product Colors (using the `group_code` column in `products` table) --}} @if (count($groupProducts) > 0) {{-- if there's a value for the `group_code` column (in `products` table) for the currently viewed product --}}
Product Colors
@foreach ($groupProducts as $product) @endforeach
@endif
Available Size:
Quantity:
{{-- PIN code Availability Check: check if the PIN code of the user's Delivery Address exists in our database (in both `cod_pincodes` and `prepaid_pincodes`) or not via AJAX. Check front/js/custom.js --}}

Delivery {{-- We'll use that checkPincode HTML id attribute in front/js/custom.js as a handle for jQuery --}}
@if ($productDetails['product_video']) @else Product Video does not exist @endif

Product Details

@php $productFilters = \App\Models\ProductsFilter::productFilters(); // Get ALL the (enabled/active) Filters // dd($productFilters); @endphp @foreach ($productFilters as $filter) {{-- show ALL the (enabled/active) Filters --}} @php // echo '
', var_dump($product), '
'; // exit; // echo '
', var_dump($filter), '
'; // exit; // dd($filter); @endphp @if (isset($productDetails['category_id'])) {{-- which comes from the AJAX call (passed in through the categoryFilters() method in Admin/FilterController.php, and ALSO may come from the if condition above there (in this page) in case of 'Edit Product' (not 'Add a Product') from addEditProduct() method in Admin/ProductsController --}} @php // dd($filter); // Firstly, for every filter in the `products_filters` table, Get the filter's (from the foreach loop) `cat_ids` using filterAvailable() method, then check if the current category id (using the $productDetails['category_id'] variable and depending on the URL) exists in the filter's `cat_ids`. If it exists, then show the filter, if not, then don't show the filter $filterAvailable = \App\Models\ProductsFilter::filterAvailable($filter['id'], $productDetails['category_id']); @endphp @if ($filterAvailable == 'Yes') {{-- if the filter has the current productDetails['category_id'] in its `cat_ids` --}} @endif @endif @endforeach
{{ $filter['filter_name'] }} @foreach ($filter['filter_values'] as $value) {{-- show the related values of the filter of the product --}} @php // echo '
', var_dump($value), '
'; exit; @endphp @if (!empty($productDetails[$filter['filter_column']]) && $productDetails[$filter['filter_column']] == $value['filter_value']) {{-- $value['filter_value'] is like '4GB' --}} {{-- $productDetails[$filter['filter_column']] is like $productDetails['screen_size'] which in turn, may be equal to '5 to 5.4 in' --}} {{ ucwords($value['filter_value']) }} @endif @endforeach
Average Rating

{{ $avgRating }}

Based on {{ count($ratings) }} Reviews
5 Stars
({{ $ratingFiveStarCount }})
4 Stars
({{ $ratingFourStarCount }})
3 Stars
({{ $ratingThreeStarCount }})
2 Stars
({{ $ratingTwoStarCount }})
1 Star
({{ $ratingOneStarCount }})
{{-- Star Rating (of a Product) (in the "Reviews" tab). --}}
@csrf {{-- Preventing CSRF Requests: https://laravel.com/docs/9.x/csrf#preventing-csrf-requests --}}
Your Review matters.
Have you used this product before?
{{-- Star Rating (of a Product) (in the "Reviews" tab). --}}
{{-- --}}
Reviews ({{ count($ratings) }})
{{-- Display/Show user's Ratings --}} @if (count($ratings) > 0) {{-- if there're any ratings for the product --}} @foreach($ratings as $rating)
{{ $rating['user']['name'] }}
{{ date('d-m-Y H:i:s', strtotime($rating['created_at'])) }}
{{-- Show/Display the Star Rating of the Review/Rating --}} @php $count = 0; // Show the stars while ($count < $rating['rating']): // while $count is 0, 1, 2, 3, 4, or 5 Stars @endphp {{-- "BLACK STAR" HTML Entity --}} {{-- HTML Entities: https://www.w3schools.com/html/html_entities.asp --}} @php $count++; endwhile; @endphp

{{ $rating['review'] }}

@endforeach @endif

Similar Products

Recently Viewed Products

@endsection