Skip to content

Commit 3d566eb

Browse files
Fix feature test bugs , verify id query get publish product , add category child where category parent doesn't have a product and add breadcump to single product page
1 parent 405e708 commit 3d566eb

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

app/Livewire/Pages/Category/CategoryProducts.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
namespace App\Livewire\Pages\Category;
66

7-
use App\Models\Category;
87
use App\Models\Product;
98
use Illuminate\Contracts\View\View;
10-
use Illuminate\Database\Eloquent\Builder;
119
use Livewire\Component;
10+
use Shopper\Core\Models\Category as ShopperCategory;
1211

1312
final class CategoryProducts extends Component
1413
{
15-
public Category $category;
14+
public ShopperCategory $category;
1615

1716
public function mount(): void
1817
{

app/Livewire/Pages/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function render(): View
3333

3434
return view('livewire.pages.store', [
3535
'products' => $query->paginate(12),
36-
'attributes' => Attribute::with('values')->enabled()->get(),
36+
'attributes' => Attribute::with('values')->scopes(['enabled', 'isFilterable'])->get(),
3737
]);
3838
}
3939
}

resources/views/livewire/category/category-products.blade.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,23 @@
1010
@forelse($products as $product)
1111
<x-products.card :product="$product" />
1212
@empty
13-
<p class="col-span-3 text-center text-gray-500">
14-
{{ __('This is an example of a category product. it does not contain any products.') }}
15-
</p>
13+
<div class="col-span-3 ml-32 space-y-4">
14+
<p class="text-gray-500">{{ __('This is an example of a category product. it does not contain any products.') }}</p>
15+
@if($category->children->isNotEmpty())
16+
<div class="flex flex-col">
17+
@foreach($category->children->filter(function($child) {
18+
return $child->is_enabled;
19+
}) as $child)
20+
<x-link class="flex items-center font-heading text-primary-600 text-md hover:text-primary-800" :href="route('category.products',['category'=> $child->slug])">
21+
{{ $child->name }}
22+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="ml-1 size-4">
23+
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 19.5 15-15m0 0H8.25m11.25 0v11.25" />
24+
</svg>
25+
</x-link>
26+
@endforeach
27+
</div>
28+
@endif
29+
</div>
1630
@endforelse
1731
</div>
1832
</div>

resources/views/livewire/pages/single-product.blade.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<div class="bg-white">
2+
<div class="py-3 bg-white border-b border-gray-200 bg-opacity-80">
3+
<x-container class="flex items-center justify-between px-4">
4+
<nav role="navigation" class="flex items-center">
5+
<!-- -->
6+
</nav>
7+
</x-container>
8+
</div>
9+
210
<div class="pt-10 pb-16 sm:pb-24">
311
<x-container class="max-w-2xl mt-8">
4-
<!-- Product -->
12+
<!-- Product -->
513
<div class="lg:grid lg:grid-cols-2 lg:items-start lg:gap-x-8">
614
<!-- Image gallery -->
715
<div class="flex flex-col">

0 commit comments

Comments
 (0)