|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2012 |
|
6
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2017 |
|
7
|
|
|
* @package Controller |
|
8
|
|
|
* @subpackage Frontend |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
namespace Aimeos\Controller\Frontend\Catalog; |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Default implementation of the catalog frontend controller. |
|
17
|
|
|
* |
|
18
|
|
|
* @package Controller |
|
19
|
|
|
* @subpackage Frontend |
|
20
|
|
|
*/ |
|
21
|
|
|
class Standard |
|
22
|
|
|
extends \Aimeos\Controller\Frontend\Base |
|
23
|
|
|
implements Iface, \Aimeos\Controller\Frontend\Common\Iface |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Returns the default catalog filter |
|
27
|
|
|
* |
|
28
|
|
|
* @return \Aimeos\MW\Criteria\Iface Criteria object for filtering |
|
29
|
|
|
* @since 2017.03 |
|
30
|
|
|
*/ |
|
31
|
|
|
public function createFilter() |
|
32
|
|
|
{ |
|
33
|
|
|
return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->createSearch( true ); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Returns the list of categries that are in the path to the root node including the one specified by its ID. |
|
39
|
|
|
* |
|
40
|
|
|
* @param integer $id Category ID to start from, null for root node |
|
41
|
|
|
* @param string[] $domains Domain names of items that are associated with the categories and that should be fetched too |
|
42
|
|
|
* @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
|
43
|
|
|
* @since 2017.03 |
|
44
|
|
|
*/ |
|
45
|
|
|
public function getPath( $id, array $domains = array( 'text', 'media' ) ) |
|
46
|
|
|
{ |
|
47
|
|
|
return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getPath( $id, $domains ); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Returns the hierarchical catalog tree starting from the given ID. |
|
53
|
|
|
* |
|
54
|
|
|
* @param integer|null $id Category ID to start from, null for root node |
|
55
|
|
|
* @param string[] $domains Domain names of items that are associated with the categories and that should be fetched too |
|
56
|
|
|
* @param integer $level Constant from \Aimeos\MW\Tree\Manager\Base for the depth of the returned tree, LEVEL_ONE for |
|
57
|
|
|
* specific node only, LEVEL_LIST for node and all direct child nodes, LEVEL_TREE for the whole tree |
|
58
|
|
|
* @param \Aimeos\MW\Criteria\Iface|null $search Optional criteria object with conditions |
|
59
|
|
|
* @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
|
60
|
|
|
* @since 2017.03 |
|
61
|
|
|
*/ |
|
62
|
|
|
public function getTree( $id = null, array $domains = array( 'text', 'media' ), |
|
63
|
|
|
$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ) |
|
64
|
|
|
{ |
|
65
|
|
|
return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getTree( $id, $domains, $level, $search ); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|