Skip to content

Commit e99c19b

Browse files
Update Supplier.php
1 parent 999f907 commit e99c19b

File tree

1 file changed

+22
-8
lines changed
  • lib/mshoplib/src/MShop/Service/Provider/Decorator

1 file changed

+22
-8
lines changed

lib/mshoplib/src/MShop/Service/Provider/Decorator/Supplier.php

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ class Supplier
2121
extends \Aimeos\MShop\Service\Provider\Decorator\Base
2222
implements \Aimeos\MShop\Service\Provider\Decorator\Iface
2323
{
24+
private $beConfig = array(
25+
'supplier.addressformat' => array(
26+
'code' => 'supplier.addressformat',
27+
'internalcode' => 'supplier.addressformat',
28+
'label' => 'Change how supplier address display.',
29+
'type' => 'string',
30+
'internaltype' => 'string',
31+
'default' => 'short',
32+
'required' => false,
33+
),
34+
);
35+
2436
private $feConfig = array(
2537
'supplier.code' => array(
2638
'code' => 'supplier.code',
@@ -64,12 +76,7 @@ public function __construct( \Aimeos\MShop\Service\Provider\Iface $provider,
6476
{
6577
$addrId = ( count( $addresses ) > 1 ) ? $item->getCode() . '-' . $id : $item->getCode();
6678

67-
$this->feConfig['supplier.code']['default'][$addrId] = trim( preg_replace( "/\n+/m", "\n", sprintf(
68-
/// Supplier address format with label (%1$s), company (%2$s),
69-
/// address part one (%3$s, e.g street), address part two (%4$s, e.g house number), address part three (%5$s, e.g additional information),
70-
/// postal/zip code (%6$s), city (%7$s), state (%8$s), country ID (%9$s),
71-
/// e-mail (%10$s), phone (%11$s), facsimile/telefax (%12$s), web site (%13$s)
72-
$context->getI18n()->dt( 'mshop', '%1$s
79+
$format = $this->getConfigValue( 'supplier.addressformat', '%1$s
7380
%2$s
7481
%3$s %4$s
7582
%5$s
@@ -79,7 +86,14 @@ public function __construct( \Aimeos\MShop\Service\Provider\Iface $provider,
7986
%11$s
8087
%12$s
8188
%13$s'
82-
),
89+
);
90+
91+
$this->feConfig['supplier.code']['default'][$addrId] = trim( preg_replace( "/\n+/m", "\n", sprintf(
92+
/// Supplier address format with label (%1$s), company (%2$s),
93+
/// address part one (%3$s, e.g street), address part two (%4$s, e.g house number), address part three (%5$s, e.g additional information),
94+
/// postal/zip code (%6$s), city (%7$s), state (%8$s), country ID (%9$s),
95+
/// e-mail (%10$s), phone (%11$s), facsimile/telefax (%12$s), web site (%13$s)
96+
$context->getI18n()->dt( 'mshop', $format ),
8397
$item->getLabel(),
8498
$addr->getCompany(),
8599
$addr->getAddress1(),
@@ -179,7 +193,7 @@ public function setConfigFE( \Aimeos\MShop\Order\Item\Base\Service\Iface $orderS
179193
if( ( $code = $attributes['supplier.code'] ) != '' )
180194
{
181195
// add short address as attribute for summary page / customer email
182-
$attributes['supplier.address'] = $this->feConfig['supplier.code']['short'][$code];
196+
$attributes['supplier.address'] = $this->feConfig['supplier.code']['default'][$code];
183197

184198
// remove code attribute for summary page / customer email
185199
$this->setAttributes( $orderServiceItem, ['supplier.code' => $attributes['supplier.code']], 'hidden' );

0 commit comments

Comments
 (0)