1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license MIT, http://opensource.org/licenses/MIT |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2016 |
6
|
|
|
* @package symfony |
7
|
|
|
* @subpackage Controller |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\ShopBundle\Controller; |
12
|
|
|
|
13
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Aimeos controller for catalog related functionality. |
18
|
|
|
* |
19
|
|
|
* @package symfony |
20
|
|
|
* @subpackage Controller |
21
|
|
|
*/ |
22
|
|
|
class CatalogController extends AbstractController |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Returns the view for the XHR response with the counts for the facetted search. |
26
|
|
|
* |
27
|
|
|
* @return Response Response object containing the generated output |
28
|
|
|
*/ |
29
|
|
|
public function countAction() |
30
|
|
|
{ |
31
|
|
|
$params = $this->get( 'aimeos_page' )->getSections( 'catalog-count' ); |
32
|
|
|
$response = $this->render( 'AimeosShopBundle:Catalog:count.html.twig', $params )->setMaxAge( 300 ); |
33
|
|
|
$response->headers->set( 'Content-Type', 'application/javascript' ); |
34
|
|
|
return $response; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Returns the html for the catalog detail page. |
40
|
|
|
* |
41
|
|
|
* @return Response Response object containing the generated output |
42
|
|
|
*/ |
43
|
|
|
public function detailAction() |
44
|
|
|
{ |
45
|
|
|
$params = $this->get( 'aimeos_page' )->getSections( 'catalog-detail' ); |
46
|
|
|
return $this->render( 'AimeosShopBundle:Catalog:detail.html.twig', $params ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Returns the html for the catalog list page. |
52
|
|
|
* |
53
|
|
|
* @return Response Response object containing the generated output |
54
|
|
|
*/ |
55
|
|
|
public function listAction() |
56
|
|
|
{ |
57
|
|
|
$params = $this->get( 'aimeos_page' )->getSections( 'catalog-list' ); |
58
|
|
|
return $this->render( 'AimeosShopBundle:Catalog:list.html.twig', $params ); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Returns the html for the catalog tree page. |
64
|
|
|
* |
65
|
|
|
* @return Response Response object containing the generated output |
66
|
|
|
*/ |
67
|
|
|
public function treeAction() |
68
|
|
|
{ |
69
|
|
|
$params = $this->get( 'aimeos_page' )->getSections( 'catalog-tree' ); |
70
|
|
|
return $this->render( 'AimeosShopBundle:Catalog:tree.html.twig', $params ); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Returns the html body part for the catalog stock page. |
76
|
|
|
* |
77
|
|
|
* @return Response Response object containing the generated output |
78
|
|
|
*/ |
79
|
|
|
public function stockAction() |
80
|
|
|
{ |
81
|
|
|
$params = $this->get( 'aimeos_page' )->getSections( 'catalog-stock' ); |
82
|
|
|
$response = $this->render( 'AimeosShopBundle:Catalog:stock.html.twig', $params )->setMaxAge( 30 ); |
83
|
|
|
$response->headers->set( 'Content-Type', 'application/javascript' ); |
84
|
|
|
return $response; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Returns the view for the XHR response with the product information for the search suggestion. |
90
|
|
|
* |
91
|
|
|
* @return Response Response object containing the generated output |
92
|
|
|
*/ |
93
|
|
|
public function suggestAction() |
94
|
|
|
{ |
95
|
|
|
$params = $this->get( 'aimeos_page' )->getSections( 'catalog-suggest' ); |
96
|
|
|
$response = $this->render( 'AimeosShopBundle:Catalog:suggest.html.twig', $params ); |
97
|
|
|
$response->headers->set( 'Content-Type', 'application/json' ); |
98
|
|
|
return $response; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Returns the output of the catalog count component |
104
|
|
|
* |
105
|
|
|
* @return Response Response object containing the generated output |
106
|
|
|
*/ |
107
|
|
|
public function countComponentAction() |
108
|
|
|
{ |
109
|
|
|
$response = $this->getOutput( 'catalog/count' )->setMaxAge( 300 ); |
110
|
|
|
$response->headers->set( 'Content-Type', 'application/javascript' ); |
111
|
|
|
return $response; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Returns the output of the catalog detail component |
117
|
|
|
* |
118
|
|
|
* @return Response Response object containing the generated output |
119
|
|
|
*/ |
120
|
|
|
public function detailComponentAction() |
121
|
|
|
{ |
122
|
|
|
return $this->getOutput( 'catalog/detail' ); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Returns the output of the catalog filter component |
128
|
|
|
* |
129
|
|
|
* @return Response Response object containing the generated output |
130
|
|
|
*/ |
131
|
|
|
public function filterComponentAction() |
132
|
|
|
{ |
133
|
|
|
return $this->getOutput( 'catalog/filter' ); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Returns the output of the catalog list component |
139
|
|
|
* |
140
|
|
|
* @return Response Response object containing the generated output |
141
|
|
|
*/ |
142
|
|
|
public function listComponentAction() |
143
|
|
|
{ |
144
|
|
|
return $this->getOutput( 'catalog/lists' ); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Returns the output of the catalog session component |
150
|
|
|
* |
151
|
|
|
* @return Response Response object containing the generated output |
152
|
|
|
*/ |
153
|
|
|
public function sessionComponentAction() |
154
|
|
|
{ |
155
|
|
|
return $this->getOutput( 'catalog/session' ); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Returns the output of the catalog stage component |
161
|
|
|
* |
162
|
|
|
* @return Response Response object containing the generated output |
163
|
|
|
*/ |
164
|
|
|
public function stageComponentAction() |
165
|
|
|
{ |
166
|
|
|
return $this->getOutput( 'catalog/stage' ); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Returns the output of the catalog stock component |
172
|
|
|
* |
173
|
|
|
* @return Response Response object containing the generated output |
174
|
|
|
*/ |
175
|
|
|
public function stockComponentAction() |
176
|
|
|
{ |
177
|
|
|
$response = $this->getOutput( 'catalog/stock' )->setMaxAge( 30 ); |
178
|
|
|
$response->headers->set( 'Content-Type', 'application/javascript' ); |
179
|
|
|
return $response; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Returns the output of the catalog suggest component |
185
|
|
|
* |
186
|
|
|
* @return Response Response object containing the generated output |
187
|
|
|
*/ |
188
|
|
|
public function suggestComponentAction() |
189
|
|
|
{ |
190
|
|
|
$response = $this->getOutput( 'catalog/suggest' ); |
191
|
|
|
$response->headers->set( 'Content-Type', 'application/json' ); |
192
|
|
|
return $response; |
193
|
|
|
} |
194
|
|
|
} |
195
|
|
|
|