Passed
Push — master ( fd781a...b1eaa4 )
by Aimeos
08:26
created

Standard   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A data() 0 15 1
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\Account\History;
12
13
14
/**
15
 * Default implementation of account history HTML client.
16
 *
17
 * @package Client
18
 * @subpackage Html
19
 */
20
class Standard
21
	extends \Aimeos\Client\Html\Common\Client\Summary\Base
22
	implements \Aimeos\Client\Html\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
		$view->historyItems = \Aimeos\Controller\Frontend::create( $this->context(), 'order' )
35
			->uses( ['order/base', 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'] )
36
			->sort( '-order.id' )
37
			->search()
38
			->each( function( $item ) {
39
				$basket = $item->getBaseItem();
40
				$basket->set( 'summaryTaxrates', $this->getTaxRates( $basket ) )
41
					->set( 'summaryNamedTaxes', $this->getNamedTaxes( $basket ) )
42
					->set( 'summaryCostsPayment', $this->getCostsPayment( $basket ) )
43
					->set( 'summaryCostsDelivery', $this->getCostsDelivery( $basket ) );
44
			} );
45
46
		return parent::data( $view, $tags, $expire );
47
	}
48
49
50
	/** client/html/account/history/template-body
51
	 * Relative path to the HTML body template of the account history client.
52
	 *
53
	 * The template file contains the HTML code and processing instructions
54
	 * to generate the result shown in the body of the frontend. The
55
	 * configuration string is the path to the template file relative
56
	 * to the templates directory (usually in client/html/templates).
57
	 *
58
	 * You can overwrite the template file configuration in extensions and
59
	 * provide alternative templates. These alternative templates should be
60
	 * named like the default one but suffixed by
61
	 * an unique name. You may use the name of your project for this. If
62
	 * you've implemented an alternative client class as well, it
63
	 * should be suffixed by the name of the new class.
64
	 *
65
	 * @param string Relative path to the template creating code for the HTML page body
66
	 * @since 2014.03
67
	 * @category Developer
68
	 * @see client/html/account/history/template-header
69
	 */
70
71
	/** client/html/account/history/template-header
72
	 * Relative path to the HTML header template of the account history client.
73
	 *
74
	 * The template file contains the HTML code and processing instructions
75
	 * to generate the HTML code that is inserted into the HTML page header
76
	 * of the rendered page in the frontend. The configuration string is the
77
	 * path to the template file relative to the templates directory (usually
78
	 * in client/html/templates).
79
	 *
80
	 * You can overwrite the template file configuration in extensions and
81
	 * provide alternative templates. These alternative templates should be
82
	 * named like the default one but suffixed by
83
	 * an unique name. You may use the name of your project for this. If
84
	 * you've implemented an alternative client class as well, it
85
	 * should be suffixed by the name of the new class.
86
	 *
87
	 * @param string Relative path to the template creating code for the HTML page head
88
	 * @since 2014.03
89
	 * @category Developer
90
	 * @see client/html/account/history/template-body
91
	 */
92
}
93