/
body-standard.php
190 lines (157 loc) · 7.65 KB
/
body-standard.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Metaways Infosystems GmbH, 2014
* @copyright Aimeos (aimeos.org), 2015-2021
*/
$enc = $this->encoder();
/** client/html/account/favorite/url/target
* Destination of the URL where the controller specified in the URL is known
*
* The destination can be a page ID like in a content management system or the
* module of a software development framework. This "target" must contain or know
* the controller that should be called by the generated URL.
*
* @param string Destination of the URL
* @since 2014.09
* @category Developer
* @see client/html/account/favorite/url/controller
* @see client/html/account/favorite/url/action
* @see client/html/account/favorite/url/config
*/
$favTarget = $this->config( 'client/html/account/favorite/url/target' );
/** client/html/account/favorite/url/controller
* Name of the controller whose action should be called
*
* In Model-View-Controller (MVC) applications, the controller contains the methods
* that create parts of the output displayed in the generated HTML page. Controller
* names are usually alpha-numeric.
*
* @param string Name of the controller
* @since 2014.09
* @category Developer
* @see client/html/account/favorite/url/target
* @see client/html/account/favorite/url/action
* @see client/html/account/favorite/url/config
*/
$favController = $this->config( 'client/html/account/favorite/url/controller', 'account' );
/** client/html/account/favorite/url/action
* Name of the action that should create the output
*
* In Model-View-Controller (MVC) applications, actions are the methods of a
* controller that create parts of the output displayed in the generated HTML page.
* Action names are usually alpha-numeric.
*
* @param string Name of the action
* @since 2014.09
* @category Developer
* @see client/html/account/favorite/url/target
* @see client/html/account/favorite/url/controller
* @see client/html/account/favorite/url/config
*/
$favAction = $this->config( 'client/html/account/favorite/url/action', 'favorite' );
/** client/html/account/favorite/url/config
* Associative list of configuration options used for generating the URL
*
* You can specify additional options as key/value pairs used when generating
* the URLs, like
*
* client/html/<clientname>/url/config = array( 'absoluteUri' => true )
*
* The available key/value pairs depend on the application that embeds the e-commerce
* framework. This is because the infrastructure of the application is used for
* generating the URLs. The full list of available config options is referenced
* in the "see also" section of this page.
*
* @param string Associative list of configuration options
* @since 2014.09
* @category Developer
* @see client/html/account/favorite/url/target
* @see client/html/account/favorite/url/controller
* @see client/html/account/favorite/url/action
* @see client/html/url/config
*/
$favConfig = $this->config( 'client/html/account/favorite/url/config', [] );
$detailTarget = $this->config( 'client/html/catalog/detail/url/target' );
$detailController = $this->config( 'client/html/catalog/detail/url/controller', 'catalog' );
$detailAction = $this->config( 'client/html/catalog/detail/url/action', 'detail' );
$detailConfig = $this->config( 'client/html/catalog/detail/url/config', [] );
$detailFilter = array_flip( $this->config( 'client/html/catalog/detail/url/filter', ['d_prodid'] ) );
$optTarget = $this->config( 'client/jsonapi/url/target' );
$optCntl = $this->config( 'client/jsonapi/url/controller', 'jsonapi' );
$optAction = $this->config( 'client/jsonapi/url/action', 'options' );
$optConfig = $this->config( 'client/jsonapi/url/config', [] );
?>
<section class="aimeos account-favorite" data-jsonurl="<?= $enc->attr( $this->url( $optTarget, $optCntl, $optAction, [], [], $optConfig ) ) ?>">
<?php if( ( $errors = $this->get( 'favoriteErrorList', [] ) ) !== [] ) : ?>
<ul class="error-list">
<?php foreach( $errors as $error ) : ?>
<li class="error-item"><?= $enc->html( $error ) ?></li>
<?php endforeach ?>
</ul>
<?php endif ?>
<?php if( !$this->get( 'favoriteItems', map() )->isEmpty() ) : ?>
<h1 class="header"><?= $this->translate( 'client', 'Favorite products' ) ?></h1>
<ul class="favorite-items">
<?php foreach( $this->get( 'favoriteItems', map() )->reverse() as $listItem ) : ?>
<?php if( ( $productItem = $listItem->getRefItem() ) !== null ) : ?>
<li class="favorite-item">
<?php $params = ['fav_action' => 'delete', 'fav_id' => $listItem->getRefId()] + $this->get( 'favoriteParams', [] ) ?>
<form method="POST" action="<?= $enc->attr( $this->url( $favTarget, $favController, $favAction, $params, [], $favConfig ) ) ?>">
<button class="minibutton delete" title="<?= $this->translate( 'client', 'Delete item' ) ?>"></button>
<?= $this->csrf()->formfield() ?>
</form>
<?php $params = array_diff_key( ['d_name' => $productItem->getName( 'url' ), 'd_prodid' => $productItem->getId(), 'd_pos' => ''], $detailFilter ) ?>
<a href="<?= $enc->attr( $this->url( $detailTarget, $detailController, $detailAction, $params, [], $detailConfig ) ) ?>">
<?php $mediaItems = $productItem->getRefItems( 'media', 'default', 'default' ) ?>
<?php if( ( $mediaItem = $mediaItems->first() ) !== null ) : ?>
<div class="media-item" style="background-image: url('<?= $enc->attr( $this->content( $mediaItem->getPreview() ) ) ?>')"></div>
<?php else : ?>
<div class="media-item"></div>
<?php endif ?>
<h3 class="name"><?= $enc->html( $productItem->getName(), $enc::TRUST ) ?></h3>
<div class="price-list">
<?= $this->partial(
$this->config( 'client/html/common/partials/price', 'common/partials/price-standard' ),
array( 'prices' => $productItem->getRefItems( 'price', null, 'default' ) )
) ?>
</div>
</a>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>
<?php if( $this->get( 'favoritePageLast', 1 ) > 1 ) : ?>
<nav class="pagination">
<div class="sort">
<span> </span>
</div>
<div class="browser">
<?php $params = array( 'fav_page' => $this->favoritePageFirst ) + $this->get( 'favoriteParams', [] ) ?>
<a class="first" href="<?= $enc->attr( $this->url( $favTarget, $favController, $favAction, $params, [], $favConfig ) ) ?>">
<?= $enc->html( $this->translate( 'client', '◀◀' ), $enc::TRUST ) ?>
</a>
<?php $params = array( 'fav_page' => $this->favoritePagePrev ) + $this->get( 'favoriteParams', [] ) ?>
<a class="prev" href="<?= $enc->attr( $this->url( $favTarget, $favController, $favAction, $params, [], $favConfig ) ) ?>" rel="prev">
<?= $enc->html( $this->translate( 'client', '◀' ), $enc::TRUST ) ?>
</a>
<span>
<?= $enc->html( sprintf(
$this->translate( 'client', 'Page %1$d of %2$d' ),
$this->get( 'favoritePageCurr', 1 ),
$this->get( 'favoritePageLast', 1 )
) ) ?>
</span>
<?php $params = array( 'fav_page' => $this->favoritePageNext ) + $this->get( 'favoriteParams', [] ) ?>
<a class="next" href="<?= $enc->attr( $this->url( $favTarget, $favController, $favAction, $params, [], $favConfig ) ) ?>" rel="next">
<?= $enc->html( $this->translate( 'client', '▶' ), $enc::TRUST ) ?>
</a>
<?php $params = array( 'fav_page' => $this->favoritePageLast ) + $this->get( 'favoriteParams', [] ) ?>
<a class="last" href="<?= $enc->attr( $this->url( $favTarget, $favController, $favAction, $params, [], $favConfig ) ) ?>">
<?= $enc->html( $this->translate( 'client', '▶▶' ), $enc::TRUST ) ?>
</a>
</div>
</nav>
<?php endif ?>
<?php endif ?>
</section>