Standard   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A data() 0 35 2
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018-2025
6
 * @package Client
7
 * @subpackage Html
8
 */
9
10
11
namespace Aimeos\Client\Html\Catalog\Count\Supplier;
12
13
14
/**
15
 * Default implementation of catalog count supplier 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\Base\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\Base\View\Iface Modified view object
31
	 */
32
	public function data( \Aimeos\Base\View\Iface $view, array &$tags = [], ?string &$expire = null ) : \Aimeos\Base\View\Iface
33
	{
34
		$context = $this->context();
35
		$config = $context->config();
36
37
		/** client/html/catalog/count/supplier/aggregate
38
		 * Enables or disables generating product counts for the supplier catalog filter
39
		 *
40
		 * This configuration option allows shop owners to enable or disable product counts
41
		 * for the supplier section of the catalog filter HTML client.
42
		 *
43
		 * @param boolean Disabled if "0", enabled if "1"
44
		 * @since 2018.07
45
		 */
46
		if( $config->get( 'client/html/catalog/count/supplier/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
				->radius( $view->param( 'f_point', [] ), $view->param( 'f_dist' ) )
54
				->supplier( $view->param( 'f_supid', [] ) )
55
				->allof( $view->param( 'f_attrid', [] ) )
56
				->oneOf( $view->param( 'f_optid', [] ) )
57
				->oneOf( $view->param( 'f_oneid', [] ) )
58
				->text( $view->param( 'f_search' ) )
59
				->price( $view->param( 'f_price' ) )
60
				->slice( 0, 0x7fffffff ) // restricted by mshop/common/manager/aggregate/limit
61
				->sort();
62
63
			$view->supplierCountList = $cntl->aggregate( 'index.supplier.id' );
64
		}
65
66
		return parent::data( $view, $tags, $expire );
67
	}
68
69
70
	/** client/html/catalog/count/supplier/template-body
71
	 * Relative path to the HTML body template of the catalog count supplier client.
72
	 *
73
	 * The template file contains the HTML code and processing instructions
74
	 * to generate the result shown in the body of the frontend. The
75
	 * configuration string is the path to the template file relative
76
	 * to the templates directory (usually in templates/client/html).
77
	 *
78
	 * You can overwrite the template file configuration in extensions and
79
	 * provide alternative templates. These alternative templates should be
80
	 * named like the default one but suffixed by
81
	 * an unique name. You may use the name of your project for this. If
82
	 * you've implemented an alternative client class as well, it
83
	 * should be suffixed by the name of the new class.
84
	 *
85
	 * @param string Relative path to the template creating code for the HTML page body
86
	 * @since 2018.07
87
	 * @see client/html/catalog/count/supplier/template-header
88
	 */
89
}
90