1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2022 |
6
|
|
|
* @package Client |
7
|
|
|
* @subpackage Html |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\Client\Html\Catalog\Count\Attribute; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Default implementation of catalog count attribute HTML client. |
16
|
|
|
* |
17
|
|
|
* @package Client |
18
|
|
|
* @subpackage Html |
19
|
|
|
*/ |
20
|
|
|
class Standard |
21
|
|
|
extends \Aimeos\Client\Html\Catalog\Base |
22
|
|
|
implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Sets the necessary parameter values in the view. |
26
|
|
|
* |
27
|
|
|
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
28
|
|
|
* @param array &$tags Result array for the list of tags that are associated to the output |
29
|
|
|
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
30
|
|
|
* @return \Aimeos\MW\View\Iface Modified view object |
31
|
|
|
*/ |
32
|
|
|
public function data( \Aimeos\MW\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\MW\View\Iface |
33
|
|
|
{ |
34
|
|
|
$context = $this->context(); |
35
|
|
|
$config = $context->config(); |
36
|
|
|
|
37
|
|
|
/** client/html/catalog/count/attribute/aggregate |
38
|
|
|
* Enables or disables generating product counts for the attribute catalog filter |
39
|
|
|
* |
40
|
|
|
* This configuration option allows shop owners to enable or disable product counts |
41
|
|
|
* for the attribute section of the catalog filter HTML client. |
42
|
|
|
* |
43
|
|
|
* @param boolean Disabled if "0", enabled if "1" |
44
|
|
|
* @since 2014.03 |
45
|
|
|
*/ |
46
|
|
|
if( $config->get( 'client/html/catalog/count/attribute/aggregate', true ) == true ) |
47
|
|
|
{ |
48
|
|
|
$startid = $view->config( 'client/html/catalog/filter/tree/startid' ); |
49
|
|
|
$level = $view->config( 'client/html/catalog/lists/levels', \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
50
|
|
|
|
51
|
|
|
$cntl = \Aimeos\Controller\Frontend::create( $context, 'product' ) |
52
|
|
|
->category( $view->param( 'f_catid', $startid ), 'default', $level ) |
53
|
|
|
->supplier( $view->param( 'f_supid', [] ) ) |
54
|
|
|
->allof( $view->param( 'f_attrid', [] ) ) |
55
|
|
|
->oneOf( $view->param( 'f_optid', [] ) ) |
56
|
|
|
->oneOf( $view->param( 'f_oneid', [] ) ) |
57
|
|
|
->text( $view->param( 'f_search' ) ) |
58
|
|
|
->slice( 0, 0x7fffffff ) // restricted by mshop/common/manager/aggregate/limit |
59
|
|
|
->sort(); |
60
|
|
|
|
61
|
|
|
$view->attributeCountList = $cntl->aggregate( 'index.attribute.id' ); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return parent::data( $view, $tags, $expire ); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
/** client/html/catalog/count/attribute/template-body |
69
|
|
|
* Relative path to the HTML body template of the catalog count attribute client. |
70
|
|
|
* |
71
|
|
|
* The template file contains the HTML code and processing instructions |
72
|
|
|
* to generate the result shown in the body of the frontend. The |
73
|
|
|
* configuration string is the path to the template file relative |
74
|
|
|
* to the templates directory (usually in client/html/templates). |
75
|
|
|
* |
76
|
|
|
* You can overwrite the template file configuration in extensions and |
77
|
|
|
* provide alternative templates. These alternative templates should be |
78
|
|
|
* named like the default one but suffixed by |
79
|
|
|
* an unique name. You may use the name of your project for this. If |
80
|
|
|
* you've implemented an alternative client class as well, it |
81
|
|
|
* should be suffixed by the name of the new class. |
82
|
|
|
* |
83
|
|
|
* @param string Relative path to the template creating code for the HTML page body |
84
|
|
|
* @since 2014.03 |
85
|
|
|
* @see client/html/catalog/count/attribute/template-header |
86
|
|
|
*/ |
87
|
|
|
} |
88
|
|
|
|