|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2025 |
|
6
|
|
|
* @package Client |
|
7
|
|
|
* @subpackage Html |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
namespace Aimeos\Client\Html\Checkout\Standard\Process; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
// Strings for translation |
|
15
|
|
|
sprintf( 'process' ); |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Default implementation of checkout process HTML client. |
|
20
|
|
|
* |
|
21
|
|
|
* @package Client |
|
22
|
|
|
* @subpackage Html |
|
23
|
|
|
*/ |
|
24
|
|
|
class Standard |
|
25
|
|
|
extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
26
|
|
|
implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
27
|
|
|
{ |
|
28
|
|
|
/** client/html/checkout/standard/process/subparts |
|
29
|
|
|
* List of HTML sub-clients rendered within the checkout standard process section |
|
30
|
|
|
* |
|
31
|
|
|
* The output of the frontend is composed of the code generated by the HTML |
|
32
|
|
|
* clients. Each HTML client can consist of serveral (or none) sub-clients |
|
33
|
|
|
* that are responsible for rendering certain sub-parts of the output. The |
|
34
|
|
|
* sub-clients can contain HTML clients themselves and therefore a |
|
35
|
|
|
* hierarchical tree of HTML clients is composed. Each HTML client creates |
|
36
|
|
|
* the output that is placed inside the container of its parent. |
|
37
|
|
|
* |
|
38
|
|
|
* At first, always the HTML code generated by the parent is printed, then |
|
39
|
|
|
* the HTML code of its sub-clients. The order of the HTML sub-clients |
|
40
|
|
|
* determines the order of the output of these sub-clients inside the parent |
|
41
|
|
|
* container. If the configured list of clients is |
|
42
|
|
|
* |
|
43
|
|
|
* array( "subclient1", "subclient2" ) |
|
44
|
|
|
* |
|
45
|
|
|
* you can easily change the order of the output by reordering the subparts: |
|
46
|
|
|
* |
|
47
|
|
|
* client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
48
|
|
|
* |
|
49
|
|
|
* You can also remove one or more parts if they shouldn't be rendered: |
|
50
|
|
|
* |
|
51
|
|
|
* client/html/<clients>/subparts = array( "subclient1" ) |
|
52
|
|
|
* |
|
53
|
|
|
* As the clients only generates structural HTML, the layout defined via CSS |
|
54
|
|
|
* should support adding, removing or reordering content by a fluid like |
|
55
|
|
|
* design. |
|
56
|
|
|
* |
|
57
|
|
|
* @param array List of sub-client names |
|
58
|
|
|
* @since 2014.03 |
|
59
|
|
|
*/ |
|
60
|
|
|
private string $subPartPath = 'client/html/checkout/standard/process/subparts'; |
|
61
|
|
|
|
|
62
|
|
|
/** client/html/checkout/standard/process/account/name |
|
63
|
|
|
* Name of the account part used by the checkout standard process client implementation |
|
64
|
|
|
* |
|
65
|
|
|
* Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Process\Account\Myname". |
|
66
|
|
|
* The name is case-sensitive and you should avoid camel case names like "MyName". |
|
67
|
|
|
* |
|
68
|
|
|
* @param string Last part of the client class name |
|
69
|
|
|
* @since 2017.04 |
|
70
|
|
|
*/ |
|
71
|
|
|
|
|
72
|
|
|
/** client/html/checkout/standard/process/address/name |
|
73
|
|
|
* Name of the address part used by the checkout standard process client implementation |
|
74
|
|
|
* |
|
75
|
|
|
* Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Process\Address\Myname". |
|
76
|
|
|
* The name is case-sensitive and you should avoid camel case names like "MyName". |
|
77
|
|
|
* |
|
78
|
|
|
* @param string Last part of the client class name |
|
79
|
|
|
* @since 2017.04 |
|
80
|
|
|
*/ |
|
81
|
|
|
private array $subPartNames = ['account', 'address']; |
|
82
|
|
|
|
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Returns the HTML code for insertion into the body. |
|
86
|
|
|
* |
|
87
|
|
|
* @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
88
|
|
|
* @return string HTML code |
|
89
|
|
|
*/ |
|
90
|
|
|
public function body( string $uid = '' ) : string |
|
91
|
|
|
{ |
|
92
|
|
|
if( $this->view()->get( 'standardStepActive' ) !== 'process' ) { |
|
93
|
|
|
return ''; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
return parent::body( $uid ); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Returns the sub-client given by its name. |
|
102
|
|
|
* |
|
103
|
|
|
* @param string $type Name of the client type |
|
104
|
|
|
* @param string|null $name Name of the sub-client (Default if null) |
|
105
|
|
|
* @return \Aimeos\Client\Html\Iface Sub-client object |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getSubClient( string $type, ?string $name = null ) : \Aimeos\Client\Html\Iface |
|
108
|
|
|
{ |
|
109
|
|
|
/** client/html/checkout/standard/process/decorators/excludes |
|
110
|
|
|
* Excludes decorators added by the "common" option from the checkout standard process html client |
|
111
|
|
|
* |
|
112
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
113
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
114
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
115
|
|
|
* modify what is returned to the caller. |
|
116
|
|
|
* |
|
117
|
|
|
* This option allows you to remove a decorator added via |
|
118
|
|
|
* "client/html/common/decorators/default" before they are wrapped |
|
119
|
|
|
* around the html client. |
|
120
|
|
|
* |
|
121
|
|
|
* client/html/checkout/standard/process/decorators/excludes = array( 'decorator1' ) |
|
122
|
|
|
* |
|
123
|
|
|
* This would remove the decorator named "decorator1" from the list of |
|
124
|
|
|
* common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
125
|
|
|
* "client/html/common/decorators/default" to the html client. |
|
126
|
|
|
* |
|
127
|
|
|
* @param array List of decorator names |
|
128
|
|
|
* @since 2015.08 |
|
129
|
|
|
* @see client/html/common/decorators/default |
|
130
|
|
|
* @see client/html/checkout/standard/process/decorators/global |
|
131
|
|
|
* @see client/html/checkout/standard/process/decorators/local |
|
132
|
|
|
*/ |
|
133
|
|
|
|
|
134
|
|
|
/** client/html/checkout/standard/process/decorators/global |
|
135
|
|
|
* Adds a list of globally available decorators only to the checkout standard process html client |
|
136
|
|
|
* |
|
137
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
138
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
139
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
140
|
|
|
* modify what is returned to the caller. |
|
141
|
|
|
* |
|
142
|
|
|
* This option allows you to wrap global decorators |
|
143
|
|
|
* ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
144
|
|
|
* |
|
145
|
|
|
* client/html/checkout/standard/process/decorators/global = array( 'decorator1' ) |
|
146
|
|
|
* |
|
147
|
|
|
* This would add the decorator named "decorator1" defined by |
|
148
|
|
|
* "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
149
|
|
|
* |
|
150
|
|
|
* @param array List of decorator names |
|
151
|
|
|
* @since 2015.08 |
|
152
|
|
|
* @see client/html/common/decorators/default |
|
153
|
|
|
* @see client/html/checkout/standard/process/decorators/excludes |
|
154
|
|
|
* @see client/html/checkout/standard/process/decorators/local |
|
155
|
|
|
*/ |
|
156
|
|
|
|
|
157
|
|
|
/** client/html/checkout/standard/process/decorators/local |
|
158
|
|
|
* Adds a list of local decorators only to the checkout standard process html client |
|
159
|
|
|
* |
|
160
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
161
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
162
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
163
|
|
|
* modify what is returned to the caller. |
|
164
|
|
|
* |
|
165
|
|
|
* This option allows you to wrap local decorators |
|
166
|
|
|
* ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
167
|
|
|
* |
|
168
|
|
|
* client/html/checkout/standard/process/decorators/local = array( 'decorator2' ) |
|
169
|
|
|
* |
|
170
|
|
|
* This would add the decorator named "decorator2" defined by |
|
171
|
|
|
* "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
172
|
|
|
* |
|
173
|
|
|
* @param array List of decorator names |
|
174
|
|
|
* @since 2015.08 |
|
175
|
|
|
* @see client/html/common/decorators/default |
|
176
|
|
|
* @see client/html/checkout/standard/process/decorators/excludes |
|
177
|
|
|
* @see client/html/checkout/standard/process/decorators/global |
|
178
|
|
|
*/ |
|
179
|
|
|
|
|
180
|
|
|
return $this->createSubClient( 'checkout/standard/process/' . $type, $name ); |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* Processes the input, e.g. store given order. |
|
186
|
|
|
* |
|
187
|
|
|
* A view must be available and this method doesn't generate any output |
|
188
|
|
|
* besides setting view variables. |
|
189
|
|
|
*/ |
|
190
|
|
|
public function init() |
|
191
|
|
|
{ |
|
192
|
|
|
$view = $this->view(); |
|
193
|
|
|
$context = $this->context(); |
|
194
|
|
|
|
|
195
|
|
|
if( $view->param( 'c_step' ) !== 'process' |
|
196
|
|
|
|| $view->get( 'errors', [] ) !== [] |
|
197
|
|
|
|| $view->get( 'standardStepActive' ) !== null |
|
198
|
|
|
) { |
|
199
|
|
|
return true; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
$orderCntl = \Aimeos\Controller\Frontend::create( $context, 'order' ); |
|
203
|
|
|
$basketCntl = \Aimeos\Controller\Frontend::create( $context, 'basket' ); |
|
204
|
|
|
|
|
205
|
|
|
|
|
206
|
|
|
if( $view->param( 'cs_order' ) !== null ) |
|
207
|
|
|
{ |
|
208
|
|
|
parent::init(); |
|
209
|
|
|
|
|
210
|
|
|
$basketCntl->get()->setChannel( 'web' ); |
|
211
|
|
|
$order = $basketCntl->store(); |
|
212
|
|
|
|
|
213
|
|
|
$context->session()->set( 'aimeos/orderid', $order->getId() ); |
|
214
|
|
|
} |
|
215
|
|
|
elseif( ( $orderid = $context->session()->get( 'aimeos/orderid' ) ) !== null ) |
|
216
|
|
|
{ |
|
217
|
|
|
$refs = $context->config()->get( 'mshop/order/manager/subdomains', [] ); |
|
218
|
|
|
$order = $orderCntl->uses( $refs )->get( $orderid, false ); |
|
219
|
|
|
} |
|
220
|
|
|
else |
|
221
|
|
|
{ |
|
222
|
|
|
return; |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
if( ( $form = $this->processPayment( $order ) ) === null ) // no payment service available |
|
226
|
|
|
{ |
|
227
|
|
|
$services = $order->getService( \Aimeos\MShop\Order\Item\Service\Base::TYPE_PAYMENT ); |
|
228
|
|
|
$args = ( $service = reset( $services ) ) ? ['code' => $service->getCode()] : []; |
|
229
|
|
|
|
|
230
|
|
|
$orderCntl->save( $order->setStatusPayment( \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED ) ); |
|
231
|
|
|
$view->standardUrlNext = $this->getUrlConfirm( $view, $args, ['absoluteUri' => true] ); |
|
232
|
|
|
$view->standardMethod = 'POST'; |
|
233
|
|
|
} |
|
234
|
|
|
else |
|
235
|
|
|
{ |
|
236
|
|
|
$this->addFormData( $view, $form ); |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
$orderCntl->save( $order ); |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
|
|
243
|
|
|
/** |
|
244
|
|
|
* Adds the required data for the payment form to the view |
|
245
|
|
|
* |
|
246
|
|
|
* @param \Aimeos\Base\View\Iface $view View object to assign the data to |
|
247
|
|
|
* @param \Aimeos\MShop\Common\Helper\Form\Iface $form Form helper object including the form data |
|
248
|
|
|
* @return \Aimeos\Base\View\Iface View object with assigned data |
|
249
|
|
|
*/ |
|
250
|
|
|
protected function addFormData( \Aimeos\Base\View\Iface $view, \Aimeos\MShop\Common\Helper\Form\Iface $form ) |
|
251
|
|
|
{ |
|
252
|
|
|
$url = $form->getUrl(); |
|
253
|
|
|
|
|
254
|
|
|
if( $form->getMethod() === 'GET' ) |
|
255
|
|
|
{ |
|
256
|
|
|
$urlParams = []; |
|
257
|
|
|
|
|
258
|
|
|
foreach( $form->getValues() as $item ) |
|
259
|
|
|
{ |
|
260
|
|
|
foreach( (array) $item->getDefault() as $key => $value ) { |
|
261
|
|
|
$urlParams[$item->getInternalCode()][$key] = $value; |
|
262
|
|
|
} |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
if( !empty( $urlParams ) ) { |
|
266
|
|
|
$url .= strpos( $url, '?' ) ? '&' : '?' . map( $urlParams )->toUrl(); |
|
267
|
|
|
} |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
$public = $hidden = []; |
|
271
|
|
|
|
|
272
|
|
|
foreach( $form->getValues() as $key => $item ) |
|
273
|
|
|
{ |
|
274
|
|
|
if( $item->isPublic() ) { |
|
275
|
|
|
$public[$key] = $item; |
|
276
|
|
|
} else { |
|
277
|
|
|
$hidden[$key] = $item; |
|
278
|
|
|
} |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
$view->standardUrlNext = $url; |
|
282
|
|
|
$view->standardProcessPublic = $public; |
|
283
|
|
|
$view->standardProcessHidden = $hidden; |
|
284
|
|
|
$view->standardProcessParams = $form->getValues(); |
|
285
|
|
|
$view->standardUrlExternal = $form->getExternal(); |
|
286
|
|
|
$view->standardMethod = $form->getMethod(); |
|
287
|
|
|
$view->standardHtml = $form->getHtml(); |
|
288
|
|
|
|
|
289
|
|
|
return $view; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
|
|
293
|
|
|
/** |
|
294
|
|
|
* Returns the form helper object for building the payment form in the frontend |
|
295
|
|
|
* |
|
296
|
|
|
* @param \Aimeos\MShop\Order\Item\Iface $orderItem Saved order item with basket object |
|
297
|
|
|
* @return \Aimeos\MShop\Common\Helper\Form\Iface|null Form object with URL, parameters, etc. or null if no form data is required |
|
298
|
|
|
*/ |
|
299
|
|
|
protected function processPayment( \Aimeos\MShop\Order\Item\Iface $orderItem ) : ?\Aimeos\MShop\Common\Helper\Form\Iface |
|
300
|
|
|
{ |
|
301
|
|
|
if( $orderItem->getPrice()->getValue() + $orderItem->getPrice()->getCosts() <= 0 |
|
302
|
|
|
&& $this->isSubscription( $orderItem->getProducts() ) === false |
|
303
|
|
|
) { |
|
304
|
|
|
return null; |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
$services = $orderItem->getService( \Aimeos\MShop\Order\Item\Service\Base::TYPE_PAYMENT ); |
|
308
|
|
|
|
|
309
|
|
|
if( ( $service = reset( $services ) ) === false ) { |
|
310
|
|
|
return null; |
|
311
|
|
|
} |
|
312
|
|
|
|
|
313
|
|
|
$view = $this->view(); |
|
314
|
|
|
$conf = ['absoluteUri' => true]; |
|
315
|
|
|
$args = ['code' => $service->getCode()]; |
|
316
|
|
|
$urls = [ |
|
317
|
|
|
'payment.url-self' => $this->getUrlSelf( $view, ['c_step' => 'process'], $conf ), |
|
318
|
|
|
'payment.url-update' => $this->getUrlUpdate( $view, $args + ['orderid' => $orderItem->getId()], $conf ), |
|
319
|
|
|
'payment.url-success' => $this->getUrlConfirm( $view, $args, $conf ), |
|
320
|
|
|
]; |
|
321
|
|
|
|
|
322
|
|
|
$params = array_merge( |
|
323
|
|
|
(array) $view->param(), |
|
324
|
|
|
(array) $view->request()->getQueryParams(), |
|
325
|
|
|
(array) $view->request()->getParsedBody(), |
|
326
|
|
|
(array) $view->request()->getAttributes() |
|
327
|
|
|
); |
|
328
|
|
|
|
|
329
|
|
|
foreach( $service->getAttributeItems() as $item ) { |
|
330
|
|
|
$params[$item->getCode()] = $item->getValue(); |
|
331
|
|
|
} |
|
332
|
|
|
|
|
333
|
|
|
$serviceCntl = \Aimeos\Controller\Frontend::create( $this->context(), 'service' ); |
|
334
|
|
|
return $serviceCntl->process( $orderItem, $service->getServiceId(), $urls, $params ); |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
|
|
338
|
|
|
/** |
|
339
|
|
|
* Returns the list of sub-client names configured for the client. |
|
340
|
|
|
* |
|
341
|
|
|
* @return array List of HTML client names |
|
342
|
|
|
*/ |
|
343
|
|
|
protected function getSubClientNames() : array |
|
344
|
|
|
{ |
|
345
|
|
|
return $this->context()->config()->get( $this->subPartPath, $this->subPartNames ); |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
|
|
349
|
|
|
/** |
|
350
|
|
|
* Returns the URL to the confirm page. |
|
351
|
|
|
* |
|
352
|
|
|
* @param \Aimeos\Base\View\Iface $view View object |
|
353
|
|
|
* @param array $params Parameters that should be part of the URL |
|
354
|
|
|
* @param array $config Default URL configuration |
|
355
|
|
|
* @return string URL string |
|
356
|
|
|
*/ |
|
357
|
|
|
protected function getUrlConfirm( \Aimeos\Base\View\Iface $view, array $params, array $config ) : string |
|
358
|
|
|
{ |
|
359
|
|
|
/** client/html/checkout/confirm/url/target |
|
360
|
|
|
* Destination of the URL where the controller specified in the URL is known |
|
361
|
|
|
* |
|
362
|
|
|
* The destination can be a page ID like in a content management system or the |
|
363
|
|
|
* module of a software development framework. This "target" must contain or know |
|
364
|
|
|
* the controller that should be called by the generated URL. |
|
365
|
|
|
* |
|
366
|
|
|
* @param string Destination of the URL |
|
367
|
|
|
* @since 2014.03 |
|
368
|
|
|
* @see client/html/checkout/confirm/url/controller |
|
369
|
|
|
* @see client/html/checkout/confirm/url/action |
|
370
|
|
|
* @see client/html/checkout/confirm/url/config |
|
371
|
|
|
*/ |
|
372
|
|
|
$target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
373
|
|
|
|
|
374
|
|
|
/** client/html/checkout/confirm/url/controller |
|
375
|
|
|
* Name of the controller whose action should be called |
|
376
|
|
|
* |
|
377
|
|
|
* In Model-View-Controller (MVC) applications, the controller contains the methods |
|
378
|
|
|
* that create parts of the output displayed in the generated HTML page. Controller |
|
379
|
|
|
* names are usually alpha-numeric. |
|
380
|
|
|
* |
|
381
|
|
|
* @param string Name of the controller |
|
382
|
|
|
* @since 2014.03 |
|
383
|
|
|
* @see client/html/checkout/confirm/url/target |
|
384
|
|
|
* @see client/html/checkout/confirm/url/action |
|
385
|
|
|
* @see client/html/checkout/confirm/url/config |
|
386
|
|
|
*/ |
|
387
|
|
|
$cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
388
|
|
|
|
|
389
|
|
|
/** client/html/checkout/confirm/url/action |
|
390
|
|
|
* Name of the action that should create the output |
|
391
|
|
|
* |
|
392
|
|
|
* In Model-View-Controller (MVC) applications, actions are the methods of a |
|
393
|
|
|
* controller that create parts of the output displayed in the generated HTML page. |
|
394
|
|
|
* Action names are usually alpha-numeric. |
|
395
|
|
|
* |
|
396
|
|
|
* @param string Name of the action |
|
397
|
|
|
* @since 2014.03 |
|
398
|
|
|
* @see client/html/checkout/confirm/url/target |
|
399
|
|
|
* @see client/html/checkout/confirm/url/controller |
|
400
|
|
|
* @see client/html/checkout/confirm/url/config |
|
401
|
|
|
*/ |
|
402
|
|
|
$action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
403
|
|
|
|
|
404
|
|
|
/** client/html/checkout/confirm/url/config |
|
405
|
|
|
* Associative list of configuration options used for generating the URL |
|
406
|
|
|
* |
|
407
|
|
|
* You can specify additional options as key/value pairs used when generating |
|
408
|
|
|
* the URLs, like |
|
409
|
|
|
* |
|
410
|
|
|
* client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
411
|
|
|
* |
|
412
|
|
|
* The available key/value pairs depend on the application that embeds the e-commerce |
|
413
|
|
|
* framework. This is because the infrastructure of the application is used for |
|
414
|
|
|
* generating the URLs. The full list of available config options is referenced |
|
415
|
|
|
* in the "see also" section of this page. |
|
416
|
|
|
* |
|
417
|
|
|
* @param string Associative list of configuration options |
|
418
|
|
|
* @since 2014.03 |
|
419
|
|
|
* @see client/html/checkout/confirm/url/target |
|
420
|
|
|
* @see client/html/checkout/confirm/url/controller |
|
421
|
|
|
* @see client/html/checkout/confirm/url/action |
|
422
|
|
|
* @see client/html/url/config |
|
423
|
|
|
*/ |
|
424
|
|
|
$config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
425
|
|
|
|
|
426
|
|
|
return $view->url( $target, $cntl, $action, $params, [], $config ); |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
|
|
430
|
|
|
/** |
|
431
|
|
|
* Returns the URL to the current page. |
|
432
|
|
|
* |
|
433
|
|
|
* @param \Aimeos\Base\View\Iface $view View object |
|
434
|
|
|
* @param array $params Parameters that should be part of the URL |
|
435
|
|
|
* @param array $config Default URL configuration |
|
436
|
|
|
* @return string URL string |
|
437
|
|
|
*/ |
|
438
|
|
|
protected function getUrlSelf( \Aimeos\Base\View\Iface $view, array $params, array $config ) : string |
|
439
|
|
|
{ |
|
440
|
|
|
/** client/html/checkout/standard/url/target |
|
441
|
|
|
* Destination of the URL where the controller specified in the URL is known |
|
442
|
|
|
* |
|
443
|
|
|
* The destination can be a page ID like in a content management system or the |
|
444
|
|
|
* module of a software development framework. This "target" must contain or know |
|
445
|
|
|
* the controller that should be called by the generated URL. |
|
446
|
|
|
* |
|
447
|
|
|
* @param string Destination of the URL |
|
448
|
|
|
* @since 2014.03 |
|
449
|
|
|
* @see client/html/checkout/standard/url/controller |
|
450
|
|
|
* @see client/html/checkout/standard/url/action |
|
451
|
|
|
* @see client/html/checkout/standard/url/config |
|
452
|
|
|
*/ |
|
453
|
|
|
$target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
454
|
|
|
|
|
455
|
|
|
/** client/html/checkout/standard/url/controller |
|
456
|
|
|
* Name of the controller whose action should be called |
|
457
|
|
|
* |
|
458
|
|
|
* In Model-View-Controller (MVC) applications, the controller contains the methods |
|
459
|
|
|
* that create parts of the output displayed in the generated HTML page. Controller |
|
460
|
|
|
* names are usually alpha-numeric. |
|
461
|
|
|
* |
|
462
|
|
|
* @param string Name of the controller |
|
463
|
|
|
* @since 2014.03 |
|
464
|
|
|
* @see client/html/checkout/standard/url/target |
|
465
|
|
|
* @see client/html/checkout/standard/url/action |
|
466
|
|
|
* @see client/html/checkout/standard/url/config |
|
467
|
|
|
*/ |
|
468
|
|
|
$cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
469
|
|
|
|
|
470
|
|
|
/** client/html/checkout/standard/url/action |
|
471
|
|
|
* Name of the action that should create the output |
|
472
|
|
|
* |
|
473
|
|
|
* In Model-View-Controller (MVC) applications, actions are the methods of a |
|
474
|
|
|
* controller that create parts of the output displayed in the generated HTML page. |
|
475
|
|
|
* Action names are usually alpha-numeric. |
|
476
|
|
|
* |
|
477
|
|
|
* @param string Name of the action |
|
478
|
|
|
* @since 2014.03 |
|
479
|
|
|
* @see client/html/checkout/standard/url/target |
|
480
|
|
|
* @see client/html/checkout/standard/url/controller |
|
481
|
|
|
* @see client/html/checkout/standard/url/config |
|
482
|
|
|
*/ |
|
483
|
|
|
$action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
484
|
|
|
|
|
485
|
|
|
/** client/html/checkout/standard/url/config |
|
486
|
|
|
* Associative list of configuration options used for generating the URL |
|
487
|
|
|
* |
|
488
|
|
|
* You can specify additional options as key/value pairs used when generating |
|
489
|
|
|
* the URLs, like |
|
490
|
|
|
* |
|
491
|
|
|
* client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
492
|
|
|
* |
|
493
|
|
|
* The available key/value pairs depend on the application that embeds the e-commerce |
|
494
|
|
|
* framework. This is because the infrastructure of the application is used for |
|
495
|
|
|
* generating the URLs. The full list of available config options is referenced |
|
496
|
|
|
* in the "see also" section of this page. |
|
497
|
|
|
* |
|
498
|
|
|
* @param string Associative list of configuration options |
|
499
|
|
|
* @since 2014.03 |
|
500
|
|
|
* @see client/html/checkout/standard/url/target |
|
501
|
|
|
* @see client/html/checkout/standard/url/controller |
|
502
|
|
|
* @see client/html/checkout/standard/url/action |
|
503
|
|
|
* @see client/html/url/config |
|
504
|
|
|
*/ |
|
505
|
|
|
$config = $view->config( 'client/html/checkout/standard/url/config', $config ); |
|
506
|
|
|
|
|
507
|
|
|
return $view->url( $target, $cntl, $action, $params, [], $config ); |
|
508
|
|
|
} |
|
509
|
|
|
|
|
510
|
|
|
|
|
511
|
|
|
/** |
|
512
|
|
|
* Returns the URL to the update page. |
|
513
|
|
|
* |
|
514
|
|
|
* @param \Aimeos\Base\View\Iface $view View object |
|
515
|
|
|
* @param array $params Parameters that should be part of the URL |
|
516
|
|
|
* @param array $config Default URL configuration |
|
517
|
|
|
* @return string URL string |
|
518
|
|
|
*/ |
|
519
|
|
|
protected function getUrlUpdate( \Aimeos\Base\View\Iface $view, array $params, array $config ) : string |
|
520
|
|
|
{ |
|
521
|
|
|
/** client/html/checkout/update/url/target |
|
522
|
|
|
* Destination of the URL where the controller specified in the URL is known |
|
523
|
|
|
* |
|
524
|
|
|
* The destination can be a page ID like in a content management system or the |
|
525
|
|
|
* module of a software development framework. This "target" must contain or know |
|
526
|
|
|
* the controller that should be called by the generated URL. |
|
527
|
|
|
* |
|
528
|
|
|
* @param string Destination of the URL |
|
529
|
|
|
* @since 2014.03 |
|
530
|
|
|
* @see client/html/checkout/update/url/controller |
|
531
|
|
|
* @see client/html/checkout/update/url/action |
|
532
|
|
|
* @see client/html/checkout/update/url/config |
|
533
|
|
|
*/ |
|
534
|
|
|
$target = $view->config( 'client/html/checkout/update/url/target' ); |
|
535
|
|
|
|
|
536
|
|
|
/** client/html/checkout/update/url/controller |
|
537
|
|
|
* Name of the controller whose action should be called |
|
538
|
|
|
* |
|
539
|
|
|
* In Model-View-Controller (MVC) applications, the controller contains the methods |
|
540
|
|
|
* that create parts of the output displayed in the generated HTML page. Controller |
|
541
|
|
|
* names are usually alpha-numeric. |
|
542
|
|
|
* |
|
543
|
|
|
* @param string Name of the controller |
|
544
|
|
|
* @since 2014.03 |
|
545
|
|
|
* @see client/html/checkout/update/url/target |
|
546
|
|
|
* @see client/html/checkout/update/url/action |
|
547
|
|
|
* @see client/html/checkout/update/url/config |
|
548
|
|
|
*/ |
|
549
|
|
|
$cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
550
|
|
|
|
|
551
|
|
|
/** client/html/checkout/update/url/action |
|
552
|
|
|
* Name of the action that should create the output |
|
553
|
|
|
* |
|
554
|
|
|
* In Model-View-Controller (MVC) applications, actions are the methods of a |
|
555
|
|
|
* controller that create parts of the output displayed in the generated HTML page. |
|
556
|
|
|
* Action names are usually alpha-numeric. |
|
557
|
|
|
* |
|
558
|
|
|
* @param string Name of the action |
|
559
|
|
|
* @since 2014.03 |
|
560
|
|
|
* @see client/html/checkout/update/url/target |
|
561
|
|
|
* @see client/html/checkout/update/url/controller |
|
562
|
|
|
* @see client/html/checkout/update/url/config |
|
563
|
|
|
*/ |
|
564
|
|
|
$action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
565
|
|
|
|
|
566
|
|
|
/** client/html/checkout/update/url/config |
|
567
|
|
|
* Associative list of configuration options used for generating the URL |
|
568
|
|
|
* |
|
569
|
|
|
* You can specify additional options as key/value pairs used when generating |
|
570
|
|
|
* the URLs, like |
|
571
|
|
|
* |
|
572
|
|
|
* client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
573
|
|
|
* |
|
574
|
|
|
* The available key/value pairs depend on the application that embeds the e-commerce |
|
575
|
|
|
* framework. This is because the infrastructure of the application is used for |
|
576
|
|
|
* generating the URLs. The full list of available config options is referenced |
|
577
|
|
|
* in the "see also" section of this page. |
|
578
|
|
|
* |
|
579
|
|
|
* @param string Associative list of configuration options |
|
580
|
|
|
* @since 2014.03 |
|
581
|
|
|
* @see client/html/checkout/update/url/target |
|
582
|
|
|
* @see client/html/checkout/update/url/controller |
|
583
|
|
|
* @see client/html/checkout/update/url/action |
|
584
|
|
|
* @see client/html/url/config |
|
585
|
|
|
*/ |
|
586
|
|
|
$config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
587
|
|
|
|
|
588
|
|
|
return $view->url( $target, $cntl, $action, $params, [], $config ); |
|
589
|
|
|
} |
|
590
|
|
|
|
|
591
|
|
|
|
|
592
|
|
|
/** |
|
593
|
|
|
* Tests if one of the products is a subscription |
|
594
|
|
|
* |
|
595
|
|
|
* @param \Aimeos\Map $products Ordered products implementing \Aimeos\MShop\Order\Item\Product\Iface |
|
596
|
|
|
* @return bool True if at least one product is a subscription, false if not |
|
597
|
|
|
*/ |
|
598
|
|
|
protected function isSubscription( \Aimeos\Map $products ) : bool |
|
599
|
|
|
{ |
|
600
|
|
|
foreach( $products as $orderProduct ) |
|
601
|
|
|
{ |
|
602
|
|
|
if( $orderProduct->getAttributeItem( 'interval', 'config' ) ) { |
|
603
|
|
|
return true; |
|
604
|
|
|
} |
|
605
|
|
|
} |
|
606
|
|
|
|
|
607
|
|
|
return false; |
|
608
|
|
|
} |
|
609
|
|
|
|
|
610
|
|
|
|
|
611
|
|
|
/** |
|
612
|
|
|
* Sets the necessary parameter values in the view. |
|
613
|
|
|
* |
|
614
|
|
|
* @param \Aimeos\Base\View\Iface $view The view object which generates the HTML output |
|
615
|
|
|
* @param array &$tags Result array for the list of tags that are associated to the output |
|
616
|
|
|
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
617
|
|
|
* @return \Aimeos\Base\View\Iface Modified view object |
|
618
|
|
|
*/ |
|
619
|
|
|
public function data( \Aimeos\Base\View\Iface $view, array &$tags = [], ?string &$expire = null ) : \Aimeos\Base\View\Iface |
|
620
|
|
|
{ |
|
621
|
|
|
$view->standardUrlPayment = $this->getUrlSelf( $view, array( 'c_step' => 'payment' ), [] ); |
|
622
|
|
|
|
|
623
|
|
|
return parent::data( $view, $tags, $expire ); |
|
624
|
|
|
} |
|
625
|
|
|
|
|
626
|
|
|
|
|
627
|
|
|
/** client/html/checkout/standard/process/template-body |
|
628
|
|
|
* Relative path to the HTML body template of the checkout standard process client. |
|
629
|
|
|
* |
|
630
|
|
|
* The template file contains the HTML code and processing instructions |
|
631
|
|
|
* to generate the result shown in the body of the frontend. The |
|
632
|
|
|
* configuration string is the path to the template file relative |
|
633
|
|
|
* to the templates directory (usually in templates/client/html). |
|
634
|
|
|
* |
|
635
|
|
|
* You can overwrite the template file configuration in extensions and |
|
636
|
|
|
* provide alternative templates. These alternative templates should be |
|
637
|
|
|
* named like the default one but suffixed by |
|
638
|
|
|
* an unique name. You may use the name of your project for this. If |
|
639
|
|
|
* you've implemented an alternative client class as well, it |
|
640
|
|
|
* should be suffixed by the name of the new class. |
|
641
|
|
|
* |
|
642
|
|
|
* @param string Relative path to the template creating code for the HTML page body |
|
643
|
|
|
* @since 2014.03 |
|
644
|
|
|
* @see client/html/checkout/standard/process/template-header |
|
645
|
|
|
*/ |
|
646
|
|
|
} |
|
647
|
|
|
|