1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2018 |
6
|
|
|
* @package Controller |
7
|
|
|
* @subpackage Frontend |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\Controller\Frontend\Supplier; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Default implementation of the supplier frontend controller |
16
|
|
|
* |
17
|
|
|
* @package Controller |
18
|
|
|
* @subpackage Frontend |
19
|
|
|
*/ |
20
|
|
|
class Standard |
21
|
|
|
extends \Aimeos\Controller\Frontend\Base |
22
|
|
|
implements Iface, \Aimeos\Controller\Frontend\Common\Iface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Returns the default supplier filter |
26
|
|
|
* |
27
|
|
|
* @param boolean True to add default criteria |
28
|
|
|
* @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
29
|
|
|
* @since 2018.07 |
30
|
|
|
*/ |
31
|
|
|
public function createFilter() |
32
|
|
|
{ |
33
|
|
|
return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' )->createSearch( true ); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Returns the supplier item for the given supplier ID |
39
|
|
|
* |
40
|
|
|
* @param string $id Unique supplier ID |
41
|
|
|
* @param string[] $domains Domain names of items that are associated with the suppliers and that should be fetched too |
42
|
|
|
* @return \Aimeos\MShop\Supplier\Item\Iface Supplier item including the referenced domains items |
43
|
|
|
* @since 2018.07 |
44
|
|
|
*/ |
45
|
|
|
public function getItem( $id, array $domains = array( 'media', 'text' ) ) |
46
|
|
|
{ |
47
|
|
|
return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' )->getItem( $id, $domains, true ); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Returns the supplier items for the given supplier IDs |
53
|
|
|
* |
54
|
|
|
* @param string $ids Unique supplier IDs |
55
|
|
|
* @param string[] $domains Domain names of items that are associated with the suppliers and that should be fetched too |
56
|
|
|
* @return \Aimeos\MShop\Supplier\Item\Iface[] Associative list of supplier item including the referenced domains items |
57
|
|
|
* @since 2018.07 |
58
|
|
|
*/ |
59
|
|
|
public function getItems( array $ids, array $domains = array( 'media', 'text' ) ) |
60
|
|
|
{ |
61
|
|
|
$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' ); |
62
|
|
|
|
63
|
|
|
$filter = $manager->createSearch( true ); |
64
|
|
|
$expr = [ |
65
|
|
|
$filter->compare( '==', 'supplier.id', $ids ), |
66
|
|
|
$filter->getConditions(), |
67
|
|
|
]; |
68
|
|
|
$filter->setConditions( $filter->combine( '&&', $expr ) ); |
69
|
|
|
|
70
|
|
|
return $manager->searchItems( $filter, $domains ); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Returns the suppliers filtered by the given criteria object |
76
|
|
|
* |
77
|
|
|
* @param \Aimeos\MW\Criteria\Iface $filter Critera object which contains the filter conditions |
78
|
|
|
* @param string[] $domains Domain names of items that are associated with the suppliers and that should be fetched too |
79
|
|
|
* @param integer &$total Parameter where the total number of found suppliers will be stored in |
80
|
|
|
* @return array Ordered list of supplier items implementing \Aimeos\MShop\Supplier\Item\Iface |
81
|
|
|
* @since 2018.07 |
82
|
|
|
*/ |
83
|
|
|
public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'text' ), &$total = null ) |
84
|
|
|
{ |
85
|
|
|
return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' )->searchItems( $filter, $domains, $total ); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|