File tree Expand file tree Collapse file tree 3 files changed +24
-14
lines changed Expand file tree Collapse file tree 3 files changed +24
-14
lines changed Original file line number Diff line number Diff line change 21
21
max-height : 25em ;
22
22
overflow : hidden;
23
23
}
24
-
25
24
.main .index .thumbnail img {
26
25
height : 160px ;
27
26
}
28
27
29
28
/* PDP styles */
30
29
30
+
31
31
.pdp .index img {
32
32
width : 90% ;
33
33
}
34
34
35
35
/* Category styles */
36
36
.category .index img {
37
- width : 64 px ;
37
+ height : 3 em ;
38
38
}
Original file line number Diff line number Diff line change 4
4
5
5
<div class =" container category index" >
6
6
7
- <div class =" panel panel-info " >
7
+ <div class =" panel panel-default " >
8
8
<div class =" panel-heading" >
9
- <h1 >Items with category: <strong class =" text-primary" >{{ $category } } </strong ></h1 >
9
+ <h2 >Items with category:
10
+ <div class =" dropdown label" >
11
+ <button class =" btn btn-default dropdown-toggle" type =" button" data-toggle =" dropdown" >
12
+ {{ $category } }
13
+ <span class =" caret" ></span >
14
+ </button >
15
+ <ul class =" dropdown-menu" >
16
+ @foreach ( $categories as $cat )
17
+ <li ><a href =" /category?category={{ $cat } }" >{{ $cat } } </a ></li >
18
+ @endforeach
19
+ </ul >
20
+ </div >
21
+ </h2 >
10
22
</div >
11
23
<div class =" panel-body" >
24
+ <div class =" list-group" >
12
25
@foreach ( $products as $product )
13
- <div class =" row" >
14
- <div class =" col-md-1" >
15
- <img src =' {{ $product -> image } }' >
16
- </div >
17
- <div class =" col-md-8" >
18
- <span >{{ $product -> name } } </span >
19
- </div >
20
- </div >
26
+ <a href =" /pdp?productId={{ $product -> id } }" class =" list-group-item" >
27
+ <img src =' {{ $product -> image } }' >
28
+ <p class =" list-group-item-text" >{{ $product -> name } } </p >
29
+ </a >
21
30
@endforeach
31
+ </div >
22
32
</div >
23
33
</div >
24
34
</div >
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public function getProductsWithCategory($categories) {
44
44
foreach ( $ this ->_productData as $ product ) {
45
45
46
46
$ common = array_intersect ($ product ->categories , $ categories );
47
- if ( array_count_values ($ common ) > 0 ) {
47
+ if ( count ($ common ) > 0 ) {
48
48
// there was at least one matching category
49
49
array_push ($ products , $ product );
50
50
}
@@ -64,7 +64,7 @@ public function getAllCategories() {
64
64
$ categories = array_merge ($ categories , $ product ->categories );
65
65
}
66
66
67
- return $ categories ;
67
+ return array_unique ( $ categories) ;
68
68
}
69
69
70
70
};
You can’t perform that action at this time.
0 commit comments