| 1 | <?php |
||
| 20 | abstract class Base |
||
| 21 | implements \Aimeos\Controller\Frontend\Common\Decorator\Iface |
||
|
1 ignored issue
–
show
|
|||
| 22 | { |
||
| 23 | private $context; |
||
| 24 | private $controller; |
||
| 25 | |||
| 26 | |||
| 27 | /** |
||
| 28 | * Initializes the controller decorator. |
||
| 29 | * |
||
| 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
||
| 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
||
| 32 | */ |
||
| 33 | public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
||
| 45 | |||
| 46 | |||
| 47 | /** |
||
| 48 | * Passes unknown methods to wrapped objects. |
||
| 49 | * |
||
| 50 | * @param string $name Name of the method |
||
| 51 | * @param array $param List of method parameter |
||
| 52 | * @return mixed Returns the value of the called method |
||
| 53 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
||
| 54 | */ |
||
| 55 | public function __call( $name, array $param ) |
||
| 59 | |||
| 60 | |||
| 61 | /** |
||
| 62 | * Returns the manager for the given name |
||
| 63 | * |
||
| 64 | * @param string $name Name of the manager |
||
| 65 | * @return \Aimeos\MShop\Common\Manager\Iface Manager object |
||
| 66 | */ |
||
| 67 | public function createManager( $name ) |
||
| 71 | |||
| 72 | |||
| 73 | /** |
||
| 74 | * Returns the default catalog filter |
||
| 75 | * |
||
| 76 | * @param boolean True to add default criteria, e.g. status > 0 |
||
| 77 | * @return \Aimeos\MW\Criteria\Iface Criteria object for filtering |
||
| 78 | * @since 2017.03 |
||
| 79 | */ |
||
| 80 | public function createFilter() |
||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | /** |
||
| 88 | * Returns the list of categries that are in the path to the root node including the one specified by its ID. |
||
| 89 | * |
||
| 90 | * @param integer $id Category ID to start from, null for root node |
||
| 91 | * @param string[] $domains Domain names of items that are associated with the categories and that should be fetched too |
||
| 92 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
||
| 93 | * @since 2017.03 |
||
| 94 | */ |
||
| 95 | public function getPath( $id, array $domains = array( 'text', 'media' ) ) |
||
| 99 | |||
| 100 | |||
| 101 | /** |
||
| 102 | * Returns the hierarchical catalog tree starting from the given ID. |
||
| 103 | * |
||
| 104 | * @param integer|null $id Category ID to start from, null for root node |
||
| 105 | * @param string[] $domains Domain names of items that are associated with the categories and that should be fetched too |
||
| 106 | * @param integer $level Constant from \Aimeos\MW\Tree\Manager\Base for the depth of the returned tree, LEVEL_ONE for |
||
| 107 | * specific node only, LEVEL_LIST for node and all direct child nodes, LEVEL_TREE for the whole tree |
||
| 108 | * @param \Aimeos\MW\Criteria\Iface|null $search Optional criteria object with conditions |
||
| 109 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
||
| 110 | * @since 2017.03 |
||
| 111 | */ |
||
| 112 | public function getTree( $id = null, array $domains = array( 'text', 'media' ), |
||
| 117 | |||
| 118 | |||
| 119 | /** |
||
| 120 | * Returns the default catalog filter |
||
| 121 | * |
||
| 122 | * @param boolean True to add default criteria, e.g. status > 0 |
||
| 123 | * @return \Aimeos\MW\Criteria\Iface Criteria object for filtering |
||
| 124 | * @since 2015.08 |
||
| 125 | * @deprecated Use createFilter() instead |
||
| 126 | */ |
||
| 127 | public function createCatalogFilter( $default = true ) |
||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | /** |
||
| 135 | * Returns the list of categries that are in the path to the root node including the one specified by its ID. |
||
| 136 | * |
||
| 137 | * @param integer $id Category ID to start from, null for root node |
||
| 138 | * @param string[] $domains Domain names of items that are associated with the categories and that should be fetched too |
||
| 139 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
||
| 140 | * @since 2015.08 |
||
| 141 | * @deprecated Use getPath() instead |
||
| 142 | */ |
||
| 143 | public function getCatalogPath( $id, array $domains = array( 'text', 'media' ) ) |
||
| 147 | |||
| 148 | |||
| 149 | /** |
||
| 150 | * Returns the hierarchical catalog tree starting from the given ID. |
||
| 151 | * |
||
| 152 | * @param integer|null $id Category ID to start from, null for root node |
||
| 153 | * @param string[] $domains Domain names of items that are associated with the categories and that should be fetched too |
||
| 154 | * @param integer $level Constant from \Aimeos\MW\Tree\Manager\Base for the depth of the returned tree, LEVEL_ONE for |
||
| 155 | * specific node only, LEVEL_LIST for node and all direct child nodes, LEVEL_TREE for the whole tree |
||
| 156 | * @param \Aimeos\MW\Criteria\Iface|null $search Optional criteria object with conditions |
||
| 157 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
||
| 158 | * @since 2015.08 |
||
| 159 | * @deprecated Use getTree() instead |
||
| 160 | */ |
||
| 161 | public function getCatalogTree( $id = null, array $domains = array( 'text', 'media' ), |
||
| 166 | |||
| 167 | |||
| 168 | /** |
||
| 169 | * Returns the aggregated count of products from the index for the given key. |
||
| 170 | * |
||
| 171 | * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions |
||
| 172 | * @param string $key Search key to aggregate for, e.g. "index.attribute.id" |
||
| 173 | * @return array Associative list of key values as key and the product count for this key as value |
||
| 174 | * @since 2015.08 |
||
| 175 | * @deprecated Use product controller instead |
||
| 176 | */ |
||
| 177 | public function aggregateIndex( \Aimeos\MW\Criteria\Iface $filter, $key ) |
||
| 181 | |||
| 182 | |||
| 183 | /** |
||
| 184 | * Returns the given search filter with the conditions attached for filtering by category. |
||
| 185 | * |
||
| 186 | * @param \Aimeos\MW\Criteria\Iface $search Criteria object used for product search |
||
| 187 | * @param string $catid Selected category by the user |
||
| 188 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
||
| 189 | * @since 2015.08 |
||
| 190 | * @deprecated Use product controller instead |
||
| 191 | */ |
||
| 192 | public function addIndexFilterCategory( \Aimeos\MW\Criteria\Iface $search, $catid ) |
||
| 196 | |||
| 197 | |||
| 198 | /** |
||
| 199 | * Returns the given search filter with the conditions attached for filtering texts. |
||
| 200 | * |
||
| 201 | * @param \Aimeos\MW\Criteria\Iface $search Criteria object used for product search |
||
| 202 | * @param string $input Search string entered by the user |
||
| 203 | * @param string $listtype List type of the text associated to the product, usually "default" |
||
| 204 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
||
| 205 | * @since 2015.08 |
||
| 206 | * @deprecated Use product controller instead |
||
| 207 | */ |
||
| 208 | public function addIndexFilterText( \Aimeos\MW\Criteria\Iface $search, $input, $listtype = 'default' ) |
||
| 212 | |||
| 213 | |||
| 214 | /** |
||
| 215 | * Returns the default index filter. |
||
| 216 | * |
||
| 217 | * @param string|null $sort Sortation of the product list like "name", "code", "price" and "position", null for no sortation |
||
| 218 | * @param string $direction Sort direction of the product list ("+", "-") |
||
| 219 | * @param integer $start Position in the list of found products where to begin retrieving the items |
||
| 220 | * @param integer $size Number of products that should be returned |
||
| 221 | * @param string $listtype Type of the product list, e.g. default, promotion, etc. |
||
| 222 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
||
| 223 | * @since 2015.08 |
||
| 224 | * @deprecated Use product controller instead |
||
| 225 | */ |
||
| 226 | public function createIndexFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
||
| 230 | |||
| 231 | |||
| 232 | /** |
||
| 233 | * Returns a index filter for the given category ID. |
||
| 234 | * |
||
| 235 | * @param integer $catid ID of the category to get the product list from |
||
| 236 | * @param string $sort Sortation of the product list like "name", "price" and "position" |
||
| 237 | * @param string $direction Sort direction of the product list ("+", "-") |
||
| 238 | * @param integer $start Position in the list of found products where to begin retrieving the items |
||
| 239 | * @param integer $size Number of products that should be returned |
||
| 240 | * @param string $listtype Type of the product list, e.g. default, promotion, etc. |
||
| 241 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
||
| 242 | * @since 2015.08 |
||
| 243 | * @deprecated Use product controller instead |
||
| 244 | */ |
||
| 245 | public function createIndexFilterCategory( $catid, $sort = 'position', $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
||
| 249 | |||
| 250 | |||
| 251 | /** |
||
| 252 | * Returns the index filter for the given search string. |
||
| 253 | * |
||
| 254 | * @param string $input Search string entered by the user |
||
| 255 | * @param string $sort Sortation of the product list like "name", "price" and "relevance" |
||
| 256 | * @param string $direction Sort direction of the product list ("+", "-", but not for relevance ) |
||
| 257 | * @param integer $start Position in the list of found products where to begin retrieving the items |
||
| 258 | * @param integer $size Number of products that should be returned |
||
| 259 | * @param string $listtype List type of the text associated to the product, usually "default" |
||
| 260 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
||
| 261 | * @since 2015.08 |
||
| 262 | * @deprecated Use product controller instead |
||
| 263 | */ |
||
| 264 | public function createIndexFilterText( $input, $sort = 'relevance', $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
||
| 268 | |||
| 269 | |||
| 270 | /** |
||
| 271 | * Returns the products from the index filtered by the given criteria object. |
||
| 272 | * |
||
| 273 | * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions |
||
| 274 | * @param string[] $domains Domain names of items that are associated with the products and that should be fetched too |
||
| 275 | * @param integer &$total Parameter where the total number of found products will be stored in |
||
| 276 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
||
| 277 | * @since 2015.08 |
||
| 278 | * @deprecated Use product controller instead |
||
| 279 | */ |
||
| 280 | public function getIndexItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
||
| 284 | |||
| 285 | |||
| 286 | /** |
||
| 287 | * Returns the product item for the given ID if it's available |
||
| 288 | * |
||
| 289 | * @param array $ids List of product IDs |
||
| 290 | * @param array $domains Domain names of items that are associated with the products and that should be fetched too |
||
| 291 | * @return array List of product items implementing \Aimeos\MShop\Product\Item\Iface |
||
| 292 | * @since 2015.08 |
||
| 293 | * @deprecated Use product controller instead |
||
| 294 | */ |
||
| 295 | public function getProductItems( array $ids, array $domains = array( 'media', 'price', 'text' ) ) |
||
| 299 | |||
| 300 | |||
| 301 | /** |
||
| 302 | * Returns text filter for the given search string. |
||
| 303 | * |
||
| 304 | * @param string $input Search string entered by the user |
||
| 305 | * @param string|null $sort Sortation of the product list like "name" and "relevance", null for no sortation |
||
| 306 | * @param string $direction Sort direction of the product list ("+", "-") |
||
| 307 | * @param integer $start Position in the list of found products where to begin retrieving the items |
||
| 308 | * @param integer $size Number of products that should be returned |
||
| 309 | * @param string $listtype List type of the text associated to the product, usually "default" |
||
| 310 | * @param string $type Type of the text like "name", "short", "long", etc. |
||
| 311 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
||
| 312 | * @deprecated Use product controller instead |
||
| 313 | */ |
||
| 314 | public function createTextFilter( $input, $sort = null, $direction = '-', $start = 0, $size = 25, $listtype = 'default', $type = 'name' ) |
||
| 318 | |||
| 319 | |||
| 320 | /** |
||
| 321 | * Returns an list of product text strings matched by the filter. |
||
| 322 | * |
||
| 323 | * @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions |
||
| 324 | * @return array Associative list of the product ID as key and the product text as value |
||
| 325 | * @deprecated Use product controller instead |
||
| 326 | */ |
||
| 327 | public function getTextList( \Aimeos\MW\Criteria\Iface $filter ) |
||
| 331 | |||
| 332 | |||
| 333 | /** |
||
| 334 | * Returns the context item |
||
| 335 | * |
||
| 336 | * @return \Aimeos\MShop\Context\Item\Iface Context item object |
||
| 337 | */ |
||
| 338 | protected function getContext() |
||
| 342 | |||
| 343 | |||
| 344 | /** |
||
| 345 | * Returns the frontend controller |
||
| 346 | * |
||
| 347 | * @return \Aimeos\Controller\Frontend\Catalog\Iface Frontend controller object |
||
| 348 | */ |
||
| 349 | protected function getController() |
||
| 353 | } |
||
| 354 |