1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @license MIT, http://opensource.org/licenses/MIT |
||
5 | * @copyright Aimeos (aimeos.org), 2015-2016 |
||
6 | * @package laravel |
||
7 | * @subpackage Controller |
||
8 | */ |
||
9 | |||
10 | |||
11 | namespace Aimeos\Shop\Controller; |
||
12 | |||
13 | use Aimeos\Shop\Facades\Shop; |
||
14 | use Illuminate\Routing\Controller; |
||
15 | use Illuminate\Support\Facades\Response; |
||
16 | |||
17 | |||
18 | /** |
||
19 | * Aimeos controller for catalog related functionality. |
||
20 | * |
||
21 | * @package laravel |
||
22 | * @subpackage Controller |
||
23 | */ |
||
24 | class CatalogController extends Controller |
||
25 | { |
||
26 | /** |
||
27 | * Returns the view for the XHR response with the counts for the facetted search. |
||
28 | * |
||
29 | * @return \Illuminate\Http\Response Response object with output and headers |
||
30 | */ |
||
31 | public function countAction() |
||
32 | { |
||
33 | foreach( app( 'config' )->get( 'shop.page.catalog-count' ) as $name ) |
||
34 | { |
||
35 | $params['aiheader'][$name] = Shop::get( $name )->getHeader(); |
||
36 | $params['aibody'][$name] = Shop::get( $name )->getBody(); |
||
37 | } |
||
38 | |||
39 | return Response::view( 'shop::catalog.count', $params ) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
40 | ->header( 'Content-Type', 'application/javascript' ) |
||
41 | ->header( 'Cache-Control', 'public, max-age=300' ); |
||
42 | } |
||
43 | |||
44 | |||
45 | /** |
||
46 | * Returns the html for the catalog detail page. |
||
47 | * |
||
48 | * @return \Illuminate\Http\Response Response object with output and headers |
||
49 | */ |
||
50 | public function detailAction() |
||
51 | { |
||
52 | foreach( app( 'config' )->get( 'shop.page.catalog-detail' ) as $name ) |
||
53 | { |
||
54 | $params['aiheader'][$name] = Shop::get( $name )->getHeader(); |
||
55 | $params['aibody'][$name] = Shop::get( $name )->getBody(); |
||
56 | } |
||
57 | |||
58 | return Response::view( 'shop::catalog.detail', $params ) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
59 | ->header( 'Cache-Control', 'private, max-age=10' ); |
||
60 | } |
||
61 | |||
62 | |||
63 | /** |
||
64 | * Returns the html for the catalog home page. |
||
65 | * |
||
66 | * @return \Illuminate\Http\Response Response object with output and headers |
||
67 | */ |
||
68 | public function homeAction() |
||
69 | { |
||
70 | foreach( app( 'config' )->get( 'shop.page.catalog-home' ) as $name ) |
||
71 | { |
||
72 | $params['aiheader'][$name] = Shop::get( $name )->getHeader(); |
||
73 | $params['aibody'][$name] = Shop::get( $name )->getBody(); |
||
74 | } |
||
75 | |||
76 | return Response::view( 'shop::catalog.home', $params ) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
77 | ->header( 'Cache-Control', 'private, max-age=10' ); |
||
78 | } |
||
79 | |||
80 | |||
81 | /** |
||
82 | * Returns the html for the catalog list page. |
||
83 | * |
||
84 | * @return \Illuminate\Http\Response Response object with output and headers |
||
85 | */ |
||
86 | public function listAction() |
||
87 | { |
||
88 | foreach( app( 'config' )->get( 'shop.page.catalog-list' ) as $name ) |
||
89 | { |
||
90 | $params['aiheader'][$name] = Shop::get( $name )->getHeader(); |
||
91 | $params['aibody'][$name] = Shop::get( $name )->getBody(); |
||
92 | } |
||
93 | |||
94 | return Response::view( 'shop::catalog.list', $params ) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
95 | ->header( 'Cache-Control', 'private, max-age=10' ); |
||
96 | } |
||
97 | |||
98 | |||
99 | /** |
||
100 | * Returns the html body part for the catalog stock page. |
||
101 | * |
||
102 | * @return \Illuminate\Http\Response Response object with output and headers |
||
103 | */ |
||
104 | public function stockAction() |
||
105 | { |
||
106 | foreach( app( 'config' )->get( 'shop.page.catalog-stock' ) as $name ) |
||
107 | { |
||
108 | $params['aiheader'][$name] = Shop::get( $name )->getHeader(); |
||
109 | $params['aibody'][$name] = Shop::get( $name )->getBody(); |
||
110 | } |
||
111 | |||
112 | return Response::view( 'shop::catalog.stock', $params ) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
113 | ->header( 'Content-Type', 'application/javascript' ) |
||
114 | ->header( 'Cache-Control', 'public, max-age=30' ); |
||
115 | } |
||
116 | |||
117 | |||
118 | /** |
||
119 | * Returns the view for the XHR response with the product information for the search suggestion. |
||
120 | * |
||
121 | * @return \Illuminate\Http\Response Response object with output and headers |
||
122 | */ |
||
123 | public function suggestAction() |
||
124 | { |
||
125 | foreach( app( 'config' )->get( 'shop.page.catalog-suggest' ) as $name ) |
||
126 | { |
||
127 | $params['aiheader'][$name] = Shop::get( $name )->getHeader(); |
||
128 | $params['aibody'][$name] = Shop::get( $name )->getBody(); |
||
129 | } |
||
130 | |||
131 | return Response::view( 'shop::catalog.suggest', $params ) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
132 | ->header( 'Cache-Control', 'private, max-age=300' ) |
||
133 | ->header( 'Content-Type', 'application/json' ); |
||
134 | } |
||
135 | |||
136 | |||
137 | /** |
||
138 | * Returns the html for the catalog tree page. |
||
139 | * |
||
140 | * @return \Illuminate\Http\Response Response object with output and headers |
||
141 | */ |
||
142 | public function treeAction() |
||
143 | { |
||
144 | foreach( app( 'config' )->get( 'shop.page.catalog-tree' ) as $name ) |
||
145 | { |
||
146 | $params['aiheader'][$name] = Shop::get( $name )->getHeader(); |
||
147 | $params['aibody'][$name] = Shop::get( $name )->getBody(); |
||
148 | } |
||
149 | |||
150 | return Response::view( 'shop::catalog.tree', $params ) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
151 | ->header( 'Cache-Control', 'private, max-age=10' ); |
||
152 | } |
||
153 | } |