Completed
Push — master ( b9f1e5...5ff555 )
by Aimeos
11:02
created

Standard::addAttachments()   B

Complexity

Conditions 6
Paths 7

Size

Total Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 8.7857
c 0
b 0
f 0
cc 6
nc 7
nop 2
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2014
6
 * @copyright Aimeos (aimeos.org), 2015-2021
7
 * @package Client
8
 * @subpackage Html
9
 */
10
11
12
namespace Aimeos\Client\Html\Email\Delivery;
13
14
15
/**
16
 * Default implementation of delivery emails.
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/email/delivery/subparts
26
	 * List of HTML sub-clients rendered within the email delivery 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/email/delivery/subparts';
59
60
	/** client/html/email/delivery/text/name
61
	 * Name of the text part used by the email delivery client implementation
62
	 *
63
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Email\Delivery\Text\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/email/delivery/html/name
72
	 * Name of the html part used by the email delivery client implementation
73
	 *
74
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Email\Delivery\Html\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
	private $subPartNames = array( 'text', 'html' );
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 getBody( string $uid = '' ) : string
91
	{
92
		$view = $this->getObject()->addData( $this->getView() );
93
94
		$content = '';
95
		foreach( $this->getSubClients() as $subclient ) {
96
			$content .= $subclient->setView( $view )->getBody( $uid );
97
		}
98
		$view->deliveryBody = $content;
99
100
101
		/** client/html/email/delivery/attachments
102
		 * List of file paths whose content should be attached to all delivery e-mails
103
		 *
104
		 * This configuration option allows you to add files to the e-mails that are
105
		 * sent to the customer when the delivery status changes. These files can't be
106
		 * customer specific.
107
		 *
108
		 * @param array List of absolute file paths
109
		 * @since 2016.10
110
		 * @category Developer
111
		 * @category User
112
		 * @see client/html/email/payment/attachments
113
		 */
114
		$files = $view->config( 'client/html/email/delivery/attachments', [] );
115
116
		$this->addAttachments( $view->mail(), $files );
117
118
119
		/** client/html/email/delivery/template-body
120
		 * Relative path to the text body template of the email delivery client.
121
		 *
122
		 * The template file contains the text and processing instructions
123
		 * to generate the result shown in the e-mail. The
124
		 * configuration string is the path to the template file relative
125
		 * to the templates directory (usually in client/html/templates).
126
		 *
127
		 * You can overwrite the template file configuration in extensions and
128
		 * provide alternative templates. These alternative templates should be
129
		 * named like the default one but with the string "standard" replaced by
130
		 * an unique name. You may use the name of your project for this. If
131
		 * you've implemented an alternative client class as well, "standard"
132
		 * should be replaced by the name of the new class.
133
		 *
134
		 * The email delivery text client allows to use a different template for
135
		 * each delivery status value. You can create a template for each delivery
136
		 * status and store it in the "email/delivery/<status number>/" directory
137
		 * below the "templates" directory (usually in client/html/templates). If no
138
		 * specific layout template is found, the common template in the
139
		 * "email/delivery/" directory is used.
140
		 *
141
		 * @param string Relative path to the template creating code for the e-mail body
142
		 * @since 2014.03
143
		 * @category Developer
144
		 * @see client/html/email/delivery/template-header
145
		 */
146
		$tplconf = 'client/html/email/delivery/template-body';
147
148
		$status = $view->extOrderItem->getDeliveryStatus();
149
		$default = array( 'email/delivery/' . $status . '/body-standard', 'email/delivery/body-standard' );
150
151
		return $view->render( $view->config( $tplconf, $default ) );
152
	}
153
154
155
	/**
156
	 * Returns the HTML string for insertion into the header.
157
	 *
158
	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
159
	 * @return string|null String including HTML tags for the header on error
160
	 */
161
	public function getHeader( string $uid = '' ) : ?string
162
	{
163
		$view = $this->getObject()->addData( $this->getView() );
164
165
		$content = '';
166
		foreach( $this->getSubClients() as $subclient ) {
167
			$content .= $subclient->setView( $view )->getHeader( $uid );
168
		}
169
		$view->deliveryHeader = $content;
170
171
172
		$addr = $view->extAddressItem;
173
174
		$msg = $view->mail();
175
		$msg->addHeader( 'X-MailGenerator', 'Aimeos' );
176
		$msg->addTo( $addr->getEMail(), $addr->getFirstName() . ' ' . $addr->getLastName() );
177
178
		$addresses = $view->extOrderBaseItem->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
179
180
		if( ( $billAddr = current( $addresses ) ) !== false && $billAddr->getEMail() != $addr->getEmail() ) {
181
			$msg->addCc( $billAddr->getEMail(), $billAddr->getFirstName() . ' ' . $billAddr->getLastName() );
182
		}
183
184
		/** client/html/email/from-name
185
		 * Name used when sending e-mails
186
		 *
187
		 * The name of the person or e-mail account that is used for sending all
188
		 * shop related emails to customers.
189
		 *
190
		 * @param string Name shown in the e-mail
191
		 * @since 2014.03
192
		 * @category User
193
		 * @see client/html/email/delivery/from-name
194
		 * @see client/html/email/from-email
195
		 * @see client/html/email/reply-email
196
		 * @see client/html/email/bcc-email
197
		 */
198
		$fromName = $view->config( 'client/html/email/from-name' );
199
200
		/** client/html/email/delivery/from-name
201
		 * Name used when sending delivery e-mails
202
		 *
203
		 * The name of the person or e-mail account that is used for sending all
204
		 * shop related delivery e-mails to customers. This configuration option
205
		 * overwrites the name set in "client/html/email/from-name".
206
		 *
207
		 * @param string Name shown in the e-mail
208
		 * @since 2014.03
209
		 * @category User
210
		 * @see client/html/email/from-name
211
		 * @see client/html/email/from-email
212
		 * @see client/html/email/reply-email
213
		 * @see client/html/email/bcc-email
214
		 */
215
		$fromNameDelivery = $view->config( 'client/html/email/delivery/from-name', $fromName );
216
217
		/** client/html/email/from-email
218
		 * E-Mail address used when sending e-mails
219
		 *
220
		 * The e-mail address of the person or account that is used for sending
221
		 * all shop related emails to customers.
222
		 *
223
		 * @param string E-mail address
224
		 * @since 2014.03
225
		 * @category User
226
		 * @see client/html/email/from-name
227
		 * @see client/html/email/delivery/from-email
228
		 * @see client/html/email/reply-email
229
		 * @see client/html/email/bcc-email
230
		 */
231
		$fromEmail = $view->config( 'client/html/email/from-email' );
232
233
		/** client/html/email/delivery/from-email
234
		 * E-Mail address used when sending delivery e-mails
235
		 *
236
		 * The e-mail address of the person or account that is used for sending
237
		 * all shop related delivery emails to customers. This configuration option
238
		 * overwrites the e-mail address set via "client/html/email/from-email".
239
		 *
240
		 * @param string E-mail address
241
		 * @since 2014.03
242
		 * @category User
243
		 * @see client/html/email/delivery/from-name
244
		 * @see client/html/email/from-email
245
		 * @see client/html/email/reply-email
246
		 * @see client/html/email/bcc-email
247
		 */
248
		if( ( $fromEmailDelivery = $view->config( 'client/html/email/delivery/from-email', $fromEmail ) ) != null ) {
249
			$msg->addFrom( $fromEmailDelivery, $fromNameDelivery );
250
		}
251
252
253
		/** client/html/email/reply-name
254
		 * Recipient name displayed when the customer replies to e-mails
255
		 *
256
		 * The name of the person or e-mail account the customer should
257
		 * reply to in case of questions or problems. If no reply name is
258
		 * configured, the name person or e-mail account set via
259
		 * "client/html/email/from-name" is used.
260
		 *
261
		 * @param string Name shown in the e-mail
262
		 * @since 2014.03
263
		 * @category User
264
		 * @see client/html/email/reply-email
265
		 * @see client/html/email/delivery/reply-email
266
		 * @see client/html/email/from-email
267
		 * @see client/html/email/from-name
268
		 * @see client/html/email/bcc-email
269
		 */
270
		$replyName = $view->config( 'client/html/email/reply-name', $fromName );
271
272
		/** client/html/email/delivery/reply-name
273
		 * Recipient name displayed when the customer replies to delivery e-mails
274
		 *
275
		 * The name of the person or e-mail account the customer should
276
		 * reply to in case of questions or problems. This configuration option
277
		 * overwrites the name set via "client/html/email/reply-name".
278
		 *
279
		 * @param string Name shown in the e-mail
280
		 * @since 2014.03
281
		 * @category User
282
		 * @see client/html/email/delivery/reply-email
283
		 * @see client/html/email/reply-name
284
		 * @see client/html/email/reply-email
285
		 * @see client/html/email/from-email
286
		 * @see client/html/email/bcc-email
287
		 */
288
		$replyNameDelivery = $view->config( 'client/html/email/delivery/reply-name', $replyName );
289
290
		/** client/html/email/reply-email
291
		 * E-Mail address used by the customer when replying to e-mails
292
		 *
293
		 * The e-mail address of the person or e-mail account the customer
294
		 * should reply to in case of questions or problems.
295
		 *
296
		 * @param string E-mail address
297
		 * @since 2014.03
298
		 * @category User
299
		 * @see client/html/email/reply-name
300
		 * @see client/html/email/delivery/reply-email
301
		 * @see client/html/email/from-email
302
		 * @see client/html/email/bcc-email
303
		 */
304
		$replyEmail = $view->config( 'client/html/email/reply-email', $fromEmail );
305
306
		/** client/html/email/delivery/reply-email
307
		 * E-Mail address used by the customer when replying to delivery e-mails
308
		 *
309
		 * The e-mail address of the person or e-mail account the customer
310
		 * should reply to in case of questions or problems. This configuration
311
		 * option overwrites the e-mail address set via "client/html/email/reply-email".
312
		 *
313
		 * @param string E-mail address
314
		 * @since 2014.03
315
		 * @category User
316
		 * @see client/html/email/delivery/reply-name
317
		 * @see client/html/email/reply-email
318
		 * @see client/html/email/from-email
319
		 * @see client/html/email/bcc-email
320
		 */
321
		if( ( $replyEmailDelivery = $view->config( 'client/html/email/delivery/reply-email', $replyEmail ) ) != null ) {
322
			$msg->addReplyTo( $replyEmailDelivery, $replyNameDelivery );
323
		}
324
325
326
		/** client/html/email/bcc-email
327
		 * E-Mail address all e-mails should be also sent to
328
		 *
329
		 * Using this option you can send a copy of all shop related e-mails to
330
		 * a second e-mail account. This can be handy for testing and checking
331
		 * the e-mails sent to customers.
332
		 *
333
		 * It also allows shop owners with a very small volume of orders to be
334
		 * notified about new orders. Be aware that this isn't useful if the
335
		 * order volumne is high or has peeks!
336
		 *
337
		 * @param string E-mail address
338
		 * @since 2014.03
339
		 * @category User
340
		 * @category Developer
341
		 * @see client/html/email/delivery/bcc-email
342
		 * @see client/html/email/reply-email
343
		 * @see client/html/email/from-email
344
		 */
345
		$bccEmail = $view->config( 'client/html/email/bcc-email' );
346
347
		/** client/html/email/delivery/bcc-email
348
		 * E-Mail address all delivery e-mails should be also sent to
349
		 *
350
		 * Using this option you can send a copy of all delivery related e-mails
351
		 * to a second e-mail account. This can be handy for testing and checking
352
		 * the e-mails sent to customers.
353
		 *
354
		 * It also allows shop owners with a very small volume of orders to be
355
		 * notified about new orders. Be aware that this isn't useful if the
356
		 * order volumne is high or has peeks!
357
		 *
358
		 * This configuration option overwrites the e-mail address set via
359
		 * "client/html/email/bcc-email".
360
		 *
361
		 * @param string|array E-mail address or list of e-mail addresses
362
		 * @since 2014.03
363
		 * @category User
364
		 * @category Developer
365
		 * @see client/html/email/bcc-email
366
		 * @see client/html/email/reply-email
367
		 * @see client/html/email/from-email
368
		 */
369
		if( ( $bccEmailDelivery = $view->config( 'client/html/email/delivery/bcc-email', $bccEmail ) ) != null )
370
		{
371
			foreach( (array) $bccEmailDelivery as $emailAddr ) {
372
				$msg->addBcc( $emailAddr );
373
			}
374
		}
375
376
377
		/** client/html/email/delivery/template-header
378
		 * Relative path to the text header template of the email delivery client.
379
		 *
380
		 * The template file contains the text and processing instructions
381
		 * to generate the text that is inserted into the header
382
		 * of the e-mail. The configuration string is the
383
		 * path to the template file relative to the templates directory (usually
384
		 * in client/html/templates).
385
		 *
386
		 * You can overwrite the template file configuration in extensions and
387
		 * provide alternative templates. These alternative templates should be
388
		 * named like the default one but with the string "standard" replaced by
389
		 * an unique name. You may use the name of your project for this. If
390
		 * you've implemented an alternative client class as well, "standard"
391
		 * should be replaced by the name of the new class.
392
		 *
393
		 * The email payment text client allows to use a different template for
394
		 * each payment status value. You can create a template for each payment
395
		 * status and store it in the "email/payment/<status number>/" directory
396
		 * below the "templates" directory (usually in client/html/templates). If no
397
		 * specific layout template is found, the common template in the
398
		 * "email/payment/" directory is used.
399
		 *
400
		 * @param string Relative path to the template creating code for the e-mail header
401
		 * @since 2014.03
402
		 * @category Developer
403
		 * @see client/html/email/delivery/template-body
404
		 */
405
		$tplconf = 'client/html/email/delivery/template-header';
406
407
		$status = $view->extOrderItem->getDeliveryStatus();
408
		$default = array( 'email/delivery/' . $status . '/header-standard', 'email/delivery/header-standard' );
409
410
		return $view->render( $view->config( $tplconf, $default ) ); ;
411
	}
412
413
414
	/**
415
	 * Returns the sub-client given by its name.
416
	 *
417
	 * @param string $type Name of the client type
418
	 * @param string|null $name Name of the sub-client (Default if null)
419
	 * @return \Aimeos\Client\Html\Iface Sub-client object
420
	 */
421
	public function getSubClient( string $type, string $name = null ) : \Aimeos\Client\Html\Iface
422
	{
423
		/** client/html/email/delivery/decorators/excludes
424
		 * Excludes decorators added by the "common" option from the email delivery html client
425
		 *
426
		 * Decorators extend the functionality of a class by adding new aspects
427
		 * (e.g. log what is currently done), executing the methods of the underlying
428
		 * class only in certain conditions (e.g. only for logged in users) or
429
		 * modify what is returned to the caller.
430
		 *
431
		 * This option allows you to remove a decorator added via
432
		 * "client/html/common/decorators/default" before they are wrapped
433
		 * around the html client.
434
		 *
435
		 *  client/html/email/delivery/decorators/excludes = array( 'decorator1' )
436
		 *
437
		 * This would remove the decorator named "decorator1" from the list of
438
		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
439
		 * "client/html/common/decorators/default" to the html client.
440
		 *
441
		 * @param array List of decorator names
442
		 * @since 2014.05
443
		 * @category Developer
444
		 * @see client/html/common/decorators/default
445
		 * @see client/html/email/delivery/decorators/global
446
		 * @see client/html/email/delivery/decorators/local
447
		 */
448
449
		/** client/html/email/delivery/decorators/global
450
		 * Adds a list of globally available decorators only to the email delivery html client
451
		 *
452
		 * Decorators extend the functionality of a class by adding new aspects
453
		 * (e.g. log what is currently done), executing the methods of the underlying
454
		 * class only in certain conditions (e.g. only for logged in users) or
455
		 * modify what is returned to the caller.
456
		 *
457
		 * This option allows you to wrap global decorators
458
		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
459
		 *
460
		 *  client/html/email/delivery/decorators/global = array( 'decorator1' )
461
		 *
462
		 * This would add the decorator named "decorator1" defined by
463
		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
464
		 *
465
		 * @param array List of decorator names
466
		 * @since 2014.05
467
		 * @category Developer
468
		 * @see client/html/common/decorators/default
469
		 * @see client/html/email/delivery/decorators/excludes
470
		 * @see client/html/email/delivery/decorators/local
471
		 */
472
473
		/** client/html/email/delivery/decorators/local
474
		 * Adds a list of local decorators only to the email delivery html client
475
		 *
476
		 * Decorators extend the functionality of a class by adding new aspects
477
		 * (e.g. log what is currently done), executing the methods of the underlying
478
		 * class only in certain conditions (e.g. only for logged in users) or
479
		 * modify what is returned to the caller.
480
		 *
481
		 * This option allows you to wrap local decorators
482
		 * ("\Aimeos\Client\Html\Email\Decorator\*") around the html client.
483
		 *
484
		 *  client/html/email/delivery/decorators/local = array( 'decorator2' )
485
		 *
486
		 * This would add the decorator named "decorator2" defined by
487
		 * "\Aimeos\Client\Html\Email\Decorator\Decorator2" only to the html client.
488
		 *
489
		 * @param array List of decorator names
490
		 * @since 2014.05
491
		 * @category Developer
492
		 * @see client/html/common/decorators/default
493
		 * @see client/html/email/delivery/decorators/excludes
494
		 * @see client/html/email/delivery/decorators/global
495
		 */
496
497
		return $this->createSubClient( 'email/delivery/' . $type, $name );
498
	}
499
500
501
	/**
502
	 * Adds the given list of files as attachments to the mail message object
503
	 *
504
	 * @param \Aimeos\MW\Mail\Message\Iface $msg Mail message
505
	 * @param array $files List of absolute file paths
506
	 */
507
	protected function addAttachments( \Aimeos\MW\Mail\Message\Iface $msg, array $files )
508
	{
509
		foreach( $files as $filename )
510
		{
511
			if( ( $content = @file_get_contents( $filename ) ) === false ) {
512
				throw new \Aimeos\Client\Html\Exception( sprintf( 'File "%1$s" doesn\'t exist', $filename ) );
513
			}
514
515
			if( class_exists( 'finfo' ) )
516
			{
517
				try
518
				{
519
					$finfo = new \finfo( FILEINFO_MIME_TYPE );
520
					$mimetype = $finfo->file( $filename );
521
				}
522
				catch( \Exception $e )
523
				{
524
					throw new \Aimeos\Client\Html\Exception( $e->getMessage() );
525
				}
526
			}
527
			else if( function_exists( 'mime_content_type' ) )
528
			{
529
				$mimetype = mime_content_type( $filename );
530
			}
531
			else
532
			{
533
				$mimetype = 'application/binary';
534
			}
535
536
			$msg->addAttachment( $content, $mimetype, basename( $filename ) );
537
		}
538
	}
539
540
541
	/**
542
	 * Returns the list of sub-client names configured for the client.
543
	 *
544
	 * @return array List of HTML client names
545
	 */
546
	protected function getSubClientNames() : array
547
	{
548
		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
549
	}
550
551
552
	/**
553
	 * Sets the necessary parameter values in the view.
554
	 *
555
	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
556
	 * @param array &$tags Result array for the list of tags that are associated to the output
557
	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
558
	 * @return \Aimeos\MW\View\Iface Modified view object
559
	 */
560
	public function addData( \Aimeos\MW\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\MW\View\Iface
561
	{
562
		$addr = $view->get( 'extAddressItem' );
563
		$list = array(
564
			/// E-mail intro with first name (%1$s) and last name (%2$s)
565
			\Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR => $view->translate( 'client', 'Dear Mr %1$s %2$s' ),
566
			/// E-mail intro with first name (%1$s) and last name (%2$s)
567
			\Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MS => $view->translate( 'client', 'Dear Ms %1$s %2$s' ),
568
		);
569
570
		if( $addr && isset( $list[$addr->getSalutation()] ) ) {
571
			$view->emailIntro = sprintf( $list[$addr->getSalutation()], $addr->getFirstName(), $addr->getLastName() );
572
		} elseif( $addr ) {
573
			$view->emailIntro = sprintf( 'Dear %1$s %2$s', $addr->getFirstName(), $addr->getLastName() );
574
		} else {
575
			$view->emailIntro = $view->translate( 'client', 'Dear customer' );
576
		}
577
578
579
		$key = 'stat:' . $view->extOrderItem->getDeliveryStatus();
580
		$status = $view->translate( 'mshop/code', $key );
581
582
		switch( $view->extOrderItem->getDeliveryStatus() )
583
		{
584
			case 3:
585
				/// Delivery e-mail intro with order ID (%1$s), order date (%2$s) and delivery status (%3%s)
586
				$msg = $view->translate( 'client', 'Your order %1$s from %2$s has been dispatched.' );
587
				break;
588
			case 6:
589
				/// Delivery e-mail intro with order ID (%1$s), order date (%2$s) and delivery status (%3%s)
590
				$msg = $view->translate( 'client', 'The parcel for your order %1$s from %2$s could not be delivered.' );
591
				break;
592
			case 7:
593
				/// Delivery e-mail intro with order ID (%1$s), order date (%2$s) and delivery status (%3%s)
594
				$msg = $view->translate( 'client', 'We received the returned parcel for your order %1$s from %2$s.' );
595
				break;
596
			default:
597
				/// Delivery e-mail intro with order ID (%1$s), order date (%2$s) and delivery status (%3%s)
598
				$msg = $view->translate( 'client', 'The delivery status of your order %1$s from %2$s has been changed to "%3$s".' );
599
		}
600
601
		$date = date_create( $view->extOrderItem->getTimeCreated() )->format( $view->translate( 'client', 'Y-m-d' ) );
602
		$view->message = sprintf( $msg, $view->extOrderItem->getId(), $date, $status );
603
604
		$pricefmt = $view->translate( 'client/code', 'price:default' );
605
		/// Price format with price value (%1$s) and currency (%2$s)
606
		$view->priceFormat = $pricefmt !== 'price:default' ? $pricefmt : $view->translate( 'client', '%1$s %2$s' );
607
608
609
		return parent::addData( $view, $tags, $expire );
610
	}
611
}
612