Skip to content

Commit a1393fc

Browse files
author
Paliarush, Alexander(apaliarush)
committed
Merge pull request #522 from magento-api/MAGETWO-41253-luma-email-customization
[API] Merging outsourced PR 28 - Luma Email Customization
2 parents cb6cded + 7aeaa18 commit a1393fc

File tree

76 files changed

+2243
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2243
-361
lines changed

app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
127127
[
128128
'name' => 'store[is_active]',
129129
'label' => __('Status'),
130-
'value' => $storeModel->getIsActive(),
130+
'value' => $storeModel->isActive(),
131131
'options' => [0 => __('Disabled'), 1 => __('Enabled')],
132132
'required' => true,
133133
'disabled' => $storeModel->isReadOnly()

app/code/Magento/Catalog/Model/Category.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,24 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
4343
*/
4444
const ENTITY = 'catalog_category';
4545

46-
/**
46+
/**#@+
4747
* Category display modes
4848
*/
4949
const DM_PRODUCT = 'PRODUCTS';
5050

5151
const DM_PAGE = 'PAGE';
5252

5353
const DM_MIXED = 'PRODUCTS_AND_PAGE';
54+
/**#@-*/
55+
56+
/**
57+
* Id of root category
58+
*/
59+
const ROOT_CATEGORY_ID = 0;
5460

61+
/**
62+
* Id of category tree root
63+
*/
5564
const TREE_ROOT_ID = 1;
5665

5766
const CACHE_TAG = 'catalog_category';

app/code/Magento/Customer/Model/Address/Config.php

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
*/
66
namespace Magento\Customer\Model\Address;
77

8+
use Magento\Framework\Config\Data as ConfigData;
9+
use Magento\Framework\DataObject;
10+
use Magento\Store\Model\ScopeInterface;
11+
812
/**
913
* Customer address config
1014
*
1115
* @author Magento Core Team <core@magentocommerce.com>
1216
*/
13-
class Config extends \Magento\Framework\Config\Data
17+
class Config extends ConfigData
1418
{
1519
const DEFAULT_ADDRESS_RENDERER = 'Magento\Customer\Block\Address\Renderer\DefaultRenderer';
1620

@@ -111,29 +115,22 @@ public function getFormats()
111115
{
112116
$store = $this->getStore();
113117
$storeId = $store->getId();
118+
114119
if (!isset($this->_types[$storeId])) {
115120
$this->_types[$storeId] = [];
116121
foreach ($this->get() as $typeCode => $typeConfig) {
117122
$path = sprintf('%s%s', self::XML_PATH_ADDRESS_TEMPLATE, $typeCode);
118-
$type = new \Magento\Framework\DataObject();
119-
if (isset(
120-
$typeConfig['escapeHtml']
121-
) && ($typeConfig['escapeHtml'] == 'true' || $typeConfig['escapeHtml'] == '1')
122-
) {
123-
$escapeHtml = true;
123+
$type = new DataObject();
124+
if (isset($typeConfig['escapeHtml'])) {
125+
$escapeHtml = $typeConfig['escapeHtml'] == 'true' || $typeConfig['escapeHtml'] == '1';
124126
} else {
125127
$escapeHtml = false;
126128
}
127129

128-
$type->setCode(
129-
$typeCode
130-
)->setTitle(
131-
(string)$typeConfig['title']
132-
)->setDefaultFormat(
133-
$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store)
134-
)->setEscapeHtml(
135-
$escapeHtml
136-
);
130+
$type->setCode($typeCode)
131+
->setTitle((string)$typeConfig['title'])
132+
->setDefaultFormat($this->_scopeConfig->getValue($path, ScopeInterface::SCOPE_STORE, $store))
133+
->setEscapeHtml($escapeHtml);
137134

138135
$renderer = isset($typeConfig['renderer']) ? (string)$typeConfig['renderer'] : null;
139136
if (!$renderer) {
@@ -152,14 +149,14 @@ public function getFormats()
152149
/**
153150
* Retrieve default address format
154151
*
155-
* @return \Magento\Framework\DataObject
152+
* @return DataObject
156153
*/
157154
protected function _getDefaultFormat()
158155
{
159156
$store = $this->getStore();
160157
$storeId = $store->getId();
161158
if (!isset($this->_defaultTypes[$storeId])) {
162-
$this->_defaultTypes[$storeId] = new \Magento\Framework\DataObject();
159+
$this->_defaultTypes[$storeId] = new DataObject();
163160
$this->_defaultTypes[$storeId]->setCode(
164161
'default'
165162
)->setDefaultFormat(
@@ -168,13 +165,9 @@ protected function _getDefaultFormat()
168165
'{{var street}}, {{var city}}, {{var region}} {{var postcode}}, {{var country}}'
169166
);
170167

171-
$this->_defaultTypes[$storeId]->setRenderer(
172-
$this->_addressHelper->getRenderer(
173-
self::DEFAULT_ADDRESS_RENDERER
174-
)->setType(
175-
$this->_defaultTypes[$storeId]
176-
)
177-
);
168+
$renderer = $this->_addressHelper->getRenderer(self::DEFAULT_ADDRESS_RENDERER)
169+
->setType($this->_defaultTypes[$storeId]);
170+
$this->_defaultTypes[$storeId]->setRenderer($renderer);
178171
}
179172
return $this->_defaultTypes[$storeId];
180173
}
@@ -183,7 +176,7 @@ protected function _getDefaultFormat()
183176
* Retrieve address format by code
184177
*
185178
* @param string $typeCode
186-
* @return \Magento\Framework\DataObject
179+
* @return DataObject
187180
*/
188181
public function getFormatByCode($typeCode)
189182
{

app/code/Magento/Customer/Model/Vat.php

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
namespace Magento\Customer\Model;
77

88
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Framework\DataObject;
10+
use Magento\Framework\Exception\LocalizedException;
11+
use Magento\Store\Model\Store;
12+
use Magento\Store\Model\Information as StoreInformation;
913
use Psr\Log\LoggerInterface as PsrLogger;
1014
use Magento\Store\Model\ScopeInterface;
1115

@@ -52,16 +56,6 @@ class Vat
5256
*/
5357
const XML_PATH_EU_COUNTRIES_LIST = 'general/country/eu_countries';
5458

55-
/**
56-
* Configuration path to merchant country id
57-
*/
58-
const XML_PATH_MERCHANT_COUNTRY_CODE = 'general/store_information/country_id';
59-
60-
/**
61-
* Config path to merchant VAT number
62-
*/
63-
const XML_PATH_MERCHANT_VAT_NUMBER = 'general/store_information/merchant_vat_number';
64-
6559
/**
6660
* @var ScopeConfigInterface
6761
*/
@@ -87,13 +81,13 @@ public function __construct(
8781
/**
8882
* Retrieve merchant country code
8983
*
90-
* @param \Magento\Store\Model\Store|string|int|null $store
84+
* @param Store|string|int|null $store
9185
* @return string
9286
*/
9387
public function getMerchantCountryCode($store = null)
9488
{
9589
return (string)$this->scopeConfig->getValue(
96-
self::XML_PATH_MERCHANT_COUNTRY_CODE,
90+
StoreInformation::XML_PATH_STORE_INFO_COUNTRY_CODE,
9791
ScopeInterface::SCOPE_STORE,
9892
$store
9993
);
@@ -102,13 +96,13 @@ public function getMerchantCountryCode($store = null)
10296
/**
10397
* Retrieve merchant VAT number
10498
*
105-
* @param \Magento\Store\Model\Store|string|int|null $store
99+
* @param Store|string|int|null $store
106100
* @return string
107101
*/
108102
public function getMerchantVatNumber($store = null)
109103
{
110104
return (string)$this->scopeConfig->getValue(
111-
self::XML_PATH_MERCHANT_VAT_NUMBER,
105+
StoreInformation::XML_PATH_STORE_INFO_VAT_NUMBER,
112106
ScopeInterface::SCOPE_STORE,
113107
$store
114108
);
@@ -118,7 +112,7 @@ public function getMerchantVatNumber($store = null)
118112
* Retrieve customer group ID based on his VAT number
119113
*
120114
* @param string $customerCountryCode
121-
* @param \Magento\Framework\DataObject $vatValidationResult
115+
* @param DataObject $vatValidationResult
122116
* @param \Magento\Store\Model\Store|string|int $store
123117
* @return null|int
124118
*/
@@ -163,21 +157,20 @@ public function getCustomerGroupIdBasedOnVatNumber($customerCountryCode, $vatVal
163157
* @param string $requesterCountryCode
164158
* @param string $requesterVatNumber
165159
*
166-
* @return \Magento\Framework\DataObject
160+
* @return DataObject
167161
*/
168162
public function checkVatNumber($countryCode, $vatNumber, $requesterCountryCode = '', $requesterVatNumber = '')
169163
{
170164
// Default response
171-
$gatewayResponse = new \Magento\Framework\DataObject(
172-
['is_valid' => false, 'request_date' => '', 'request_identifier' => '', 'request_success' => false]
173-
);
165+
$gatewayResponse = new DataObject([
166+
'is_valid' => false,
167+
'request_date' => '',
168+
'request_identifier' => '',
169+
'request_success' => false
170+
]);
174171

175172
if (!extension_loaded('soap')) {
176-
$this->logger->critical(
177-
new \Magento\Framework\Exception\LocalizedException(
178-
__('PHP SOAP extension is required.')
179-
)
180-
);
173+
$this->logger->critical(new LocalizedException(__('PHP SOAP extension is required.')));
181174
return $gatewayResponse;
182175
}
183176

@@ -252,8 +245,8 @@ public function canCheckVatNumber($countryCode, $vatNumber, $requesterCountryCod
252245
* Get VAT class
253246
*
254247
* @param string $customerCountryCode
255-
* @param \Magento\Framework\DataObject $vatValidationResult
256-
* @param \Magento\Store\Model\Store|string|int|null $store
248+
* @param DataObject $vatValidationResult
249+
* @param Store|string|int|null $store
257250
* @return null|string
258251
*/
259252
public function getCustomerVatClass($customerCountryCode, $vatValidationResult, $store = null)
@@ -292,11 +285,7 @@ public function isCountryInEU($countryCode, $storeId = null)
292285
{
293286
$euCountries = explode(
294287
',',
295-
$this->scopeConfig->getValue(
296-
self::XML_PATH_EU_COUNTRIES_LIST,
297-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
298-
$storeId
299-
)
288+
$this->scopeConfig->getValue(self::XML_PATH_EU_COUNTRIES_LIST, ScopeInterface::SCOPE_STORE, $storeId)
300289
);
301290
return in_array($countryCode, $euCountries);
302291
}

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function collectRates(RateRequest $request)
313313

314314
$origCompanyName = $this->_getDefaultValue(
315315
$requestDhl->getOrigCompanyName(),
316-
\Magento\Store\Model\Store::XML_PATH_STORE_STORE_NAME
316+
\Magento\Store\Model\Information::XML_PATH_STORE_INFO_NAME
317317
);
318318
$origCountryId = $this->_getDefaultValue($requestDhl->getOrigCountryId(), Shipment::XML_PATH_STORE_COUNTRY_ID);
319319
$origState = $this->_getDefaultValue($requestDhl->getOrigState(), Shipment::XML_PATH_STORE_REGION_ID);

app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
namespace Magento\Dhl\Test\Unit\Model;
77

8-
9-
use Magento\Framework\Object;
108
use Magento\Quote\Model\Quote\Address\RateRequest;
119
use Magento\Framework\Xml\Security;
1210

app/code/Magento/Email/Model/AbstractTemplate.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\Model\AbstractModel;
1212
use Magento\Framework\DataObject;
1313
use Magento\Store\Model\ScopeInterface;
14+
use Magento\Store\Model\Information as StoreInformation;
1415
use Magento\Store\Model\Store;
1516

1617
/**
@@ -457,14 +458,14 @@ protected function addEmailVariables($variables, $storeId)
457458
}
458459
if (!isset($variables['store_phone'])) {
459460
$variables['store_phone'] = $this->scopeConfig->getValue(
460-
Store::XML_PATH_STORE_STORE_PHONE,
461+
StoreInformation::XML_PATH_STORE_INFO_PHONE,
461462
ScopeInterface::SCOPE_STORE,
462463
$store
463464
);
464465
}
465466
if (!isset($variables['store_hours'])) {
466467
$variables['store_hours'] = $this->scopeConfig->getValue(
467-
Store::XML_PATH_STORE_STORE_HOURS,
468+
StoreInformation::XML_PATH_STORE_INFO_HOURS,
468469
ScopeInterface::SCOPE_STORE,
469470
$store
470471
);

app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function testGetDefaultEmailLogo()
299299
->method('getDesignParams')
300300
->will($this->returnValue($designParams));
301301
$this->assetRepo->method('getUrlWithParams')
302-
->with('Magento_Email::logo_email.png', $designParams)
302+
->with(\Magento\Email\Model\AbstractTemplate::DEFAULT_LOGO_FILE_ID, $designParams)
303303
->will($this->returnValue($value));
304304
$this->assertEquals($value, $model->getDefaultEmailLogo());
305305
}

app/code/Magento/Email/etc/adminhtml/system.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<label>Emails</label>
1313
<field id="logo" translate="label comment" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
1414
<label>Logo Image</label>
15-
<comment>Allowed file types: jpg, jpeg, gif, png. To optimize logo for high-resolution displays, upload an image that is 2x normal size and then specify 1x dimensions in width/height fields below.</comment>
15+
<comment>Allowed file types: jpg, jpeg, gif, png. To optimize logo for high-resolution displays, upload an image that is 3x normal size and then specify 1x dimensions in width/height fields below.</comment>
1616
<backend_model>Magento\Config\Model\Config\Backend\Email\Logo</backend_model>
1717
<base_url type="media" scope_info="1">email/logo</base_url>
1818
</field>
@@ -21,10 +21,12 @@
2121
</field>
2222
<field id="logo_width" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
2323
<label>Logo Width</label>
24+
<frontend_class>validate-digits</frontend_class>
2425
<comment>Only necessary if image has been uploaded above. Enter number of pixels, without appending "px".</comment>
2526
</field>
2627
<field id="logo_height" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
2728
<label>Logo Height</label>
29+
<frontend_class>validate-digits</frontend_class>
2830
<comment>Only necessary if image has been uploaded above. Enter number of pixels, without appending "px".</comment>
2931
</field>
3032
<field id="header_template" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">

app/code/Magento/Newsletter/view/frontend/email/subscr_success.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
{{template config_path="design/email/header_template"}}
1515

16-
{{trans "Newsletter subscription success"}}
16+
{{trans "You have been successfully subscribed to our newsletter."}}
1717

1818
{{template config_path="design/email/footer_template"}}

app/code/Magento/Newsletter/view/frontend/email/unsub_success.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
{{template config_path="design/email/header_template"}}
1515

16-
{{trans "Newsletter unsubscription success"}}
16+
{{trans "You have been unsubscribed from the newsletter."}}
1717

1818
{{template config_path="design/email/footer_template"}}

app/code/Magento/Sales/Model/Order/Address/Renderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Sales\Model\Order\Address;
1212

1313
/**
14-
* Class Renderer using for formatting of order address
14+
* Class Renderer used for formatting an order address
1515
*/
1616
class Renderer
1717
{

app/code/Magento/Sales/view/frontend/email/creditmemo_new.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
-->
7-
<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @-->
7+
<!--@subject Credit memo for your {{var store.getFrontendName()}} order @-->
88
<!--@vars {
99
"var formattedBillingAddress|raw":"Billing Address",
1010
"var comment":"Credit Memo Comment",

app/code/Magento/Sales/view/frontend/email/creditmemo_new_guest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
-->
7-
<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @-->
7+
<!--@subject Credit memo for your {{var store.getFrontendName()}} order @-->
88
<!--@vars {
99
"var formattedBillingAddress|raw":"Billing Address",
1010
"var comment":"Credit Memo Comment",

app/code/Magento/Sales/view/frontend/email/creditmemo_update.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
-->
7-
<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} update @-->
7+
<!--@subject Update to your {{var store.getFrontendName()}} credit memo @-->
88
<!--@vars {
99
"var comment":"Credit Memo Comment",
1010
"var creditmemo.increment_id":"Credit Memo Id",

app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
-->
7-
<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} update @-->
7+
<!--@subject Update to your {{var store.getFrontendName()}} credit memo @-->
88
<!--@vars {
99
"var comment":"Credit Memo Comment",
1010
"var creditmemo.increment_id":"Credit Memo Id",

0 commit comments

Comments
 (0)