1 | <?php |
||
20 | class Standard |
||
21 | extends \Aimeos\Controller\Frontend\Base |
||
22 | implements Iface, \Aimeos\Controller\Frontend\Common\Iface |
||
23 | { |
||
24 | private $conditions = []; |
||
25 | private $domain = 'product'; |
||
26 | private $filter; |
||
27 | private $manager; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * Common initialization for controller classes |
||
32 | * |
||
33 | * @param \Aimeos\MShop\Context\Item\Iface $context Common MShop context object |
||
34 | */ |
||
35 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
||
43 | |||
44 | |||
45 | /** |
||
46 | * Clones objects in controller and resets values |
||
47 | */ |
||
48 | public function __clone() |
||
52 | |||
53 | |||
54 | /** |
||
55 | * Adds attribute IDs for filtering |
||
56 | * |
||
57 | * @param array|string $attrIds Attribute ID or list of IDs |
||
58 | * @return \Aimeos\Controller\Frontend\Attribute\Iface Attribute controller for fluent interface |
||
59 | * @since 2019.04 |
||
60 | */ |
||
61 | public function attribute( $attrIds ) |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Adds generic condition for filtering attributes |
||
73 | * |
||
74 | * @param string $operator Comparison operator, e.g. "==", "!=", "<", "<=", ">=", ">", "=~", "~=" |
||
75 | * @param string $key Search key defined by the attribute manager, e.g. "attribute.status" |
||
76 | * @param array|string $value Value or list of values to compare to |
||
77 | * @return \Aimeos\Controller\Frontend\Attribute\Iface Attribute controller for fluent interface |
||
78 | * @since 2019.04 |
||
79 | */ |
||
80 | public function compare( $operator, $key, $value ) |
||
85 | |||
86 | |||
87 | /** |
||
88 | * Adds the domain of the attributes for filtering |
||
89 | * |
||
90 | * @param string $domain Domain of the attributes |
||
91 | * @return \Aimeos\Controller\Frontend\Attribute\Iface Attribute controller for fluent interface |
||
92 | * @since 2019.04 |
||
93 | */ |
||
94 | public function domain( $domain ) |
||
99 | |||
100 | |||
101 | /** |
||
102 | * Returns the attribute for the given attribute ID |
||
103 | * |
||
104 | * @param string $id Unique attribute ID |
||
105 | * @param string[] $domains Domain names of items that are associated with the attributes and that should be fetched too |
||
106 | * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item including the referenced domains items |
||
107 | * @since 2019.04 |
||
108 | */ |
||
109 | public function get( $id, $domains = ['media', 'price', 'text'] ) |
||
113 | |||
114 | |||
115 | /** |
||
116 | * Returns the attribute for the given attribute code |
||
117 | * |
||
118 | * @param string $code Unique attribute code |
||
119 | * @param string[] $domains Domain names of items that are associated with the attributes and that should be fetched too |
||
120 | * @param string $type Type assigned to the attribute |
||
121 | * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item including the referenced domains items |
||
122 | * @since 2019.04 |
||
123 | */ |
||
124 | public function find( $code, $domains = ['media', 'price', 'text'], $type ) |
||
128 | |||
129 | |||
130 | /** |
||
131 | * Parses the given array and adds the conditions to the list of conditions |
||
132 | * |
||
133 | * @param array $conditions List of conditions, e.g. ['&&' => [['>' => ['attribute.status' => 0]], ['==' => ['attribute.type' => 'color']]]] |
||
134 | * @return \Aimeos\Controller\Frontend\Attribute\Iface Attribute controller for fluent interface |
||
135 | * @since 2019.04 |
||
136 | */ |
||
137 | public function parse( array $conditions ) |
||
142 | |||
143 | |||
144 | /** |
||
145 | * Returns the attributes filtered by the previously assigned conditions |
||
146 | * |
||
147 | * @param string[] $domains Domain names of items that are associated with the attributes and that should be fetched too |
||
148 | * @param integer &$total Parameter where the total number of found attributes will be stored in |
||
149 | * @return \Aimeos\MShop\Attribute\Item\Iface[] Ordered list of attribute items |
||
150 | * @since 2019.04 |
||
151 | */ |
||
152 | public function search( $domains = ['media', 'price', 'text'], &$total = null ) |
||
159 | |||
160 | |||
161 | /** |
||
162 | * Sets the start value and the number of returned attributes for slicing the list of found attributes |
||
163 | * |
||
164 | * @param integer $start Start value of the first attribute in the list |
||
165 | * @param integer $limit Number of returned attributes |
||
166 | * @return \Aimeos\Controller\Frontend\Attribute\Iface Attribute controller for fluent interface |
||
167 | * @since 2019.04 |
||
168 | */ |
||
169 | public function slice( $start, $limit ) |
||
174 | |||
175 | |||
176 | /** |
||
177 | * Sets the sorting of the attribute list |
||
178 | * |
||
179 | * @param string|null $key Sorting of the attribute list like "position" or "-position", null for no sortation |
||
180 | * @return \Aimeos\Controller\Frontend\Attribute\Iface Attribute controller for fluent interface |
||
181 | * @since 2019.04 |
||
182 | */ |
||
183 | public function sort( $key = null ) |
||
210 | |||
211 | |||
212 | /** |
||
213 | * Adds attribute types for filtering |
||
214 | * |
||
215 | * @param array|string $codes Attribute ID or list of IDs |
||
216 | * @return \Aimeos\Controller\Frontend\Attribute\Iface Attribute controller for fluent interface |
||
217 | * @since 2019.04 |
||
218 | */ |
||
219 | public function type( $codes ) |
||
227 | } |
||
228 |