Passed
Push — master ( fd6974...da0ae9 )
by Aimeos
07:05 queued 04:07
created

Standard::data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 9
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2022
6
 * @package Client
7
 * @subpackage Html
8
 */
9
10
11
namespace Aimeos\Client\Html\Account\Basket;
12
13
14
/**
15
 * Default implementation of account basket HTML client.
16
 *
17
 * @package Client
18
 * @subpackage Html
19
 */
20
class Standard
21
	extends \Aimeos\Client\Html\Base
22
	implements \Aimeos\Client\Html\Iface
23
{
24
	/** client/html/account/basket/name
25
	 * Class name of the used account basket client implementation
26
	 *
27
	 * Each default HTML client can be replace by an alternative imlementation.
28
	 * To use this implementation, you have to set the last part of the class
29
	 * name as configuration value so the client factory knows which class it
30
	 * has to instantiate.
31
	 *
32
	 * For example, if the name of the default class is
33
	 *
34
	 *  \Aimeos\Client\Html\Account\Basket\Standard
35
	 *
36
	 * and you want to replace it with your own version named
37
	 *
38
	 *  \Aimeos\Client\Html\Account\Basket\Mybasket
39
	 *
40
	 * then you have to set the this configuration option:
41
	 *
42
	 *  client/html/account/basket/name = Mybasket
43
	 *
44
	 * The value is the last part of your own class name and it's case sensitive,
45
	 * so take care that the configuration value is exactly named like the last
46
	 * part of the class name.
47
	 *
48
	 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
49
	 * characters are possible! You should always start the last part of the class
50
	 * name with an upper case character and continue only with lower case characters
51
	 * or numbers. Avoid chamel case names like "MyBasket"!
52
	 *
53
	 * @param string Last part of the class name
54
	 * @since 2022.10
55
	 */
56
57
58
	/**
59
	 * Sets the necessary parameter values in the view.
60
	 *
61
	 * @param \Aimeos\Base\View\Iface $view The view object which generates the HTML output
62
	 * @param array &$tags Result array for the list of tags that are associated to the output
63
	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
64
	 * @return \Aimeos\Base\View\Iface Modified view object
65
	 */
66
	public function data( \Aimeos\Base\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\Base\View\Iface
67
	{
68
		$context = $this->context();
69
		$manager = \Aimeos\MShop::create( $context, 'order/basket' );
70
		$filter = $manager->filter()->add( ['order.basket.customerid' => $context->user()] )->order( '-order.basket.mtime' );
71
72
		$view->basketItems = $manager->search( $filter );
73
74
		return parent::data( $view, $tags, $expire );
75
	}
76
77
78
	/** client/html/account/basket/template-body
79
	 * Relative path to the HTML body template of the account basket client.
80
	 *
81
	 * The template file contains the HTML code and processing instructions
82
	 * to generate the result shown in the body of the frontend. The
83
	 * configuration string is the path to the template file relative
84
	 * to the templates directory (usually in client/html/templates).
85
	 *
86
	 * You can overwrite the template file configuration in extensions and
87
	 * provide alternative templates. These alternative templates should be
88
	 * named like the default one but suffixed by
89
	 * an unique name. You may use the name of your project for this. If
90
	 * you've implemented an alternative client class as well, it
91
	 * should be suffixed by the name of the new class.
92
	 *
93
	 * @param string Relative path to the template creating code for the HTML page body
94
	 * @since 2022.10
95
	 * @see client/html/account/basket/template-header
96
	 */
97
98
	/** client/html/account/basket/template-header
99
	 * Relative path to the HTML header template of the account basket client.
100
	 *
101
	 * The template file contains the HTML code and processing instructions
102
	 * to generate the HTML code that is inserted into the HTML page header
103
	 * of the rendered page in the frontend. The configuration string is the
104
	 * path to the template file relative to the templates directory (usually
105
	 * in client/html/templates).
106
	 *
107
	 * You can overwrite the template file configuration in extensions and
108
	 * provide alternative templates. These alternative templates should be
109
	 * named like the default one but suffixed by
110
	 * an unique name. You may use the name of your project for this. If
111
	 * you've implemented an alternative client class as well, it
112
	 * should be suffixed by the name of the new class.
113
	 *
114
	 * @param string Relative path to the template creating code for the HTML page head
115
	 * @since 2022.10
116
	 * @see client/html/account/basket/template-body
117
	 */
118
}
119