Completed
Push — master ( 8b8334...2005c2 )
by Aimeos
07:11
created

Standard::addNavigationUrls()   B

Complexity

Conditions 6
Paths 4

Size

Total Lines 102
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 102
rs 8.1463
cc 6
eloc 22
nc 4
nop 3

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * @copyright Metaways Infosystems GmbH, 2013
5
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
6
 * @copyright Aimeos (aimeos.org), 2015
7
 * @package Client
8
 * @subpackage Html
9
 */
10
11
12
namespace Aimeos\Client\Html\Checkout\Standard;
13
14
15
/**
16
 * Default implementation of standard checkout HTML client.
17
 *
18
 * @package Client
19
 * @subpackage Html
20
 */
21
class Standard
22
	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24
{
25
	/** client/html/checkout/standard/standard/subparts
26
	 * List of HTML sub-clients rendered within the checkout standard section
27
	 *
28
	 * The output of the frontend is composed of the code generated by the HTML
29
	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
	 * that are responsible for rendering certain sub-parts of the output. The
31
	 * sub-clients can contain HTML clients themselves and therefore a
32
	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
	 * the output that is placed inside the container of its parent.
34
	 *
35
	 * At first, always the HTML code generated by the parent is printed, then
36
	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
	 * determines the order of the output of these sub-clients inside the parent
38
	 * container. If the configured list of clients is
39
	 *
40
	 *  array( "subclient1", "subclient2" )
41
	 *
42
	 * you can easily change the order of the output by reordering the subparts:
43
	 *
44
	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
	 *
46
	 * You can also remove one or more parts if they shouldn't be rendered:
47
	 *
48
	 *  client/html/<clients>/subparts = array( "subclient1" )
49
	 *
50
	 * As the clients only generates structural HTML, the layout defined via CSS
51
	 * should support adding, removing or reordering content by a fluid like
52
	 * design.
53
	 *
54
	 * @param array List of sub-client names
55
	 * @since 2014.03
56
	 * @category Developer
57
	 */
58
	private $subPartPath = 'client/html/checkout/standard/standard/subparts';
59
60
	/** client/html/checkout/standard/address/name
61
	 * Name of the address part used by the checkout standard client implementation
62
	 *
63
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Address\Myname".
64
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
65
	 *
66
	 * @param string Last part of the client class name
67
	 * @since 2014.03
68
	 * @category Developer
69
	 */
70
71
	/** client/html/checkout/standard/delivery/name
72
	 * Name of the delivery part used by the checkout standard client implementation
73
	 *
74
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Delivery\Myname".
75
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
76
	 *
77
	 * @param string Last part of the client class name
78
	 * @since 2014.03
79
	 * @category Developer
80
	 */
81
82
	/** client/html/checkout/standard/payment/name
83
	 * Name of the payment part used by the checkout standard client implementation
84
	 *
85
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Payment\Myname".
86
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
87
	 *
88
	 * @param string Last part of the client class name
89
	 * @since 2014.03
90
	 * @category Developer
91
	 */
92
93
	/** client/html/checkout/standard/summary/name
94
	 * Name of the summary part used by the checkout standard client implementation
95
	 *
96
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Myname".
97
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
98
	 *
99
	 * @param string Last part of the client class name
100
	 * @since 2014.03
101
	 * @category Developer
102
	 */
103
104
	/** client/html/checkout/standard/order/name
105
	 * Name of the order part used by the checkout standard client implementation
106
	 *
107
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Order\Myname".
108
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
109
	 *
110
	 * @param string Last part of the client class name
111
	 * @since 2014.03
112
	 * @category Developer
113
	 */
114
115
	/** client/html/checkout/standard/process/name
116
	 * Name of the process part used by the checkout standard client implementation
117
	 *
118
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Process\Myname".
119
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
120
	 *
121
	 * @param string Last part of the client class name
122
	 * @since 2015.07
123
	 * @category Developer
124
	 */
125
	private $subPartNames = array( 'address', 'delivery', 'payment', 'summary', 'order', 'process' );
126
	private $cache;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
127
128
129
	/**
130
	 * Returns the HTML code for insertion into the body.
131
	 *
132
	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
133
	 * @param array &$tags Result array for the list of tags that are associated to the output
134
	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
135
	 * @return string HTML code
136
	 */
137
	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
138
	{
139
		$context = $this->getContext();
140
		$view = $this->getView();
141
142
		try
143
		{
144
			$view = $this->setViewParams( $view, $tags, $expire );
145
146
			$html = '';
147
			foreach( $this->getSubClients() as $subclient ) {
148
				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
149
			}
150
			$view->standardBody = $html;
151
		}
152
		catch( \Aimeos\Client\Html\Exception $e )
153
		{
154
			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
155
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
156
		}
157
		catch( \Aimeos\Controller\Frontend\Exception $e )
158
		{
159
			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
160
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
161
		}
162
		catch( \Aimeos\MShop\Exception $e )
163
		{
164
			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
165
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
166
		}
167
		catch( \Exception $e )
168
		{
169
			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
170
171
			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
172
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
173
		}
174
175
		/** client/html/checkout/standard/standard/template-body
176
		 * Relative path to the HTML body template of the checkout standard client.
177
		 *
178
		 * The template file contains the HTML code and processing instructions
179
		 * to generate the result shown in the body of the frontend. The
180
		 * configuration string is the path to the template file relative
181
		 * to the templates directory (usually in client/html/templates).
182
		 *
183
		 * You can overwrite the template file configuration in extensions and
184
		 * provide alternative templates. These alternative templates should be
185
		 * named like the default one but with the string "standard" replaced by
186
		 * an unique name. You may use the name of your project for this. If
187
		 * you've implemented an alternative client class as well, "standard"
188
		 * should be replaced by the name of the new class.
189
		 *
190
		 * @param string Relative path to the template creating code for the HTML page body
191
		 * @since 2014.03
192
		 * @category Developer
193
		 * @see client/html/checkout/standard/standard/template-header
194
		 */
195
		$tplconf = 'client/html/checkout/standard/standard/template-body';
196
		$default = 'checkout/standard/body-default.php';
197
198
		return $view->render( $view->config( $tplconf, $default ) );
199
	}
200
201
202
	/**
203
	 * Returns the HTML string for insertion into the header.
204
	 *
205
	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
206
	 * @param array &$tags Result array for the list of tags that are associated to the output
207
	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
208
	 * @return string|null String including HTML tags for the header on error
209
	 */
210
	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
211
	{
212
		try
213
		{
214
			$view = $this->setViewParams( $this->getView(), $tags, $expire );
215
216
			$html = '';
217
			foreach( $this->getSubClients() as $subclient ) {
218
				$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
219
			}
220
			$view->standardHeader = $html;
221
222
			/** client/html/checkout/standard/standard/template-header
223
			 * Relative path to the HTML header template of the checkout standard client.
224
			 *
225
			 * The template file contains the HTML code and processing instructions
226
			 * to generate the HTML code that is inserted into the HTML page header
227
			 * of the rendered page in the frontend. The configuration string is the
228
			 * path to the template file relative to the templates directory (usually
229
			 * in client/html/templates).
230
			 *
231
			 * You can overwrite the template file configuration in extensions and
232
			 * provide alternative templates. These alternative templates should be
233
			 * named like the default one but with the string "standard" replaced by
234
			 * an unique name. You may use the name of your project for this. If
235
			 * you've implemented an alternative client class as well, "standard"
236
			 * should be replaced by the name of the new class.
237
			 *
238
			 * @param string Relative path to the template creating code for the HTML page head
239
			 * @since 2014.03
240
			 * @category Developer
241
			 * @see client/html/checkout/standard/standard/template-body
242
			 */
243
			$tplconf = 'client/html/checkout/standard/standard/template-header';
244
			$default = 'checkout/standard/header-default.php';
245
246
			return $view->render( $view->config( $tplconf, $default ) );
247
		}
248
		catch( \Exception $e )
249
		{
250
			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
251
		}
252
	}
253
254
255
	/**
256
	 * Returns the sub-client given by its name.
257
	 *
258
	 * @param string $type Name of the client type
259
	 * @param string|null $name Name of the sub-client (Default if null)
260
	 * @return \Aimeos\Client\Html\Iface Sub-client object
261
	 */
262
	public function getSubClient( $type, $name = null )
263
	{
264
		/** client/html/checkout/standard/decorators/excludes
265
		 * Excludes decorators added by the "common" option from the checkout standard html client
266
		 *
267
		 * Decorators extend the functionality of a class by adding new aspects
268
		 * (e.g. log what is currently done), executing the methods of the underlying
269
		 * class only in certain conditions (e.g. only for logged in users) or
270
		 * modify what is returned to the caller.
271
		 *
272
		 * This option allows you to remove a decorator added via
273
		 * "client/html/common/decorators/default" before they are wrapped
274
		 * around the html client.
275
		 *
276
		 *  client/html/checkout/standard/decorators/excludes = array( 'decorator1' )
277
		 *
278
		 * This would remove the decorator named "decorator1" from the list of
279
		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
280
		 * "client/html/common/decorators/default" to the html client.
281
		 *
282
		 * @param array List of decorator names
283
		 * @since 2014.05
284
		 * @category Developer
285
		 * @see client/html/common/decorators/default
286
		 * @see client/html/checkout/standard/decorators/global
287
		 * @see client/html/checkout/standard/decorators/local
288
		 */
289
290
		/** client/html/checkout/standard/decorators/global
291
		 * Adds a list of globally available decorators only to the checkout standard html client
292
		 *
293
		 * Decorators extend the functionality of a class by adding new aspects
294
		 * (e.g. log what is currently done), executing the methods of the underlying
295
		 * class only in certain conditions (e.g. only for logged in users) or
296
		 * modify what is returned to the caller.
297
		 *
298
		 * This option allows you to wrap global decorators
299
		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
300
		 *
301
		 *  client/html/checkout/standard/decorators/global = array( 'decorator1' )
302
		 *
303
		 * This would add the decorator named "decorator1" defined by
304
		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
305
		 *
306
		 * @param array List of decorator names
307
		 * @since 2014.05
308
		 * @category Developer
309
		 * @see client/html/common/decorators/default
310
		 * @see client/html/checkout/standard/decorators/excludes
311
		 * @see client/html/checkout/standard/decorators/local
312
		 */
313
314
		/** client/html/checkout/standard/decorators/local
315
		 * Adds a list of local decorators only to the checkout standard html client
316
		 *
317
		 * Decorators extend the functionality of a class by adding new aspects
318
		 * (e.g. log what is currently done), executing the methods of the underlying
319
		 * class only in certain conditions (e.g. only for logged in users) or
320
		 * modify what is returned to the caller.
321
		 *
322
		 * This option allows you to wrap local decorators
323
		 * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client.
324
		 *
325
		 *  client/html/checkout/standard/decorators/local = array( 'decorator2' )
326
		 *
327
		 * This would add the decorator named "decorator2" defined by
328
		 * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client.
329
		 *
330
		 * @param array List of decorator names
331
		 * @since 2014.05
332
		 * @category Developer
333
		 * @see client/html/common/decorators/default
334
		 * @see client/html/checkout/standard/decorators/excludes
335
		 * @see client/html/checkout/standard/decorators/global
336
		 */
337
338
		return $this->createSubClient( 'checkout/standard/' . $type, $name );
339
	}
340
341
342
	/**
343
	 * Processes the input, e.g. store given values.
344
	 * A view must be available and this method doesn't generate any output
345
	 * besides setting view variables.
346
	 */
347
	public function process()
348
	{
349
		$view = $this->getView();
350
		$context = $this->getContext();
351
352
		try
353
		{
354
			parent::process();
355
		}
356
		catch( \Aimeos\Client\Html\Exception $e )
357
		{
358
			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
359
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
360
		}
361
		catch( \Aimeos\Controller\Frontend\Exception $e )
362
		{
363
			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
364
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
365
		}
366
		catch( \Aimeos\MShop\Plugin\Provider\Exception $e )
367
		{
368
			$errors = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
369
			$errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) );
370
371
			$view->summaryErrorCodes = $e->getErrorCodes();
372
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors;
373
		}
374
		catch( \Aimeos\MShop\Exception $e )
375
		{
376
			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
377
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
378
		}
379
		catch( \Exception $e )
380
		{
381
			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
382
383
			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
384
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
385
		}
386
	}
387
388
389
	/**
390
	 * Returns the list of sub-client names configured for the client.
391
	 *
392
	 * @return array List of HTML client names
393
	 */
394
	protected function getSubClientNames()
395
	{
396
		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
397
	}
398
399
400
	/**
401
	 * Sets the necessary parameter values in the view.
402
	 *
403
	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
404
	 * @param array &$tags Result array for the list of tags that are associated to the output
405
	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
406
	 * @return \Aimeos\MW\View\Iface Modified view object
407
	 */
408
	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
409
	{
410
		if( !isset( $this->cache ) )
411
		{
412
			$context = $this->getContext();
413
414
			$basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
415
			$view->standardBasket = $basketCntl->get();
416
417
418
			/** client/html/checkout/standard/url/step-active
419
			 * Name of the checkout process step to jump to if no previous step requires attention
420
			 *
421
			 * The checkout process consists of several steps which are usually
422
			 * displayed one by another to the customer. If the data of a step
423
			 * is already available, then that step is skipped. The active step
424
			 * is the one that is displayed if all other steps are skipped.
425
			 *
426
			 * If one of the previous steps misses some data the customer has
427
			 * to enter, then this step is displayed first. After providing
428
			 * the missing data, the whole series of steps are tested again
429
			 * and if no other step requests attention, the configured active
430
			 * step will be displayed.
431
			 *
432
			 * The order of the steps is determined by the order of sub-parts
433
			 * that are configured for the checkout client.
434
			 *
435
			 * @param string Name of the confirm standard HTML client
436
			 * @since 2014.07
437
			 * @category Developer
438
			 * @category User
439
			 * @see client/html/checkout/standard/standard/subparts
440
			 */
441
			$default = $view->config( 'client/html/checkout/standard/url/step-active', 'summary' );
442
443
			/** client/html/checkout/standard/onepage
444
			 * Shows all named checkout subparts at once for a one page checkout
445
			 *
446
			 * Normally, the checkout process is divided into several steps for entering
447
			 * addresses, select delivery and payment options as well as showing the
448
			 * summary page. This enables dependencies between two steps like showing
449
			 * delivery options based on the address entered by the customer. Furthermore,
450
			 * this is good way to limit the amount of information displayed which is
451
			 * preferred by mobile users.
452
			 *
453
			 * Contrary to that, a one page checkout displays all information on only
454
			 * one page and customers get an immediate overview of which information
455
			 * they have to enter and what options they can select from. This is an
456
			 * advantage if only a very limited amount of information must be entered
457
			 * or if there are almost no options to choose from and no dependencies
458
			 * between exist.
459
			 *
460
			 * Using this config options, shop developers are able to define which
461
			 * checkout subparts are combined to a one page view. Simply add the names
462
			 * of all checkout subparts to the list. Available checkout subparts for
463
			 * a one page checkout are:
464
			 * * address
465
			 * * delivery
466
			 * * payment
467
			 * * summary
468
			 *
469
			 * @param array List of checkout subparts name
470
			 * @since 2015.05
471
			 * @category Developer
472
			 */
473
			$onepage = $view->config( 'client/html/checkout/standard/onepage', array() );
474
			$onestep = array_shift( $onepage ); // keep the first one page step
475
476
			$steps = (array) $context->getConfig()->get( $this->subPartPath, $this->subPartNames );
477
			$steps = array_diff( $steps, $onepage ); // remove all remaining steps in $onepage
478
479
			// use first step if default step isn't available
480
			$default = ( !in_array( $default, $steps ) ? reset( $steps ) : $default );
481
482
			$current = $view->param( 'c_step', $default );
483
			// use $onestep if current step isn't available due to one page layout
484
			$current = ( !in_array( $current, $steps ) ? $onestep : $current );
485
486
			$cpos = $cpos = array_search( $current, $steps );
487
488
			if( !isset( $view->standardStepActive )
489
				|| ( ( $apos = array_search( $view->standardStepActive, $steps ) ) !== false
490
				&& $cpos !== false && $cpos < $apos )
491
			) {
492
				$view->standardStepActive = $current;
493
			}
494
495
			$view->standardSteps = $steps;
496
497
498
			$this->cache = $this->addNavigationUrls( $view, $steps, $view->standardStepActive );
499
		}
500
501
		return $this->cache;
502
	}
503
504
505
	/**
506
	 * Adds the "back" and "next" URLs to the view
507
	 *
508
	 * @param \Aimeos\MW\View\Iface $view View object
509
	 * @param array $steps List of checkout step names
510
	 * @param unknown $activeStep Name of the active step
511
	 * @return \Aimeos\MW\View\Iface Enhanced view object
512
	 * @since 2016.05
513
	 */
514
	protected function addNavigationUrls( \Aimeos\MW\View\Iface $view, array $steps, $activeStep )
515
	{
516
		/** client/html/checkout/standard/url/target
517
		 * Destination of the URL where the controller specified in the URL is known
518
		 *
519
		 * The destination can be a page ID like in a content management system or the
520
		 * module of a software development framework. This "target" must contain or know
521
		 * the controller that should be called by the generated URL.
522
		 *
523
		 * @param string Destination of the URL
524
		 * @since 2014.03
525
		 * @category Developer
526
		 * @see client/html/checkout/standard/url/controller
527
		 * @see client/html/checkout/standard/url/action
528
		 * @see client/html/checkout/standard/url/config
529
		 */
530
		$cTarget = $view->config( 'client/html/checkout/standard/url/target' );
531
532
		/** client/html/checkout/standard/url/controller
533
		 * Name of the controller whose action should be called
534
		 *
535
		 * In Model-View-Controller (MVC) applications, the controller contains the methods
536
		 * that create parts of the output displayed in the generated HTML page. Controller
537
		 * names are usually alpha-numeric.
538
		 *
539
		 * @param string Name of the controller
540
		 * @since 2014.03
541
		 * @category Developer
542
		 * @see client/html/checkout/standard/url/target
543
		 * @see client/html/checkout/standard/url/action
544
		 * @see client/html/checkout/standard/url/config
545
		*/
546
		$cCntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' );
547
548
		/** client/html/checkout/standard/url/action
549
		 * Name of the action that should create the output
550
		 *
551
		 * In Model-View-Controller (MVC) applications, actions are the methods of a
552
		 * controller that create parts of the output displayed in the generated HTML page.
553
		 * Action names are usually alpha-numeric.
554
		 *
555
		 * @param string Name of the action
556
		 * @since 2014.03
557
		 * @category Developer
558
		 * @see client/html/checkout/standard/url/target
559
		 * @see client/html/checkout/standard/url/controller
560
		 * @see client/html/checkout/standard/url/config
561
		*/
562
		$cAction = $view->config( 'client/html/checkout/standard/url/action', 'index' );
563
564
		/** client/html/checkout/standard/url/config
565
		 * Associative list of configuration options used for generating the URL
566
		 *
567
		 * You can specify additional options as key/value pairs used when generating
568
		 * the URLs, like
569
		 *
570
		 *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
571
		 *
572
		 * The available key/value pairs depend on the application that embeds the e-commerce
573
		 * framework. This is because the infrastructure of the application is used for
574
		 * generating the URLs. The full list of available config options is referenced
575
		 * in the "see also" section of this page.
576
		 *
577
		 * @param string Associative list of configuration options
578
		 * @since 2014.03
579
		 * @category Developer
580
		 * @see client/html/checkout/standard/url/target
581
		 * @see client/html/checkout/standard/url/controller
582
		 * @see client/html/checkout/standard/url/action
583
		 * @see client/html/url/config
584
		*/
585
		$cConfig = $view->config( 'client/html/checkout/standard/url/config', array() );
586
587
588
		$bTarget = $view->config( 'client/html/basket/standard/url/target' );
589
		$bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' );
590
		$bAction = $view->config( 'client/html/basket/standard/url/action', 'index' );
591
		$bConfig = $view->config( 'client/html/basket/standard/url/config', array() );
592
593
594
		$step = null;
595
		do {
596
			$lastStep = $step;
597
		}
598
		while( ( $step = array_shift( $steps ) ) !== null && $step !== $activeStep );
599
600
601
		if( $lastStep !== null ) {
602
			$param = array( 'c_step' => $lastStep );
603
			$view->standardUrlBack = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig );
604
		} else {
605
			$view->standardUrlBack = $view->url( $bTarget, $bCntl, $bAction, array(), array(), $bConfig );
606
		}
607
608
		if( !isset( $view->standardUrlNext ) && ( $nextStep = array_shift( $steps ) ) !== null ) {
609
			$param = array( 'c_step' => $nextStep );
610
			$view->standardUrlNext = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig );
611
		}
612
		// don't overwrite $view->standardUrlNext so order step URL is used
613
614
		return $view;
615
	}
616
}