diff --git a/.travis.yml b/.travis.yml index a7efddd875217294ebd2dc52a1994f68bfe3f3ce..19fe6377984837242a736f1c60618a4ac52bfd60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ before_install: $HOME/.cache/bin/composer self-update; echo ''; else mkdir -p $HOME/.cache/bin; - curl --connect-timeout 30 -sS https://getcomposer.org/installer \ + curl --connect-timeout 30 -sS https://getcomposer.org/installer | php -- --install-dir $HOME/.cache/bin/ --filename composer; fi fi' diff --git a/app/code/Magento/AdvancedPricingImportExport/i18n/en_US.csv b/app/code/Magento/AdvancedPricingImportExport/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Authorization/i18n/en_US.csv b/app/code/Magento/Authorization/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index 09556da2326bb5e8cb7f21a32534ed1a7a6df9eb..162aba1cfa3ef6fd6d86ada42171e834be6bcb80 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -352,8 +352,9 @@ <resource>Magento_Config::config_admin</resource> <group id="emails" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Admin User Emails</label> - <field id="forgot_email_template" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="forgot_email_template" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Forgot Password Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="forgot_email_identity" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php index d348945a052bc154831fd92c1a5dd4c5db930edc..51c1995995b8774c8b1e92228ccbb9cae8b22b80 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php @@ -36,7 +36,7 @@ class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRend * @param \Magento\Framework\Object $item * @return array|null */ - public function getChilds($item) + public function getChildren($item) { $itemsArray = []; diff --git a/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php b/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php index 44df68a474e22e05fd759c7bcddf76e3802e3b94..b24b9ceecfba50002856a4d254b9331c467f46c4 100644 --- a/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php +++ b/app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php @@ -125,7 +125,7 @@ class Renderer extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer * @param \Magento\Framework\Object $item * @return array */ - public function getChilds($item) + public function getChildren($item) { $itemsArray = []; diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php index f5971bdb578de9b60cacaede66d9a0a8c9e397ec..a66b77563eab90c4bf3e6498da27dec9501ea6e4 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php @@ -18,7 +18,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra * @param \Magento\Framework\Object $item * @return array */ - public function getChilds($item) + public function getChildren($item) { $itemsArray = []; diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php index c3242c43e1f5cccc5a2be6905f2d9efdd11a494c..abb34010db412efd4612150a189393ff2d2aea2a 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -67,7 +67,7 @@ class Creditmemo extends AbstractItems $pdf = $this->getPdf(); $page = $this->getPage(); - $items = $this->getChilds($item); + $items = $this->getChildren($item); $prevOptionId = ''; $drawItems = []; $leftBound = 35; diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php index d47ee84b9a2a7b3e0dc0f4c81f12cf43ce5f98cb..b35c32c9ab0b2770616d59687e280207e8e22b26 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php @@ -69,7 +69,7 @@ class Invoice extends AbstractItems $page = $this->getPage(); $this->_setFontRegular(); - $items = $this->getChilds($item); + $items = $this->getChildren($item); $prevOptionId = ''; $drawItems = []; diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php index 957bde5254681d3ac16d492d8b9f242a53abb4f4..4bc2256187594196d417fe03c81f32b9b7187d8f 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php @@ -66,7 +66,7 @@ class Shipment extends AbstractItems $this->_setFontRegular(); - $shipItems = $this->getChilds($item); + $shipItems = $this->getChildren($item); $items = array_merge([$item->getOrderItem()], $item->getOrderItem()->getChildrenItems()); $prevOptionId = ''; diff --git a/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Sales/Order/Items/RendererTest.php b/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Sales/Order/Items/RendererTest.php index 90ec92dfd008139090fc04c1158c8b9322854631..2e1aad0757cb368ddfa7fa13e1ca5ee5006d6078 100644 --- a/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Sales/Order/Items/RendererTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Sales/Order/Items/RendererTest.php @@ -40,7 +40,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase $item->expects($this->once())->method('getOrderItem')->will($this->returnValue($this->orderItem)); $this->orderItem->expects($this->any())->method('getId')->will($this->returnValue(1)); - $this->assertSame(null, $this->model->getChilds($item)); + $this->assertSame(null, $this->model->getChildren($item)); } public function getChildrenEmptyItemsDataProvider() @@ -79,7 +79,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase $item->expects($this->once())->method('getInvoice')->will($this->returnValue($salesModel)); $item->expects($this->any())->method('getOrderItem')->will($this->returnValue($this->orderItem)); - $this->assertSame([2 => $this->orderItem], $this->model->getChilds($item)); + $this->assertSame([2 => $this->orderItem], $this->model->getChildren($item)); } public function getChildrenDataProvider() diff --git a/app/code/Magento/Bundle/Test/Unit/Block/Sales/Order/Items/RendererTest.php b/app/code/Magento/Bundle/Test/Unit/Block/Sales/Order/Items/RendererTest.php index bc744f159b326df19b2778f5d9a71a16f18f50ef..f5aef7e9200c3f14e6a8eb411f2e1ea753ed54de 100644 --- a/app/code/Magento/Bundle/Test/Unit/Block/Sales/Order/Items/RendererTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Block/Sales/Order/Items/RendererTest.php @@ -40,7 +40,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase $item->expects($this->once())->method('getOrderItem')->will($this->returnValue($this->orderItem)); $this->orderItem->expects($this->any())->method('getId')->will($this->returnValue(1)); - $this->assertSame(null, $this->model->getChilds($item)); + $this->assertSame(null, $this->model->getChildren($item)); } public function getChildrenEmptyItemsDataProvider() @@ -79,7 +79,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase $item->expects($this->once())->method('getInvoice')->will($this->returnValue($salesModel)); $item->expects($this->any())->method('getOrderItem')->will($this->returnValue($this->orderItem)); - $this->assertSame([2 => $this->orderItem], $this->model->getChilds($item)); + $this->assertSame([2 => $this->orderItem], $this->model->getChildren($item)); } public function getChildrenDataProvider() diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Sales/Order/Pdf/Items/AbstractItemsTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Sales/Order/Pdf/Items/AbstractItemsTest.php index 224f8d5dec7b5594441e6e36726820c25495bc9e..7f86f19d714318ee6ff0e8ead0e6f2f42adf9aed 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Sales/Order/Pdf/Items/AbstractItemsTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Sales/Order/Pdf/Items/AbstractItemsTest.php @@ -40,7 +40,7 @@ class AbstractItemsTest extends \PHPUnit_Framework_TestCase $item->expects($this->once())->method('getOrderItem')->will($this->returnValue($this->orderItem)); $this->orderItem->expects($this->any())->method('getId')->will($this->returnValue(1)); - $this->assertSame(null, $this->model->getChilds($item)); + $this->assertSame(null, $this->model->getChildren($item)); } public function getChildrenEmptyItemsDataProvider() @@ -79,7 +79,7 @@ class AbstractItemsTest extends \PHPUnit_Framework_TestCase $item->expects($this->once())->method('getInvoice')->will($this->returnValue($salesModel)); $item->expects($this->any())->method('getOrderItem')->will($this->returnValue($this->orderItem)); - $this->assertSame([2 => $this->orderItem], $this->model->getChilds($item)); + $this->assertSame([2 => $this->orderItem], $this->model->getChildren($item)); } public function getChildrenDataProvider() diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml index d436575a237064cc7dd43abdeae0432e0c91c33e..dbbdb3d5861deccc562c917db29aeb19bea23afc 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/create/items/renderer.phtml @@ -15,7 +15,7 @@ ?> <?php $_item = $block->getItem() ?> -<?php $items = $block->getChilds($_item); ?> +<?php $items = $block->getChildren($_item); ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml index 339bc32af067a91741ffcf2945265f7696177ecd..99572df301e36bed15530d4b91d9cc749d53421f 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/creditmemo/view/items/renderer.phtml @@ -15,7 +15,7 @@ ?> <?php $_item = $block->getItem() ?> -<?php $items = $block->getChilds($_item); ?> +<?php $items = $block->getChildren($_item); ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml index e3878b3eecc6936d297cfc989e8b913928168c51..51de593040bde5f7b62355539b7ab986f3a8ac1d 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/create/items/renderer.phtml @@ -15,7 +15,7 @@ ?> <?php $_item = $block->getItem() ?> -<?php $items = $block->getChilds($_item); ?> +<?php $items = $block->getChildren($_item); ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml index 904d804580feace61ab761f2daaf284fc712b64c..e36e011098332832c1aed6400a0f024043129b18 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/invoice/view/items/renderer.phtml @@ -15,7 +15,7 @@ ?> <?php $_item = $block->getItem() ?> -<?php $items = $block->getChilds($_item); ?> +<?php $items = $block->getChildren($_item); ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml index f1555682244ee4ba68b1d7e6202f2d9b66f884bc..6a9e4b31871ce740c3ca9d9bf6d53f84d4ed8702 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/create/items/renderer.phtml @@ -7,14 +7,11 @@ // @codingStandardsIgnoreFile ?> -<?php -/** - * @see \Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer - */ -?> + +<?php /** @var $block \Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer */ ?> <?php $_item = $block->getItem() ?> -<?php $items = $block->getChilds($_item); ?> +<?php $items = $block->getChildren($_item); ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml index e8a2d69f16530de18698e5808cc57591fb420bb2..4b6b77ee25644d2ee8c7955aaae0ba0d7f7f9055 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/sales/shipment/view/items/renderer.phtml @@ -7,15 +7,11 @@ // @codingStandardsIgnoreFile ?> -<?php -/** - * @see \Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer - */ -?> +<?php /** @var $block \Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer */ ?> <?php $_item = $block->getItem() ?> <?php $items = array_merge([$_item->getOrderItem()], $_item->getOrderItem()->getChildrenItems()) ?> -<?php $shipItems = $block->getChilds($_item) ?> +<?php $shipItems = $block->getChildren($_item) ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml index 0caea13b65b5a392e18217bfa682c4a46e70c0d0..a75d15983dd36a96d3ed490a510a871145ba4b3e 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/creditmemo/default.phtml @@ -11,11 +11,7 @@ <?php $parentItem = $block->getItem() ?> <?php $_order = $block->getItem()->getOrder(); ?> -<?php $items = $block->getChilds($parentItem) ?> - -<?php $_prevOptionId = '' ?> - -<?php foreach ($items as $_item): ?> +<?php $items = $block->getChildren($parentItem) ?> <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> <?php $_showlastRow = true ?> @@ -23,57 +19,70 @@ <?php $_showlastRow = false ?> <?php endif; ?> -<?php if ($_item->getOrderItem()->getParentItem()): ?> - <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> - <tr> - <td align="left" valign="top" style="padding:3px 9px"><strong><?php echo $attributes['option_label'] ?></strong></td> - <td> </td> - <td> </td> - <td> </td> - </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> +<?php $_prevOptionId = '' ?> + +<?php foreach ($items as $_item): ?> + + <?php + // As part of invoice item renderer logic, the order is set on each invoice item. + // In the case of a bundle product, this template takes over rendering its children, + // so it is necessary to pass the order along to each child. + $_item->setOrder($_order); + ?> + + <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php $attributes = $block->getSelectionAttributes($_item) ?> + <?php if ($_prevOptionId != $attributes['option_id']): ?> + <tr class="bundle-option-label"> + <td colspan="3"> + <strong><?= $attributes['option_label'] ?></strong> + </td> + </tr> + <?php $_prevOptionId = $attributes['option_id'] ?> + <?php endif; ?> <?php endif; ?> -<?php endif; ?> -<tr id="order-item-row-<?php echo $_item->getId() ?>"> <?php if (!$_item->getOrderItem()->getParentItem()): ?> - <td align="left" valign="top" style="padding:3px 9px"><strong><?php echo $block->escapeHtml($_item->getName()) ?></strong></td> + <tr class="bundle-item bundle-parent"> + <td class="item-info"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + </td> <?php else: ?> - <td align="left" valign="top" style="padding:3px 19px"><?php echo $block->getValueHtml($_item)?></td> + <tr class="bundle-item bundle-option-value"> + <td class="item-info"> + <p><?= $block->getValueHtml($_item)?></p> + </td> <?php endif; ?> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($_item->getSku()) ?></td> - <td align="center" valign="top" style="padding:3px 9px"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?php echo $_item->getQty()*1 ?> - <?php else: ?> - - <?php endif; ?> - </td> - <td align="right" valign="top" style="padding:3px 9px"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?php echo $block->getItemPrice($_item); ?> - <?php else: ?> - - <?php endif; ?> - </td> -</tr> + <td class="item-qty"> + <?php if ($block->canShowPriceInfo($_item)): ?> + <?= $_item->getQty() * 1 ?> + <?php else: ?> + + <?php endif; ?> + </td> + <td class="item-price"> + <?php if ($block->canShowPriceInfo($_item)): ?> + <?= $block->getItemPrice($_item) ?> + <?php else: ?> + + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> <?php if ($_showlastRow): ?> -<tr> - <td align="left" valign="top" style="padding:3px 9px"> - <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $option['value'] ?></dd> - <?php endforeach; ?> - </dl> - <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> - </td> - <td> </td> - <td> </td> - <td> </td> -</tr> + <tr> + <td colspan="3" class="item-extra"> + <?php if ($block->getItemOptions()): ?> + <dl> + <?php foreach ($block->getItemOptions() as $option): ?> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd><?= $option['value'] ?></dd> + <?php endforeach; ?> + </dl> + <?php endif; ?> + <?= $block->escapeHtml($_item->getDescription()) ?> + </td> + </tr> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml index 4aec9e983e7c5e86238ee178f30a331d77e3c907..cdbf8f57a3ff1d5bd36f09fbc074b493a7ff24c5 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/invoice/default.phtml @@ -10,71 +10,80 @@ <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $parentItem = $block->getItem() ?> -<?php $items = $block->getChilds($parentItem) ?> +<?php $items = $block->getChildren($parentItem) ?> <?php $_index = 0 ?> <?php $_order = $block->getItem()->getOrder(); ?> -<?php $_prevOptionId = '' ?> - -<?php foreach ($items as $_item): ?> - <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> <?php $_showlastRow = true ?> <?php else: ?> <?php $_showlastRow = false ?> <?php endif; ?> -<?php if ($_item->getOrderItem()->getParentItem()): ?> - <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> - <tr> - <td align="left" valign="top" style="padding:3px 9px"><strong><em><?php echo $attributes['option_label'] ?></em></strong></td> - <td> </td> - <td> </td> - <td> </td> - </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> +<?php $_prevOptionId = '' ?> + +<?php foreach ($items as $_item): ?> + + <?php + // As part of invoice item renderer logic, the order is set on each invoice item. + // In the case of a bundle product, this template takes over rendering its children, + // so it is necessary to pass the order along to each child. + $_item->setOrder($_order); + ?> + + <?php if ($_item->getOrderItem()->getParentItem()): ?> + <?php $attributes = $block->getSelectionAttributes($_item) ?> + <?php if ($_prevOptionId != $attributes['option_id']): ?> + <tr class="bundle-option-label"> + <td colspan="3"> + <strong><em><?= $attributes['option_label'] ?></em></strong> + </td> + </tr> + <?php $_prevOptionId = $attributes['option_id'] ?> + <?php endif; ?> <?php endif; ?> -<?php endif; ?> -<tr id="order-item-row-<?php echo $_item->getId() ?>"> <?php if (!$_item->getOrderItem()->getParentItem()): ?> - <td align="left" valign="top" style="padding:3px 9px"><strong><?php echo $block->escapeHtml($_item->getName()) ?></strong></td> + <tr class="bundle-item bundle-parent"> + <td class="item-info"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + </td> <?php else: ?> - <td align="left" valign="top" style="padding:3px 19px"><?php echo $block->getValueHtml($_item)?></td> + <tr class="bundle-item bundle-option-value"> + <td class="item-info"> + <p><?= $block->getValueHtml($_item)?></p> + </td> <?php endif; ?> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($_item->getSku()) ?></td> - <td align="center" valign="top" style="padding:3px 9px"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?php echo $_item->getQty()*1 ?> - <?php else: ?> - - <?php endif; ?> - </td> - <td align="right" valign="top" style="padding:3px 9px"> - <?php if ($block->canShowPriceInfo($_item)): ?> - <?php echo $block->getItemPrice($_item); ?> - <?php else: ?> - - <?php endif; ?> - </td> -</tr> + <td class="item-qty"> + <?php if ($block->canShowPriceInfo($_item)): ?> + <?= $_item->getQty() * 1 ?> + <?php else: ?> + + <?php endif; ?> + </td> + <td class="item-price"> + <?php if ($block->canShowPriceInfo($_item)): ?> + <?= $block->getItemPrice($_item) ?> + <?php else: ?> + + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> <?php if ($_showlastRow): ?> -<tr> - <td align="left" valign="top" style="padding:3px 9px"> - <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $option['value'] ?></dd> - <?php endforeach; ?> - </dl> - <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> - </td> - <td> </td> - <td> </td> - <td> </td> -</tr> + <tr> + <td colspan="3" class="item-extra"> + <?php if ($block->getItemOptions()): ?> + <dl> + <?php foreach ($block->getItemOptions() as $option): ?> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd><?= $option['value'] ?></dd> + <?php endforeach; ?> + </dl> + <?php endif; ?> + <?= $block->escapeHtml($_item->getDescription()) ?> + </td> + </tr> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml index c40ac91faf20a0c999997f46c23e9cec3403874e..b5b4dbe28a18594c967dff5e7347d561b108f2dc 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/order/default.phtml @@ -24,62 +24,64 @@ <?php foreach ($items as $_item): ?> -<?php if ($_item->getParentItem()): ?> - <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> - <tr> - <td align="left" valign="top" style="padding:3px 9px"><strong><em><?php echo $attributes['option_label'] ?></em></strong></td> - <td> </td> - <td> </td> - <td> </td> - </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> - <?php endif; ?> -<?php endif; ?> -<tr id="order-item-row-<?php echo $_item->getId() ?>"> - <?php if (!$_item->getParentItem()): ?> - <td align="left" valign="top" style="padding:3px 9px"><strong><?php echo $block->escapeHtml($_item->getName()) ?></strong></td> - <?php else: ?> - <td align="left" valign="top" style="padding:3px 19px"><?php echo $block->getValueHtml($_item)?></td> - <?php endif; ?> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($_item->getSku()) ?></td> - <td align="center" valign="top" style="padding:3px 9px"> - <?php if (!$_item->getParentItem()): ?> - <?php echo $_item->getQtyOrdered()*1 ?> - <?php else: ?> - + <?php if ($_item->getParentItem()): ?> + <?php $attributes = $block->getSelectionAttributes($_item) ?> + <?php if ($_prevOptionId != $attributes['option_id']): ?> + <tr class="bundle-option-label"> + <td colspan="3"> + <strong><em><?= $attributes['option_label'] ?></em></strong> + </td> + </tr> + <?php $_prevOptionId = $attributes['option_id'] ?> + <?php endif; ?> <?php endif; ?> - </td> - <td align="right" valign="top" style="padding:3px 9px"> <?php if (!$_item->getParentItem()): ?> - <?php echo $block->getItemPrice($_item); ?> + <tr class="bundle-item bundle-parent"> + <td class="item-info"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + </td> + <td class="item-qty"> + <?= $_item->getQtyOrdered() * 1 ?> + </td> + <td class="item-price"> + <?= $block->getItemPrice($_item); ?> + </td> + </tr> <?php else: ?> - + <tr class="bundle-item bundle-option-value"> + <td class="item-info" colspan="3"> + <p><?= $block->getValueHtml($_item)?></p> + </td> + </tr> <?php endif; ?> - </td> -</tr> + <?php endforeach; ?> <?php if ($_showlastRow): ?> -<tr> - <td align="left" valign="top" style="padding:3px 9px"> - <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $option['value'] ?></dd> - <?php endforeach; ?> - </dl> - <?php endif; ?> - <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_item->getGiftMessageId())): ?> - <br /><strong><?php echo __('Gift Message') ?></strong> - <br /><?php echo __('From:'); ?> <?php echo $block->escapeHtml($_giftMessage->getSender()) ?> - <br /><?php echo __('To:'); ?> <?php echo $block->escapeHtml($_giftMessage->getRecipient()) ?> - <br /><?php echo __('Message:'); ?><br /> <?php echo $block->escapeHtml($_giftMessage->getMessage()) ?> - <?php endif; ?> - </td> - <td> </td> - <td> </td> - <td> </td> -</tr> + <tr> + <td colspan="3" class="item-extra"> + <?php if ($block->getItemOptions()): ?> + <dl> + <?php foreach ($block->getItemOptions() as $option): ?> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd><?= $option['value'] ?></dd> + <?php endforeach; ?> + </dl> + <?php endif; ?> + <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_item->getGiftMessageId())): ?> + <table class="message-gift"> + <tr> + <td> + <h3><?= __('Gift Message') ?></h3> + <strong><?= __('From:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?> + <br /><strong><?= __('To:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?> + <br /><strong><?= __('Message:'); ?></strong> + <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?> + </td> + </tr> + </table> + <?php endif; ?> + </td> + </tr> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml index c485ea7524906bce8ab030dbf5d8ff6263875b8e..aafeefc5e7351e56f41e56998dffc18fdfe9361b 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/email/order/items/shipment/default.phtml @@ -7,14 +7,12 @@ // @codingStandardsIgnoreFile ?> +<?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> + <?php $parentItem = $block->getItem() ?> <?php $items = array_merge([$parentItem->getOrderItem()], $parentItem->getOrderItem()->getChildrenItems()) ?> -<?php $shipItems = $block->getChilds($parentItem) ?> - -<?php $_prevOptionId = '' ?> - -<?php foreach ($items as $_item): ?> +<?php $shipItems = $block->getChildren($parentItem) ?> <?php if ($block->getItemOptions() || $parentItem->getDescription() || $this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?> <?php $_showlastRow = true ?> @@ -22,54 +20,62 @@ <?php $_showlastRow = false ?> <?php endif; ?> -<?php if ($_item->getParentItem()): ?> - <?php $attributes = $block->getSelectionAttributes($_item) ?> - <?php if ($_prevOptionId != $attributes['option_id']): ?> - <tr> - <td align="left" valign="top" style="padding:3px 9px"><strong><em><?php echo $attributes['option_label'] ?></em></strong></td> - <td> </td> - <td> </td> - </tr> - <?php $_prevOptionId = $attributes['option_id'] ?> +<?php $_prevOptionId = '' ?> + +<?php foreach ($items as $_item): ?> + + <?php if ($_item->getParentItem()): ?> + <?php $attributes = $block->getSelectionAttributes($_item) ?> + <?php if ($_prevOptionId != $attributes['option_id']): ?> + <tr class="bundle-option-label"> + <td colspan="2"> + <strong><em><?= $attributes['option_label'] ?></em></strong> + </td> + </tr> + <?php $_prevOptionId = $attributes['option_id'] ?> + <?php endif; ?> <?php endif; ?> -<?php endif; ?> -<tr id="order-item-row-<?php echo $_item->getId() ?>"> <?php if (!$_item->getParentItem()): ?> - <td align="left" valign="top" style="padding:3px 9px"><strong><?php echo $block->escapeHtml($_item->getName()) ?></strong></td> + <tr class="bundle-item bundle-parent"> + <td class="item-info"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> + </td> <?php else: ?> - <td align="left" valign="top" style="padding:3px 19px"><?php echo $block->getValueHtml($_item) ?></td> + <tr class="bundle-item bundle-option-value"> + <td class="item-info"> + <p><?= $block->getValueHtml($_item)?></p> + </td> <?php endif; ?> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($_item->getSku()) ?></td> - <td align="center" valign="top" style="padding:3px 9px"> - <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())): ?> - <?php if (isset($shipItems[$_item->getId()])): ?> - <?php echo $shipItems[$_item->getId()]->getQty()*1 ?> - <?php elseif ($_item->getIsVirtual()): ?> - <?php echo __('N/A') ?> - <?php else: ?> - 0 - <?php endif; ?> - <?php else: ?> - - <?php endif; ?> - </td> -</tr> + <td class="item-qty"> + <?php if (($block->isShipmentSeparately() && $_item->getParentItem()) || (!$block->isShipmentSeparately() && !$_item->getParentItem())): ?> + <?php if (isset($shipItems[$_item->getId()])): ?> + <?= $shipItems[$_item->getId()]->getQty() * 1 ?> + <?php elseif ($_item->getIsVirtual()): ?> + <?= __('N/A') ?> + <?php else: ?> + 0 + <?php endif; ?> + <?php else: ?> + + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> <?php if ($_showlastRow): ?> -<tr> - <td align="left" valign="top" style="padding:3px 9px"> - <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $option['value'] ?></dd> - <?php endforeach; ?> - </dl> - <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> - </td> - <td> </td> - <td> </td> -</tr> + <tr> + <td colspan="2" class="item-extra"> + <?php if ($block->getItemOptions()): ?> + <dl> + <?php foreach ($block->getItemOptions() as $option): ?> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd><?= $option['value'] ?></dd> + <?php endforeach; ?> + </dl> + <?php endif; ?> + <?= $block->escapeHtml($_item->getDescription()) ?> + </td> + </tr> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml index 85ab2f080cc6086aded54f77dfc5caca314fbd4f..b1cd0917932c0fe903d5c7a303d1d41bf1f4d02b 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml @@ -10,7 +10,7 @@ <?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> <?php $parentItem = $block->getItem() ?> -<?php $items = $block->getChilds($parentItem) ?> +<?php $items = $block->getChildren($parentItem) ?> <?php $_order = $block->getItem()->getOrderItem()->getOrder() ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml index c7f4dd44bc08b82634ec14cbc2753806cb1fae3b..541390798c29e1248ff852eb78627f034a0ee857 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml @@ -11,7 +11,7 @@ <?php $parentItem = $block->getItem() ?> <?php $_order = $block->getItem()->getOrderItem()->getOrder() ?> -<?php $items = $block->getChilds($parentItem) ?> +<?php $items = $block->getChildren($parentItem) ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml b/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml index 15406932c1c3e8706afa0c13b58c5c717ddb3dca..e7b304935cd49c700d9a47598607b4bbeeb05437 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml @@ -7,9 +7,11 @@ // @codingStandardsIgnoreFile ?> +<?php /** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */ ?> + <?php $parentItem = $block->getItem() ?> <?php $items = array_merge([$parentItem->getOrderItem()], $parentItem->getOrderItem()->getChildrenItems()) ?> -<?php $shipItems = $block->getChilds($parentItem) ?> +<?php $shipItems = $block->getChildren($parentItem) ?> <?php $_count = count($items) ?> <?php $_index = 0 ?> diff --git a/app/code/Magento/BundleImportExport/i18n/en_US.csv b/app/code/Magento/BundleImportExport/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/CacheInvalidate/i18n/en_US.csv b/app/code/Magento/CacheInvalidate/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Catalog/Model/Template/Filter.php b/app/code/Magento/Catalog/Model/Template/Filter.php index d71c06a87ac4c7140d663d2dcf8d5b501bd2a6f6..debc0a56254183719cb7c8b593c16bef23b405cc 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter.php +++ b/app/code/Magento/Catalog/Model/Template/Filter.php @@ -93,7 +93,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function viewDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); $params['_absolute'] = $this->_useAbsoluteLinks; /** * @bug: the "_absolute" key is not supported by underlying services @@ -122,7 +122,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function mediaDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; } @@ -136,7 +136,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function storeDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); if (!isset($params['_query'])) { $params['_query'] = []; } diff --git a/app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv b/app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/CatalogWidget/i18n/en_US.csv b/app/code/Magento/CatalogWidget/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Checkout/Block/Onepage/Billing.php b/app/code/Magento/Checkout/Block/Onepage/Billing.php index 7522552dfdfdac4debf6676cd3f78f8050b1fc87..f4ddf26ba9126b9042e52e5322767f15a21fdbb4 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Billing.php +++ b/app/code/Magento/Checkout/Block/Onepage/Billing.php @@ -17,7 +17,7 @@ use Magento\Customer\Model\Address\Config as AddressConfig; class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage { /** - * Sales Qoute Billing Address instance + * Sales Quote Billing Address instance * * @var \Magento\Quote\Model\Quote\Address */ diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping.php b/app/code/Magento/Checkout/Block/Onepage/Shipping.php index 8f0ab4985149e05741a1a69794257a3534d39c6b..45eff05bf29620128b33d537dc5b2892fdeb094a 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Shipping.php +++ b/app/code/Magento/Checkout/Block/Onepage/Shipping.php @@ -17,7 +17,7 @@ use Magento\Customer\Model\Address\Config as AddressConfig; class Shipping extends \Magento\Checkout\Block\Onepage\AbstractOnepage { /** - * Sales Qoute Shipping Address instance + * Sales Quote Shipping Address instance * * @var \Magento\Quote\Model\Quote\Address */ diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 44f5950b80be6b60230d9b008b56b33a5fab7f73..51ac3e2d298eb4076d7f908a9374a6e8531fa521 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -273,7 +273,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper $transport = $this->_transportBuilder->setTemplateIdentifier( $template )->setTemplateOptions( - ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $checkout->getStoreId()] + [ + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => Store::DEFAULT_STORE_ID + ] )->setTemplateVars( [ 'reason' => $message, diff --git a/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php b/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php index e844d62b7d840199cd200112a946810c1db01e6d..9ce33f555c72dbdff97673f23607ef2e24f3b591 100644 --- a/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Helper/DataTest.php @@ -148,7 +148,10 @@ class DataTest extends \PHPUnit_Framework_TestCase )->method( 'setTemplateOptions' )->with( - ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 8] + [ + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, + ] )->will( $this->returnSelf() ); diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 44250f0ec5f883aa2baaa8865678fe472d53ee24..1c4aba3bae37dece9785b015add6419e76d759f8 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -5,6 +5,7 @@ "php": "~5.5.0|~5.6.0", "magento/module-store": "0.74.0-beta16", "magento/module-sales": "0.74.0-beta16", + "magento/module-backend": "0.74.0-beta16", "magento/module-catalog-inventory": "0.74.0-beta16", "magento/module-config": "0.74.0-beta16", "magento/module-customer": "0.74.0-beta16", diff --git a/app/code/Magento/Checkout/etc/adminhtml/system.xml b/app/code/Magento/Checkout/etc/adminhtml/system.xml index 52c132421c1387e634e6afa15f57151a4a98471d..40787d2ee67632883afe8adb372164a948c4cf91 100644 --- a/app/code/Magento/Checkout/etc/adminhtml/system.xml +++ b/app/code/Magento/Checkout/etc/adminhtml/system.xml @@ -66,8 +66,9 @@ <label>Payment Failed Email Receiver</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Payment Failed Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Checkout/etc/email_templates.xml b/app/code/Magento/Checkout/etc/email_templates.xml index eceda7cf63d678df0c6231a21559e9e0a91fcf5c..56e2a0618fd5ae2c904bbac574b1f4ef001b15a9 100644 --- a/app/code/Magento/Checkout/etc/email_templates.xml +++ b/app/code/Magento/Checkout/etc/email_templates.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="checkout_payment_failed_template" label="Payment Failed" file="failed_payment.html" type="html" module="Magento_Checkout"/> + <template id="checkout_payment_failed_template" label="Payment Failed" file="failed_payment.html" type="html" module="Magento_Checkout" area="adminhtml"/> </config> diff --git a/app/code/Magento/Checkout/view/adminhtml/email/failed_payment.html b/app/code/Magento/Checkout/view/adminhtml/email/failed_payment.html new file mode 100644 index 0000000000000000000000000000000000000000..1fd563413562af4bae9a6401f0718fc991bcb5af --- /dev/null +++ b/app/code/Magento/Checkout/view/adminhtml/email/failed_payment.html @@ -0,0 +1,65 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Payment Transaction Failed Reminder @--> +<!--@vars { +"var billingAddress.format('html')|raw":"Billing Address", +"var checkoutType":"Checkout Type", +"var customerEmail":"Customer Email", +"var customer":"Customer Name", +"var dateAndTime":"Date and Time of Transaction", +"var paymentMethod":"Payment Method", +"var shippingAddress.format('html')|raw":"Shipping Address", +"var shippingMethod":"Shipping Method", +"var items|raw":"Shopping Cart Items", +"var total":"Total", +"var reason":"Transaction Failed Reason" +} @--> + +<h1>{{trans "Payment Transaction Failed"}}</h1> + +<ul> + <li> + <b>{{trans "Reason"}}</b><br /> + {{var reason}} + </li> + <li> + <b>{{trans "Checkout Type"}}</b><br /> + {{var checkoutType}} + </li> + <li> + <b>{{trans "Customer:"}}</b><br /> + <a href="mailto:{{var customerEmail}}">{{var customer}}</a> <{{var customerEmail}}> + </li> + <li> + <b>{{trans "Items"}}</b><br /> + {{var items|raw}} + </li> + <li> + <b>{{trans "Total:"}}</b><br /> + {{var total}} + </li> + <li> + <b>{{trans "Billing Address:"}}</b><br /> + {{var billingAddress.format('html')|raw}} + </li> + <li> + <b>{{trans "Shipping Address:"}}</b><br /> + {{var shippingAddress.format('html')|raw}} + </li> + <li> + <b>{{trans "Shipping Method:"}}</b><br /> + {{var shippingMethod}} + </li> + <li> + <b>{{trans "Payment Method:"}}</b><br /> + {{var paymentMethod}} + </li> + <li> + <b>{{trans "Date & Time:"}}</b><br /> + {{var dateAndTime}} + </li> +</ul> diff --git a/app/code/Magento/Checkout/view/email/failed_payment.html b/app/code/Magento/Checkout/view/email/failed_payment.html deleted file mode 100644 index c4413cc60fc2e014dadfe75fff6c79102ffd8916..0000000000000000000000000000000000000000 --- a/app/code/Magento/Checkout/view/email/failed_payment.html +++ /dev/null @@ -1,77 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -{* This is a comment block - -Use vars: {{var var_name}} -*}<!--@subject Payment Transaction Failed Reminder @--> -<!--@vars -{"var reason":"Transaction Failed Reason", -"var checkoutType":"Checkout Type", -"var customerEmail":"Customer Email", -"var customer":"Customer Name", -"var items":"Shopping Cart Items", -"var total":"Total", -"var billingAddress.format('html')":"Billing Address", -"var shippingAddress.format('html')":"Shipping Address", -"var shippingMethod":"Shipping Method", -"var paymentMethod":"Payment Method", -"var dateAndTime":"Date and Time of Transaction"} -@--> - -<table> - <thead> - <tr> - <th>Payment transaction failed.</th> - </tr> - </thead> - <tbody> - <tr> - <td> - <p> - <b>Reason</b><br /> - {{var reason}} - </p> - <p> - <b>Checkout Type</b><br /> - {{var checkoutType}} - </p> - <p> - <b>Customer:</b><br /> - <a href="mailto:{{var customerEmail}}">{{var customer}}</a> <{{var customerEmail}}> - </p> - <p> - <b>Items</b><br /> - {{var items}} - </p> - <p> - <b>Total:</b><br /> - {{var total}} - </p> - <p> - <b>Billing Address:</b><br /> - {{var billingAddress.format('html')}} - </p> - <p> - <b>Shipping Address:</b><br /> - {{var shippingAddress.format('html')}} - </p> - <p> - <b>Shipping Method:</b><br /> - {{var shippingMethod}} - </p> - <p> - <b>Payment Method:</b><br /> - {{var paymentMethod}} - </p> - <p> - <b>Date & Time:</b><br /> - {{var dateAndTime}} - </p> - </td> - </tr> - </tbody> -</table> \ No newline at end of file diff --git a/app/code/Magento/Cms/Model/Template/Filter.php b/app/code/Magento/Cms/Model/Template/Filter.php index 5a5c725cb7c650db85cfa9710ff600dc76a6bdda..194d8547d58420ed5591a5c44e13fa234e4d6e4b 100644 --- a/app/code/Magento/Cms/Model/Template/Filter.php +++ b/app/code/Magento/Cms/Model/Template/Filter.php @@ -37,7 +37,7 @@ class Filter extends \Magento\Email\Model\Template\Filter */ public function mediaDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); return $this->_storeManager->getStore()->getBaseMediaDir() . '/' . $params['url']; } } diff --git a/app/code/Magento/CmsUrlRewrite/i18n/en_US.csv b/app/code/Magento/CmsUrlRewrite/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/_files/invalidSystemXmlArray.php b/app/code/Magento/Config/Test/Unit/Model/Config/_files/invalidSystemXmlArray.php index 88b585f57fb72dbfe1bcf676f9a9dc3b50c980e8..584451fd147d9255722e2b1828d88effe693a600 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/_files/invalidSystemXmlArray.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/_files/invalidSystemXmlArray.php @@ -70,7 +70,7 @@ return [ "Element 'if_module_enabled': [facet 'minLength'] The value has a length of '3'; this underruns the " . "allowed minimum length of '5'.", "Element 'if_module_enabled': [facet 'pattern'] The value 'Som' is not " . - "accepted by the pattern '[A-Z]+[a-z0-9]{1,}[_\\\\\\\\][A-Z]+[A-Z0-9a-z]{1,}'.", + "accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}[_\\\\\\\\][A-Z]+[A-Z0-9a-z]{1,}'.", "Element 'if_module_enabled': 'Som' " . "is not a valid value of the atomic type 'typeModule'." ], ], @@ -118,7 +118,7 @@ return [ "Element 'resource': [facet 'minLength'] The value has a length of '4'; this underruns the allowed " . "minimum length of '8'.", "Element 'resource': [facet 'pattern'] The value 'One:' is not accepted by the " . - "pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource': 'One:' is not " . "a valid value of the atomic type 'typeAclResourceId'." ], ], diff --git a/app/code/Magento/Config/etc/system.xsd b/app/code/Magento/Config/etc/system.xsd index 658532148e4d9edd6a8811ccba0090812553ad05..7f3057d602cb9d69e13bd21cd570ee128aae865f 100644 --- a/app/code/Magento/Config/etc/system.xsd +++ b/app/code/Magento/Config/etc/system.xsd @@ -414,7 +414,7 @@ </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}" /> + <xs:pattern value="[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}" /> <xs:minLength value="8" /> </xs:restriction> </xs:simpleType> @@ -422,11 +422,11 @@ <xs:simpleType name="typeModule"> <xs:annotation> <xs:documentation> - Item module attribute can has only [a-z0-9_\]. Minimal length 5 symbol. Case insensitive. + Item module attribute can have only [a-zA-Z0-9_\]. Minimal length 5 symbol. Case insensitive. </xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z]+[a-z0-9]{1,}[_\\\\][A-Z]+[A-Z0-9a-z]{1,}" /> + <xs:pattern value="[A-Z]+[a-zA-Z0-9]{1,}[_\\\\][A-Z]+[A-Z0-9a-z]{1,}" /> <xs:minLength value="5" /> </xs:restriction> </xs:simpleType> @@ -434,7 +434,7 @@ <xs:simpleType name="typeModel"> <xs:annotation> <xs:documentation> - Item model attribute can has only [a-zA-Z0-9_]. Minimal length 5 symbol. Case insensitive. + Item model attribute can have only [a-zA-Z0-9_]. Minimal length 5 symbol. Case insensitive. </xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> diff --git a/app/code/Magento/Config/etc/system_file.xsd b/app/code/Magento/Config/etc/system_file.xsd index f0ededa2efadbbacdf98ab5111ced942e917cab7..bb23e69a24c8fdbb5bed087972064a956558ab40 100644 --- a/app/code/Magento/Config/etc/system_file.xsd +++ b/app/code/Magento/Config/etc/system_file.xsd @@ -427,7 +427,7 @@ </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}" /> + <xs:pattern value="[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}" /> <xs:minLength value="8" /> </xs:restriction> </xs:simpleType> @@ -443,7 +443,7 @@ </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9/.]{1,}" /> + <xs:pattern value="[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9/.]{1,}" /> <xs:minLength value="8" /> </xs:restriction> </xs:simpleType> @@ -455,7 +455,7 @@ </xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}" /> + <xs:pattern value="[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}" /> <xs:minLength value="5" /> </xs:restriction> </xs:simpleType> diff --git a/app/code/Magento/ConfigurableImportExport/i18n/en_US.csv b/app/code/Magento/ConfigurableImportExport/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Contact/Controller/Index/Post.php b/app/code/Magento/Contact/Controller/Index/Post.php index d283a439da9455f605d29c006f54ac0fd47c2612..c5dd05cb5d5ac5a63e62a2aa0193111a8e229d8e 100644 --- a/app/code/Magento/Contact/Controller/Index/Post.php +++ b/app/code/Magento/Contact/Controller/Index/Post.php @@ -50,8 +50,8 @@ class Post extends \Magento\Contact\Controller\Index ->setTemplateIdentifier($this->scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE, $storeScope)) ->setTemplateOptions( [ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => $this->storeManager->getStore()->getId(), + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, ] ) ->setTemplateVars(['data' => $postObject]) diff --git a/app/code/Magento/Contact/Test/Unit/Controller/Index/PostTest.php b/app/code/Magento/Contact/Test/Unit/Controller/Index/PostTest.php index f7acd3a75891a4aec12e358b91a9017ad63406ba..a508c25a445c2556670d756bef190f7eb85d13bd 100644 --- a/app/code/Magento/Contact/Test/Unit/Controller/Index/PostTest.php +++ b/app/code/Magento/Contact/Test/Unit/Controller/Index/PostTest.php @@ -6,6 +6,9 @@ */ namespace Magento\Contact\Test\Unit\Controller\Index; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class PostTest extends \PHPUnit_Framework_TestCase { /** @@ -177,16 +180,6 @@ class PostTest extends \PHPUnit_Framework_TestCase ->method('getPostValue') ->will($this->returnValue($post)); - $store = $this->getMock('\Magento\Store\Model\Store', ['getId', '__sleep', '__wakeup'], [], '', false); - - $store->expects($this->once()) - ->method('getId') - ->will($this->returnValue(1)); - - $this->_storeManager->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($store)); - $transport = $this->getMock('\Magento\Framework\Mail\TransportInterface', [], [], '', false); $this->_transportBuilder->expects($this->once()) @@ -196,8 +189,8 @@ class PostTest extends \PHPUnit_Framework_TestCase $this->_transportBuilder->expects($this->once()) ->method('setTemplateOptions') ->with([ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => 1, + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, ]) ->will($this->returnSelf()); diff --git a/app/code/Magento/Contact/etc/adminhtml/system.xml b/app/code/Magento/Contact/etc/adminhtml/system.xml index 1a59c631be927cd70b0b3cee66f0baaa8ded5157..b6471ae8a066baea5f7ea6a08f7ca4c9b20064af 100644 --- a/app/code/Magento/Contact/etc/adminhtml/system.xml +++ b/app/code/Magento/Contact/etc/adminhtml/system.xml @@ -29,8 +29,9 @@ <label>Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="email_template" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="email_template" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> </group> diff --git a/app/code/Magento/Contact/etc/email_templates.xml b/app/code/Magento/Contact/etc/email_templates.xml index 1b136af8d7baa15497ea50ba61ceb2e7cb9df2db..10b1171395b7e1e463522d012be582353f82834b 100644 --- a/app/code/Magento/Contact/etc/email_templates.xml +++ b/app/code/Magento/Contact/etc/email_templates.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="contact_email_email_template" label="Contact Form" file="submitted_form.html" type="text" module="Magento_Contact"/> + <template id="contact_email_email_template" label="Contact Form" file="submitted_form.html" type="text" module="Magento_Contact" area="adminhtml"/> </config> diff --git a/app/code/Magento/Contact/view/adminhtml/email/submitted_form.html b/app/code/Magento/Contact/view/adminhtml/email/submitted_form.html new file mode 100644 index 0000000000000000000000000000000000000000..ed5acf45bb55efcfd450ddff160f6e7e3a34093e --- /dev/null +++ b/app/code/Magento/Contact/view/adminhtml/email/submitted_form.html @@ -0,0 +1,19 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Contact Form@--> +<!--@vars { +"var data.comment":"Comment", +"var data.email":"Sender Email", +"var data.name":"Sender Name", +"var data.telephone":"Sender Telephone" +} @--> + +{{trans "Name: %name" name=$data.name}} +{{trans "Email: %email" email=$data.email}} +{{trans "Phone Number: %telephone" telephone=$data.telephone}} + +{{trans "Comment: %comment" comment=$data.comment}} diff --git a/app/code/Magento/Contact/view/email/submitted_form.html b/app/code/Magento/Contact/view/email/submitted_form.html deleted file mode 100644 index 5bff540b55d442db04ba85c3e9ea1f6b6591d23b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Contact/view/email/submitted_form.html +++ /dev/null @@ -1,18 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Contact Form@--> -<!--@vars -{"var data.name":"Sender Name", -"var data.email":"Sender Email", -"var data.telephone":"Sender Telephone", -"var data.comment":"Comment"} -@--> -Name: {{var data.name}} -Email: {{var data.email}} -Phone Number: {{var data.telephone}} - -Comment: {{var data.comment}} \ No newline at end of file diff --git a/app/code/Magento/Cookie/i18n/en_US.csv b/app/code/Magento/Cookie/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 46b0bb477f6d433a207ce7d929c008b222105b73..aa5a30ea4c53befd6ca972edec88c6e20733a8ea 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -14,10 +14,12 @@ use Magento\Customer\Api\CustomerMetadataInterface; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Api\Data\ValidationResultsInterfaceFactory; use Magento\Customer\Helper\View as CustomerViewHelper; use Magento\Customer\Model\Config\Share as ConfigShare; use Magento\Customer\Model\Customer as CustomerModel; use Magento\Customer\Model\Metadata\Validator; +use Magento\Framework\Api\ExtensibleDataObjectConverter; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Encryption\EncryptorInterface as Encryptor; use Magento\Framework\Event\ManagerInterface; @@ -30,6 +32,8 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\State\ExpiredException; use Magento\Framework\Exception\State\InputMismatchException; use Magento\Framework\Exception\State\InvalidTransitionException; +use Magento\Framework\ObjectFactory; +use Magento\Framework\Registry; use Psr\Log\LoggerInterface as PsrLogger; use Magento\Framework\Exception\MailException; use Magento\Framework\Mail\Template\TransportBuilder; @@ -126,11 +130,6 @@ class AccountManagement implements AccountManagementInterface */ private $customerMetadataService; - /** - * @var \Magento\Framework\Url - */ - private $url; - /** * @var PsrLogger */ @@ -210,11 +209,10 @@ class AccountManagement implements AccountManagementInterface * @param StoreManagerInterface $storeManager * @param Random $mathRandom * @param Validator $validator - * @param \Magento\Customer\Api\Data\ValidationResultsInterfaceFactory $validationResultsDataFactory + * @param ValidationResultsInterfaceFactory $validationResultsDataFactory * @param AddressRepositoryInterface $addressRepository * @param CustomerMetadataInterface $customerMetadataService * @param CustomerRegistry $customerRegistry - * @param \Magento\Framework\Url $url * @param PsrLogger $logger * @param Encryptor $encryptor * @param ConfigShare $configShare @@ -223,12 +221,12 @@ class AccountManagement implements AccountManagementInterface * @param ScopeConfigInterface $scopeConfig * @param TransportBuilder $transportBuilder * @param DataObjectProcessor $dataProcessor - * @param \Magento\Framework\Registry $registry + * @param Registry $registry * @param CustomerViewHelper $customerViewHelper * @param DateTime $dateTime * @param CustomerModel $customerModel - * @param \Magento\Framework\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter + * @param ObjectFactory $objectFactory + * @param ExtensibleDataObjectConverter $extensibleDataObjectConverter * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -238,11 +236,10 @@ class AccountManagement implements AccountManagementInterface StoreManagerInterface $storeManager, Random $mathRandom, Validator $validator, - \Magento\Customer\Api\Data\ValidationResultsInterfaceFactory $validationResultsDataFactory, + ValidationResultsInterfaceFactory $validationResultsDataFactory, AddressRepositoryInterface $addressRepository, CustomerMetadataInterface $customerMetadataService, CustomerRegistry $customerRegistry, - \Magento\Framework\Url $url, PsrLogger $logger, Encryptor $encryptor, ConfigShare $configShare, @@ -251,12 +248,12 @@ class AccountManagement implements AccountManagementInterface ScopeConfigInterface $scopeConfig, TransportBuilder $transportBuilder, DataObjectProcessor $dataProcessor, - \Magento\Framework\Registry $registry, + Registry $registry, CustomerViewHelper $customerViewHelper, DateTime $dateTime, CustomerModel $customerModel, - \Magento\Framework\ObjectFactory $objectFactory, - \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter + ObjectFactory $objectFactory, + ExtensibleDataObjectConverter $extensibleDataObjectConverter ) { $this->customerFactory = $customerFactory; $this->eventManager = $eventManager; @@ -267,7 +264,6 @@ class AccountManagement implements AccountManagementInterface $this->addressRepository = $addressRepository; $this->customerMetadataService = $customerMetadataService; $this->customerRegistry = $customerRegistry; - $this->url = $url; $this->logger = $logger; $this->encryptor = $encryptor; $this->configShare = $configShare; @@ -409,7 +405,7 @@ class AccountManagement implements AccountManagementInterface try { switch ($template) { case AccountManagement::EMAIL_REMINDER: - $this->sendPasswordReminderEmail($customer, $newPasswordToken); + $this->sendPasswordReminderEmail($customer); break; case AccountManagement::EMAIL_RESET: $this->sendPasswordResetConfirmationEmail($customer); @@ -620,18 +616,19 @@ class AccountManagement implements AccountManagementInterface /** * Change customer password. * - * @param string $email + * @param CustomerModel $customer * @param string $currentPassword * @param string $newPassword * @return bool true on success + * @throws InputException + * @throws InvalidEmailOrPasswordException */ private function changePasswordForCustomer($customer, $currentPassword, $newPassword) { $customerSecure = $this->customerRegistry->retrieveSecureData($customer->getId()); $hash = $customerSecure->getPasswordHash(); if (!$this->encryptor->validateHash($currentPassword, $hash)) { - throw new InvalidEmailOrPasswordException( - __('The password doesn\'t match this account.')); + throw new InvalidEmailOrPasswordException(__('The password doesn\'t match this account.')); } $customerSecure->setRpToken(null); $customerSecure->setRpTokenCreatedAt(null); @@ -1053,34 +1050,23 @@ class AccountManagement implements AccountManagementInterface * Send email with new customer password * * @param CustomerInterface $customer - * @param string $newPasswordToken * @return $this */ - public function sendPasswordReminderEmail($customer, $newPasswordToken) + public function sendPasswordReminderEmail($customer) { - $this->url->setScope($customer->getStoreId()); - //TODO : Fix how template is built. Maybe Framework Object or create new Email template data model? - // Check template to see what values need to be set in the data model to be passed - // Need to set the reset_password_url property of the object - $store = $this->storeManager->getStore($customer->getStoreId()); - $resetUrl = $this->url->getUrl( - 'customer/account/createPassword', - [ - '_query' => ['id' => $customer->getId(), 'token' => $newPasswordToken], - '_store' => $customer->getStoreId(), - '_secure' => $store->isFrontUrlSecure(), - ] - ); + $storeId = $this->storeManager->getStore()->getId(); + if (!$storeId) { + $storeId = $this->getWebsiteStoreId($customer); + } $customerEmailData = $this->getFullCustomerObject($customer); - $customerEmailData->setResetPasswordUrl($resetUrl); $this->sendEmailTemplate( $customer, self::XML_PATH_REMIND_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY, - ['customer' => $customerEmailData, 'store' => $store], - $customer->getStoreId() + ['customer' => $customerEmailData, 'store' => $this->storeManager->getStore($storeId)], + $storeId ); return $this; diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index f8ae3816d8905c396ecd2fda99423348c7d70d86..1a7355c6a87aedb24228082ae06aa236ded5436a 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -49,9 +49,6 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Model\CustomerRegistry|\PHPUnit_Framework_MockObject_MockObject */ protected $customerRegistry; - /** @var \Magento\Framework\Url|\PHPUnit_Framework_MockObject_MockObject */ - protected $url; - /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $logger; @@ -127,7 +124,6 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase $this->addressRepository = $this->getMock('Magento\Customer\Api\AddressRepositoryInterface'); $this->customerMetadata = $this->getMock('Magento\Customer\Api\CustomerMetadataInterface'); $this->customerRegistry = $this->getMock('Magento\Customer\Model\CustomerRegistry', [], [], '', false); - $this->url = $this->getMock('Magento\Framework\Url', [], [], '', false); $this->logger = $this->getMock('Psr\Log\LoggerInterface'); $this->encryptor = $this->getMock('Magento\Framework\Encryption\EncryptorInterface'); $this->share = $this->getMock('Magento\Customer\Model\Config\Share', [], [], '', false); @@ -178,7 +174,6 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase 'addressRepository' => $this->addressRepository, 'customerMetadataService' => $this->customerMetadata, 'customerRegistry' => $this->customerRegistry, - 'url' => $this->url, 'logger' => $this->logger, 'encryptor' => $this->encryptor, 'configShare' => $this->share, @@ -616,9 +611,6 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase $customerId = 1; $customerStoreId = 2; $customerEmail = 'email@email.com'; - $passwordToken = 'token'; - $isFrontendSecure = true; - $resetUrl = 'reset url'; $customerData = ['key' => 'value']; $customerName = 'Customer Name'; $templateIdentifier = 'Template Identifier'; @@ -636,25 +628,18 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ->method('getEmail') ->willReturn($customerEmail); - $this->storeManager->expects($this->any()) + $this->store->expects($this->any()) + ->method('getId') + ->willReturn($customerStoreId); + + $this->storeManager->expects($this->at(0)) ->method('getStore') - ->with($customerStoreId) ->willReturn($this->store); - $this->store->expects($this->any()) - ->method('isFrontUrlSecure') - ->willReturn($isFrontendSecure); - - $this->url->expects($this->once()) - ->method('getUrl') - ->with( - 'customer/account/createPassword', - [ - '_query' => ['id' => $customerId, 'token' => $passwordToken], - '_store' => $customerStoreId, - '_secure' => $isFrontendSecure, - ] - )->willReturn($resetUrl); + $this->storeManager->expects($this->at(1)) + ->method('getStore') + ->with($customerStoreId) + ->willReturn($this->store); $this->customerRegistry->expects($this->once()) ->method('retrieveSecureData') @@ -679,9 +664,6 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ->method('setData') ->with('name', $customerName) ->willReturnSelf(); - $this->customerSecure->expects($this->any()) - ->method('setResetPasswordUrl') - ->with($resetUrl); $this->scopeConfig->expects($this->at(0)) ->method('getValue') @@ -722,10 +704,7 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase $transport->expects($this->once()) ->method('sendMessage'); - $this->assertEquals( - $this->accountManagement, - $this->accountManagement->sendPasswordReminderEmail($customer, $passwordToken) - ); + $this->assertEquals($this->accountManagement, $this->accountManagement->sendPasswordReminderEmail($customer)); } /** @@ -866,33 +845,10 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase $sender = 'Sender'; $storeId = 1; - $isFrontendSecure = true; - - $resetUrl = 'reset url'; mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX); $hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true)); - $this->store->expects($this->once()) - ->method('isFrontUrlSecure') - ->willReturn($isFrontendSecure); - - $this->url->expects($this->once()) - ->method('setScope') - ->with($storeId) - ->willReturnSelf(); - $this->url->expects($this->once()) - ->method('getUrl') - ->with( - 'customer/account/createPassword', - [ - '_query' => ['id' => $customerId, 'token' => $hash], - '_store' => $storeId, - '_secure' => $isFrontendSecure, - ] - ) - ->willReturn($resetUrl); - $this->scopeConfig->expects($this->at(0)) ->method('getValue') ->with(AccountManagement::XML_PATH_REMIND_EMAIL_TEMPLATE, ScopeInterface::SCOPE_STORE, $storeId) @@ -902,11 +858,6 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ->with(AccountManagement::XML_PATH_FORGOT_EMAIL_IDENTITY, ScopeInterface::SCOPE_STORE, $storeId) ->willReturn($sender); - $this->customerSecure->expects($this->any()) - ->method('setResetPasswordUrl') - ->with($resetUrl) - ->willReturnSelf(); - $this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash); $this->assertTrue($this->accountManagement->initiatePasswordReset($email, $template)); diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index 8ccba94947f04b0b2b1b42eafb5803482b29acc3..df4a56940f5e050208c72ee4432e6b4f1ca5425d 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -81,16 +81,17 @@ <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> <backend_model>Magento\Customer\Model\Config\Backend\CreateAccount\DisableAutoGroupAssignDefault</backend_model> </field> - <field id="vat_frontend_visibility" translate="label" type="select" sortOrder="58" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="vat_frontend_visibility" translate="label comment" type="select" sortOrder="58" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Show VAT Number on Storefront</label> - <comment>To show VAT number on Storefront, set "Show VAT Number on Storefront" option to Yes.</comment> + <comment>To show VAT number on Storefront, set Show VAT Number on Storefront option to Yes.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> <field id="email_domain" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Default Email Domain</label> </field> - <field id="email_template" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="email_template" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Default Welcome Email</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="email_identity" translate="label" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -101,13 +102,17 @@ <label>Require Emails Confirmation</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="email_confirmation_template" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="email_confirmation_template" translate="label comment" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Confirmation Link Email</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="email_confirmed_template" translate="label comment" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Welcome Email</label> - <comment>This email will be sent instead of default welcome email, after account confirmation.</comment> + <comment><![CDATA[ + This email will be sent instead of the Default Welcome Email, after account confirmation. <br /><br /> + Email template chosen based on theme fallback when "Default" option is selected. + ]]></comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="generate_human_friendly_id" translate="label" type="select" sortOrder="120" showInDefault="1" showInWebsite="0" showInStore="0"> @@ -117,16 +122,19 @@ </group> <group id="password" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Password Options</label> - <field id="forgot_email_template" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="forgot_email_template" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Forgot Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="remind_email_template" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="remind_email_template" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Remind Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="reset_password_template" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="reset_password_template" translate="label comment" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Reset Password Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="forgot_email_identity" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Customer/etc/email_templates.xml b/app/code/Magento/Customer/etc/email_templates.xml index d1e3f2e90e0f0b4096c4808d7bbc34ae280934d2..943137b85ac99554506bf411128b163770911cbe 100644 --- a/app/code/Magento/Customer/etc/email_templates.xml +++ b/app/code/Magento/Customer/etc/email_templates.xml @@ -6,10 +6,10 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="customer_create_account_email_template" label="New Account" file="account_new.html" type="html" module="Magento_Customer"/> - <template id="customer_create_account_email_confirmation_template" label="New Account Confirmation Key" file="account_new_confirmation.html" type="html" module="Magento_Customer"/> - <template id="customer_create_account_email_confirmed_template" label="New Account Confirmed" file="account_new_confirmed.html" type="html" module="Magento_Customer"/> - <template id="customer_password_forgot_email_template" label="Forgot Password" file="password_reset_confirmation.html" type="html" module="Magento_Customer"/> - <template id="customer_password_remind_email_template" label="Remind Password" file="password_new.html" type="html" module="Magento_Customer"/> - <template id="customer_password_reset_password_template" label="Reset Password" file="password_reset.html" type="html" module="Magento_Customer"/> + <template id="customer_create_account_email_template" label="New Account" file="account_new.html" type="html" module="Magento_Customer" area="frontend"/> + <template id="customer_create_account_email_confirmation_template" label="New Account Confirmation Key" file="account_new_confirmation.html" type="html" module="Magento_Customer" area="frontend"/> + <template id="customer_create_account_email_confirmed_template" label="New Account Confirmed" file="account_new_confirmed.html" type="html" module="Magento_Customer" area="frontend"/> + <template id="customer_password_forgot_email_template" label="Forgot Password" file="password_reset_confirmation.html" type="html" module="Magento_Customer" area="frontend"/> + <template id="customer_password_remind_email_template" label="Remind Password" file="password_new.html" type="html" module="Magento_Customer" area="frontend"/> + <template id="customer_password_reset_password_template" label="Reset Password" file="password_reset.html" type="html" module="Magento_Customer" area="frontend"/> </config> diff --git a/app/code/Magento/Customer/view/email/account_new.html b/app/code/Magento/Customer/view/email/account_new.html deleted file mode 100644 index 9faacb39c9e2b7405ed843d35ab94950b6437e8f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Customer/view/email/account_new.html +++ /dev/null @@ -1,63 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Welcome, {{var customer.name}}! @--> -<!--@vars -{"store direct_url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"escapehtml var=$customer.name":"Customer Name", -"store direct_url=\"customer/account/\"":"Customer Account Url", -"var customer.email":"Customer Email", -"escapehtml var=$customer.password":"Customer Password"} -@--> - -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store direct_url=''}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$customer.name}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Welcome to {{var store.getFrontendName()}}. To sign in when visiting our site just click <a href="{{store direct_url='customer/account/'}}" style="color:#1E7EC8;">Login</a> or <a href="{{store direct_url='customer/account/'}}" style="color:#1E7EC8;">My Account</a> at the top of every page, and then enter your email address and password.</p> - <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#f9f9f9;"> - Use the following values when prompted to sign in:<br/> - <strong>Email</strong>: {{var customer.email}}<br/> - <strong>Password</strong>: Only you know that! (Hint: It’s the password you created at {{var store.getFrontendName()}})<br/> - Forgot your Account password? No problems. Click <a href="{{store direct_url='customer/account/createPassword/' _query_id=$customer.id _query_token=$customer.rp_token}}">here</a> to reset it.</p> - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">When you sign in to your account, you will be able to do the following:</p> - <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;"> - <li style="list-style:none inside; padding:0 0 0 10px;">– Proceed through checkout faster when making a purchase</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Check the status of orders</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– View past orders</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Make changes to your account information</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Change your password</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Store alternative addresses (for shipping to multiple family members and friends!)</li> - </ul> - <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> - </table> -</div> -</body> diff --git a/app/code/Magento/Customer/view/email/account_new_confirmation.html b/app/code/Magento/Customer/view/email/account_new_confirmation.html deleted file mode 100644 index 501f45ed0f8576923ab537d11da7ffcd75a36efe..0000000000000000000000000000000000000000 --- a/app/code/Magento/Customer/view/email/account_new_confirmation.html +++ /dev/null @@ -1,58 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Account confirmation for {{var customer.name}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"store url=\"customer/account/\"":"Customer Account Url", -"escapehtml var=$customer.name":"Customer Name", -"var customer.email":"Customer Email", -"store url=\"customer/account/confirm/\" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url":"Confirmation Url", -"var store.getFrontendName()|escape":"Store Name"} -@--> - -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a> - </td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$customer.name}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Your email {{var customer.email}} must be confirmed before using it to sign in to our store.</p> - <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">To confirm the email and instantly sign in, please, use <a href="{{store url="customer/account/confirm/" _query_id=$customer.id _query_key=$customer.confirmation _query_back_url=$back_url}}" style="color:#1E7EC8;">this confirmation link</a>. This link is valid only once.</p> - <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0 0 16px 0; padding:13px 18px; background:#f9f9f9;"> - Use the following values when prompted to sign in:<br/> - <strong>Email:</strong> {{var customer.email}}<br/> - <strong>Password:</strong> Only you know that! (Hint: It’s the password you created at {{var store.getFrontendName()|escape}})<br/> - Forgot your Account password? No problems. Click <a href="{{store url="customer/account/createPassword/" _query_id=$customer.id _query_token=$customer.rp_token}}">here</a> to reset it. - </p> - <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()|escape}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> - </table> -</div> -</body> diff --git a/app/code/Magento/Customer/view/email/account_new_confirmed.html b/app/code/Magento/Customer/view/email/account_new_confirmed.html deleted file mode 100644 index e6b7f3e93799b8efa624c3410ced72a97328b514..0000000000000000000000000000000000000000 --- a/app/code/Magento/Customer/view/email/account_new_confirmed.html +++ /dev/null @@ -1,57 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Welcome, {{var customer.name}}! @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$customer.name":"Customer Name", -"store url=\"customer/account/\"":"Customer Account Url"} -@--> - -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a> - </td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$customer.name}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Welcome to {{var store.getFrontendName()}}. To sign in when visiting our site just click <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">Sign In</a> or <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">My Account</a> at the top of every page, and then enter your email address and password.</p> - <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">When you sign in to your account, you will be able to do the following:</p> - <ul style="font-size:12px; line-height:16px; margin:0 0 16px 0; padding:0;"> - <li style="list-style:none inside; padding:0 0 0 10px;">– Proceed through checkout faster when making a purchase</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Check the status of orders</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– View past orders</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Make changes to your account information</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Change your password</li> - <li style="list-style:none inside; padding:0 0 0 10px;">– Store alternative addresses (for shipping to multiple family members and friends!)</li> - </ul> - <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> - </table> -</div> -</body> diff --git a/app/code/Magento/Customer/view/email/password_new.html b/app/code/Magento/Customer/view/email/password_new.html deleted file mode 100644 index 1bd197198d1594a85525820a91af25207299d99d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Customer/view/email/password_new.html +++ /dev/null @@ -1,51 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject New password for {{var customer.name}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"store url=\"customer/account/\"":"Customer Account Url", -"escapehtml var=$customer.name":"Customer Name", -"var store.getFrontendName()|escape":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a> - </td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size: 22px; font-weight: normal; line-height: 22px; margin: 0 0 11px 0;">Dear {{escapehtml var=$customer.name}},</h1> - <p style="font-size: 12px; line-height: 16px; margin: 0 0 8px 0;">There was recently a request to change the password for your account.</p> - <p style="font-size: 12px; line-height: 16px; margin: 0;">If you requested this password change, please click on the following link to reset your password: <a href="{{var customer.reset_password_url}}" style="color:#1E7EC8;">{{var customer.reset_password_url}}</a></p> - <p style="font-size: 12px; line-height: 16px; margin: 0;">If clicking the link does not work, please copy and paste the URL into your browser instead.</p> - <br /> - <p style="font-size:12px; line-height:16px; margin:0;">If you did not make this request, you can ignore this message and your password will remain the same.</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()|escape}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Customer/view/email/password_reset.html b/app/code/Magento/Customer/view/email/password_reset.html deleted file mode 100644 index a9710c41002d65d333c89eb75394df7c9748866b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Customer/view/email/password_reset.html +++ /dev/null @@ -1,46 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject New password for {{var customer.name}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$customer.name":"Customer Name", -"var store.getFrontendName()|escape":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> - <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a> - </td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$customer.name}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">There was recently a request to change the password for your account.</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()|escape}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> - </table> -</div> -</body> diff --git a/app/code/Magento/Customer/view/email/password_reset_confirmation.html b/app/code/Magento/Customer/view/email/password_reset_confirmation.html deleted file mode 100644 index 3a7ebb4ded9524ed48295002effe77e4623216d6..0000000000000000000000000000000000000000 --- a/app/code/Magento/Customer/view/email/password_reset_confirmation.html +++ /dev/null @@ -1,49 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Password Reset Confirmation for {{var customer.name}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$customer.name":"Customer Name", -"store url=\"customer/account/createpassword/\" _query_id=$customer.id _query_token=$customer.rp_token":"Reset Password URL"} -@--> - -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background: #F6F6F6; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin: 0; padding: 0;"> - <div style="background: #F6F6F6; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin: 0; padding: 0;"> - <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding: 20px 0 20px 0"> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a> - </td> - </tr> - <tr> - <td valign="top"> - <h1 style="font-size: 22px; font-weight: normal; line-height: 22px; margin: 0 0 11px 0;">Dear {{escapehtml var=$customer.name}},</h1> - <p style="font-size: 12px; line-height: 16px; margin: 0 0 8px 0;">There was recently a request to change the password for your account.</p> - <p style="font-size: 12px; line-height: 16px; margin: 0;">If you requested this password change, please click on the following link to reset your password: <a href="{{store url="customer/account/createPassword/" _query_id=$customer.id _query_token=$customer.rp_token}}" style="color:#1E7EC8;">{{store url="customer/account/createPassword/" _query_id=$customer.id _query_token=$customer.rp_token}}</a></p> - <p style="font-size: 12px; line-height: 16px; margin: 0;">If clicking the link does not work, please copy and paste the URL into your browser instead.</p> - <br /> - <p style="font-size:12px; line-height:16px; margin:0;">If you did not make this request, you can ignore this message and your password will remain the same.</p> - </td> - </tr> - <tr> - <td style="background-color: #EAEAEA; text-align: center;"><p style="font-size:12px; margin:0; text-align: center;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></td> - </tr> - </table> - </td> - </tr> - </table> - </div> -</body> diff --git a/app/code/Magento/Customer/view/frontend/email/account_new.html b/app/code/Magento/Customer/view/frontend/email/account_new.html new file mode 100644 index 0000000000000000000000000000000000000000..f5c2706ae392e887840d48cba416df2e7aef2dca --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/email/account_new.html @@ -0,0 +1,44 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Welcome to {{var store.getFrontendName()}} @--> +<!--@vars { +"var store.getUrl('customer/account/')":"Customer Account URL", +"var customer.email":"Customer Email", +"var customer.name":"Customer Name" +} @--> + +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customer.name}}</p> +<p>{{trans "Welcome to %store_name." store_name=$store.getFrontendName()}}</p> +<p> + {{trans + 'To sign in to our site, use these credentials during checkout or on the <a href="%customer_url">My Account</a> page:' + + customer_url=$store.getUrl('customer/account/') + |raw}} +</p> +<ul> + <li><strong>{{trans "Email:"}}</strong> {{var customer.email}}</li> + <li><strong>{{trans "Password:"}}</strong> <em>{{trans "Password you set when creating account"}}</em></li> +</ul> +<p> + {{trans + 'Forgot your account password? Click <a href="%reset_url">here</a> to reset it.' + + reset_url="$store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])" + |raw}} +</p> +<p>{{trans "When you sign in to your account, you will be able to:"}}</p> +<ul> + <li>{{trans "Proceed through checkout faster"}}</li> + <li>{{trans "Check the status of orders"}}</li> + <li>{{trans "View past orders"}}</li> + <li>{{trans "Store alternative addresses (for shipping to multiple family members and friends)"}}</li> +</ul> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html b/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html new file mode 100644 index 0000000000000000000000000000000000000000..7c018b1f1f27a4a633e012eb0bd0f0c6bfceb1c4 --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/email/account_new_confirmation.html @@ -0,0 +1,34 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Please confirm your {{var store.getFrontendName()}} account @--> +<!--@vars { +"var store.getUrl('customer/account/confirm/', [_query:[id:$customer.id, key:$customer.confirmation, back_url:$back_url]])":"Account Confirmation URL", +"var store.getUrl('customer/account/')":"Customer Account URL", +"var customer.email":"Customer Email", +"var customer.name":"Customer Name" +} @--> + +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customer.name}}</p> +<p>{{trans "You must confirm your %customer_email email before you can sign in (link is only valid once):" customer_email=$customer.email}}</p> + +<table class="button" width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> + <table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center"> + <tr> + <td align="center"> + <a href="{{var store.getUrl('customer/account/confirm/', [_query:[id:$customer.id, key:$customer.confirmation, back_url:$back_url]])}}" target="_blank">{{trans "Confirm Your Account"}}</a> + </td> + </tr> + </table> + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html b/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html new file mode 100644 index 0000000000000000000000000000000000000000..0d800973e815abf7f579ab3498f074321391624b --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/email/account_new_confirmed.html @@ -0,0 +1,43 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Welcome to {{var store.getFrontendName()}} @--> +<!--@vars { +"var store.getUrl('customer/account/')":"Customer Account URL", +"var customer.email":"Customer Email", +"var customer.name":"Customer Name" +} @--> +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customer.name}}</p> +<p>{{trans "Thank you for confirming your %store_name account." store_name=$store.getFrontendName()}}</p> +<p> + {{trans + 'To sign in to our site, use these credentials during checkout or on the <a href="%customer_url">My Account</a> page:' + + customer_url=$store.getUrl('customer/account/') + |raw}} +</p> +<ul> + <li><strong>{{trans "Email:"}}</strong> {{var customer.email}}</li> + <li><strong>{{trans "Password:"}}</strong> <em>{{trans "Password you set when creating account"}}</em></li> +</ul> +<p> + {{trans + 'Forgot your account password? Click <a href="%reset_url">here</a> to reset it.' + + reset_url="$store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])" + |raw}} +</p> +<p>{{trans "When you sign in to your account, you will be able to:"}}</p> +<ul> + <li>{{trans "Proceed through checkout faster"}}</li> + <li>{{trans "Check the status of orders"}}</li> + <li>{{trans "View past orders"}}</li> + <li>{{trans "Store alternative addresses (for shipping to multiple family members and friends)"}}</li> +</ul> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Customer/view/frontend/email/password_new.html b/app/code/Magento/Customer/view/frontend/email/password_new.html new file mode 100644 index 0000000000000000000000000000000000000000..fe0b0c9cc51911cd142c4fc02a0f618e3b6d9962 --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/email/password_new.html @@ -0,0 +1,34 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Reset your {{var store.getFrontendName()}} password @--> +<!--@vars { +"var store.getUrl('customer/account/')":"Customer Account URL", +"var customer.name":"Customer Name" +} @--> +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customer.name}}</p> +<p>{{trans "There was recently a request to change the password for your account."}}</p> +<p>{{trans "If you requested this change, reset your password here:"}}</p> + +<table class="button" width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> + <table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center"> + <tr> + <td align="center"> + <a href="{{var store.getUrl('customer/account/createPassword', [_query:[id:$customer.id, token:$customer.rp_token]])}}" target="_blank">{{trans "Reset Password"}}</a> + </td> + </tr> + </table> + </td> + </tr> +</table> + +<p>{{trans "If you did not make this request, you can ignore this email and your password will remain the same."}}</p> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Customer/view/frontend/email/password_reset.html b/app/code/Magento/Customer/view/frontend/email/password_reset.html new file mode 100644 index 0000000000000000000000000000000000000000..872e7c4a789db542775bc2eefbe063d64b30542f --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/email/password_reset.html @@ -0,0 +1,17 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Your {{var store.getFrontendName()}} password has been changed @--> +<!--@vars { +"var customer.name":"Customer Name" +} @--> +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customer.name}}</p> +<p>{{trans "The password for your account has been successfully changed."}}</p> +<p>{{trans "If you did not request this change, please contact us."}}</p> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html b/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html new file mode 100644 index 0000000000000000000000000000000000000000..d6f7a607bdd3eab2504b49516e454650e8405935 --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/email/password_reset_confirmation.html @@ -0,0 +1,34 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Reset your {{var store.getFrontendName()}} password @--> +<!--@vars { +"var customer.name":"Customer Name", +"var store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])":"Reset Password URL" +} @--> +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customer.name}}</p> +<p>{{trans "There was recently a request to change the password for your account."}}</p> +<p>{{trans "If you requested this change, reset your password here:"}}</p> + +<table class="button" width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> + <table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center"> + <tr> + <td align="center"> + <a href="{{var store.getUrl('customer/account/createPassword/', [_query:[id:$customer.id, token:$customer.rp_token]])}}" target="_blank">{{trans "Reset Password"}}</a> + </td> + </tr> + </table> + </td> + </tr> +</table> + +<p>{{trans "If you did not make this request, you can ignore this email and your password will remain the same."}}</p> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Developer/i18n/en_US.csv b/app/code/Magento/Developer/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 3943551de3fcf17fcd2cc2b099b2a95620b5c53c..4e28283eae0edeef9c1ce24e695ab02b198227d7 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -946,7 +946,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin } /** - * Build qoutes request XML object + * Build quotes request XML object * * @return \SimpleXMLElement */ diff --git a/app/code/Magento/Directory/Model/Observer.php b/app/code/Magento/Directory/Model/Observer.php index 23d0b5c52f010583ae316fd3ee91fea5c6743a29..3756e8026f60c37cd3819ac5c8f3556c64b9ef84 100644 --- a/app/code/Magento/Directory/Model/Observer.php +++ b/app/code/Magento/Directory/Model/Observer.php @@ -136,8 +136,8 @@ class Observer ) )->setTemplateOptions( [ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, ] )->setTemplateVars( ['warnings' => join("\n", $importWarnings)] diff --git a/app/code/Magento/Directory/etc/adminhtml/system.xml b/app/code/Magento/Directory/etc/adminhtml/system.xml index 352a1a7922664988e329f5919bb50f8c2262785f..7f6d63561141492060876303474293328aa7ee6f 100644 --- a/app/code/Magento/Directory/etc/adminhtml/system.xml +++ b/app/code/Magento/Directory/etc/adminhtml/system.xml @@ -54,8 +54,9 @@ <label>Error Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="error_email_template" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Error Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="frequency" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Directory/etc/email_templates.xml b/app/code/Magento/Directory/etc/email_templates.xml index c9693f2423c07591f8ed527bc26a910eb5576f94..3f4ca760584253327a2840c4740bddda9320f354 100644 --- a/app/code/Magento/Directory/etc/email_templates.xml +++ b/app/code/Magento/Directory/etc/email_templates.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="currency_import_error_email_template" label="Currency Update Warnings" file="currency_update_notification.html" type="text" module="Magento_Directory"/> + <template id="currency_import_error_email_template" label="Currency Update Warnings" file="currency_update_notification.html" type="text" module="Magento_Directory" area="adminhtml"/> </config> diff --git a/app/code/Magento/Directory/view/email/currency_update_notification.html b/app/code/Magento/Directory/view/adminhtml/email/currency_update_notification.html similarity index 57% rename from app/code/Magento/Directory/view/email/currency_update_notification.html rename to app/code/Magento/Directory/view/adminhtml/email/currency_update_notification.html index 1633937af4ab056fcbe22c501df465a27de22389..e195ba48fa50a70f91ae926ba356d61f009f4a07 100644 --- a/app/code/Magento/Directory/view/email/currency_update_notification.html +++ b/app/code/Magento/Directory/view/adminhtml/email/currency_update_notification.html @@ -5,10 +5,10 @@ */ --> <!--@subject Currency Update Warnings @--> -<!--@vars -{"var warnings":"Currency Update Warnings"} -@--> -Currency update warnings: +<!--@vars { +"var warnings":"Currency Update Warnings" +} @--> +{{trans "Currency Update Warnings"}} -{{var warnings}} \ No newline at end of file +{{var warnings}} diff --git a/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/creditmemo/downloadable.phtml b/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/creditmemo/downloadable.phtml index 68c97f06e0cfa573789e8ba85cae65ede91939af..837529e94c5d3368057ed918294d1659d6e0a5c3 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/creditmemo/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/creditmemo/downloadable.phtml @@ -11,29 +11,31 @@ <?php $_item = $block->getItem() ?> <?php $_order = $block->getItem()->getOrder(); ?> <tr> - <td align="left" valign="top" style="padding:3px 9px"> - <strong><?php echo $block->escapeHtml($_item->getName()) ?></strong> + <td class="item-info has-extra"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> + <dl> <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $option['value'] ?></dd> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd><?= $option['value'] ?></dd> <?php endforeach; ?> </dl> <?php endif; ?> <?php if ($links = $block->getLinks()->getPurchasedItems()): ?> - <dl style="margin:0; padding:0;"> - <dt><strong><em><?php echo $block->getLinksTitle() ?></em></strong></dt> + <dl> + <dt><strong><em><?= $block->getLinksTitle() ?></em></strong></dt> <?php foreach ($links as $link): ?> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $block->escapeHtml($link->getLinkTitle()) ?></dd> + <dd> + <?= $block->escapeHtml($link->getLinkTitle()) ?> + </dd> <?php endforeach; ?> </dl> <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> + <?= $block->escapeHtml($_item->getDescription()) ?> </td> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($block->getSku($_item)) ?></td> - <td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getQty()*1 ?></td> - <td align="right" valign="top" style="padding:3px 9px"> - <?php echo $block->getItemPrice($_item); ?> + <td class="item-qty"><?= $_item->getQty() * 1 ?></td> + <td class="item-price"> + <?= $block->getItemPrice($_item) ?> </td> </tr> diff --git a/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/invoice/downloadable.phtml b/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/invoice/downloadable.phtml index bfd7be082601a20596e639d2032f7dfd3110f19c..4e172c477f11c14fd23f5147181ddec3ead2666b 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/invoice/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/invoice/downloadable.phtml @@ -9,34 +9,34 @@ ?> <?php /** @var $block \Magento\Downloadable\Block\Sales\Order\Email\Items\Downloadable */ ?> <?php $_item = $block->getItem() ?> -<?php $_order = $block->getItem()->getOrder(); ?> +<?php $_order = $block->getItem()->getOrder() ?> <tr> - <td align="left" valign="top" style="padding:3px 9px"> - <strong><?php echo $block->escapeHtml($_item->getName()) ?></strong> + <td class="item-info has-extra"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> + <dl> <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $option['value'] ?></dd> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd><?= $option['value'] ?></dd> <?php endforeach; ?> </dl> <?php endif; ?> <?php if ($links = $block->getLinks()->getPurchasedItems()): ?> - <dl style="margin:0; padding:0;"> - <dt><strong><em><?php echo $block->getLinksTitle() ?></em></strong></dt> + <dl> + <dt><strong><em><?= $block->getLinksTitle() ?></em></strong></dt> <?php foreach ($links as $link): ?> - <dd style="margin:0; padding:0 0 0 9px;"> - <?php echo $block->escapeHtml($link->getLinkTitle()) ?> - (<a href="<?php echo $block->getPurchasedLinkUrl($link) ?>" style="color:#1E7EC8;"><?php echo __('download') ?></a>) + <dd> + <?= $block->escapeHtml($link->getLinkTitle()) ?> + (<a href="<?= $block->getPurchasedLinkUrl($link) ?>"><?= __('download') ?></a>) </dd> <?php endforeach; ?> </dl> <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> + <?= $block->escapeHtml($_item->getDescription()) ?> </td> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($block->getSku($_item)) ?></td> - <td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getQty()*1 ?></td> - <td align="right" valign="top" style="padding:3px 9px"> - <?php echo $block->getItemPrice($_item); ?> + <td class="item-qty"><?= $_item->getQty() * 1 ?></td> + <td class="item-price"> + <?= $block->getItemPrice($_item) ?> </td> </tr> diff --git a/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/order/downloadable.phtml b/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/order/downloadable.phtml index 1dcf66254397a66b176d7637dcb5d2da982a50d7..dae8b75bf316fdcdf63fa7344d02ab5d097d7936 100644 --- a/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/order/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/frontend/templates/email/order/items/order/downloadable.phtml @@ -11,38 +11,45 @@ <?php $_item = $block->getItem() ?> <?php $_order = $block->getItem()->getOrder() ?> <tr> - <td align="left" valign="top" style="padding:3px 9px"> - <strong><?php echo $block->escapeHtml($_item->getName()) ?></strong> + <td class="item-info has-extra"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> + <dl> <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo $option['value'] ?></dd> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd><?= $option['value'] ?></dd> <?php endforeach; ?> </dl> <?php endif; ?> <?php if ($links = $block->getLinks()->getPurchasedItems()): ?> - <dl style="margin:0; padding:0;"> - <dt><strong><em><?php echo $block->getLinksTitle() ?></em></strong></dt> + <dl> + <dt><strong><em><?= $block->getLinksTitle() ?></em></strong></dt> <?php foreach ($links as $link): ?> - <dd style="margin:0; padding:0 0 0 9px;"> - <?php echo $block->escapeHtml($link->getLinkTitle()); ?> - (<a href="<?php echo $block->getPurchasedLinkUrl($link) ?>" style="color:#1E7EC8;"><?php echo __('download') ?></a>) + <dd> + <?= $block->escapeHtml($link->getLinkTitle()) ?> + (<a href="<?= $block->getPurchasedLinkUrl($link) ?>"><?= __('download') ?></a>) </dd> <?php endforeach; ?> </dl> <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> + <?= $block->escapeHtml($_item->getDescription()) ?> <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_item->getGiftMessageId())): ?> - <br /><strong><?php echo __('Gift Message') ?></strong> - <br /><?php echo __('From:'); ?> <?php echo $block->escapeHtml($_giftMessage->getSender()) ?> - <br /><?php echo __('To:'); ?> <?php echo $block->escapeHtml($_giftMessage->getRecipient()) ?> - <br /><?php echo __('Message:'); ?><br /> <?php echo $block->escapeHtml($_giftMessage->getMessage()) ?> + <table class="message-gift"> + <tr> + <td> + <h3><?= __('Gift Message') ?></h3> + <strong><?= __('From:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?> + <br /><strong><?= __('To:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?> + <br /><strong><?= __('Message:'); ?></strong> + <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?> + </td> + </tr> + </table> <?php endif; ?> </td> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($block->getSku($_item)) ?></td> - <td align="center" valign="top" style="padding:3px 9px"><?php echo $_item->getQtyOrdered()*1 ?></td> - <td align="right" valign="top" style="padding:3px 9px"> - <?php echo $block->getItemPrice($_item); ?> + <td class="item-qty"><?= $_item->getQtyOrdered() * 1 ?></td> + <td class="item-price"> + <?= $block->getItemPrice($_item); ?> </td> </tr> diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php index 54cb61d5b32b2b1ade459ebfef0793fb63902e1f..d61d7dcf17f292d890c77452eedd0a09b4817bf2 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php @@ -250,14 +250,10 @@ class Edit extends \Magento\Backend\Block\Widget implements \Magento\Backend\Blo */ protected function _getDefaultTemplatesAsOptionsArray() { - $options = [['value' => '', 'label' => '', 'group' => '']]; - foreach ($this->_emailConfig->getAvailableTemplates() as $templateId) { - $options[] = [ - 'value' => $templateId, - 'label' => $this->_emailConfig->getTemplateLabel($templateId), - 'group' => $this->_emailConfig->getTemplateModule($templateId), - ]; - } + $options = array_merge( + [['value' => '', 'label' => '', 'group' => '']], + $this->_emailConfig->getAvailableTemplates() + ); uasort( $options, function (array $firstElement, array $secondElement) { @@ -370,35 +366,17 @@ class Edit extends \Magento\Backend\Block\Widget implements \Magento\Backend\Blo return $this->getUrl('adminhtml/*/defaultTemplate'); } - /** - * Get paths of where current template is used as default - * - * @param bool $asJSON - * @return string - */ - public function getUsedDefaultForPaths($asJSON = true) - { - /** @var $template \Magento\Email\Model\BackendTemplate */ - $template = $this->getEmailTemplate(); - $paths = $template->getSystemConfigPathsWhereUsedAsDefault(); - $pathsParts = $this->_getSystemConfigPathsParts($paths); - if ($asJSON) { - return $this->jsonHelper->jsonEncode($pathsParts); - } - return $pathsParts; - } - /** * Get paths of where current template is currently used * * @param bool $asJSON * @return string */ - public function getUsedCurrentlyForPaths($asJSON = true) + public function getCurrentlyUsedForPaths($asJSON = true) { /** @var $template \Magento\Email\Model\BackendTemplate */ $template = $this->getEmailTemplate(); - $paths = $template->getSystemConfigPathsWhereUsedCurrently(); + $paths = $template->getSystemConfigPathsWhereCurrentlyUsed(); $pathsParts = $this->_getSystemConfigPathsParts($paths); if ($asJSON) { return $this->_jsonEncoder->encode($pathsParts); @@ -416,7 +394,7 @@ class Edit extends \Magento\Backend\Block\Widget implements \Magento\Backend\Blo protected function _getSystemConfigPathsParts($paths) { $result = $urlParams = $prefixParts = []; - $scopeLabel = __('GLOBAL'); + $scopeLabel = __('Default Config'); if ($paths) { /** @var $menu \Magento\Backend\Model\Menu */ $menu = $this->_menuConfig->getMenu(); diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php index c05c1e44ad12bf2262d31344fdd44ed02be1f379..2691361192ce35b871a825eff0a37751fc029c71 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit/Form.php @@ -72,37 +72,19 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic ); $templateId = $this->getEmailTemplate()->getId(); - if ($templateId) { - $fieldset->addField( - 'used_currently_for', - 'label', - [ - 'label' => __('Now Used For'), - 'container_id' => 'used_currently_for', - 'after_element_html' => '<script>require(["prototype"], function () {' . - (!$this->getEmailTemplate()->getSystemConfigPathsWhereUsedCurrently() ? '$(\'' . - 'used_currently_for' . - '\').hide(); ' : '') . - '});</script>' - ] - ); - } - - if (!$templateId) { - $fieldset->addField( - 'used_default_for', - 'label', - [ - 'label' => __('Used as Default For'), - 'container_id' => 'used_default_for', - 'after_element_html' => '<script>require(["prototype"], function () {' . - (!(bool)$this->getEmailTemplate()->getOrigTemplateCode() ? '$(\'' . - 'used_default_for' . - '\').hide(); ' : '') . - '});</script>' - ] - ); - } + $fieldset->addField( + 'currently_used_for', + 'label', + [ + 'label' => __('Currently Used For'), + 'container_id' => 'currently_used_for', + 'after_element_html' => '<script>require(["prototype"], function () {' . + (!$this->getEmailTemplate()->getSystemConfigPathsWhereCurrentlyUsed() ? '$(\'' . + 'currently_used_for' . + '\').hide(); ' : '') . + '});</script>' + ] + ); $fieldset->addField( 'template_code', diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/DefaultTemplate.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/DefaultTemplate.php index d1111fcdd906201d131a917f328e6ab60d159a64..116d88710173e97f8e9af57ea125f6f3da5389f7 100644 --- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/DefaultTemplate.php +++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/DefaultTemplate.php @@ -8,6 +8,25 @@ namespace Magento\Email\Controller\Adminhtml\Email\Template; class DefaultTemplate extends \Magento\Email\Controller\Adminhtml\Email\Template { + /** + * @var \Magento\Email\Model\Template\Config + */ + private $emailConfig; + + /** + * @param \Magento\Backend\App\Action\Context $context + * @param \Magento\Framework\Registry $coreRegistry + * @param \Magento\Email\Model\Template\Config $emailConfig + */ + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Framework\Registry $coreRegistry, + \Magento\Email\Model\Template\Config $emailConfig + ) { + $this->emailConfig = $emailConfig; + parent::__construct($context, $coreRegistry); + } + /** * Set template data to retrieve it in template info form * @@ -17,14 +36,23 @@ class DefaultTemplate extends \Magento\Email\Controller\Adminhtml\Email\Template { $this->_view->loadLayout(); $template = $this->_initTemplate('id'); - $templateCode = $this->getRequest()->getParam('code'); + $templateId = $this->getRequest()->getParam('code'); try { - $template->loadDefault($templateCode); - $template->setData('orig_template_code', $templateCode); + $parts = $this->emailConfig->parseTemplateIdParts($templateId); + $templateId = $parts['templateId']; + $theme = $parts['theme']; + + if ($theme) { + $template->setForcedTheme($templateId, $theme); + } + $template->setForcedArea($templateId); + + $template->loadDefault($templateId); + $template->setData('orig_template_code', $templateId); $template->setData('template_variables', \Zend_Json::encode($template->getVariablesOptionArray(true))); $templateBlock = $this->_view->getLayout()->createBlock('Magento\Email\Block\Adminhtml\Template\Edit'); - $template->setData('orig_template_used_default_for', $templateBlock->getUsedDefaultForPaths(false)); + $template->setData('orig_template_currently_used_for', $templateBlock->getCurrentlyUsedForPaths(false)); $this->getResponse()->representJson( $this->_objectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($template->getData()) diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Delete.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Delete.php index 89a80f1dffc818569b22a52d3356e0e6a7bf2d8c..7022d18ff3cc9700f85fd4ec83da3461dd290bb7 100644 --- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Delete.php +++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template/Delete.php @@ -19,7 +19,7 @@ class Delete extends \Magento\Email\Controller\Adminhtml\Email\Template if ($template->getId()) { try { // check if the template is currently used - if (count($template->getSystemConfigPathsWhereUsedCurrently()) == 0) { + if (count($template->getSystemConfigPathsWhereCurrentlyUsed()) == 0) { $template->delete(); // display success message $this->messageManager->addSuccess(__('You deleted the email template.')); diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index 8273cc370eda7c7bbcdbaebffd931484cba5f77a..1b438eaa9133c89b64aa8f8dfbda0211dec3be14 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -31,29 +31,21 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn /** * Email logo url - * - * @var string */ const XML_PATH_DESIGN_EMAIL_LOGO = 'design/email/logo'; /** * Email logo alt text - * - * @var string */ const XML_PATH_DESIGN_EMAIL_LOGO_ALT = 'design/email/logo_alt'; /** * Email logo width - * - * @var string */ const XML_PATH_DESIGN_EMAIL_LOGO_WIDTH = 'design/email/logo_width'; /** * Email logo height - * - * @var string */ const XML_PATH_DESIGN_EMAIL_LOGO_HEIGHT = 'design/email/logo_height'; @@ -100,8 +92,9 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn private $store; /** - * Tracks whether design has been applied within the context of this template model. Important as there are multiple - * entry points for the applyDesignConfig method. + * Tracks whether design has been applied within the context of this template model. + * + * Important as there are multiple entry points for the applyDesignConfig method. * * @var bool */ @@ -223,10 +216,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn */ protected function getTemplateInstance() { - return $this->templateFactory->create([ - // Pass filesystem object to child template. Intended to be used for the test isolation purposes. - 'filesystem' => $this->filesystem - ]); + return $this->templateFactory->create(); } /** @@ -276,19 +266,19 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn */ public function loadDefault($templateId) { - $templateFile = $this->emailConfig->getTemplateFilename($templateId); + $designParams = $this->getDesignParams(); + $templateFile = $this->emailConfig->getTemplateFilename($templateId, $designParams); $templateType = $this->emailConfig->getTemplateType($templateId); $templateTypeCode = $templateType == 'html' ? self::TYPE_HTML : self::TYPE_TEXT; $this->setTemplateType($templateTypeCode); - $modulesDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MODULES); - $templateText = $modulesDirectory->readFile($modulesDirectory->getRelativePath($templateFile)); + $rootDirectory = $this->filesystem->getDirectoryRead(DirectoryList::ROOT); + $templateText = $rootDirectory->readFile($rootDirectory->getRelativePath($templateFile)); /** - * trim copyright message for text templates + * trim copyright message */ - if ('html' != $templateType - && preg_match('/^<!--[\w\W]+?-->/m', $templateText, $matches) + if (preg_match('/^<!--[\w\W]+?-->/m', $templateText, $matches) && strpos($matches[0], 'Copyright') > 0 ) { $templateText = str_replace($matches[0], '', $templateText); @@ -335,7 +325,6 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn $variables['this'] = $this; - // Only run app emulation if this is the parent template. Otherwise child will run inside parent emulation. $isDesignApplied = $this->applyDesignConfig(); // Set design params so that CSS will be loaded from the proper theme @@ -356,7 +345,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn $result = $processor->filter($this->getTemplateText()); } catch (\Exception $e) { $this->cancelDesignConfig(); - throw new \Magento\Framework\Exception\MailException(__($e->getMessage()), $e); + throw new \LogicException(__($e->getMessage()), $e); } if ($isDesignApplied) { $this->cancelDesignConfig(); @@ -497,6 +486,8 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn */ protected function applyDesignConfig() { + // Only run app emulation if this is the parent template and emulation isn't already running. + // Otherwise child will run inside parent emulation. if ($this->isChildTemplate() || $this->hasDesignBeenApplied) { return false; } @@ -525,6 +516,38 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn return $this; } + /** + * Store the area associated with a template so that it will be returned by getDesignConfig and getDesignParams + * + * @param string $templateId + * @return $this + * @throws \Magento\Framework\Exception\MailException + */ + public function setForcedArea($templateId) + { + if ($this->area) { + throw new \LogicException(__('Area is already set')); + } + $this->area = $this->emailConfig->getTemplateArea($templateId); + return $this; + } + + /** + * Manually set a theme that will be used by getParams + * + * Used to force the loading of an email template from a specific theme + * + * @param string $templateId + * @param string $theme + * @return $this + */ + public function setForcedTheme($templateId, $theme) + { + $area = $this->emailConfig->getTemplateArea($templateId); + $this->design->setDesignTheme($theme, $area); + return $this; + } + /** * Returns the design params for the template being processed * diff --git a/app/code/Magento/Email/Model/BackendTemplate.php b/app/code/Magento/Email/Model/BackendTemplate.php index c17a6b6ea7fee7fbcc16d69a012b13fe7ba2ec22..a89fe65fa7597ef1fa3739387877cc8fd19b4983 100644 --- a/app/code/Magento/Email/Model/BackendTemplate.php +++ b/app/code/Magento/Email/Model/BackendTemplate.php @@ -17,7 +17,7 @@ class BackendTemplate extends Template /** * @var \Magento\Config\Model\Config\Structure */ - private $_structure; + private $structure; /** * @param \Magento\Framework\Model\Context $context @@ -51,7 +51,7 @@ class BackendTemplate extends Template \Magento\Config\Model\Config\Structure $structure, array $data = [] ) { - $this->_structure = $structure; + $this->structure = $structure; parent::__construct( $context, $design, @@ -68,60 +68,19 @@ class BackendTemplate extends Template ); } - /** - * Collect all system config paths where current template is used as default - * - * @return array - */ - public function getSystemConfigPathsWhereUsedAsDefault() - { - $templateCode = $this->getOrigTemplateCode(); - if (!$templateCode) { - return []; - } - - $configData = $this->scopeConfig->getValue(null, ScopeConfigInterface::SCOPE_TYPE_DEFAULT); - $paths = $this->_findEmailTemplateUsages($templateCode, $configData, ''); - return $paths; - } - - /** - * Find nodes which are using $templateCode value - * - * @param string $code - * @param array $data - * @param string $path - * @return array - */ - protected function _findEmailTemplateUsages($code, array $data, $path) - { - $output = []; - foreach ($data as $key => $value) { - $configPath = $path ? $path . '/' . $key : $key; - if (is_array($value)) { - $output = array_merge($output, $this->_findEmailTemplateUsages($code, $value, $configPath)); - } else { - if ($value == $code) { - $output[] = ['path' => $configPath]; - } - } - } - return $output; - } - /** * Collect all system config paths where current template is currently used * * @return array */ - public function getSystemConfigPathsWhereUsedCurrently() + public function getSystemConfigPathsWhereCurrentlyUsed() { $templateId = $this->getId(); if (!$templateId) { return []; } - $templatePaths = $this->_structure->getFieldPathsByAttribute( + $templatePaths = $this->structure->getFieldPathsByAttribute( 'source_model', 'Magento\Config\Model\Config\Source\Email\Template' ); @@ -131,8 +90,19 @@ class BackendTemplate extends Template } $configData = $this->_getResource()->getSystemConfigByPathsAndTemplateId($templatePaths, $templateId); - if (!$configData) { - return []; + foreach ($templatePaths as $path) { + if ($this->scopeConfig->getValue($path, ScopeConfigInterface::SCOPE_TYPE_DEFAULT) == $templateId) { + foreach ($configData as $data) { + if ($data['path'] == $path) { + continue 2; // don't add final fallback value if it was found in stored config + } + } + + $configData[] = [ + 'scope' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + 'path' => $path + ]; + } } return $configData; diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php index 841539864df8a229dc7a1206e69dede930bf0fa5..cda315f41a56ac9e0412ee59ce8d30a19e2c6c61 100644 --- a/app/code/Magento/Email/Model/Template.php +++ b/app/code/Magento/Email/Model/Template.php @@ -351,7 +351,7 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ */ public function processTemplate() { - // Necessary to support theme fallback for email templates + // Support theme fallback for email templates $isDesignApplied = $this->applyDesignConfig(); $templateId = $this->getId(); diff --git a/app/code/Magento/Email/Model/Template/Config.php b/app/code/Magento/Email/Model/Template/Config.php index f8056d7c66f3bec222f0668dd7e9a978343762e1..1fb2a86a6ba2a299885b7004ce5ab219427f0b58 100644 --- a/app/code/Magento/Email/Model/Template/Config.php +++ b/app/code/Magento/Email/Model/Template/Config.php @@ -1,14 +1,15 @@ <?php /** + * High-level interface for email templates data that hides format from the client code + * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Email\Model\Template; -/** - * High-level interface for email templates data that hides format from the client code - */ -class Config +use Magento\Framework\App\Filesystem\DirectoryList; + +class Config implements \Magento\Framework\Mail\Template\ConfigInterface { /** * @var \Magento\Email\Model\Template\Config\Data @@ -20,26 +21,123 @@ class Config */ protected $_moduleReader; + /** + * @var \Magento\Framework\Filesystem + */ + protected $fileSystem; + + /** + * Themes directory + * + * @var \Magento\Framework\Filesystem\Directory\ReadInterface + */ + protected $themesDirectory; + + /** + * @var \Magento\Framework\View\FileSystem + */ + protected $viewFileSystem; + /** * @param \Magento\Email\Model\Template\Config\Data $dataStorage + * @param \Magento\Framework\Filesystem $fileSystem * @param \Magento\Framework\Module\Dir\Reader $moduleReader + * @param \Magento\Framework\View\FileSystem $viewFileSystem */ public function __construct( \Magento\Email\Model\Template\Config\Data $dataStorage, - \Magento\Framework\Module\Dir\Reader $moduleReader + \Magento\Framework\Module\Dir\Reader $moduleReader, + \Magento\Framework\Filesystem $fileSystem, + \Magento\Framework\View\FileSystem $viewFileSystem ) { $this->_dataStorage = $dataStorage; $this->_moduleReader = $moduleReader; + $this->themesDirectory = $fileSystem->getDirectoryRead(DirectoryList::THEMES); + $this->viewFileSystem = $viewFileSystem; } /** - * Retrieve unique identifiers of all available email templates + * Return list of all email templates, both default module and theme-specific templates * - * @return string[] + * @return array[] */ public function getAvailableTemplates() { - return array_keys($this->_dataStorage->get()); + $templates = []; + foreach (array_keys($this->_dataStorage->get()) as $templateId) { + $templates[] = [ + 'value' => $templateId, + 'label' => $this->getTemplateLabel($templateId), + 'group' => $this->getTemplateModule($templateId), + ]; + $themeTemplates = $this->getThemeTemplates($templateId); + $templates = array_merge($templates, $themeTemplates); + } + return $templates; + } + + /** + * Find all theme-based email templates for a given template ID + * + * @param string $templateId + * @return array[] + */ + public function getThemeTemplates($templateId) + { + $templates = []; + + $area = $this->getTemplateArea($templateId); + $themePath = '*/*'; + $module = $this->getTemplateModule($templateId); + $filename = $this->_getInfo($templateId, 'file'); + $searchPattern = "{$area}/{$themePath}/{$module}/email/{$filename}"; + $files = $this->themesDirectory->search($searchPattern); + + $pattern = "#^(?<area>[^/]+)/(?<themeVendor>[^/]+)/(?<themeName>[^/]+)/#i"; + foreach ($files as $file) { + if (!preg_match($pattern, $file, $matches)) { + continue; + } + $themeVendor = $matches['themeVendor']; + $themeName = $matches['themeName']; + + $templates[] = [ + 'value' => sprintf( + '%s/%s/%s', + $templateId, + $themeVendor, + $themeName + ), + 'label' => sprintf( + '%s (%s/%s)', + $this->getTemplateLabel($templateId), + $themeVendor, + $themeName + ), + 'group' => $this->getTemplateModule($templateId), + ]; + } + return $templates; + } + + /** + * Parses a template ID and returns an array of templateId and theme + * + * @param string $templateId + * @return array an array of array('templateId' => '...', 'theme' => '...') + */ + public function parseTemplateIdParts($templateId) + { + $parts = [ + 'templateId' => $templateId, + 'theme' => null + ]; + $pattern = "#^(?<templateId>[^/]+)/(?<themeVendor>[^/]+)/(?<themeName>[^/]+)#i"; + if (preg_match($pattern, $templateId, $matches)) { + $parts['templateId'] = $matches['templateId']; + $parts['theme'] = $matches['themeVendor'] . '/' . $matches['themeName']; + } + return $parts; } /** @@ -75,17 +173,36 @@ class Config return $this->_getInfo($templateId, 'module'); } + /** + * Retrieve the area an email template belongs to + * + * @param string $templateId + * @return string + */ + public function getTemplateArea($templateId) + { + return $this->_getInfo($templateId, 'area'); + } + /** * Retrieve full path to an email template file * * @param string $templateId + * @param array|null $designParams * @return string */ - public function getTemplateFilename($templateId) + public function getTemplateFilename($templateId, $designParams = []) { + // If design params aren't passed, then use area/module defined in email_templates.xml + if (!isset($designParams['area'])) { + $designParams['area'] = $this->getTemplateArea($templateId); + } $module = $this->getTemplateModule($templateId); + $designParams['module'] = $module; + $file = $this->_getInfo($templateId, 'file'); - return $this->_moduleReader->getModuleDir('view', $module) . '/email/' . $file; + + return $this->viewFileSystem->getEmailTemplateFileName($file, $designParams, $module); } /** diff --git a/app/code/Magento/Email/Model/Template/Config/Converter.php b/app/code/Magento/Email/Model/Template/Config/Converter.php index 8408f32142a0f01e890a5a9bae75486f243bd3fa..1676e11e28bea04e3c7d0d3278bb4f464b5e2aa9 100644 --- a/app/code/Magento/Email/Model/Template/Config/Converter.php +++ b/app/code/Magento/Email/Model/Template/Config/Converter.php @@ -25,11 +25,14 @@ class Converter implements \Magento\Framework\Config\ConverterInterface $templateFile = $templateNode->attributes->getNamedItem('file')->nodeValue; $templateType = $templateNode->attributes->getNamedItem('type')->nodeValue; $templateModule = $templateNode->attributes->getNamedItem('module')->nodeValue; + $templateArea = $templateNode->attributes->getNamedItem('area')->nodeValue; + $result[$templateId] = [ 'label' => $templateLabel, 'file' => $templateFile, 'type' => $templateType, 'module' => $templateModule, + 'area' => $templateArea, ]; } return $result; diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index 8ec60965cc8ef8f45f86a0e7a564c74ba5f2b6d4..b6b722a8cff71227353111176a8fcf346628ec33 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -14,6 +14,16 @@ namespace Magento\Email\Model\Template; */ class Filter extends \Magento\Framework\Filter\Template { + /** + * The name used in the {{trans}} directive + */ + const TRANS_DIRECTIVE_NAME = 'trans'; + + /** + * The regex to match interior portion of a {{trans "foo"}} translation directive + */ + const TRANS_DIRECTIVE_REGEX = '/^\s*([\'"])([^\1]*?)(?<!\\\)\1(\s.*)?$/si'; + /** * Use absolute links flag * @@ -309,7 +319,7 @@ class Filter extends \Magento\Framework\Filter\Template public function blockDirective($construction) { $skipParams = ['class', 'id', 'output']; - $blockParameters = $this->_getParameters($construction[2]); + $blockParameters = $this->getParameters($construction[2]); $block = null; if (isset($blockParameters['class'])) { @@ -354,9 +364,9 @@ class Filter extends \Magento\Framework\Filter\Template */ public function layoutDirective($construction) { - $this->_directiveParams = $this->_getParameters($construction[2]); + $this->_directiveParams = $this->getParameters($construction[2]); if (!isset($this->_directiveParams['area'])) { - $this->_directiveParams['area'] = 'frontend'; + $this->_directiveParams['area'] = \Magento\Framework\App\Area::AREA_FRONTEND; } if ($this->_directiveParams['area'] != $this->_appState->getAreaCode()) { return $this->_appState->emulateAreaCode( @@ -433,7 +443,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function viewDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); $url = $this->_assetRepo->getUrlWithParams($params['url'], $params); return $url; } @@ -446,7 +456,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function mediaDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); return $this->_storeManager->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; } @@ -460,7 +470,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function storeDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); if (!isset($params['_query'])) { $params['_query'] = []; } @@ -504,47 +514,93 @@ class Filter extends \Magento\Framework\Filter\Template } /** - * Directive for converting special characters to HTML entities - * Supported options: - * allowed_tags - Comma separated html tags that have not to be converted + * Trans directive for localized strings support + * + * Usage: + * + * {{trans "string to translate"}} + * {{trans "string to %var" var="$variable"}} + * + * The |escape modifier is applied by default, use |raw to override * * @param string[] $construction * @return string */ - public function escapehtmlDirective($construction) + public function transDirective($construction) { - $params = $this->_getParameters($construction[2]); - if (!isset($params['var'])) { + list($directive, $modifiers) = $this->explodeModifiers($construction[2], 'escape'); + + list($text, $params) = $this->getTransParameters($directive); + if (empty($text)) { return ''; } - $allowedTags = null; - if (isset($params['allowed_tags'])) { - $allowedTags = preg_split('/\s*\,\s*/', $params['allowed_tags'], 0, PREG_SPLIT_NO_EMPTY); + $text = __($text, $params)->render(); + return $this->applyModifiers($text, $modifiers); + } + + /** + * Parses directive construction into a multipart array containing the text value and key/value pairs of parameters + * + * @param string $value raw parameters + * @return array always a two-part array in the format [value, [param, ...]] + */ + protected function getTransParameters($value) + { + if (preg_match(self::TRANS_DIRECTIVE_REGEX, $value, $matches) !== 1) { + return ['', []]; // malformed directive body; return without breaking list + } + + $text = stripslashes($matches[2]); + + $params = []; + if (!empty($matches[3])) { + $params = $this->getParameters($matches[3]); } - return $this->_escaper->escapeHtml($params['var'], $allowedTags); + return [$text, $params]; } /** * Var directive with modifiers support * + * The |escape modifier is applied by default, use |raw to override + * * @param string[] $construction * @return string */ public function varDirective($construction) { - if (count($this->_templateVars) == 0) { - // If template preprocessing + // just return the escaped value if no template vars exist to process + if (count($this->templateVars) == 0) { return $construction[0]; } - $parts = explode('|', $construction[2], 2); + list($directive, $modifiers) = $this->explodeModifiers($construction[2], 'escape'); + return $this->applyModifiers($this->getVariable($directive, ''), $modifiers); + } + + /** + * Explode modifiers out of a given string + * + * This will return the value and modifiers in a two-element array. Where no modifiers are present in the passed + * value an array with a null modifier string will be returned + * + * Syntax: some text value, etc|modifier string + * + * Result: ['some text value, etc', 'modifier string'] + * + * @param string $value + * @param string $default assumed modifier if none present + * @return array + */ + protected function explodeModifiers($value, $default = null) + { + $parts = explode('|', $value, 2); if (2 === count($parts)) { - list($variableName, $modifiersString) = $parts; - return $this->_amplifyModifiers($this->_getVariable($variableName, ''), $modifiersString); + return $parts; } - return $this->_getVariable($construction[2], ''); + return [$value, $default]; } /** @@ -556,7 +612,7 @@ class Filter extends \Magento\Framework\Filter\Template * @param string $modifiers * @return string */ - protected function _amplifyModifiers($value, $modifiers) + protected function applyModifiers($value, $modifiers) { foreach (explode('|', $modifiers) as $part) { if (empty($part)) { @@ -614,7 +670,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function protocolDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); $store = null; if (isset($params['store'])) { try { @@ -648,7 +704,7 @@ class Filter extends \Magento\Framework\Filter\Template public function configDirective($construction) { $configValue = ''; - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); $storeId = $this->getStoreId(); if (isset($params['path'])) { $configValue = $this->_scopeConfig->getValue( @@ -669,7 +725,7 @@ class Filter extends \Magento\Framework\Filter\Template public function customvarDirective($construction) { $customVarValue = ''; - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); if (isset($params['code'])) { $variable = $this->_variableFactory->create()->setStoreId( $this->getStoreId() @@ -700,7 +756,7 @@ class Filter extends \Magento\Framework\Filter\Template */ public function cssDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); $file = isset($params['file']) ? $params['file'] : null; if (!$file) { // Return CSS comment for debugging purposes @@ -750,7 +806,7 @@ class Filter extends \Magento\Framework\Filter\Template return $construction[0]; } - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); if (!isset($params['file']) || !$params['file']) { throw new \Magento\Framework\Exception\MailException( __('"file" parameter must be specified and must not be empty') diff --git a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php index 7a4ed36eaed2facbfd961d337885433639e34cef..0034bbaec651a4630c5cffd1049dd181d17392ac 100644 --- a/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php +++ b/app/code/Magento/Email/Test/Unit/Block/Adminhtml/Template/EditTest.php @@ -116,7 +116,7 @@ class EditTest extends \PHPUnit_Framework_TestCase * @return void * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testGetUsedCurrentlyForPaths() + public function testGetCurrentlyUsedForPaths() { $sectionMock = $this->getMock( 'Magento\Config\Model\Config\Structure\Element\Section', @@ -172,51 +172,33 @@ class EditTest extends \PHPUnit_Framework_TestCase $groupMock3->expects($this->any())->method('getLabel')->will($this->returnValue('Group_3_Label')); $filedMock->expects($this->any())->method('getLabel')->will($this->returnValue('Field_1_Label')); - $this->_configStructureMock->expects( - $this->any() - )->method( - 'getElement' - )->with( - 'section1' - )->will( - $this->returnValue($sectionMock) - ); + $this->_configStructureMock->expects($this->any()) + ->method('getElement') + ->with('section1') + ->will($this->returnValue($sectionMock)); - $this->_configStructureMock->expects( - $this->any() - )->method( - 'getElementByPathParts' - )->will( - $this->returnValueMap($map) - ); + $this->_configStructureMock->expects($this->any()) + ->method('getElementByPathParts') + ->will($this->returnValueMap($map)); $templateMock = $this->getMock('Magento\Email\Model\BackendTemplate', [], [], '', false, false); - $templateMock->expects( - $this->once() - )->method( - 'getSystemConfigPathsWhereUsedCurrently' - )->will( - $this->returnValue($this->_fixtureConfigPath) - ); + $templateMock->expects($this->once()) + ->method('getSystemConfigPathsWhereCurrentlyUsed') + ->will($this->returnValue($this->_fixtureConfigPath)); - $this->_registryMock->expects( - $this->once() - )->method( - 'registry' - )->with( - 'current_email_template' - )->will( - $this->returnValue($templateMock) - ); + $this->_registryMock->expects($this->once()) + ->method('registry') + ->with('current_email_template') + ->will($this->returnValue($templateMock)); - $actual = $this->_block->getUsedCurrentlyForPaths(false); + $actual = $this->_block->getCurrentlyUsedForPaths(false); $expected = [ [ ['title' => __('Title')], ['title' => __('Title'), 'url' => 'adminhtml/system_config/'], ['title' => 'Section_1_Label', 'url' => 'adminhtml/system_config/edit'], ['title' => 'Group_1_Label'], - ['title' => 'Field_1_Label', 'scope' => __('GLOBAL')], + ['title' => 'Field_1_Label', 'scope' => __('Default Config')], ], [ ['title' => __('Title')], @@ -224,7 +206,7 @@ class EditTest extends \PHPUnit_Framework_TestCase ['title' => 'Section_1_Label', 'url' => 'adminhtml/system_config/edit'], ['title' => 'Group_1_Label'], ['title' => 'Group_2_Label'], - ['title' => 'Field_1_Label', 'scope' => __('GLOBAL')] + ['title' => 'Field_1_Label', 'scope' => __('Default Config')] ], [ ['title' => __('Title')], @@ -233,7 +215,7 @@ class EditTest extends \PHPUnit_Framework_TestCase ['title' => 'Group_1_Label'], ['title' => 'Group_2_Label'], ['title' => 'Group_3_Label'], - ['title' => 'Field_1_Label', 'scope' => __('GLOBAL')] + ['title' => 'Field_1_Label', 'scope' => __('Default Config')] ], ]; $this->assertEquals($expected, $actual); @@ -256,15 +238,25 @@ class EditTest extends \PHPUnit_Framework_TestCase $this->_emailConfigMock ->expects($this->once()) ->method('getAvailableTemplates') - ->will($this->returnValue(['template_b2', 'template_a', 'template_b1'])); - $this->_emailConfigMock - ->expects($this->exactly(3)) - ->method('getTemplateModule') - ->will($this->onConsecutiveCalls('Fixture_ModuleB', 'Fixture_ModuleA', 'Fixture_ModuleB')); - $this->_emailConfigMock - ->expects($this->exactly(3)) - ->method('getTemplateLabel') - ->will($this->onConsecutiveCalls('Template B2', 'Template A', 'Template B1')); + ->will($this->returnValue( + [ + [ + 'value' => 'template_b2', + 'label' => 'Template B2', + 'group' => 'Fixture_ModuleB', + ], + [ + 'value' => 'template_a', + 'label' => 'Template A', + 'group' => 'Fixture_ModuleA', + ], + [ + 'value' => 'template_b1', + 'label' => 'Template B1', + 'group' => 'Fixture_ModuleB', + ], + ] + )); $this->assertEmpty($this->_block->getData('template_options')); $this->_block->setTemplate('my/custom\template.phtml'); diff --git a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php index f6580836c13c027e666169406c1cdcf828689a7b..00305a4529bbbf30a5d5c9934480fb02ea414785 100644 --- a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php @@ -80,25 +80,14 @@ class BackendTemplateTest extends \PHPUnit_Framework_TestCase \Magento\Framework\App\ObjectManager::setInstance($this->objectManagerBackup); } - public function testGetSystemConfigPathsWhereUsedAsDefaultNoTemplateCode() + public function testGetSystemConfigPathsWhereCurrentlyUsedNoId() { - $this->assertEquals([], $this->model->getSystemConfigPathsWhereUsedAsDefault()); + $this->assertEquals([], $this->model->getSystemConfigPathsWhereCurrentlyUsed()); } - public function testGetSystemConfigPathsWhereUsedAsDefaultValidTemplateCode() - { - $this->model->setData('orig_template_code', 1); - $this->assertEquals([['path' => 'test']], $this->model->getSystemConfigPathsWhereUsedAsDefault()); - } - - public function testGetSystemConfigPathsWhereUsedCurrentlyNoId() - { - $this->assertEquals([], $this->model->getSystemConfigPathsWhereUsedCurrently()); - } - - public function testGetSystemConfigPathsWhereUsedCurrentlyValidId() + public function testGetSystemConfigPathsWhereCurrentlyUsedValidId() { $this->model->setId(1); - $this->assertEquals(['test_config' => 2015], $this->model->getSystemConfigPathsWhereUsedCurrently()); + $this->assertEquals(['test_config' => 2015], $this->model->getSystemConfigPathsWhereCurrentlyUsed()); } } diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php index 2c5d96c7b27dfb0a8fc7967baa6e1bf8cb69969e..1f813288ae0a0ba73f24d4410eb509151f32564f 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php @@ -5,6 +5,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Email\Test\Unit\Model\Template\Config; class XsdTest extends \PHPUnit_Framework_TestCase @@ -26,7 +29,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase { return [ 'valid' => [ - '<config><template id="test" label="Test" file="test.txt" type="text" module="Module"/></config>', + '<config><template id="test" label="Test" file="test.txt" type="text" module="Module" area="frontend"/></config>', [], ], 'empty root node' => [ @@ -34,7 +37,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase ["Element 'config': Missing child element(s). Expected is ( template )."], ], 'irrelevant root node' => [ - '<template id="test" label="Test" file="test.txt" type="text" module="Module"/>', + '<template id="test" label="Test" file="test.txt" type="text" module="Module" area="frontend"/>', ["Element 'template': No matching global declaration available for the validation root."], ], 'invalid node' => [ @@ -43,34 +46,34 @@ class XsdTest extends \PHPUnit_Framework_TestCase ], 'node "template" with value' => [ '<config> - <template id="test" label="Test" file="test.txt" type="text" module="Module">invalid</template> + <template id="test" label="Test" file="test.txt" type="text" module="Module" area="frontend">invalid</template> </config>', ["Element 'template': Character content is not allowed, because the content type is empty."], ], 'node "template" with children' => [ '<config> - <template id="test" label="Test" file="test.txt" type="text" module="Module"><invalid/></template> + <template id="test" label="Test" file="test.txt" type="text" module="Module" area="frontend"><invalid/></template> </config>', ["Element 'template': Element content is not allowed, because the content type is empty."], ], 'node "template" without attribute "id"' => [ - '<config><template label="Test" file="test.txt" type="text" module="Module"/></config>', + '<config><template label="Test" file="test.txt" type="text" module="Module" area="frontend"/></config>', ["Element 'template': The attribute 'id' is required but missing."], ], 'node "template" without attribute "label"' => [ - '<config><template id="test" file="test.txt" type="text" module="Module"/></config>', + '<config><template id="test" file="test.txt" type="text" module="Module" area="frontend"/></config>', ["Element 'template': The attribute 'label' is required but missing."], ], 'node "template" without attribute "file"' => [ - '<config><template id="test" label="Test" type="text" module="Module"/></config>', + '<config><template id="test" label="Test" type="text" module="Module" area="frontend"/></config>', ["Element 'template': The attribute 'file' is required but missing."], ], 'node "template" without attribute "type"' => [ - '<config><template id="test" label="Test" file="test.txt" module="Module"/></config>', + '<config><template id="test" label="Test" file="test.txt" module="Module" area="frontend"/></config>', ["Element 'template': The attribute 'type' is required but missing."], ], 'node "template" with invalid attribute "type"' => [ - '<config><template id="test" label="Test" file="test.txt" type="invalid" module="Module"/></config>', + '<config><template id="test" label="Test" file="test.txt" type="invalid" module="Module" area="frontend"/></config>', [ "Element 'template', attribute 'type': " . "[facet 'enumeration'] The value 'invalid' is not an element of the set {'html', 'text'}.", @@ -78,9 +81,22 @@ class XsdTest extends \PHPUnit_Framework_TestCase "'invalid' is not a valid value of the atomic type 'emailTemplateFormatType'." ], ], + 'node "template" without attribute "area"' => [ + '<config><template id="test" label="Test" file="test.txt" type="text" module="Module"/></config>', + ["Element 'template': The attribute 'area' is required but missing."], + ], + 'node "template" with invalid attribute "area"' => [ + '<config><template id="test" label="Test" file="test.txt" type="text" module="Module" area="invalid"/></config>', + [ + "Element 'template', attribute 'area': " . + "[facet 'enumeration'] The value 'invalid' is not an element of the set {'frontend', 'adminhtml'}.", + "Element 'template', attribute 'area': " . + "'invalid' is not a valid value of the atomic type 'areaType'." + ], + ], 'node "template" with unknown attribute' => [ '<config> - <template id="test" label="Test" file="test.txt" type="text" module="Module" unknown="true"/> + <template id="test" label="Test" file="test.txt" type="text" module="Module" area="frontend" unknown="true"/> </config>', ["Element 'template', attribute 'unknown': The attribute 'unknown' is not allowed."], ] diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleOne/etc/email_templates_one.xml b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleOne/etc/email_templates_one.xml index 5ec731db05a9face8286017aab81cecbba9e8eb1..afbb22b473dd8bbd95bf8db7a58f5dd226f97797 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleOne/etc/email_templates_one.xml +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleOne/etc/email_templates_one.xml @@ -6,6 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../../app/code/Magento/Email/etc/email_templates.xsd"> - <template id="template_one" label="Template One" file="one.html" type="html" /> - <template id="template_two" label="Template Two" file="two.html" type="html" /> + <template id="template_one" label="Template One" file="one.html" type="html" area="frontend"/> + <template id="template_two" label="Template Two" file="two.html" type="html" area="adminhtml" /> </config> diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml index d530dceeb44468150f02a96ef05c69f02e2632a3..f01600200209b46bdfc401ac797fe9fa1d0bdea9 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/Fixture/ModuleTwo/etc/email_templates_two.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../../app/code/Magento/Email/etc/email_templates.xsd"> - <template id="template_two" label="Template 2" file="2.txt" type="text" /> + <template id="template_two" label="Template 2" file="2.txt" type="text" area="adminhtml"/> </config> diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php index 828a3467a4fc0d7a24534d5f9ffc9596f4853e50..daa228fc4abdca0ab62dfa686006ef8b7fc36f82 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.php @@ -9,11 +9,13 @@ return [ 'file' => 'one.html', 'type' => 'html', 'module' => 'Fixture_ModuleOne', + 'area' => 'frontend', ], 'template_two' => [ 'label' => 'Template 2', 'file' => '2.txt', 'type' => 'text', 'module' => 'Fixture_ModuleTwo', + 'area' => 'adminhtml', ] ]; diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.xml b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.xml index d6c74474149518e710365340d344c0f3e5392c88..720981799154c59840520e236442969b12f690b1 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.xml +++ b/app/code/Magento/Email/Test/Unit/Model/Template/Config/_files/email_templates_merged.xml @@ -6,6 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Email/etc/email_templates.xsd"> - <template module="Fixture_ModuleOne" id="template_one" label="Template One" file="one.html" type="html"/> - <template module="Fixture_ModuleTwo" id="template_two" label="Template 2" file="2.txt" type="text"/> + <template module="Fixture_ModuleOne" id="template_one" label="Template One" file="one.html" type="html" area="frontend"/> + <template module="Fixture_ModuleTwo" id="template_two" label="Template 2" file="2.txt" type="text" area="adminhtml"/> </config> diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php index a5a4af86443b7bf2ee221b55a63c4ac0e1b0546c..9114dc48788617778f6b48b5433e2f37921532f9 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php @@ -7,8 +7,15 @@ namespace Magento\Email\Test\Unit\Model\Template; class ConfigTest extends \PHPUnit_Framework_TestCase { + private $designParams = [ + 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, + 'theme' => 'Magento/blank', + 'locale' => \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE, + 'module' => 'Fixture_ModuleOne', + ]; + /** - * @var \Magento\Email\Model\Template\Config + * @var \Magento\Email\Model\Template\Config|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -22,6 +29,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_moduleReader; + /** + * @var \Magento\Framework\View\FileSystem|\PHPUnit_Framework_MockObject_MockObject + */ + protected $viewFileSystem; + + /** + * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject + */ + protected $fileSystem; + protected function setUp() { $this->_dataStorage = $this->getMock( @@ -45,12 +62,131 @@ class ConfigTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_model = new \Magento\Email\Model\Template\Config($this->_dataStorage, $this->_moduleReader); + $this->viewFileSystem = $this->getMock( + '\Magento\Framework\View\FileSystem', + ['getEmailTemplateFileName'], + [], + '', + false + ); + $this->fileSystem = $this->getMock( + '\Magento\Framework\Filesystem', + [], + [], + '', + false + ); + $this->_model = $this->getMockBuilder('\Magento\Email\Model\Template\Config') + ->setConstructorArgs( + [ + $this->_dataStorage, + $this->_moduleReader, + $this->fileSystem, + $this->viewFileSystem + ] + ) + ->setMethods(['getThemeTemplates']) + ->getMock(); } public function testGetAvailableTemplates() { - $this->assertEquals(['template_one', 'template_two'], $this->_model->getAvailableTemplates()); + $this->_model->expects($this->atLeastOnce()) + ->method('getThemeTemplates') + ->will($this->returnValue([])); + + $expectedTemplates = require __DIR__ . '/Config/_files/email_templates_merged.php'; + + foreach ($this->_model->getAvailableTemplates() as $templateOptions) { + $this->assertArrayHasKey($templateOptions['value'], $expectedTemplates); + $expectedOptions = $expectedTemplates[$templateOptions['value']]; + + $this->assertEquals($expectedOptions['label'], (string) $templateOptions['label']); + $this->assertEquals($expectedOptions['module'], (string) $templateOptions['group']); + } + } + + public function testGetThemeTemplates() + { + $themeDirectory = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\ReadInterface') + ->disableOriginalConstructor() + ->setMethods(['search']) + ->getMockForAbstractClass(); + + $templates = require __DIR__ . '/Config/_files/email_templates_merged.php'; + + $templateId = 'template_one'; + $template = $templates[$templateId]; + + $area = $template['area']; + $searchThemePath = '*/*'; + $foundThemePath = 'Vendor/custom_theme'; + $module = $template['module']; + $filename = $template['file']; + $themeDirectory->expects($this->once()) + ->method('search') + ->with("{$area}/{$searchThemePath}/{$module}/email/{$filename}") + ->will($this->returnValue(["{$area}/{$foundThemePath}/{$module}/email/{$filename}"])); + + $this->fileSystem->expects($this->once()) + ->method('getDirectoryRead') + ->will($this->returnValue($themeDirectory)); + + $this->_model = $this->getMockBuilder('\Magento\Email\Model\Template\Config') + ->setConstructorArgs( + [ + $this->_dataStorage, + $this->_moduleReader, + $this->fileSystem, + $this->viewFileSystem + ] + ) + ->setMethods(null) + ->getMock(); + + foreach ($this->_model->getThemeTemplates($templateId) as $templateOptions) { + $this->assertEquals( + sprintf( + '%s (%s)', + $template['label'], + $foundThemePath + ), + $templateOptions['label'] + ); + $this->assertEquals(sprintf('%s/%s', $templateId, $foundThemePath), $templateOptions['value']); + $this->assertEquals($template['module'], $templateOptions['group']); + } + } + + /** + * @dataProvider parseTemplateCodePartsDataProvider + * + * @param string $input + * @param array $expectedOutput + */ + public function testParseTemplateIdParts($input, $expectedOutput) + { + $this->assertEquals($this->_model->parseTemplateIdParts($input), $expectedOutput); + } + + public function parseTemplateCodePartsDataProvider() + { + return [ + 'Template ID with no theme' => [ + 'random_template_code', + [ + 'templateId' => 'random_template_code', + 'theme' => null, + ], + ], + 'Template ID with theme' => [ + 'random_template_code/Vendor/CustomTheme', + [ + 'templateId' => 'random_template_code', + 'theme' => 'Vendor/CustomTheme', + ], + ], + ]; } public function testGetTemplateLabel() @@ -68,31 +204,67 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Fixture_ModuleOne', $this->_model->getTemplateModule('template_one')); } - public function testGetTemplateFilename() + public function testGetTemplateArea() + { + $this->assertEquals('frontend', $this->_model->getTemplateArea('template_one')); + } + + public function testGetTemplateFilenameWithParams() + { + $this->viewFileSystem->expects( + $this->once() + )->method( + 'getEmailTemplateFileName' + )->with( + 'one.html', + $this->designParams, + 'Fixture_ModuleOne' + )->will( + $this->returnValue('_files/Fixture/ModuleOne/view/frontend/email/one.html') + ); + + $actualResult = $this->_model->getTemplateFilename('template_one', $this->designParams); + $this->assertEquals('_files/Fixture/ModuleOne/view/frontend/email/one.html', $actualResult); + } + + /** + * Ensure that the getTemplateFilename method can be called without design params + */ + public function testGetTemplateFilenameWithNoParams() { - $this->_moduleReader->expects( + $this->viewFileSystem->expects( $this->once() )->method( - 'getModuleDir' + 'getEmailTemplateFileName' )->with( - 'view', + 'one.html', + [ + 'area' => $this->designParams['area'], + 'module' => $this->designParams['module'], + ], 'Fixture_ModuleOne' )->will( - $this->returnValue('_files/Fixture/ModuleOne/view') + $this->returnValue('_files/Fixture/ModuleOne/view/frontend/email/one.html') ); + $actualResult = $this->_model->getTemplateFilename('template_one'); - $this->assertEquals('_files/Fixture/ModuleOne/view/email/one.html', $actualResult); + $this->assertEquals('_files/Fixture/ModuleOne/view/frontend/email/one.html', $actualResult); } /** * @param string $getterMethod + * @param $argument * @dataProvider getterMethodUnknownTemplateDataProvider * @expectedException \UnexpectedValueException * @expectedExceptionMessage Email template 'unknown' is not defined */ - public function testGetterMethodUnknownTemplate($getterMethod) + public function testGetterMethodUnknownTemplate($getterMethod, $argument = null) { - $this->_model->{$getterMethod}('unknown'); + if (!$argument) { + $this->_model->{$getterMethod}('unknown'); + } else { + $this->_model->{$getterMethod}('unknown', $argument); + } } public function getterMethodUnknownTemplateDataProvider() @@ -101,7 +273,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'label getter' => ['getTemplateLabel'], 'type getter' => ['getTemplateType'], 'module getter' => ['getTemplateModule'], - 'file getter' => ['getTemplateFilename'] + 'file getter' => ['getTemplateFilename', $this->designParams], ]; } @@ -109,10 +281,15 @@ class ConfigTest extends \PHPUnit_Framework_TestCase * @param string $getterMethod * @param string $expectedException * @param array $fixtureFields + * @param $argument * @dataProvider getterMethodUnknownFieldDataProvider */ - public function testGetterMethodUnknownField($getterMethod, $expectedException, array $fixtureFields = []) - { + public function testGetterMethodUnknownField( + $getterMethod, + $expectedException, + array $fixtureFields = [], + $argument = null + ) { $this->setExpectedException('UnexpectedValueException', $expectedException); $dataStorage = $this->getMock('Magento\Email\Model\Template\Config\Data', ['get'], [], '', false); $dataStorage->expects( @@ -122,8 +299,17 @@ class ConfigTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue(['fixture' => $fixtureFields]) ); - $model = new \Magento\Email\Model\Template\Config($dataStorage, $this->_moduleReader); - $model->{$getterMethod}('fixture'); + $model = new \Magento\Email\Model\Template\Config( + $dataStorage, + $this->_moduleReader, + $this->fileSystem, + $this->viewFileSystem + ); + if (!$argument) { + $model->{$getterMethod}('fixture'); + } else { + $model->{$getterMethod}('fixture', $argument); + } } public function getterMethodUnknownFieldDataProvider() @@ -138,12 +324,15 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'file getter, unknown module' => [ 'getTemplateFilename', "Field 'module' is not defined for email template 'fixture'.", + [], + $this->designParams, ], 'file getter, unknown file' => [ 'getTemplateFilename', "Field 'file' is not defined for email template 'fixture'.", ['module' => 'Fixture_Module'], - ] + $this->designParams, + ], ]; } } diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php index 0334a7fca6a8d214ab884483132714e2ecc2044a..5994d69332b3c13b80acfc1111088306a79a20d6 100644 --- a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php @@ -15,11 +15,6 @@ class FilterTest extends \PHPUnit_Framework_TestCase */ private $objectManager; - /** - * @var \Magento\Email\Model\Template\Filter|\PHPUnit_Framework_MockObject_MockObject - */ - protected $filter; - /** * @var \Magento\Framework\Stdlib\String|\PHPUnit_Framework_MockObject_MockObject */ @@ -133,7 +128,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase } /** - * @param null $mockedMethods Methods to mock + * @param array|null $mockedMethods Methods to mock * @return \Magento\Email\Model\Template\Filter|\PHPUnit_Framework_MockObject_MockObject */ protected function getModel($mockedMethods = null) @@ -158,6 +153,83 @@ class FilterTest extends \PHPUnit_Framework_TestCase ->getMock(); } + /** + * Tests proper parsing of the {{trans ...}} directive used in email templates + * + * @dataProvider transDirectiveDataProvider + * @param $value + * @param $expected + * @param array $variables + */ + public function testTransDirective($value, $expected, array $variables = []) + { + $filter = $this->getModel()->setVariables($variables); + $this->assertEquals($expected, $filter->filter($value)); + } + + /** + * Data provider for various possible {{trans ...}} usages + * + * @return array + */ + public function transDirectiveDataProvider() + { + return [ + 'empty directive' => [ + '{{trans}}', + '', + ], + + 'empty string' => [ + '{{trans ""}}', + '', + ], + + 'no padding' => [ + '{{trans"Hello cruel coder..."}}', + 'Hello cruel coder...', + ], + + 'multi-line padding' => [ + "{{trans \t\n\r'Hello cruel coder...' \t\n\r}}", + 'Hello cruel coder...', + ], + + 'capture escaped double-quotes inside text' => [ + '{{trans "Hello \"tested\" world!"}}', + 'Hello "tested" world!', + ], + + 'capture escaped single-quotes inside text' => [ + "{{trans 'Hello \\'tested\\' world!'|escape}}", + "Hello 'tested' world!", + ], + + 'basic var' => [ + '{{trans "Hello %adjective world!" adjective="tested"}}', + 'Hello tested world!', + ], + + 'auto-escaped output' => [ + '{{trans "Hello %adjective <strong>world</strong>!" adjective="<em>bad</em>"}}', + 'Hello <em>bad</em> <strong>world</strong>!', + ], + + 'unescaped modifier' => [ + '{{trans "Hello %adjective <strong>world</strong>!" adjective="<em>bad</em>"|raw}}', + 'Hello <em>bad</em> <strong>world</strong>!', + ], + + 'variable replacement' => [ + '{{trans "Hello %adjective world!" adjective="$mood"}}', + 'Hello happy world!', + [ + 'mood' => 'happy' + ], + ], + ]; + } + /** * Test basic usages of applyInlineCss * @@ -169,7 +241,6 @@ class FilterTest extends \PHPUnit_Framework_TestCase */ public function testApplyInlineCss($html, $css, $expectedResults) { - /* @var $filter \Magento\Email\Model\Template\Filter */ $filter = $this->getModel(['getCssFilesContent']); $filter->expects($this->exactly(count($expectedResults))) diff --git a/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php index 17e7cee953779270d53b9c27631541fa9b7b1378..72945c314c400ac32ce55db540e155a5e3f69e68 100644 --- a/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/TemplateTest.php @@ -201,7 +201,19 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $expectedOrigTemplateVariables, $expectedTemplateStyles ) { - $model = $this->getModelMock(); + $model = $this->getModelMock([ + 'getDesignParams' + ]); + + $designParams = [ + 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, + 'theme' => 'Magento/blank', + 'locale' => \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE, + ]; + + $model->expects($this->once()) + ->method('getDesignParams') + ->will($this->returnValue($designParams)); $templateId = 'templateId'; @@ -230,7 +242,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $this->filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Framework\App\Filesystem\DirectoryList::MODULES) + ->with(\Magento\Framework\App\Filesystem\DirectoryList::ROOT) ->will($this->returnValue($modulesDir)); $model->loadDefault($templateId); @@ -266,10 +278,10 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'expectedOrigTemplateVariables' => null, 'expectedTemplateStyles' => null, ], - 'copyright in HTML Remains' => [ + 'copyright in HTML Removed' => [ 'templateType' => 'html', 'templateText' => '<!-- Copyright © 2015 Magento. All rights reserved. -->', - 'parsedTemplateText' => '<!-- Copyright © 2015 Magento. All rights reserved. -->', + 'parsedTemplateText' => '', 'expectedTemplateSubject' => null, 'expectedOrigTemplateVariables' => null, 'expectedTemplateStyles' => null, @@ -554,7 +566,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'customer account new variables' => [ 'withGroup' => false, 'templateVariables' => '{"store url=\"\"":"Store Url","var logo_url":"Email Logo Image Url",' - . '"escapehtml var=$customer.name":"Customer Name"}', + . '"var customer.name":"Customer Name"}', 'expectedResult' => [ [ 'value' => '{{store url=""}}', @@ -565,7 +577,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'label' => __('%1', 'Email Logo Image Url'), ], [ - 'value' => '{{escapehtml var=$customer.name}}', + 'value' => '{{var customer.name}}', 'label' => __('%1', 'Customer Name'), ], ], @@ -573,7 +585,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'customer account new variables with grouped option' => [ 'withGroup' => true, 'templateVariables' => '{"store url=\"\"":"Store Url","var logo_url":"Email Logo Image Url",' - . '"escapehtml var=$customer.name":"Customer Name"}', + . '"var customer.name":"Customer Name"}', 'expectedResult' => [ 'label' => __('Template Variables'), 'value' => [ @@ -586,7 +598,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'label' => __('%1', 'Email Logo Image Url'), ], [ - 'value' => '{{escapehtml var=$customer.name}}', + 'value' => '{{var customer.name}}', 'label' => __('%1', 'Customer Name'), ], ], diff --git a/app/code/Magento/Email/etc/adminhtml/system.xml b/app/code/Magento/Email/etc/adminhtml/system.xml index 2c2034c493dfd70e6291f760f2f91e9ee362be5e..9000e1cfc85d321529b09631e2b6f5b685f48ddd 100644 --- a/app/code/Magento/Email/etc/adminhtml/system.xml +++ b/app/code/Magento/Email/etc/adminhtml/system.xml @@ -10,7 +10,7 @@ <section id="design"> <group id="email" translate="label" type="text" sortOrder="510" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Emails</label> - <field id="logo" translate="label" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="logo" translate="label comment" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Logo Image</label> <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> <backend_model>Magento\Config\Model\Config\Backend\Email\Logo</backend_model> @@ -19,20 +19,22 @@ <field id="logo_alt" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Logo Image Alt</label> </field> - <field id="logo_width" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="logo_width" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Logo Width</label> <comment>Only necessary if image has been uploaded above. Enter number of pixels, without appending "px".</comment> </field> - <field id="logo_height" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="logo_height" translate="label comment" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Logo Height</label> <comment>Only necessary if image has been uploaded above. Enter number of pixels, without appending "px".</comment> </field> - <field id="header_template" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="header_template" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Header Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="footer_template" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="footer_template" translate="label comment" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Footer Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> </group> diff --git a/app/code/Magento/Email/etc/email_templates.xml b/app/code/Magento/Email/etc/email_templates.xml index 7c60ea07ef797c4763ccf4fc5fe77f2ae22c872d..6be93a0993829cbdf264cc9dc00566d6ac98ff5b 100644 --- a/app/code/Magento/Email/etc/email_templates.xml +++ b/app/code/Magento/Email/etc/email_templates.xml @@ -6,6 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="design_email_header_template" label="Header" file="header.html" type="html" module="Magento_Email"/> - <template id="design_email_footer_template" label="Footer" file="footer.html" type="html" module="Magento_Email"/> + <template id="design_email_header_template" label="Header" file="header.html" type="html" module="Magento_Email" area="frontend"/> + <template id="design_email_footer_template" label="Footer" file="footer.html" type="html" module="Magento_Email" area="frontend"/> </config> diff --git a/app/code/Magento/Email/etc/email_templates.xsd b/app/code/Magento/Email/etc/email_templates.xsd index 2e51620a4bc20af34f19e7e16aac14026e527bda..81edaa59f8c790b5bc316ec356dea9df5babd29b 100644 --- a/app/code/Magento/Email/etc/email_templates.xsd +++ b/app/code/Magento/Email/etc/email_templates.xsd @@ -14,6 +14,7 @@ <xs:attribute name="file" type="xs:string" use="required"/> <xs:attribute name="type" type="emailTemplateFormatType" use="required"/> <xs:attribute name="module" type="xs:string" use="required"/> + <xs:attribute name="area" type="areaType" use="required"/> </xs:complexType> <xs:simpleType name="emailTemplateFormatType"> @@ -23,6 +24,13 @@ </xs:restriction> </xs:simpleType> + <xs:simpleType name="areaType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="frontend"/> + <xs:enumeration value="adminhtml"/> + </xs:restriction> + </xs:simpleType> + <xs:element name="config"> <xs:complexType> <xs:sequence> diff --git a/app/code/Magento/Email/i18n/de_DE.csv b/app/code/Magento/Email/i18n/de_DE.csv index 21c4989d602c2bd8c5b85d9e969b2b78ff19c962..dbcdb63824f423620be0d511840577d04783d033 100644 --- a/app/code/Magento/Email/i18n/de_DE.csv +++ b/app/code/Magento/Email/i18n/de_DE.csv @@ -23,7 +23,7 @@ Updated,Updated "New Email Template","New Email Template" GLOBAL,GLOBAL "Template Information","Template Information" -"Used Currently For","Used Currently For" +"Currently Used For","Currently Used For" "Used as Default For","Used as Default For" "Template Name","Template Name" "Template Subject","Template Subject" diff --git a/app/code/Magento/Email/i18n/es_ES.csv b/app/code/Magento/Email/i18n/es_ES.csv index 21c4989d602c2bd8c5b85d9e969b2b78ff19c962..dbcdb63824f423620be0d511840577d04783d033 100644 --- a/app/code/Magento/Email/i18n/es_ES.csv +++ b/app/code/Magento/Email/i18n/es_ES.csv @@ -23,7 +23,7 @@ Updated,Updated "New Email Template","New Email Template" GLOBAL,GLOBAL "Template Information","Template Information" -"Used Currently For","Used Currently For" +"Currently Used For","Currently Used For" "Used as Default For","Used as Default For" "Template Name","Template Name" "Template Subject","Template Subject" diff --git a/app/code/Magento/Email/i18n/fr_FR.csv b/app/code/Magento/Email/i18n/fr_FR.csv index 21c4989d602c2bd8c5b85d9e969b2b78ff19c962..dbcdb63824f423620be0d511840577d04783d033 100644 --- a/app/code/Magento/Email/i18n/fr_FR.csv +++ b/app/code/Magento/Email/i18n/fr_FR.csv @@ -23,7 +23,7 @@ Updated,Updated "New Email Template","New Email Template" GLOBAL,GLOBAL "Template Information","Template Information" -"Used Currently For","Used Currently For" +"Currently Used For","Currently Used For" "Used as Default For","Used as Default For" "Template Name","Template Name" "Template Subject","Template Subject" diff --git a/app/code/Magento/Email/i18n/nl_NL.csv b/app/code/Magento/Email/i18n/nl_NL.csv index 21c4989d602c2bd8c5b85d9e969b2b78ff19c962..dbcdb63824f423620be0d511840577d04783d033 100644 --- a/app/code/Magento/Email/i18n/nl_NL.csv +++ b/app/code/Magento/Email/i18n/nl_NL.csv @@ -23,7 +23,7 @@ Updated,Updated "New Email Template","New Email Template" GLOBAL,GLOBAL "Template Information","Template Information" -"Used Currently For","Used Currently For" +"Currently Used For","Currently Used For" "Used as Default For","Used as Default For" "Template Name","Template Name" "Template Subject","Template Subject" diff --git a/app/code/Magento/Email/i18n/pt_BR.csv b/app/code/Magento/Email/i18n/pt_BR.csv index 21c4989d602c2bd8c5b85d9e969b2b78ff19c962..dbcdb63824f423620be0d511840577d04783d033 100644 --- a/app/code/Magento/Email/i18n/pt_BR.csv +++ b/app/code/Magento/Email/i18n/pt_BR.csv @@ -23,7 +23,7 @@ Updated,Updated "New Email Template","New Email Template" GLOBAL,GLOBAL "Template Information","Template Information" -"Used Currently For","Used Currently For" +"Currently Used For","Currently Used For" "Used as Default For","Used as Default For" "Template Name","Template Name" "Template Subject","Template Subject" diff --git a/app/code/Magento/Email/i18n/zh_CN.csv b/app/code/Magento/Email/i18n/zh_CN.csv index 21c4989d602c2bd8c5b85d9e969b2b78ff19c962..dbcdb63824f423620be0d511840577d04783d033 100644 --- a/app/code/Magento/Email/i18n/zh_CN.csv +++ b/app/code/Magento/Email/i18n/zh_CN.csv @@ -23,7 +23,7 @@ Updated,Updated "New Email Template","New Email Template" GLOBAL,GLOBAL "Template Information","Template Information" -"Used Currently For","Used Currently For" +"Currently Used For","Currently Used For" "Used as Default For","Used as Default For" "Template Name","Template Name" "Template Subject","Template Subject" diff --git a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml index 96b6789adca87d7f6f99d5ea8ae95bf6f8854e7f..25944c62b9211b759fc06b9f12233476a2b0e0ac 100644 --- a/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml +++ b/app/code/Magento/Email/view/adminhtml/templates/template/edit.phtml @@ -86,8 +86,7 @@ require([ this.bindEvents(); - this.renderPaths(<?php echo $block->getUsedDefaultForPaths(); ?>, 'used_default_for'); - this.renderPaths(<?php echo $block->getUsedCurrentlyForPaths(); ?>, 'used_currently_for'); + this.renderPaths(<?php echo $block->getCurrentlyUsedForPaths(); ?>, 'currently_used_for'); }, bindEvents: function(){ @@ -194,13 +193,13 @@ require([ $('convert_button').show(); } } - if (pair.key == 'orig_template_used_default_for') { + if (pair.key == 'orig_template_currently_used_for') { if(pair.value.length){ - $('used_default_for').show(); - this.renderPaths(pair.value, 'used_default_for'); + $('currently_used_for').show(); + this.renderPaths(pair.value, 'currently_used_for'); } else{ - $('used_default_for').hide(); + $('currently_used_for').hide(); } } }.bind(this)); diff --git a/app/code/Magento/Email/view/email/header.html b/app/code/Magento/Email/view/email/header.html deleted file mode 100644 index 1bff10cb3dd518b6302afe6ca53ea7e209cb9498..0000000000000000000000000000000000000000 --- a/app/code/Magento/Email/view/email/header.html +++ /dev/null @@ -1,57 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Header @--> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta name="viewport" content="initial-scale=1.0, width=device-width" /> - <style type="text/css"> - {{var template_styles}} - - {{css file="css/email.css"}} - </style> -</head> -<body> -{{inlinecss file="css/email-inline.css"}} -<!-- Begin wrapper table --> -<table width="100%" cellpadding="0" cellspacing="0" border="0" id="background-table"> - <tr> - <td valign="top" class="container-td" align="center"> - <table cellpadding="0" cellspacing="0" border="0" align="center" class="container-table"> - <tr> - <td> - <table cellpadding="0" cellspacing="0" border="0" class="logo-container"> - <tr> - <td class="logo"> - <a href="{{store url=""}}"> - <img - {{if logo_width}} - width="{{var logo_width}}" - {{else}} - width="167" - {{/if}} - - {{if logo_height}} - height="{{var logo_height}}" - {{else}} - height="47" - {{/if}} - - src="{{var logo_url}}" - alt="{{var logo_alt}}" - border="0" - /> - </a> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td valign="top" class="top-content"> - <!-- Begin Content --> diff --git a/app/code/Magento/Email/view/email/footer.html b/app/code/Magento/Email/view/frontend/email/footer.html similarity index 51% rename from app/code/Magento/Email/view/email/footer.html rename to app/code/Magento/Email/view/frontend/email/footer.html index c54ff43bf40bb5f6ed8adb38360152526b73361d..d160104ac31e954ee1e4bd8a0773cd9a07c3fbe6 100644 --- a/app/code/Magento/Email/view/email/footer.html +++ b/app/code/Magento/Email/view/frontend/email/footer.html @@ -5,11 +5,19 @@ */ --> <!--@subject Footer @--> +<!--@vars { +"var store.getFrontendName()":"Store Name" +} @--> + <!-- End Content --> </td> </tr> + <tr> + <td class="footer"> + <p class="closing">{{trans "Thank you, %store_name" store_name=$store.getFrontendName()}}!</p> + </td> + </tr> </table> - <h5 class="closing-text">Thank you, {{var store.getFrontendName()}}!</h5> </td> </tr> </table> diff --git a/app/code/Magento/Email/view/frontend/email/header.html b/app/code/Magento/Email/view/frontend/email/header.html new file mode 100644 index 0000000000000000000000000000000000000000..736add12fa7af7a02e4f0b64ad7d5e12e2ae73c5 --- /dev/null +++ b/app/code/Magento/Email/view/frontend/email/header.html @@ -0,0 +1,59 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Header @--> +<!--@vars { +"var logo_height":"Email Logo Image Height", +"var logo_width":"Email Logo Image Width", +"var template_styles|raw":"Template CSS" +} @--> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="viewport" content="initial-scale=1.0, width=device-width" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <style type="text/css"> + {{var template_styles|raw}} + + {{css file="css/email.css"}} + </style> +</head> +<body> +{{inlinecss file="css/email-inline.css"}} + +<!-- Begin wrapper table --> +<table class="wrapper" width="100%"> + <tr> + <td class="wrapper-inner" align="center"> + <table class="main" align="center"> + <tr> + <td class="header"> + <a class="logo" href="{{store url=""}}"> + <img + {{if logo_width}} + width="{{var logo_width}}" + {{else}} + width="180" + {{/if}} + + {{if logo_height}} + height="{{var logo_height}}" + {{else}} + height="52" + {{/if}} + + src="{{var logo_url}}" + alt="{{var logo_alt}}" + border="0" + /> + </a> + </td> + </tr> + <tr> + <td class="main-content"> + <!-- Begin Content --> diff --git a/app/code/Magento/Email/view/frontend/web/logo_email.png b/app/code/Magento/Email/view/frontend/web/logo_email.png index 0a659fd813783c391184a0db47c80e4d2683fb68..4031893124b155675d03a9d3ccd22ebd80f016ab 100644 Binary files a/app/code/Magento/Email/view/frontend/web/logo_email.png and b/app/code/Magento/Email/view/frontend/web/logo_email.png differ diff --git a/app/code/Magento/GroupedImportExport/i18n/en_US.csv b/app/code/Magento/GroupedImportExport/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Log/Model/Cron.php b/app/code/Magento/Log/Model/Cron.php index d69cc88970d734dd54df0d5ed0e8b2a4b1a795c2..b30ea8f0c3cc8ba0a9527a0c66313541c9697d3b 100644 --- a/app/code/Magento/Log/Model/Cron.php +++ b/app/code/Magento/Log/Model/Cron.php @@ -4,13 +4,13 @@ * See COPYING.txt for license details. */ +namespace Magento\Log\Model; + /** * Log Cron Model * - * @author Magento Core Team <core@magentocommerce.com> + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -namespace Magento\Log\Model; - class Cron extends \Magento\Framework\Model\AbstractModel { const XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE = 'system/log/error_email_template'; @@ -114,8 +114,8 @@ class Cron extends \Magento\Framework\Model\AbstractModel ) )->setTemplateOptions( [ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, ] )->setTemplateVars( ['warnings' => join("\n", $this->_errors)] diff --git a/app/code/Magento/Log/etc/adminhtml/system.xml b/app/code/Magento/Log/etc/adminhtml/system.xml index d4345655d59e892075a16d5a99b0b73e1a3fc4ff..284569ef599ec13bb68295df6f27376ae9a7242f 100644 --- a/app/code/Magento/Log/etc/adminhtml/system.xml +++ b/app/code/Magento/Log/etc/adminhtml/system.xml @@ -42,8 +42,9 @@ <label>Error Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="error_email_template" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Error Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> </group> diff --git a/app/code/Magento/Log/etc/email_templates.xml b/app/code/Magento/Log/etc/email_templates.xml index 4719bca33395b68a469580c2cc52a03b2933c4f1..7a1dbfc028f58e58707b3f973e2bb6180cd39c9b 100644 --- a/app/code/Magento/Log/etc/email_templates.xml +++ b/app/code/Magento/Log/etc/email_templates.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="system_log_error_email_template" label="Log Cleanup Warnings" file="cleanup_warning.html" type="text" module="Magento_Log"/> + <template id="system_log_error_email_template" label="Log Cleanup Warnings" file="cleanup_warning.html" type="text" module="Magento_Log" area="adminhtml"/> </config> diff --git a/app/code/Magento/Log/view/email/cleanup_warning.html b/app/code/Magento/Log/view/adminhtml/email/cleanup_warning.html similarity index 57% rename from app/code/Magento/Log/view/email/cleanup_warning.html rename to app/code/Magento/Log/view/adminhtml/email/cleanup_warning.html index a5a8d233c93d06009dca459c8367b382d0c8b56a..6f7a9017d2821594729388b5f10f3c9a0fed56eb 100644 --- a/app/code/Magento/Log/view/email/cleanup_warning.html +++ b/app/code/Magento/Log/view/adminhtml/email/cleanup_warning.html @@ -5,9 +5,10 @@ */ --> <!--@subject Log Cleanup Warnings @--> -<!--@vars -{"var warnings":"Log Cleanup Warnings"} -@--> -Log Cleanup Warnings: +<!--@vars { +"var warnings":"Log Cleanup Warnings" +} @--> -{{var warnings}} \ No newline at end of file +{{trans "Log Cleanup Warnings"}} + +{{var warnings}} diff --git a/app/code/Magento/Msrp/i18n/en_US.csv b/app/code/Magento/Msrp/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Newsletter/Model/Template/Filter.php b/app/code/Magento/Newsletter/Model/Template/Filter.php index fae42c4a3e3480b21eee6912f261ddb6bf5744e9..43a68d085bbf9a1b079f8751d5a5d52a99b910ff 100644 --- a/app/code/Magento/Newsletter/Model/Template/Filter.php +++ b/app/code/Magento/Newsletter/Model/Template/Filter.php @@ -21,7 +21,7 @@ class Filter extends \Magento\Widget\Model\Template\Filter */ public function widgetDirective($construction) { - if (!isset($this->_templateVars['subscriber'])) { + if (!isset($this->templateVars['subscriber'])) { return $construction[0]; } $construction[2] .= sprintf(' store_id ="%s"', $this->getStoreId()); diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php index 9ff9d12c403772992813c93c351f2a59d8e40b83..52a501f9ef3b6b15fd72079266db9629fef8fa98 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Newsletter\Test\Unit\Model\Queue; +use Magento\Framework\App\TemplateTypesInterface; +use Magento\Framework\Mail\MessageInterface; + class TransportBuilderTest extends \Magento\Framework\Mail\Test\Unit\Template\TransportBuilderTest { /** @@ -25,8 +28,8 @@ class TransportBuilderTest extends \Magento\Framework\Mail\Test\Unit\Template\Tr * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function testGetTransport( - $templateType = \Magento\Framework\App\TemplateTypesInterface::TYPE_HTML, - $messageType = \Magento\Framework\Mail\Message::TYPE_HTML, + $templateType = TemplateTypesInterface::TYPE_HTML, + $messageType = MessageInterface::TYPE_HTML, $bodyText = '<h1>Html message</h1>' ) { $data = [ diff --git a/app/code/Magento/Newsletter/etc/adminhtml/system.xml b/app/code/Magento/Newsletter/etc/adminhtml/system.xml index 7d2e518e74c8d847be62b1ce2d5cd9d693bacdce..9fdd0f6cb36a4da7e46ebcb60dbb8a90008b2892 100644 --- a/app/code/Magento/Newsletter/etc/adminhtml/system.xml +++ b/app/code/Magento/Newsletter/etc/adminhtml/system.xml @@ -25,24 +25,27 @@ <label>Confirmation Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="confirm_email_template" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="confirm_email_template" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Confirmation Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="success_email_identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Success Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="success_email_template" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="success_email_template" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Success Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="un_email_identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Unsubscription Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="un_email_template" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="un_email_template" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Unsubscription Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> </group> diff --git a/app/code/Magento/Newsletter/etc/email_templates.xml b/app/code/Magento/Newsletter/etc/email_templates.xml index ffcb76a0ed4bf484d4ab7a4e055345476493130b..980d05693d22f00869dc8c92835994f4e58d1726 100644 --- a/app/code/Magento/Newsletter/etc/email_templates.xml +++ b/app/code/Magento/Newsletter/etc/email_templates.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="newsletter_subscription_confirm_email_template" label="Subscription Confirmation" file="subscr_confirm.html" type="html" module="Magento_Newsletter"/> - <template id="newsletter_subscription_success_email_template" label="Subscription Success" file="subscr_success.html" type="html" module="Magento_Newsletter"/> - <template id="newsletter_subscription_un_email_template" label="Unsubscription Success" file="unsub_success.html" type="html" module="Magento_Newsletter"/> + <template id="newsletter_subscription_confirm_email_template" label="Subscription Confirmation" file="subscr_confirm.html" type="html" module="Magento_Newsletter" area="frontend"/> + <template id="newsletter_subscription_success_email_template" label="Subscription Success" file="subscr_success.html" type="html" module="Magento_Newsletter" area="frontend"/> + <template id="newsletter_subscription_un_email_template" label="Unsubscription Success" file="unsub_success.html" type="html" module="Magento_Newsletter" area="frontend"/> </config> diff --git a/app/code/Magento/Newsletter/view/email/subscr_confirm.html b/app/code/Magento/Newsletter/view/email/subscr_confirm.html deleted file mode 100644 index 8586cdadd166e174d9cebbb3fe77a1deef473996..0000000000000000000000000000000000000000 --- a/app/code/Magento/Newsletter/view/email/subscr_confirm.html +++ /dev/null @@ -1,47 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Newsletter subscription confirmation @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$customer.name":"Customer Name", -"var subscriber.getConfirmationLink()":"Subscriber Confirmation Url"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a> - </td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Thank you for subscribing to our newsletter.</h1> - <p style="border:1px solid #E0E0E0; font-size:12px; line-height:16px; margin:0; padding:13px 18px; background:#F9F9F9;">To begin receiving the newsletter, you must first confirm your subscription by clicking on the following link:<br /> - <a href="{{var subscriber.getConfirmationLink()}}" style="color:#1E7EC8;">{{var subscriber.getConfirmationLink()}}</a><p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Newsletter/view/frontend/email/subscr_confirm.html b/app/code/Magento/Newsletter/view/frontend/email/subscr_confirm.html new file mode 100644 index 0000000000000000000000000000000000000000..94aed5247e0a56725106349817e0358639bece88 --- /dev/null +++ b/app/code/Magento/Newsletter/view/frontend/email/subscr_confirm.html @@ -0,0 +1,19 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Newsletter subscription confirmation @--> +<!--@vars { +"var customer.name":"Customer Name", +"var subscriber.getConfirmationLink()":"Subscriber Confirmation URL" +} @--> + +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "Thank you for subscribing to our newsletter."}}</p> +<p>{{trans "To begin receiving the newsletter, you must first confirm your subscription by clicking on the following link:"}}</p> +<p><a href="{{var subscriber.getConfirmationLink()}}">{{var subscriber.getConfirmationLink()}}</a></p> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Newsletter/view/frontend/email/subscr_success.html b/app/code/Magento/Newsletter/view/frontend/email/subscr_success.html new file mode 100644 index 0000000000000000000000000000000000000000..81e1cbb9b370a2e4cfee5dc13bbca6b2a326e554 --- /dev/null +++ b/app/code/Magento/Newsletter/view/frontend/email/subscr_success.html @@ -0,0 +1,18 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Newsletter subscription success @--> +<!--@vars { +"template config_path=\"design\/email\/footer_template\"":"Email Footer Template", +"template config_path=\"design\/email\/header_template\"":"Email Header Template" +} @--> + + +{{template config_path="design/email/header_template"}} + +{{trans "Newsletter subscription success"}} + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Newsletter/view/frontend/email/unsub_success.html b/app/code/Magento/Newsletter/view/frontend/email/unsub_success.html new file mode 100644 index 0000000000000000000000000000000000000000..c89e03a1788bce337828fbb46e510ff0bad2bc93 --- /dev/null +++ b/app/code/Magento/Newsletter/view/frontend/email/unsub_success.html @@ -0,0 +1,18 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Newsletter unsubscription success @--> +<!--@vars { +"template config_path=\"design\/email\/footer_template\"":"Email Footer Template", +"template config_path=\"design\/email\/header_template\"":"Email Header Template" +} @--> + + +{{template config_path="design/email/header_template"}} + +{{trans "Newsletter unsubscription success"}} + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index 16fff2d707ae29d1ba124afcffe9d1e203c99ae8..20753356671c3bd0d85e51822595b575e2488999 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -371,8 +371,8 @@ class Observer ) )->setTemplateOptions( [ - 'area' => \Magento\Framework\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, ] )->setTemplateVars( ['warnings' => join("\n", $this->_errors)] diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index 4dd2b0681df2c5032b23ac1ac3bda1b1014f1a52..7a271e1a01d199522a8f7e4f1d32c6845c7fefde 100644 --- a/app/code/Magento/ProductAlert/composer.json +++ b/app/code/Magento/ProductAlert/composer.json @@ -3,6 +3,7 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", + "magento/module-backend": "0.74.0-beta16", "magento/module-store": "0.74.0-beta16", "magento/module-catalog": "0.74.0-beta16", "magento/module-customer": "0.74.0-beta16", diff --git a/app/code/Magento/ProductAlert/etc/adminhtml/system.xml b/app/code/Magento/ProductAlert/etc/adminhtml/system.xml index 8da856804b434b63d0a938a0d4a0076b2379fd69..3b7c405529615327f5bb844c45e2b9c4ec6ef8ba 100644 --- a/app/code/Magento/ProductAlert/etc/adminhtml/system.xml +++ b/app/code/Magento/ProductAlert/etc/adminhtml/system.xml @@ -18,12 +18,14 @@ <label>Allow Alert When Product Comes Back in Stock</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="email_price_template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="email_price_template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Price Alert Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="email_stock_template" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="email_stock_template" translate="label comment" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Stock Alert Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="email_identity" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -49,8 +51,9 @@ <label>Error Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="error_email_template" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="error_email_template" translate="label comment" type="select" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Error Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> </group> diff --git a/app/code/Magento/ProductAlert/etc/email_templates.xml b/app/code/Magento/ProductAlert/etc/email_templates.xml index 515313d51c03c146747751c0fdaa53719b12db6c..ce8e0ecd3801e18b35393dcecd52db74a2830db1 100644 --- a/app/code/Magento/ProductAlert/etc/email_templates.xml +++ b/app/code/Magento/ProductAlert/etc/email_templates.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="catalog_productalert_email_stock_template" label="Stock Alert" file="stock_alert.html" type="html" module="Magento_ProductAlert"/> - <template id="catalog_productalert_email_price_template" label="Price Alert" file="price_alert.html" type="html" module="Magento_ProductAlert"/> - <template id="catalog_productalert_cron_error_email_template" label="Cron Error Warning" file="cron_error.html" type="html" module="Magento_ProductAlert"/> + <template id="catalog_productalert_email_stock_template" label="Stock Alert" file="stock_alert.html" type="html" module="Magento_ProductAlert" area="frontend"/> + <template id="catalog_productalert_email_price_template" label="Price Alert" file="price_alert.html" type="html" module="Magento_ProductAlert" area="frontend"/> + <template id="catalog_productalert_cron_error_email_template" label="Cron Error Warning" file="cron_error.html" type="text" module="Magento_ProductAlert" area="adminhtml"/> </config> diff --git a/app/code/Magento/ProductAlert/view/email/cron_error.html b/app/code/Magento/ProductAlert/view/adminhtml/email/cron_error.html similarity index 59% rename from app/code/Magento/ProductAlert/view/email/cron_error.html rename to app/code/Magento/ProductAlert/view/adminhtml/email/cron_error.html index fdef1cc9f5a53f6b5999a7440f7a701a0fbe921a..666182d23f487a3797f5e5d47b2a4803cbb5b77c 100644 --- a/app/code/Magento/ProductAlert/view/email/cron_error.html +++ b/app/code/Magento/ProductAlert/view/adminhtml/email/cron_error.html @@ -5,9 +5,10 @@ */ --> <!--@subject Product alerts Cron error @--> -<!--@vars -{"var warnings":"Warnings"} -@--> -Product alerts cron warnings: +<!--@vars { +"var warnings":"Warnings" +} @--> -{{var warnings}} \ No newline at end of file +{{trans "Product alerts cron warnings"}} + +{{var warnings}} diff --git a/app/code/Magento/ProductAlert/view/email/price_alert.html b/app/code/Magento/ProductAlert/view/email/price_alert.html deleted file mode 100644 index ce7f50a804beb33d0e2bb13811f0fc7d6dcc4098..0000000000000000000000000000000000000000 --- a/app/code/Magento/ProductAlert/view/email/price_alert.html +++ /dev/null @@ -1,14 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Products price changed alert @--> -<!--@vars -{"var customerName":"Customer Name", -"var alertGrid":"Alert Data Grid"} -@--> -Hello {{var customerName}}, - -{{var alertGrid}} \ No newline at end of file diff --git a/app/code/Magento/ProductAlert/view/email/stock_alert.html b/app/code/Magento/ProductAlert/view/email/stock_alert.html deleted file mode 100644 index 13e11962bf981d76f710e999b87e22432676869b..0000000000000000000000000000000000000000 --- a/app/code/Magento/ProductAlert/view/email/stock_alert.html +++ /dev/null @@ -1,14 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Products back in stock alert @--> -<!--@vars -{"var customerName":"Customer Name", -"var alertGrid":"Alert Data Grid"} -@--> -Hello {{var customerName}}, - -{{var alertGrid}} \ No newline at end of file diff --git a/app/code/Magento/ProductAlert/view/frontend/email/price_alert.html b/app/code/Magento/ProductAlert/view/frontend/email/price_alert.html new file mode 100644 index 0000000000000000000000000000000000000000..9e41114d777a849c607ffc793ce72c077f5f44c3 --- /dev/null +++ b/app/code/Magento/ProductAlert/view/frontend/email/price_alert.html @@ -0,0 +1,20 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Products price changed alert @--> +<!--@vars { +"var alertGrid|raw":"Alert Data Grid", +"var customerName":"Customer Name", +"template config_path=\"design\/email\/footer_template\"":"Email Footer Template", +"template config_path=\"design\/email\/header_template\"":"Email Header Template" +} @--> + +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customerName}}</p> +{{var alertGrid|raw}} + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/ProductAlert/view/frontend/email/stock_alert.html b/app/code/Magento/ProductAlert/view/frontend/email/stock_alert.html new file mode 100644 index 0000000000000000000000000000000000000000..82791f1c7820b99e3f83c8174f2694ebd73170be --- /dev/null +++ b/app/code/Magento/ProductAlert/view/frontend/email/stock_alert.html @@ -0,0 +1,20 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Products back in stock alert @--> +<!--@vars { +"var alertGrid|raw":"Alert Data Grid", +"var customerName":"Customer Name", +"template config_path=\"design\/email\/footer_template\"":"Email Footer Template", +"template config_path=\"design\/email\/header_template\"":"Email Header Template" +} @--> + +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$customerName}}</p> +{{var alertGrid|raw}} + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/ProductAlert/view/frontend/templates/email/price.phtml b/app/code/Magento/ProductAlert/view/frontend/templates/email/price.phtml index f0e9c131837ff212a5380f47476cb08a55367a1a..08c1f5fc12e63228e3feac0ed31450ca32269f8c 100644 --- a/app/code/Magento/ProductAlert/view/frontend/templates/email/price.phtml +++ b/app/code/Magento/ProductAlert/view/frontend/templates/email/price.phtml @@ -9,26 +9,26 @@ /** @var $block \Magento\ProductAlert\Block\Email\Price */ ?> <?php if ($_products = $block->getProducts()): ?> -<p><?php echo __('Price change alert! We wanted you to know that prices have changed for these products:') ?></p> +<p><?= __('Price change alert! We wanted you to know that prices have changed for these products:') ?></p> <table> <?php /** @var $_product \Magento\Catalog\Model\Product */ ?> <?php foreach ($_products as $_product): ?> <tr> <td class="col photo"> - <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $block->escapeHtml($_product->getName()) ?>" class="product photo"> - <img src="<?php echo $block->getThumbnailUrl($_product) ?>" width="<?php echo $block->getThumbnailSize()?>" height="<?php echo $block->getThumbnailSize()?>" alt="<?php echo $block->escapeHtml($_product->getName()) ?>" class="photo image" /> + <a href="<?= $_product->getProductUrl() ?>" title="<?= $block->escapeHtml($_product->getName()) ?>" class="product photo"> + <img src="<?= $block->getThumbnailUrl($_product) ?>" height="<?= $block->getThumbnailSize() ?>" alt="<?= $block->escapeHtml($_product->getName()) ?>" class="photo image" /> </a> </td> <td class="col item"> <p> <strong class="product name"> - <a href="<?php echo $_product->getProductUrl() ?>"><?php echo $block->escapeHtml($_product->getName()) ?></a> + <a href="<?= $_product->getProductUrl() ?>"><?= $block->escapeHtml($_product->getName()) ?></a> </strong> </p> <?php if ($shortDescription = $block->getFilteredContent($_product->getShortDescription())): ?> - <p><small><?php echo $shortDescription ?></small></p> + <p><small><?= $shortDescription ?></small></p> <?php endif; ?> - <p><?php echo $block->getProductPriceHtml( + <?= $block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_EMAIL, @@ -37,11 +37,10 @@ ] ); ?> - </p> - <p><small><a href="<?php echo $block->getProductUnsubscribeUrl($_product->getId()) ?>"><?php echo __('Click here to stop alerts for this product.') ?></a></small></p> + <p><small><a href="<?= $block->getProductUnsubscribeUrl($_product->getId()) ?>"><?= __('Click here to stop alerts for this product.') ?></a></small></p> </td> </tr> <?php endforeach; ?> </table> -<p><a href="<?php echo $block->getUnsubscribeUrl() ?>"><?php echo __('Unsubscribe from all price alerts') ?></a></p> +<p><a href="<?= $block->getUnsubscribeUrl() ?>"><?= __('Unsubscribe from all price alerts') ?></a></p> <?php endif; ?> diff --git a/app/code/Magento/ProductAlert/view/frontend/templates/email/stock.phtml b/app/code/Magento/ProductAlert/view/frontend/templates/email/stock.phtml index 7c2a812b970e2fd40d40948024f27aa226835713..06678faa6b7804eebdcd3482c98ff76b32b01736 100644 --- a/app/code/Magento/ProductAlert/view/frontend/templates/email/stock.phtml +++ b/app/code/Magento/ProductAlert/view/frontend/templates/email/stock.phtml @@ -9,25 +9,25 @@ /** @var $block \Magento\ProductAlert\Block\Email\Stock */ ?> <?php if ($_products = $block->getProducts()): ?> -<p><?php echo __('In stock alert! We wanted you to know that these products are now available:') ?></p> +<p><?= __('In stock alert! We wanted you to know that these products are now available:') ?></p> <table> <?php foreach ($_products as $_product): ?> <tr> <td class="col photo"> - <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $block->escapeHtml($_product->getName()) ?>" class="product photo"> - <img src="<?php echo $block->getThumbnailUrl($_product) ?>" width="<?php echo $block->getThumbnailSize()?>" height="<?php echo $block->getThumbnailSize()?>" alt="<?php echo $block->escapeHtml($_product->getName()) ?>" class="photo image" /> + <a href="<?= $_product->getProductUrl() ?>" title="<?= $block->escapeHtml($_product->getName()) ?>" class="product photo"> + <img src="<?= $block->getThumbnailUrl($_product) ?>" height="<?= $block->getThumbnailSize() ?>" alt="<?= $block->escapeHtml($_product->getName()) ?>" class="photo image" /> </a> </td> <td class="col item"> <p> <strong class="product name"> - <a href="<?php echo $_product->getProductUrl() ?>"><?php echo $block->escapeHtml($_product->getName()) ?></a> + <a href="<?= $_product->getProductUrl() ?>"><?= $block->escapeHtml($_product->getName()) ?></a> </strong> </p> <?php if ($shortDescription = $block->getFilteredContent($_product->getShortDescription())): ?> - <p><small><?php echo $shortDescription ?></small></p> + <p><small><?= $shortDescription ?></small></p> <?php endif; ?> - <p><?php echo $block->getProductPriceHtml( + <?= $block->getProductPriceHtml( $_product, \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_EMAIL, @@ -36,11 +36,10 @@ ] ); ?> - </p> - <p><small><a href="<?php echo $block->getProductUnsubscribeUrl($_product->getId()) ?>"><?php echo __('Click here to stop alerts for this product.') ?></a></small></p> + <p><small><a href="<?= $block->getProductUnsubscribeUrl($_product->getId()) ?>"><?= __('Click here to stop alerts for this product.') ?></a></small></p> </td> </tr> <?php endforeach; ?> </table> -<p><a href="<?php echo $block->getUnsubscribeUrl() ?>"><?php echo __('Unsubscribe from all stock alerts') ?></a></p> +<p><a href="<?= $block->getUnsubscribeUrl() ?>"><?= __('Unsubscribe from all stock alerts') ?></a></p> <?php endif; ?> diff --git a/app/code/Magento/RequireJs/i18n/en_US.csv b/app/code/Magento/RequireJs/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index d843ae55ec914c73b45e9f681717178a4578c81a..ae28f57ab2f9751f5f535b9cb903b7a484481b62 100755 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1784,12 +1784,12 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface } /** - * Get formated order created date in store timezone + * Get formatted order created date in store timezone * * @param string $format date format type (short|medium|long|full) * @return string */ - public function getCreatedAtFormated($format) + public function getCreatedAtFormatted($format) { return $this->timezone->formatDate( $this->timezone->scopeDate( diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml index 4ea65218f81382b54f65b88152199aa1e2866db6..4711f0d1ce9d9dbb12d841af339d23b2ed9f40d4 100644 --- a/app/code/Magento/Sales/etc/adminhtml/system.xml +++ b/app/code/Magento/Sales/etc/adminhtml/system.xml @@ -137,12 +137,14 @@ <label>New Order Confirmation Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>New Order Confirmation Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>New Order Confirmation Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -164,12 +166,14 @@ <label>Order Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Order Comment Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Order Comment Email Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -191,12 +195,14 @@ <label>Invoice Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Invoice Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Invoice Email Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -218,12 +224,14 @@ <label>Invoice Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Invoice Comment Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Invoice Comment Email Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -245,12 +253,14 @@ <label>Shipment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Shipment Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Shipment Email Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -272,12 +282,14 @@ <label>Shipment Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Shipment Comment Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Shipment Comment Email Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -299,12 +311,14 @@ <label>Credit Memo Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Credit Memo Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Credit Memo Email Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -326,12 +340,14 @@ <label>Credit Memo Comment Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Credit Memo Comment Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> - <field id="guest_template" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="guest_template" translate="label comment" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Credit Memo Comment Email Template for Guest</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="copy_to" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Sales/etc/email_templates.xml b/app/code/Magento/Sales/etc/email_templates.xml index e1ad171537ae5e8683b62ef127f24fe26c7084f5..d95211657aa2d8779b19240f09b0187898bba872 100644 --- a/app/code/Magento/Sales/etc/email_templates.xml +++ b/app/code/Magento/Sales/etc/email_templates.xml @@ -6,20 +6,20 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="sales_email_order_template" label="New Order" file="order_new.html" type="html" module="Magento_Sales"/> - <template id="sales_email_order_guest_template" label="New Order for Guest" file="order_new_guest.html" type="html" module="Magento_Sales"/> - <template id="sales_email_order_comment_template" label="Order Update" file="order_update.html" type="html" module="Magento_Sales"/> - <template id="sales_email_order_comment_guest_template" label="Order Update for Guest" file="order_update_guest.html" type="html" module="Magento_Sales"/> - <template id="sales_email_invoice_template" label="New Invoice" file="invoice_new.html" type="html" module="Magento_Sales"/> - <template id="sales_email_invoice_guest_template" label="New Invoice for Guest" file="invoice_new_guest.html" type="html" module="Magento_Sales"/> - <template id="sales_email_invoice_comment_template" label="Invoice Update" file="invoice_update.html" type="html" module="Magento_Sales"/> - <template id="sales_email_invoice_comment_guest_template" label="Invoice Update for Guest" file="invoice_update_guest.html" type="html" module="Magento_Sales"/> - <template id="sales_email_creditmemo_template" label="New Credit Memo" file="creditmemo_new.html" type="html" module="Magento_Sales"/> - <template id="sales_email_creditmemo_guest_template" label="New Credit Memo for Guest" file="creditmemo_new_guest.html" type="html" module="Magento_Sales"/> - <template id="sales_email_creditmemo_comment_template" label="Credit Memo Update" file="creditmemo_update.html" type="html" module="Magento_Sales"/> - <template id="sales_email_creditmemo_comment_guest_template" label="Credit Memo Update for Guest" file="creditmemo_update_guest.html" type="html" module="Magento_Sales"/> - <template id="sales_email_shipment_template" label="New Shipment" file="shipment_new.html" type="html" module="Magento_Sales"/> - <template id="sales_email_shipment_guest_template" label="New Shipment for Guest" file="shipment_new_guest.html" type="html" module="Magento_Sales"/> - <template id="sales_email_shipment_comment_template" label="Shipment Update" file="shipment_update.html" type="html" module="Magento_Sales"/> - <template id="sales_email_shipment_comment_guest_template" label="Shipment Update for Guest" file="shipment_update_guest.html" type="html" module="Magento_Sales"/> + <template id="sales_email_order_template" label="New Order" file="order_new.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_order_guest_template" label="New Order for Guest" file="order_new_guest.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_order_comment_template" label="Order Update" file="order_update.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_order_comment_guest_template" label="Order Update for Guest" file="order_update_guest.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_invoice_template" label="New Invoice" file="invoice_new.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_invoice_guest_template" label="New Invoice for Guest" file="invoice_new_guest.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_invoice_comment_template" label="Invoice Update" file="invoice_update.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_invoice_comment_guest_template" label="Invoice Update for Guest" file="invoice_update_guest.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_creditmemo_template" label="New Credit Memo" file="creditmemo_new.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_creditmemo_guest_template" label="New Credit Memo for Guest" file="creditmemo_new_guest.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_creditmemo_comment_template" label="Credit Memo Update" file="creditmemo_update.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_creditmemo_comment_guest_template" label="Credit Memo Update for Guest" file="creditmemo_update_guest.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_shipment_template" label="New Shipment" file="shipment_new.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_shipment_guest_template" label="New Shipment for Guest" file="shipment_new_guest.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_shipment_comment_template" label="Shipment Update" file="shipment_update.html" type="html" module="Magento_Sales" area="frontend"/> + <template id="sales_email_shipment_comment_guest_template" label="Shipment Update for Guest" file="shipment_update_guest.html" type="html" module="Magento_Sales" area="frontend"/> </config> diff --git a/app/code/Magento/Sales/view/email/creditmemo_new.html b/app/code/Magento/Sales/view/email/creditmemo_new.html deleted file mode 100644 index c37e42e9c96f5c8f9f84106c7fb53d77ac466ff9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/creditmemo_new.html +++ /dev/null @@ -1,114 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var store.getFrontendName()":"Store Name", -"store url=\"customer/account/\"":"Customer Account Url", -"var creditmemo.increment_id":"Credit Memo Id", -"var order.increment_id":"Order Id", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.shipping_description":"Shipping Description", -"layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid", -"var comment":"Credit Memo Comment"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{escapehtml var=$order.getCustomerName()}}</h1> - <p> - Thank you for your order from {{var store.getFrontendName()}}. - You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #{{var creditmemo.increment_id}} for Order #{{var order.increment_id}}</h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - {{depend order.getIsNotVirtual()}} - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_description}} - - </td> - </tr> - </tbody> - </table> - <br/> - {{/depend}} - {{layout handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order}} - <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/creditmemo_new_guest.html b/app/code/Magento/Sales/view/email/creditmemo_new_guest.html deleted file mode 100644 index 2d91c7aa04834b2b349f88b2bf9bf818dc4878db..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/creditmemo_new_guest.html +++ /dev/null @@ -1,112 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$billing.getName()":"Guest Customer Name (Billing)", -"var store.getFrontendName()":"Store Name", -"var creditmemo.increment_id":"Credit Memo Id", -"var order.increment_id":"Order Id", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.shipping_description":"Shipping Description", -"layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid", -"var comment":"Credit Memo Comment"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{escapehtml var=$billing.getName()}}</h1> - <p> - Thank you for your order from {{var store.getFrontendName()}}. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #{{var creditmemo.increment_id}} for Order #{{var order.increment_id}}</h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - {{depend order.getIsNotVirtual()}} - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_description}} - - </td> - </tr> - </tbody> - </table> - <br/> - {{/depend}} - {{layout handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order}} - <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/creditmemo_update.html b/app/code/Magento/Sales/view/email/creditmemo_update.html deleted file mode 100644 index 6edc86341ffe0f39492c29ef96a57a2fe7102102..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/creditmemo_update.html +++ /dev/null @@ -1,58 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"store url=\"customer/account/\"":"Customer Account Url", -"var comment":"Credit Memo Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$order.getCustomerName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.</p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/creditmemo_update_guest.html b/app/code/Magento/Sales/view/email/creditmemo_update_guest.html deleted file mode 100644 index 7473d4271f1fd647f8ca1e2a866c64bf74dc8a1c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/creditmemo_update_guest.html +++ /dev/null @@ -1,57 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", - -"escapehtml var=$billing.getName()":"Guest Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"var comment":"Credit Memo Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$billing.getName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/invoice_new.html b/app/code/Magento/Sales/view/email/invoice_new.html deleted file mode 100644 index b9b8d8bfb2a7e36aa31b71a7410c20d897af14cf..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/invoice_new.html +++ /dev/null @@ -1,113 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} for Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var store.getFrontendName()":"Store Name", -"store url=\"customer/account/\"":"Customer Account Url", -"var invoice.increment_id":"Invoice Id", -"var order.increment_id":"Order Id", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.shipping_description":"Shipping Description", -"layout area=\"frontend\" handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid", -"var comment":"Invoice Comment"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{escapehtml var=$order.getCustomerName()}}</h1> - <p style="font-size:12px; line-height:16px; margin:0;"> - Thank you for your order from {{var store.getFrontendName()}}. - You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #{{var invoice.increment_id}} for Order #{{var order.increment_id}}</h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - {{depend order.getIsNotVirtual()}} - <table cellspacing="0" cellpadding="0" border="0" width="100%"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_description}} - </td> - </tr> - </tbody> - </table> - <br/> - {{/depend}} - {{layout area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order}} - <p style="font-size:12px; margin:0 10px 10px 0;">{{var comment}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/invoice_new_guest.html b/app/code/Magento/Sales/view/email/invoice_new_guest.html deleted file mode 100644 index 99511adf65684a47c2156e54a812770fb7eaa0a1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/invoice_new_guest.html +++ /dev/null @@ -1,112 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} for Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$billing.getName()":"Guest Customer Name", -"var store.getFrontendName()":"Store Name", -"var invoice.increment_id":"Invoice Id", -"var order.increment_id":"Order Id", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.shipping_description":"Shipping Description", -"layout handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid", -"var comment":"Invoice Comment"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{escapehtml var=$billing.getName()}}</h1> - <p style="font-size:12px; line-height:16px; margin:0;"> - Thank you for your order from {{var store.getFrontendName()}}. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #{{var invoice.increment_id}} for Order #{{var order.increment_id}}</h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - {{depend order.getIsNotVirtual()}} - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_description}} - - </td> - </tr> - </tbody> - </table> - <br/> - {{/depend}} - {{layout handle="sales_email_order_invoice_items" invoice=$invoice order=$order}} - <p style="font-size:12px; margin:0 0 10px 0">{{var comment}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/invoice_update.html b/app/code/Magento/Sales/view/email/invoice_update.html deleted file mode 100644 index 49b687c535fa82980441bfff7bc65c4ef58bd1f9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/invoice_update.html +++ /dev/null @@ -1,58 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"store url=\"customer/account/\"":"Customer Account Url", -"var comment":"Invoice Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$order.getCustomerName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.</p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/invoice_update_guest.html b/app/code/Magento/Sales/view/email/invoice_update_guest.html deleted file mode 100644 index 8563878d66d81437ea72725d3dd644db77eed3c1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/invoice_update_guest.html +++ /dev/null @@ -1,55 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$billing.getName()":"Guest Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"var comment":"Invoice Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$billing.getName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> diff --git a/app/code/Magento/Sales/view/email/order_new.html b/app/code/Magento/Sales/view/email/order_new.html deleted file mode 100644 index 74948c978587e8a9d5bb2acd80004ee8e0cafaee..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/order_new.html +++ /dev/null @@ -1,116 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: New Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var store.getFrontendName()":"Store Name", -"store url=\"customer/account/\"":"Customer Account Url", -"var order.increment_id":"Order Id", -"var order.getCreatedAtFormated(1)":"Order Created At (datetime)", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.getShippingDescription()":"Shipping Description", -"layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid", -"var order.getEmailCustomerNote()":"Email Order Note"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <!-- [ header starts here] --> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{escapehtml var=$order.getCustomerName()}}</h1> - <p style="font-size:12px; line-height:16px; margin:0;"> - Thank you for your order from {{var store.getFrontendName()}}. - Once your package ships we will send an email with a link to track your order. - You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - <p style="font-size:12px; line-height:16px; margin:0;">Your order confirmation is below. Thank you again for your business.</p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #{{var order.increment_id}} <small>(placed on {{var order.getCreatedAtFormated(1)}})</small></h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - {{depend order.getIsNotVirtual()}} - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.getShippingDescription()}} - - </td> - </tr> - </tbody> - </table> - <br/> - {{/depend}} - {{layout handle="sales_email_order_items" order=$order area="frontend"}} - <p style="font-size:12px; margin:0 0 10px 0">{{var order.getEmailCustomerNote()}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/order_new_guest.html b/app/code/Magento/Sales/view/email/order_new_guest.html deleted file mode 100644 index ae97a164c268e1235e69f02b65f7d49fc10210fb..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/order_new_guest.html +++ /dev/null @@ -1,114 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: New Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getBillingAddress().getName()":"Guest Customer Name", -"var store.getFrontendName()":"Store Name", -"var order.increment_id":"Order Id", -"var order.getCreatedAtFormated(1)":"Order Created At (datetime)", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.getShippingDescription()":"Shipping Description", -"layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid", -"var order.getEmailCustomerNote()":"Email Order Note"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{escapehtml var=$order.getBillingAddress().getName()}}</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Thank you for your order from {{var store.getFrontendName()}}. - Once your package ships we will send an email with a link to track your order. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - <p style="font-size:12px; line-height:16px; margin:0;">Your order confirmation is below. Thank you again for your business.</p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #{{var order.increment_id}} <small>(placed on {{var order.getCreatedAtFormated(1)}})</small></h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - {{depend order.getIsNotVirtual()}} - <table cellspacing="0" cellpadding="0" border="0" width="100%"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.getShippingDescription()}} - - </td> - </tr> - </tbody> - </table> - <br/> - {{/depend}} - {{layout handle="sales_email_order_items" order=$order}} - <p style="font-size:12px; margin:0 10px 10px 0">{{var order.getEmailCustomerNote()}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/order_update.html b/app/code/Magento/Sales/view/email/order_update.html deleted file mode 100644 index f7b2a77cc37e1e1ce2af7a6fc577a908da5f1a53..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/order_update.html +++ /dev/null @@ -1,58 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Order # {{var order.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"store url=\"customer/account/\"":"Customer Account Url", -"var comment":"Order Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$order.getCustomerName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.</p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/order_update_guest.html b/app/code/Magento/Sales/view/email/order_update_guest.html deleted file mode 100644 index 161fc81eb75ad05baad231e57db33a8c5ab07bc1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/order_update_guest.html +++ /dev/null @@ -1,56 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Order # {{var order.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$billing.getName()":"Guest Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"var comment":"Order Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$billing.getName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/shipment_new.html b/app/code/Magento/Sales/view/email/shipment_new.html deleted file mode 100644 index 99537c6ebb4bd1a53cc46d5fb221106094db632c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/shipment_new.html +++ /dev/null @@ -1,117 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} for Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var store.getFrontendName()":"Store Name", -"store url=\"customer/account/\"":"Customer Account Url", -"var shipment.increment_id":"Shipment Id", -"var order.increment_id":"Order Id", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.shipping_description":"Shipping Description", -"layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid", -"block type='Magento\\Framework\\View\\Element\\Template' area='frontend' template='email/shipment/track.phtml' shipment=$shipment order=$order":"Shipment Track Details", -"var comment":"Shipment Comment"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{escapehtml var=$order.getCustomerName()}}</h1> - <p style="font-size:12px; line-height:16px; margin:0;"> - Thank you for your order from {{var store.getFrontendName()}}. - You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - <p style="font-size:12px; line-height:16px; margin:0;"> - Your shipping confirmation is below. Thank you again for your business. - </p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #{{var shipment.increment_id}} for Order #{{var order.increment_id}}</h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - <table cellspacing="0" cellpadding="0" border="0" width="100%"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_description}} - - </td> - </tr> - </tbody> - </table> - <br/> - {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}} - {{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} - <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/shipment_new_guest.html b/app/code/Magento/Sales/view/email/shipment_new_guest.html deleted file mode 100644 index bdd9a0cb88d5850ac266c8fe950fea28cc07c6b9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/shipment_new_guest.html +++ /dev/null @@ -1,115 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} for Order # {{var order.increment_id}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$billing.getName()":"Guest Customer Name", -"var store.getFrontendName()":"Store Name", -"var shipment.increment_id":"Shipment Id", -"var order.increment_id":"Order Id", -"var formattedBillingAddress":"Billing Address", -"var payment_html":"Payment Details", -"var formattedShippingAddress":"Shipping Address", -"var order.shipping_description":"Shipping Description", -"layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid", -"block type='Magento\\Framework\\View\\Element\\Template' area='frontend' template='email/shipment/track.phtml' shipment=$shipment order=$order":"Shipment Track Details", -"var comment":"Shipment Comment"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Hello, {{escapehtml var=$billing.getName()}}</h1> - <p style="font-size:12px; line-height:16px; margin:0;"> - Thank you for your order from {{var store.getFrontendName()}}. - If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST. - </p> - <p style="font-size:12px; line-height:16px; margin:0;"> - Your shipping confirmation is below. Thank you again for your business. - </p> - </td> - </tr> - <tr> - <td> - <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #{{var shipment.increment_id}} for Order #{{var order.increment_id}}</h2> - </td> - </tr> - <tr> - <td> - <table cellspacing="0" cellpadding="0" border="0" width="650"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedBillingAddress }} - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var payment_html}} - </td> - </tr> - </tbody> - </table> - <br/> - <table cellspacing="0" cellpadding="0" border="0" width="100%"> - <thead> - <tr> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th> - <th width="10"></th> - <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th> - </tr> - </thead> - <tbody> - <tr> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var formattedShippingAddress }} - - </td> - <td> </td> - <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_description}} - - </td> - </tr> - </tbody> - </table> - <br/> - {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}} - {{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} - <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/shipment_update.html b/app/code/Magento/Sales/view/email/shipment_update.html deleted file mode 100644 index edf22d6b301d95017eb274c0721954ec04c8d414..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/shipment_update.html +++ /dev/null @@ -1,58 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$order.getCustomerName()":"Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"store url=\"customer/account/\"":"Customer Account Url", -"var comment":"Order Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$order.getCustomerName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">You can check the status of your order by <a href="{{store url="customer/account/"}}" style="color:#1E7EC8;">logging into your account</a>.</p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/email/shipment_update_guest.html b/app/code/Magento/Sales/view/email/shipment_update_guest.html deleted file mode 100644 index 30adaf0c2098a97bf1ba1213c9cc3e33732d0d25..0000000000000000000000000000000000000000 --- a/app/code/Magento/Sales/view/email/shipment_update_guest.html +++ /dev/null @@ -1,56 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} update @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$billing.getName()":"Guest Customer Name", -"var order.increment_id":"Order Id", -"var order.getStatusLabel()":"Order Status", -"var comment":"Order Comment", -"var store.getFrontendName()":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> -<tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"><a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$billing.getName()}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;"> - Your order # {{var order.increment_id}} has been <br/> - <strong>{{var order.getStatusLabel()}}</strong>. - </p> - <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">{{var comment}}</p> - <p style="font-size:12px; line-height:16px; margin:0;"> - If you have any questions, please feel free to contact us at - <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> - or by phone at {{config path='general/store_information/phone'}}. - </p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td> - </tr> - </table> - </td> -</tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_new.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_new.html new file mode 100644 index 0000000000000000000000000000000000000000..2b513aea62a818dac1fdaf9121ca5a073082d17e --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_new.html @@ -0,0 +1,84 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var comment":"Credit Memo Comment", +"var creditmemo.increment_id":"Credit Memo Id", +"layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid", +"var store.getUrl('customer/account/')":"Customer Account URL", +"var order.getCustomerName()":"Customer Name", +"var order.increment_id":"Order Id", +"var payment_html|raw":"Payment Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.getShippingDescription()":"Shipping Description", +"var order.shipping_description":"Shipping Description" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}} + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <h1>{{trans "Your Credit Memo #%creditmemo_id for Order #%order_id" creditmemo_id=$creditmemo.increment_id order_id=$order.increment_id}}</h1> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_new_guest.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_new_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..cd0ca912ad0fc6c2bbecee49d3566c49c58732e2 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_new_guest.html @@ -0,0 +1,82 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var comment":"Credit Memo Comment", +"var creditmemo.increment_id":"Credit Memo Id", +"layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid", +"var billing.getName()":"Guest Customer Name (Billing)", +"var order.increment_id":"Order Id", +"var payment_html|raw":"Payment Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.getShippingDescription()":"Shipping Description", +"var order.shipping_description":"Shipping Description" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$billing.getName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <h1>{{trans "Your Credit Memo #%creditmemo_id for Order #%order_id" creditmemo_id=$creditmemo.increment_id order_id=$order.incrh1ent_id}}</h1> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html new file mode 100644 index 0000000000000000000000000000000000000000..aa97c9437316a5426e7287406a2c2b75550e180f --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html @@ -0,0 +1,54 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} update @--> +<!--@vars { +"var comment":"Credit Memo Comment", +"var creditmemo.increment_id":"Credit Memo Id", +"var store.getUrl('customer/account/')":"Customer Account URL", +"var order.getCustomerName()":"Customer Name", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..19a818a5192d309ae763f2ead4e0b6fb6b6c4630 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html @@ -0,0 +1,52 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} update @--> +<!--@vars { +"var comment":"Credit Memo Comment", +"var creditmemo.increment_id":"Credit Memo Id", +"var billing.getName()":"Guest Customer Name", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$billing.getName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_new.html b/app/code/Magento/Sales/view/frontend/email/invoice_new.html new file mode 100644 index 0000000000000000000000000000000000000000..50b15e7eac4a013effa7a490771e5aed692943b5 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/invoice_new.html @@ -0,0 +1,84 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} for Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var store.getUrl('customer/account/')":"Customer Account URL", +"var order.getCustomerName()":"Customer Name", +"var comment":"Invoice Comment", +"var invoice.increment_id":"Invoice Id", +"layout area=\"frontend\" handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid", +"var order.increment_id":"Order Id", +"var payment_html|raw":"Payment Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.shipping_description":"Shipping Description", +"var order.getShippingDescription()":"Shipping Description" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}} + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <h1>{{trans "Your Invoice #%invoice_id for Order #%order_id" invoice_id=$invoice.increment_id order_id=$order.increment_id}}</h1> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_new_guest.html b/app/code/Magento/Sales/view/frontend/email/invoice_new_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..e0e7cb6d95ef72b8af4d479808614a9d1f7a0dda --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/invoice_new_guest.html @@ -0,0 +1,82 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} for Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var billing.getName()":"Guest Customer Name", +"var comment":"Invoice Comment", +"var invoice.increment_id":"Invoice Id", +"layout handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid", +"var order.increment_id":"Order Id", +"var payment_html|raw":"Payment Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.getShippingDescription()":"Shipping Description", +"var order.shipping_description":"Shipping Description" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$billing.getName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <h1>{{trans "Your Invoice #%invoice_id for Order #%order_id" invoice_id=$invoice.increment_id order_id=$order.increment_id}}</h1> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout handle="sales_email_order_invoice_items" invoice=$invoice order=$order}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update.html b/app/code/Magento/Sales/view/frontend/email/invoice_update.html new file mode 100644 index 0000000000000000000000000000000000000000..d487fc7586de1fe34a89852fb2a5c8b11328dd3b --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/invoice_update.html @@ -0,0 +1,54 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} update @--> +<!--@vars { +"var store.getUrl('customer/account/')":"Customer Account URL", +"var order.getCustomerName()":"Customer Name", +"var comment":"Invoice Comment", +"var invoice.increment_id":"Invoice Id", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..7180e11b7383df050d62f3b98947161c006a8170 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html @@ -0,0 +1,52 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} update @--> +<!--@vars { +"var billing.getName()":"Guest Customer Name", +"var comment":"Invoice Comment", +"var invoice.increment_id":"Invoice Id", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$billing.getName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/order_new.html b/app/code/Magento/Sales/view/frontend/email/order_new.html new file mode 100644 index 0000000000000000000000000000000000000000..b3447d2f813915530aae019cde6b027b3c21e26e --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/order_new.html @@ -0,0 +1,85 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: New Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var order.getEmailCustomerNote()":"Email Order Note", +"var order.increment_id":"Order Id", +"layout handle=\"sales_email_order_items\" order=$order area=\"frontend\"":"Order Items Grid", +"var payment_html|raw":"Payment Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.getShippingDescription()":"Shipping Description" +} @--> + +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%customer_name," customer_name=$order.getCustomerName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans "Once your package ships we will send you a tracking number."}} + {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}} + </p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <h1>{{trans 'Your Order <span class="no-link">#%increment_id</span>' increment_id=$order.increment_id |raw}}</h1> + <p>{{trans 'Placed on <span class="no-link">%created_at</span>' created_at=$order.getCreatedAtFormatted(1) |raw}}</p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend order.getEmailCustomerNote()}} + <table class="message-info"> + <tr> + <td> + {{var order.getEmailCustomerNote()|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout handle="sales_email_order_items" order=$order area="frontend"}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/order_new_guest.html b/app/code/Magento/Sales/view/frontend/email/order_new_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..23060058e50850fb37437abfd03dbad0557c3110 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/order_new_guest.html @@ -0,0 +1,83 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: New Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var order.getEmailCustomerNote()":"Email Order Note", +"var order.getBillingAddress().getName()":"Guest Customer Name", +"var order.getCreatedAtFormatted(1)":"Order Created At (datetime)", +"var order.increment_id":"Order Id", +"layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid", +"var payment_html|raw":"Payment Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.getShippingDescription()":"Shipping Description" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getBillingAddress().getName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans "Once your package ships we will send an email with a link to track your order."}} + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <h1>{{trans 'Your Order <span class="no-link">#%increment_id</span>' increment_id=$order.increment_id |raw}}</h1> + <p>{{trans 'Placed on <span class="no-link">%created_at</span>' created_at=$order.getCreatedAtFormatted(1) |raw}}</p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend order.getEmailCustomerNote()}} + <table class="message-info"> + <tr> + <td> + {{var order.getEmailCustomerNote()|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout handle="sales_email_order_items" order=$order}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/order_update.html b/app/code/Magento/Sales/view/frontend/email/order_update.html new file mode 100644 index 0000000000000000000000000000000000000000..da59fb187f69c1f65327b3d77bab3ea3288a2139 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/order_update.html @@ -0,0 +1,53 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Order # {{var order.increment_id}} update @--> +<!--@vars { +"var store.getUrl('customer/account/')":"Customer Account URL", +"var order.getCustomerName()":"Customer Name", +"var comment":"Order Comment", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/order_update_guest.html b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..6a13d1957a7ac1266acf05b4acc17f804dff3404 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html @@ -0,0 +1,51 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Order # {{var order.increment_id}} update @--> +<!--@vars { +"var billing.getName()":"Guest Customer Name", +"var comment":"Order Comment", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$billing.getName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_new.html b/app/code/Magento/Sales/view/frontend/email/shipment_new.html new file mode 100644 index 0000000000000000000000000000000000000000..41e8f7507ab4e3d81e65cc3bfc8e5bfd13498db8 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/shipment_new.html @@ -0,0 +1,88 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} for Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var store.getUrl('customer/account/')":"Customer Account URL", +"var order.getCustomerName()":"Customer Name", +"var order.increment_id":"Order Id", +"var payment_html|raw":"Payment Details", +"var comment":"Shipment Comment", +"var shipment.increment_id":"Shipment Id", +"layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid", +"block class='Magento\\\\Framework\\\\View\\\\Element\\\\Template' area='frontend' template='Magento_Sales::email\/shipment\/track.phtml' shipment=$shipment order=$order":"Shipment Track Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.shipping_description":"Shipping Description", +"var order.getShippingDescription()":"Shipping Description" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}} + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <p>{{trans "Your shipping confirmation is below. Thank you again for your business."}}</p> + + <h1>{{trans "Your Shipment #%shipment_id for Order #%order_id" shipment_id=$shipment.increment_id order_id=$order.increment_id}}</h1> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + {{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_new_guest.html b/app/code/Magento/Sales/view/frontend/email/shipment_new_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..0f3b9890ce4d76bf2cca88b45c425f6b4bf41cf4 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/shipment_new_guest.html @@ -0,0 +1,86 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} for Order # {{var order.increment_id}} @--> +<!--@vars { +"var formattedBillingAddress|raw":"Billing Address", +"var billing.getName()":"Guest Customer Name", +"var order.increment_id":"Order Id", +"var payment_html|raw":"Payment Details", +"var comment":"Shipment Comment", +"var shipment.increment_id":"Shipment Id", +"layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid", +"block class='Magento\\\\Framework\\\\View\\\\Element\\\\Template' area='frontend' template='Magento_Sales::email\/shipment\/track.phtml' shipment=$shipment order=$order":"Shipment Track Details", +"var formattedShippingAddress|raw":"Shipping Address", +"var order.shipping_description":"Shipping Description", +"var order.getShippingDescription()":"Shipping Description" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$billing.getName()}}</p> + <p> + {{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}} + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-summary"> + <td> + <p>{{trans "Your shipping confirmation is below. Thank you again for your business."}}</p> + + <h1>{{trans "Your Shipment #%shipment_id for Order #%order_id" shipment_id=$shipment.increment_id order_id=$order.increment_id}}</h1> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + {{block class='Magento\\Framework\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} + <table class="order-details"> + <tr> + <td class="address-details"> + <h3>{{trans "Billing Info"}}</h3> + <p>{{var formattedBillingAddress|raw}}</p> + </td> + {{depend order.getIsNotVirtual()}} + <td class="address-details"> + <h3>{{trans "Shipping Info"}}</h3> + <p>{{var formattedShippingAddress|raw}}</p> + </td> + {{/depend}} + </tr> + <tr> + <td class="method-info"> + <h3>{{trans "Payment Method"}}</h3> + {{var payment_html|raw}} + </td> + {{depend order.getIsNotVirtual()}} + <td class="method-info"> + <h3>{{trans "Shipping Method"}}</h3> + <p>{{var order.getShippingDescription()}}</p> + </td> + {{/depend}} + </tr> + </table> + {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update.html b/app/code/Magento/Sales/view/frontend/email/shipment_update.html new file mode 100644 index 0000000000000000000000000000000000000000..0c4ffa610edc2c20f1d88c74bbf7b15969a8674f --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/shipment_update.html @@ -0,0 +1,54 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} update @--> +<!--@vars { +"var store.getUrl('customer/account/')":"Customer Account URL", +"var order.getCustomerName()":"Customer Name", +"var comment":"Order Comment", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status", +"var shipment.increment_id":"Shipment Id" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$order.getCustomerName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p>{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$store.getUrl('customer/account/') |raw}}</p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html new file mode 100644 index 0000000000000000000000000000000000000000..ac8d90b275ed7fb2c9b41e299380425fb59c5727 --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html @@ -0,0 +1,53 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} update @--> +<!--@vars { + +"var billing.getName()":"Guest Customer Name", +"var comment":"Order Comment", +"var order.increment_id":"Order Id", +"var order.getStatusLabel()":"Order Status", +"var shipment.increment_id":"Shipment Id" +} @--> +{{template config_path="design/email/header_template"}} + +<table> + <tr class="email-intro"> + <td> + <p class="greeting">{{trans "%name," name=$billing.getName()}}</p> + <p> + {{trans + "Your order #%increment_id has been updated with a status of <strong>%order_status</strong>." + + increment_id=$order.increment_id + order_status=$order.getStatusLabel() + |raw}} + </p> + <p> + {{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}. + {{depend store_hours}} + {{trans 'Our hours are <span class="no-link">%store_hours</span>.' store_hours=$store_hours |raw}} + {{/depend}} + </p> + </td> + </tr> + <tr class="email-information"> + <td> + {{depend comment}} + <table class="message-info"> + <tr> + <td> + {{var comment|escape|nl2br}} + </td> + </tr> + </table> + {{/depend}} + </td> + </tr> +</table> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_items.xml b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_items.xml index 3e8d8c5b8c8d2227c1021bde513ece5a95dd2a1b..497bf8984986403dcfbf457d2613434bb4833661 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_items.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_items.xml @@ -13,8 +13,7 @@ <block class="Magento\Framework\View\Element\RendererList" name="sales.email.order.creditmemo.renderers" as="renderer.list"/> <block class="Magento\Sales\Block\Order\Creditmemo\Totals" name="creditmemo_totals" template="order/totals.phtml" cacheable="false"> <arguments> - <argument name="label_properties" xsi:type="string">colspan="3" align="right" style="padding:3px 9px"</argument> - <argument name="value_properties" xsi:type="string">align="right" style="padding:3px 9px"</argument> + <argument name="label_properties" xsi:type="string">colspan="2"</argument> </arguments> <block class="Magento\Tax\Block\Sales\Order\Tax" name="tax" template="order/tax.phtml"/> </block> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_items.xml b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_items.xml index 7b033f1b5bd249695aaa3c6cc486b96308acdbed..68c4265a6f2c00407c4f229d9cbb1025c0ab09d0 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_items.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_items.xml @@ -13,8 +13,7 @@ <block class="Magento\Framework\View\Element\RendererList" name="sales.email.order.invoice.renderers" as="renderer.list"/> <block class="Magento\Sales\Block\Order\Invoice\Totals" name="invoice_totals" template="order/totals.phtml" cacheable="false"> <arguments> - <argument name="label_properties" xsi:type="string">colspan="3" align="right" style="padding:3px 9px"</argument> - <argument name="value_properties" xsi:type="string">align="right" style="padding:3px 9px"</argument> + <argument name="label_properties" xsi:type="string">colspan="2"</argument> </arguments> <block class="Magento\Tax\Block\Sales\Order\Tax" name="tax" template="order/tax.phtml"/> </block> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_items.xml b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_items.xml index e199fe989535fd5a97f1cc58eee7a0731a4f0bdc..95d97a20061fec23b289e5fe082ba4a99380886a 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_items.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_items.xml @@ -13,8 +13,7 @@ <block class="Magento\Framework\View\Element\RendererList" name="sales.email.order.renderers" as="renderer.list"/> <block class="Magento\Sales\Block\Order\Totals" name="order_totals" template="order/totals.phtml"> <arguments> - <argument name="label_properties" xsi:type="string">colspan="3" align="right" style="padding:3px 9px"</argument> - <argument name="value_properties" xsi:type="string">align="right" style="padding:3px 9px"</argument> + <argument name="label_properties" xsi:type="string">colspan="2"</argument> </arguments> <block class="Magento\Tax\Block\Sales\Order\Tax" name="tax" template="order/tax.phtml"> <action method="setIsPlaneMode"> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml index 8a7e12a8fddc8db8bad7b8a8ff34dce1a5e71a2a..1fbd7f5bf286e679c22261618a68bbfd5f9a7bc1 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml @@ -10,29 +10,32 @@ <?php $_creditmemo = $block->getCreditmemo() ?> <?php $_order = $block->getOrder() ?> <?php if ($_creditmemo && $_order): ?> -<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;"> - <thead> - <tr> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Item') ?></th> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Sku') ?></th> - <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Qty') ?></th> - <th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Subtotal') ?></th> - </tr> - </thead> - - <?php $i = 0; foreach ($_creditmemo->getAllItems() as $_item): ?> - <?php if ($_item->getOrderItem()->getParentItem()) { - continue; -} else { - $i++; -} ?> - <tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>> - <?php echo $block->getItemHtml($_item) ?> - </tbody> - <?php endforeach; ?> - - <tfoot> - <?php echo $block->getChildHtml('creditmemo_totals');?> - </tfoot> -</table> + <table class="email-items"> + <thead> + <tr> + <th class="item-info"> + <?= __('Items'); ?> + </th> + <th class="item-qty"> + <?= __('Qty'); ?> + </th> + <th class="item-subtotal"> + <?= __('Subtotal'); ?> + </th> + </tr> + </thead> + <?php foreach ($_creditmemo->getAllItems() as $_item): ?> + <?php + if ($_item->getOrderItem()->getParentItem()) { + continue; + } + ?> + <tbody> + <?= $block->getItemHtml($_item) ?> + </tbody> + <?php endforeach; ?> + <tfoot class="order-totals"> + <?= $block->getChildHtml('creditmemo_totals') ?> + </tfoot> + </table> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml index 448f61e1ab5d32eb7037ed9629fa0228b6976b70..9be510312600ca25a72b5964717b2b87baa82d45 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml @@ -10,29 +10,32 @@ <?php $_invoice = $block->getInvoice() ?> <?php $_order = $block->getOrder() ?> <?php if ($_invoice && $_order): ?> -<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;"> - <thead> - <tr> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Item') ?></th> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Sku') ?></th> - <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Qty') ?></th> - <th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Subtotal') ?></th> - </tr> - </thead> - - <?php $i = 0; foreach ($_invoice->getAllItems() as $_item): ?> - <?php if ($_item->getOrderItem()->getParentItem()) { - continue; -} else { - $i++; -} ?> - <tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>> - <?php echo $block->getItemHtml($_item) ?> - </tbody> - <?php endforeach; ?> - - <tfoot> - <?php echo $block->getChildHtml('invoice_totals')?> - </tfoot> -</table> + <table class="email-items"> + <thead> + <tr> + <th class="item-info"> + <?= __('Items'); ?> + </th> + <th class="item-qty"> + <?= __('Qty'); ?> + </th> + <th class="item-subtotal"> + <?= __('Subtotal'); ?> + </th> + </tr> + </thead> + <?php foreach ($_invoice->getAllItems() as $_item): ?> + <?php + if ($_item->getOrderItem()->getParentItem()) { + continue; + } + ?> + <tbody> + <?= $block->getItemHtml($_item) ?> + </tbody> + <?php endforeach; ?> + <tfoot class="order-totals"> + <?= $block->getChildHtml('invoice_totals') ?> + </tfoot> + </table> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items.phtml index b8a15bcbb3707819001b5ab6016a5ba635b3dbe7..d40b4fbccfd20bbb18cf99df197b96297eb69049 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items.phtml @@ -9,53 +9,50 @@ ?> <?php $_order = $block->getOrder() ?> <?php if ($_order): ?> -<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;"> - <thead> - <tr> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Item') ?></th> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Sku') ?></th> - <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Qty') ?></th> - <th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Subtotal') ?></th> - </tr> - </thead> - - <?php $i = 0; foreach ($_order->getAllItems() as $_item): ?> - <?php if ($_item->getParentItem()) { - continue; -} else { - $i++; -} ?> - <tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>> - <?php echo $block->getItemHtml($_item) ?> - </tbody> - <?php endforeach; ?> - - <tbody> - <?php echo $block->getChildHtml('order_totals') ?> - </tbody> -</table> -<?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?> - <?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_order->getGiftMessageId()); ?> - <?php if ($_giftMessage): ?> -<br /> -<table cellspacing="0" cellpadding="0" border="0" width="100%" style="border:1px solid #EAEAEA;"> - <thead> - <tr> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><strong><?php echo __('Gift Message for this Order') ?></strong></th> - </tr> - </thead> - - <tbody> - - <tr> - <td colspan="4" align="left" style="padding:3px 9px"> - <strong><?php echo __('From:'); ?></strong> <?php echo $block->escapeHtml($_giftMessage->getSender()) ?> - <br /><strong><?php echo __('To:'); ?></strong> <?php echo $block->escapeHtml($_giftMessage->getRecipient()) ?> - <br /><strong><?php echo __('Message:'); ?></strong><br /> <?php echo $block->escapeHtml($_giftMessage->getMessage()) ?> - </td> - </tr> - </tbody> -</table> + <?php $_items = $_order->getAllItems(); ?> + <table class="email-items"> + <thead> + <tr> + <th class="item-info"> + <?= __('Items'); ?> + </th> + <th class="item-qty"> + <?= __('Qty'); ?> + </th> + <th class="item-price"> + <?= __('Price'); ?> + </th> + </tr> + </thead> + <?php foreach ($_items as $_item): ?> + <?php + if ($_item->getParentItem()) { + continue; + } + ?> + <tbody> + <?= $block->getItemHtml($_item) ?> + </tbody> + <?php endforeach; ?> + <tfoot class="order-totals"> + <?= $block->getChildHtml('order_totals') ?> + </tfoot> + </table> + <?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?> + <?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_order->getGiftMessageId()); ?> + <?php if ($_giftMessage): ?> + <br /> + <table class="message-gift"> + <tr> + <td> + <h3><?= __('Gift Message for this Order') ?></h3> + <strong><?= __('From:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?> + <br /><strong><?= __('To:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?> + <br /><strong><?= __('Message:'); ?></strong> + <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?> + </td> + </tr> + </table> + <?php endif; ?> <?php endif; ?> <?php endif; ?> -<?php endif; ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml index 9e0da2fb4d1daf67c7ee53c56a957eb9f53700a3..7ddefe645b83fb0d3b770f7224619e45bcf525fe 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/creditmemo/default.phtml @@ -10,25 +10,27 @@ <?php $_item = $block->getItem() ?> <?php $_order = $block->getItem()->getOrder(); ?> <tr> - <td align="left" valign="top" style="padding:3px 9px; border-bottom:1px dotted #CCCCCC;"> - <strong style="font-size:11px;"><?php echo $block->escapeHtml($_item->getName()) ?></strong> + <td class="item-info<?php if ($block->getItemOptions()): ?> has-extra<?php endif; ?>"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo nl2br($option['value']) ?></dd> - <?php endforeach; ?> - </dl> + <dl> + <?php foreach ($block->getItemOptions() as $option): ?> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd> + <?= nl2br($option['value']) ?> + </dd> + <?php endforeach; ?> + </dl> <?php endif; ?> <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?> <?php if ($addInfoBlock) :?> - <?php echo $addInfoBlock->setItem($_item->getOrderItem())->toHtml(); ?> + <?= $addInfoBlock->setItem($_item->getOrderItem())->toHtml() ?> <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> + <?= $block->escapeHtml($_item->getDescription()) ?> </td> - <td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $block->escapeHtml($block->getSku($_item)) ?></td> - <td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $_item->getQty()*1 ?></td> - <td align="right" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"> - <?php echo $block->getItemPrice($_item); ?> + <td class="item-qty"><?= $_item->getQty() * 1 ?></td> + <td class="item-price"> + <?= $block->getItemPrice($_item); ?> </td> </tr> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml index 9e0da2fb4d1daf67c7ee53c56a957eb9f53700a3..7ddefe645b83fb0d3b770f7224619e45bcf525fe 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/invoice/default.phtml @@ -10,25 +10,27 @@ <?php $_item = $block->getItem() ?> <?php $_order = $block->getItem()->getOrder(); ?> <tr> - <td align="left" valign="top" style="padding:3px 9px; border-bottom:1px dotted #CCCCCC;"> - <strong style="font-size:11px;"><?php echo $block->escapeHtml($_item->getName()) ?></strong> + <td class="item-info<?php if ($block->getItemOptions()): ?> has-extra<?php endif; ?>"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo nl2br($option['value']) ?></dd> - <?php endforeach; ?> - </dl> + <dl> + <?php foreach ($block->getItemOptions() as $option): ?> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd> + <?= nl2br($option['value']) ?> + </dd> + <?php endforeach; ?> + </dl> <?php endif; ?> <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?> <?php if ($addInfoBlock) :?> - <?php echo $addInfoBlock->setItem($_item->getOrderItem())->toHtml(); ?> + <?= $addInfoBlock->setItem($_item->getOrderItem())->toHtml() ?> <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> + <?= $block->escapeHtml($_item->getDescription()) ?> </td> - <td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $block->escapeHtml($block->getSku($_item)) ?></td> - <td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $_item->getQty()*1 ?></td> - <td align="right" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"> - <?php echo $block->getItemPrice($_item); ?> + <td class="item-qty"><?= $_item->getQty() * 1 ?></td> + <td class="item-price"> + <?= $block->getItemPrice($_item); ?> </td> </tr> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml index 8c54ec5826c45d0a7ae901d50ad59296f4e669fc..dfea3dc103f62aa5e030d9ecf3de48af07952978 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/order/default.phtml @@ -13,37 +13,44 @@ $_item = $block->getItem(); $_order = $_item->getOrder(); ?> <tr> - <td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"> - <strong style="font-size:11px;"><?php echo $block->escapeHtml($_item->getName()) ?></strong> + <td class="item-info<?php if ($block->getItemOptions()): ?> has-extra<?php endif; ?>"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> + <dl class="item-options"> <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"> - <?php echo nl2br($option['value']) ?> - </dd> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd> + <?= nl2br($option['value']) ?> + </dd> <?php endforeach; ?> - </dl> + </dl> <?php endif; ?> <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?> <?php if ($addInfoBlock) :?> - <?php echo $addInfoBlock->setItem($_item)->toHtml(); ?> + <?= $addInfoBlock->setItem($_item)->toHtml() ?> <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> + <?= $block->escapeHtml($_item->getDescription()) ?> </td> - <td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $block->escapeHtml($block->getSku($_item)) ?></td> - <td align="center" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $_item->getQtyOrdered()*1 ?></td> - <td align="right" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"> - <?php echo $block->getItemPrice($_item); ?> + <td class="item-qty"><?= $_item->getQtyOrdered() * 1 ?></td> + <td class="item-price"> + <?= $block->getItemPrice($_item); ?> </td> </tr> <?php if ($_item->getGiftMessageId() && $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_item->getGiftMessageId())): ?> <tr> - <td colspan="4" style=" border-bottom:2px solid #CCCCCC; padding:3px 9px;"> - <strong style="color:#444444; font-size:11px;"><?php echo __('Gift Message') ?></strong> - <?php echo __('From:'); ?> <?php echo $block->escapeHtml($_giftMessage->getSender()) ?><br /> - <?php echo __('To:'); ?> <?php echo $block->escapeHtml($_giftMessage->getRecipient()) ?><br /> - <strong><?php echo __('Message:'); ?></strong><br /><?php echo $block->escapeHtml($_giftMessage->getMessage()) ?> + <td colspan="3" class="item-extra"> + <table class="message-gift"> + <tr> + <td> + <h3><?= __('Gift Message') ?></h3> + <strong><?= __('From:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?> + <br /><strong><?= __('To:'); ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?> + <br /><strong><?= __('Message:'); ?></strong> + <br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?> + </td> + </tr> + </table> </td> </tr> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml index 25da1016fcd97af3e26266a6a3790345c1806f5d..c070a67aecb5520064dc409540c0574194d3c0b3 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/price/row.phtml @@ -16,4 +16,4 @@ $_item = $block->getItem(); $_order = $_item->getOrder(); ?> -<?php echo $_order->formatPrice($_item->getRowTotal()) ?> +<?= $_order->formatPrice($_item->getRowTotal()) ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml b/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml index b0768ec1accf98a2583d71bfd94ac35a80f65a91..c2648c6921a23a4ec4f5752e2b690d0d0cb6dc69 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/items/shipment/default.phtml @@ -6,25 +6,27 @@ // @codingStandardsIgnoreFile -?> -<?php $_item = $block->getItem() ?> +/** @var $_item \Magento\Sales\Model\Order\Item */ +$_item = $block->getItem() ?> <tr> - <td align="left" valign="top" style="font-size:11px; padding:3px 9px;"> - <strong><?php echo $block->escapeHtml($_item->getName()) ?></strong> + <td class="item-info<?php if ($block->getItemOptions()): ?> has-extra<?php endif; ?>"> + <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p> + <p class="sku"><?= __('SKU'); ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p> <?php if ($block->getItemOptions()): ?> - <dl style="margin:0; padding:0;"> - <?php foreach ($block->getItemOptions() as $option): ?> - <dt><strong><em><?php echo $option['label'] ?></em></strong></dt> - <dd style="margin:0; padding:0 0 0 9px;"><?php echo nl2br($option['value']) ?></dd> - <?php endforeach; ?> - </dl> + <dl class="item-options"> + <?php foreach ($block->getItemOptions() as $option): ?> + <dt><strong><em><?= $option['label'] ?></em></strong></dt> + <dd> + <?= nl2br($option['value']) ?> + </dd> + <?php endforeach; ?> + </dl> <?php endif; ?> <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?> <?php if ($addInfoBlock) :?> - <?php echo $addInfoBlock->setItem($_item->getOrderItem())->toHtml(); ?> + <?= $addInfoBlock->setItem($_item->getOrderItem())->toHtml() ?> <?php endif; ?> - <?php echo $block->escapeHtml($_item->getDescription()) ?> + <?= $block->escapeHtml($_item->getDescription()) ?> </td> - <td align="left" valign="top" style="font-size:11px; padding:3px 9px;"><?php echo $block->escapeHtml($block->getSku($_item)) ?></td> - <td align="center" valign="top" style="font-size:11px; padding:3px 9px;"><?php echo $_item->getQty()*1 ?></td> + <td class="item-qty"><?= $_item->getQty() * 1 ?></td> </tr> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml b/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml index 2501fb1196ad1f61c4bdd68d625f9a8ade926760..df6f192b74a6a2752c2c66307a949410560c392c 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml @@ -10,25 +10,26 @@ <?php $_shipment = $block->getShipment() ?> <?php $_order = $block->getOrder() ?> <?php if ($_shipment && $_order): ?> -<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;"> - <thead> - <tr> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Item') ?></th> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Sku') ?></th> - <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Qty') ?></th> - </tr> - </thead> - - <?php $i = 0; foreach ($_shipment->getAllItems() as $_item): ?> - <?php if ($_item->getOrderItem()->getParentItem()) { - continue; -} else { - $i++; -} ?> - <tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>> - <?php echo $block->getItemHtml($_item) ?> - </tbody> - <?php endforeach; ?> - -</table> + <table class="email-items"> + <thead> + <tr> + <th class="item-info"> + <?= __('Items'); ?> + </th> + <th class="item-qty"> + <?= __('Qty'); ?> + </th> + </tr> + </thead> + <?php foreach ($_shipment->getAllItems() as $_item): ?> + <?php + if ($_item->getOrderItem()->getParentItem()) { + continue; + } + ?> + <tbody> + <?= $block->getItemHtml($_item) ?> + </tbody> + <?php endforeach; ?> + </table> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml b/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml index 6a43489da2789daed3d4e9bf18f703e037461a17..5f8548c5fd17e7df25d6482a29bd0c03ed5e1139 100644 --- a/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/email/shipment/track.phtml @@ -10,18 +10,19 @@ <?php $_shipment = $block->getShipment() ?> <?php $_order = $block->getOrder() ?> <?php if ($_shipment && $_order && $_shipment->getAllTracks()): ?> -<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;"> +<br /> +<table class="shipment-track"> <thead> <tr> - <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Shipped By') ?></th> - <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo __('Tracking Number') ?></th> + <th><?= __('Shipped By') ?></th> + <th><?= __('Tracking Number') ?></th> </tr> </thead> <tbody> - <?php $i = 0; foreach ($_shipment->getAllTracks() as $_item): $i++ ?> - <tr <?php echo $i%2 ? 'bgcolor="#F6F6F6"' : '' ?>> - <td align="left" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($_item->getTitle()) ?></td> - <td align="center" valign="top" style="padding:3px 9px"><?php echo $block->escapeHtml($_item->getNumber()) ?></td> + <?php foreach ($_shipment->getAllTracks() as $_item): ?> + <tr> + <td><?= $block->escapeHtml($_item->getTitle()) ?>:</td> + <td><?= $block->escapeHtml($_item->getNumber()) ?></td> </tr> <?php endforeach ?> </tbody> diff --git a/app/code/Magento/SalesSequence/i18n/en_US.csv b/app/code/Magento/SalesSequence/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Search/i18n/en_US.csv b/app/code/Magento/Search/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/SendFriend/etc/adminhtml/system.xml b/app/code/Magento/SendFriend/etc/adminhtml/system.xml index c6c8e092fa9b60c1fb1ac29f881b826a944a3583..a893f9650a33b3e4c4650ad4df917eb9f77600c5 100644 --- a/app/code/Magento/SendFriend/etc/adminhtml/system.xml +++ b/app/code/Magento/SendFriend/etc/adminhtml/system.xml @@ -17,8 +17,9 @@ <label>Enabled</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="template" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="template" translate="label comment" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Select Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="allow_guest" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/SendFriend/etc/email_templates.xml b/app/code/Magento/SendFriend/etc/email_templates.xml index 4070d1a2fe93c5453a2e8cce864b3688e6e45611..379e2d3020029c1d7ddb2a6c3b28696391e73ab7 100644 --- a/app/code/Magento/SendFriend/etc/email_templates.xml +++ b/app/code/Magento/SendFriend/etc/email_templates.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="sendfriend_email_template" label="Send Product Link to Friend" file="product_share.html" type="html" module="Magento_SendFriend"/> + <template id="sendfriend_email_template" label="Send Product Link to Friend" file="product_share.html" type="html" module="Magento_SendFriend" area="frontend"/> </config> diff --git a/app/code/Magento/SendFriend/view/email/product_share.html b/app/code/Magento/SendFriend/view/email/product_share.html deleted file mode 100644 index 638ad79bcc8f94aab34b2ac4de4130d6db890401..0000000000000000000000000000000000000000 --- a/app/code/Magento/SendFriend/view/email/product_share.html +++ /dev/null @@ -1,28 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -{* This is a comment block - -Available vars in this template: - - name Recipient name - - email Recipient Email address - - product_name Product name - - product_url Url for product - - product_image Url for product small image (75 px) - - message Sender custom message - - sender_name Sender name - - sender_email Sender email - -Use vars: {{var var_name}} -*}<!--@subject Welcome, {{var name}} @--> -<!--@vars -{"escapehtml var=$name":"Recipient Name", -"var product_url":"Url for Product", -"var product_name":"Product Name", -"var message":"Sender Message"} -@--> - -Welcome, {{escapehtml var=$name}}<br /><br />Please look at <a href="{{var product_url}}">{{var product_name}}</a><br /><br />Here is message: <br />{{var message}}<br /><br /> diff --git a/app/code/Magento/SendFriend/view/frontend/email/product_share.html b/app/code/Magento/SendFriend/view/frontend/email/product_share.html new file mode 100644 index 0000000000000000000000000000000000000000..a2a7f8096d68303f00d38113b1b2e4b2b2220942 --- /dev/null +++ b/app/code/Magento/SendFriend/view/frontend/email/product_share.html @@ -0,0 +1,37 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!--@subject Welcome, {{var name}} @--> +<!--@vars { +"var product_name":"Product name", +"var email":"Recipient Email address", +"var name":"Recipient name", +"var message|raw":"Sender custom message", +"var sender_email":"Sender email", +"var sender_name":"Sender name", +"var product_url":"URL for Product", +"var product_image":"URL for product small image (75 px)" +} @--> + +{{template config_path="design/email/header_template"}} + +<p class="greeting">{{trans "%name," name=$name}}</p> +<p>{{trans "%sender_name wants to share this product with you:" sender_name=$sender_name}} <a href="{{var product_url}}">{{var product_name}}</a></p> + +{{depend message}} +<table class="message-info"> + <tr> + <td> + <h3>{{trans "Message from %sender_name:" sender_name=$sender_name}}</h3> + {{var message|raw}} + </td> + </tr> +</table> +<br /> +{{/depend}} + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index f0f7066e7091ecca43e48db61813d9b5adf4c622..76ac8c6e9722bb86918f2f4e334ba39fa799c8e1 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -133,8 +133,8 @@ class Observer ) )->setTemplateOptions( [ - 'area' => \Magento\Framework\App\Area::AREA_ADMIN, - 'store' => $this->_storeManager->getStore()->getId(), + 'area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, ] )->setTemplateVars( ['warnings' => join("\n", $errors)] diff --git a/app/code/Magento/Sitemap/etc/adminhtml/system.xml b/app/code/Magento/Sitemap/etc/adminhtml/system.xml index 9807bf22b3a2eb586ba247c64be25e50c5c88029..e3484e071adff8e7d97ab8680b356d47d70e251f 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/system.xml +++ b/app/code/Magento/Sitemap/etc/adminhtml/system.xml @@ -65,8 +65,9 @@ <label>Error Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="error_email_template" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0"> + <field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Error Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="frequency" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Sitemap/etc/email_templates.xml b/app/code/Magento/Sitemap/etc/email_templates.xml index 2fc5e8e4296e05aae57c7ac0145ef86f33c7a89c..a3d0fd0c9fda6fb81c9f367a554b3b81f89cde6b 100644 --- a/app/code/Magento/Sitemap/etc/email_templates.xml +++ b/app/code/Magento/Sitemap/etc/email_templates.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="sitemap_generate_error_email_template" label="Sitemap Generation Warnings" file="generate_warnings.html" type="text" module="Magento_Sitemap"/> + <template id="sitemap_generate_error_email_template" label="Sitemap Generation Warnings" file="generate_warnings.html" type="text" module="Magento_Sitemap" area="adminhtml"/> </config> diff --git a/app/code/Magento/Sitemap/view/email/generate_warnings.html b/app/code/Magento/Sitemap/view/adminhtml/email/generate_warnings.html similarity index 56% rename from app/code/Magento/Sitemap/view/email/generate_warnings.html rename to app/code/Magento/Sitemap/view/adminhtml/email/generate_warnings.html index 8556878fd0d6a48a144c34d9462e363abfae51be..5488d742d3935729f5ebc45c20617b26c373d380 100644 --- a/app/code/Magento/Sitemap/view/email/generate_warnings.html +++ b/app/code/Magento/Sitemap/view/adminhtml/email/generate_warnings.html @@ -5,10 +5,10 @@ */ --> <!--@subject Sitemap generate Warnings @--> -<!--@vars -{"var warnings":"Sitemap Generate Warnings"} -@--> -Sitemap generate warnings: +<!--@vars { +"var warnings":"Sitemap Generation Warnings" +} @--> +{{trans "Sitemap Generation Warnings"}} -{{var warnings}} \ No newline at end of file +{{var warnings}} diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 2d3ea6fdc867e179a2011d1c8b7a7357c3a3fe14..e206f2b22d9d1fd28face302c0d5c3a069662c16 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -478,7 +478,7 @@ class Store extends AbstractModel implements * @param string $path * @return string|null */ - protected function _getConfig($path) + public function getConfig($path) { $data = $this->_config->getValue($path, ScopeInterface::SCOPE_STORE, $this->getCode()); if (!$data) { @@ -549,25 +549,25 @@ class Store extends AbstractModel implements $path = $secure ? self::XML_PATH_SECURE_BASE_URL : self::XML_PATH_UNSECURE_BASE_URL; - $url = $this->_getConfig($path); + $url = $this->getConfig($path); break; case \Magento\Framework\UrlInterface::URL_TYPE_LINK: $path = $secure ? self::XML_PATH_SECURE_BASE_LINK_URL : self::XML_PATH_UNSECURE_BASE_LINK_URL; - $url = $this->_getConfig($path); + $url = $this->getConfig($path); $url = $this->_updatePathUseRewrites($url); $url = $this->_updatePathUseStoreView($url); break; case \Magento\Framework\UrlInterface::URL_TYPE_DIRECT_LINK: $path = $secure ? self::XML_PATH_SECURE_BASE_LINK_URL : self::XML_PATH_UNSECURE_BASE_LINK_URL; - $url = $this->_getConfig($path); + $url = $this->getConfig($path); $url = $this->_updatePathUseRewrites($url); break; case \Magento\Framework\UrlInterface::URL_TYPE_STATIC: $path = $secure ? self::XML_PATH_SECURE_BASE_STATIC_URL : self::XML_PATH_UNSECURE_BASE_STATIC_URL; - $url = $this->_getConfig($path); + $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl( \Magento\Framework\UrlInterface::URL_TYPE_WEB, @@ -582,7 +582,7 @@ class Store extends AbstractModel implements $url = $this->_getMediaScriptUrl($this->filesystem, $secure); if (!$url) { $path = $secure ? self::XML_PATH_SECURE_BASE_MEDIA_URL : self::XML_PATH_UNSECURE_BASE_MEDIA_URL; - $url = $this->_getConfig($path); + $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl( \Magento\Framework\UrlInterface::URL_TYPE_WEB, @@ -637,7 +637,7 @@ class Store extends AbstractModel implements */ protected function _updatePathUseRewrites($url) { - if ($this->getForceDisableRewrites() || !$this->_getConfig(self::XML_PATH_USE_REWRITES)) { + if ($this->getForceDisableRewrites() || !$this->getConfig(self::XML_PATH_USE_REWRITES)) { if ($this->_isCustomEntryPoint()) { $indexFileName = 'index.php'; } else { @@ -670,7 +670,7 @@ class Store extends AbstractModel implements */ protected function _getMediaScriptUrl(\Magento\Framework\Filesystem $filesystem, $secure) { - if (!$this->_getConfig(self::XML_PATH_USE_REWRITES) && $this->_coreFileStorageDatabase->checkDbUsage()) { + if (!$this->getConfig(self::XML_PATH_USE_REWRITES) && $this->_coreFileStorageDatabase->checkDbUsage()) { return $this->getBaseUrl( \Magento\Framework\UrlInterface::URL_TYPE_WEB, $secure @@ -704,7 +704,7 @@ class Store extends AbstractModel implements { return !($this->hasDisableStoreInUrl() && $this->getDisableStoreInUrl()) && - $this->_getConfig(self::XML_PATH_STORE_IN_URL); + $this->getConfig(self::XML_PATH_STORE_IN_URL); } /** @@ -787,14 +787,14 @@ class Store extends AbstractModel implements */ public function getBaseCurrencyCode() { - $configValue = $this->_getConfig(self::XML_PATH_PRICE_SCOPE); + $configValue = $this->getConfig(self::XML_PATH_PRICE_SCOPE); if ($configValue == self::PRICE_SCOPE_GLOBAL) { return $this->_config->getValue( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, ScopeConfigInterface::SCOPE_TYPE_DEFAULT ); } else { - return $this->_getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); + return $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); } } @@ -820,7 +820,7 @@ class Store extends AbstractModel implements */ public function getDefaultCurrencyCode() { - $result = $this->_getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT); + $result = $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT); return $result; } @@ -899,7 +899,7 @@ class Store extends AbstractModel implements { $codes = $this->getData('available_currency_codes'); if (null === $codes) { - $codes = explode(',', $this->_getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW)); + $codes = explode(',', $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW)); // add base currency, if it is not in allowed currencies $baseCurrencyCode = $this->getBaseCurrencyCode(); if (!in_array($baseCurrencyCode, $codes)) { @@ -930,7 +930,7 @@ class Store extends AbstractModel implements */ public function getAllowedCurrencies() { - return explode(',', $this->_getConfig($this->_currencyInstalled)); + return explode(',', $this->getConfig($this->_currencyInstalled)); } /** diff --git a/app/code/Magento/Store/Test/Unit/Model/StoreTest.php b/app/code/Magento/Store/Test/Unit/Model/StoreTest.php index 8d305848c554f900bd521f04490c7b8f18fca6a4..f7cd329bef4c3ac4bec05f5f5bfcf3b6f3a644d5 100644 --- a/app/code/Magento/Store/Test/Unit/Model/StoreTest.php +++ b/app/code/Magento/Store/Test/Unit/Model/StoreTest.php @@ -189,7 +189,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase * @covers \Magento\Store\Model\Store::getBaseUrl * @covers \Magento\Store\Model\Store::getCode * @covers \Magento\Store\Model\Store::_updatePathUseRewrites - * @covers \Magento\Store\Model\Store::_getConfig + * @covers \Magento\Store\Model\Store::getConfig * * @param string $type * @param boolean $secure diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml index 1bc032018f7c8a1ff22c9c0863f1c5aaac1d62b0..ecda7a87e6b85889b034ead1340c2426ddc1931c 100644 --- a/app/code/Magento/Store/etc/di.xml +++ b/app/code/Magento/Store/etc/di.xml @@ -294,6 +294,7 @@ <item name="less" xsi:type="array"> <item name="css" xsi:type="array"> <item name="less_css" xsi:type="string">Magento\Framework\Css\PreProcessor\Less</item> + <item name="variable_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\VariableNotation</item> <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item> </item> <item name="less" xsi:type="array"> @@ -303,6 +304,7 @@ </item> <item name="css" xsi:type="array"> <item name="css" xsi:type="array"> + <item name="variable_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\VariableNotation</item> <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item> </item> </item> diff --git a/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml index 80b03e70584d65bb585811d17893a3811008a4f9..35dddc6cad5cc31fc195795e21adc56de80342ec 100644 --- a/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Tax/view/frontend/templates/email/items/price/row.phtml @@ -17,16 +17,16 @@ $_order = $_item->getOrder(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?php echo __('Excl. Tax'); ?>:</span> + <span class="label"><?= __('Excl. Tax') ?>:</span> <?php endif; ?> - <?php echo $_order->formatPrice($_item->getRowTotal()) ?> + <?= $_order->formatPrice($_item->getRowTotal()) ?> <?php endif; ?> <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?php echo __('Incl. Tax'); ?>:</span> + <br /><span class="label"><?= __('Incl. Tax') ?>:</span> <?php endif; ?> <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?> - <?php echo $_order->formatPrice($_incl) ?> + <?= $_order->formatPrice($_incl) ?> <?php endif; ?> diff --git a/app/code/Magento/TaxImportExport/i18n/en_US.csv b/app/code/Magento/TaxImportExport/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Theme/Model/Theme.php b/app/code/Magento/Theme/Model/Theme.php index a120ab45c9d94cda05efbc7dbae6edcc53748353..8cfee2298828e0bcf3730ab5c42e1cf2f8d70c98 100644 --- a/app/code/Magento/Theme/Model/Theme.php +++ b/app/code/Magento/Theme/Model/Theme.php @@ -256,6 +256,10 @@ class Theme extends \Magento\Framework\Model\AbstractModel implements ThemeInter */ public function getArea() { + // In order to support environment emulation of area, if area is set, return it + if ($this->getData('area') && !$this->_appState->isAreaCodeEmulated()) { + return $this->getData('area'); + } return $this->_appState->getAreaCode(); } diff --git a/app/code/Magento/Theme/Model/View/Design.php b/app/code/Magento/Theme/Model/View/Design.php index f0cf795f6b4482b9c8ac59bc444e62f4af24f14c..d012f0117313e49791d12b6ed56d512cea509af3 100644 --- a/app/code/Magento/Theme/Model/View/Design.php +++ b/app/code/Magento/Theme/Model/View/Design.php @@ -120,6 +120,10 @@ class Design implements \Magento\Framework\View\DesignInterface */ public function getArea() { + // In order to support environment emulation of area, if area is set, return it + if ($this->_area && !$this->_appState->isAreaCodeEmulated()) { + return $this->_area; + } return $this->_appState->getAreaCode(); } diff --git a/app/code/Magento/Ui/i18n/en_US.csv b/app/code/Magento/Ui/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index b152509226ddb7602511f4c53240ccddb7008e95..00878d88c5e05e042b20cb1ad92c959cc46b0c4c 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -5,9 +5,11 @@ */ namespace Magento\User\Model; +use Magento\Backend\App\Area\FrontNameResolver; use Magento\Backend\Model\Auth\Credential\StorageInterface; use Magento\Framework\Model\AbstractModel; use Magento\Framework\Exception\AuthenticationException; +use Magento\Store\Model\Store; use Magento\User\Api\Data\UserInterface; /** @@ -365,20 +367,13 @@ class User extends AbstractModel implements StorageInterface, UserInterface */ public function sendPasswordResetConfirmationEmail() { - // Set all required params and send emails - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->setTemplateIdentifier( - $this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_TEMPLATE) - )->setTemplateOptions( - ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 0] - )->setTemplateVars( - ['user' => $this, 'store' => $this->_storeManager->getStore(0)] - )->setFrom( - $this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY) - )->addTo( - $this->getEmail(), - $this->getName() - )->getTransport(); + $templateId = $this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_TEMPLATE); + $transport = $this->_transportBuilder->setTemplateIdentifier($templateId) + ->setTemplateOptions(['area' => FrontNameResolver::AREA_CODE, 'store' => Store::DEFAULT_STORE_ID]) + ->setTemplateVars(['user' => $this, 'store' => $this->_storeManager->getStore(Store::DEFAULT_STORE_ID)]) + ->setFrom($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY)) + ->addTo($this->getEmail(), $this->getName()) + ->getTransport(); $transport->sendMessage(); return $this; @@ -391,20 +386,13 @@ class User extends AbstractModel implements StorageInterface, UserInterface */ public function sendPasswordResetNotificationEmail() { - // Set all required params and send emails - /** @var \Magento\Framework\Mail\TransportInterface $transport */ - $transport = $this->_transportBuilder->setTemplateIdentifier( - $this->_config->getValue(self::XML_PATH_RESET_PASSWORD_TEMPLATE) - )->setTemplateOptions( - ['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 0] - )->setTemplateVars( - ['user' => $this, 'store' => $this->_storeManager->getStore(0)] - )->setFrom( - $this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY) - )->addTo( - $this->getEmail(), - $this->getName() - )->getTransport(); + $templateId = $this->_config->getValue(self::XML_PATH_RESET_PASSWORD_TEMPLATE); + $transport = $this->_transportBuilder->setTemplateIdentifier($templateId) + ->setTemplateOptions(['area' => FrontNameResolver::AREA_CODE, 'store' => Store::DEFAULT_STORE_ID]) + ->setTemplateVars(['user' => $this, 'store' => $this->_storeManager->getStore(Store::DEFAULT_STORE_ID)]) + ->setFrom($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY)) + ->addTo($this->getEmail(), $this->getName()) + ->getTransport(); $transport->sendMessage(); return $this; diff --git a/app/code/Magento/User/etc/adminhtml/system.xml b/app/code/Magento/User/etc/adminhtml/system.xml index a800b600071e9c52a9a479f31caa97d686c8d13a..c49f8f81f1ddf01857fe0d4d22bdd8bfb01d7966 100644 --- a/app/code/Magento/User/etc/adminhtml/system.xml +++ b/app/code/Magento/User/etc/adminhtml/system.xml @@ -9,8 +9,9 @@ <system> <section id="admin"> <group id="emails"> - <field id="reset_password_template" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> + <field id="reset_password_template" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Reset Password Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> </group> diff --git a/app/code/Magento/User/etc/email_templates.xml b/app/code/Magento/User/etc/email_templates.xml index 3040d44fdc9823c0004f5dabe7eeb6ced37a6e5e..b6b5e239c63e91ea65a339637d71bff398500ff8 100644 --- a/app/code/Magento/User/etc/email_templates.xml +++ b/app/code/Magento/User/etc/email_templates.xml @@ -6,6 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="admin_emails_forgot_email_template" label="Forgot Admin Password" file="password_reset_confirmation.html" type="html" module="Magento_User"/> - <template id="admin_emails_reset_password_template" label="Reset Password" file="password_reset.html" type="html" module="Magento_User"/> + <template id="admin_emails_forgot_email_template" label="Forgot Admin Password" file="password_reset_confirmation.html" type="text" module="Magento_User" area="adminhtml"/> + <template id="admin_emails_reset_password_template" label="Reset Password" file="password_reset.html" type="text" module="Magento_User" area="adminhtml"/> </config> diff --git a/app/code/Magento/User/view/adminhtml/email/password_reset.html b/app/code/Magento/User/view/adminhtml/email/password_reset.html new file mode 100644 index 0000000000000000000000000000000000000000..97e040a8fb3d263485c4b8e7b102043e15d59bf2 --- /dev/null +++ b/app/code/Magento/User/view/adminhtml/email/password_reset.html @@ -0,0 +1,20 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject New password for {{var user.name}} @--> +<!--@vars { +"var user.name":"Customer Name", +"var store.getFrontendName()|escape":"Store Name" +} @--> + +{{trans "%name," name=$user.name}} + +{{trans "The password for your account has been successfully changed."}} + +{{trans "If you did not request this change, please contact us."}} + +{{trans "Thank you,"}} +{{var store.getFrontendName()}} diff --git a/app/code/Magento/User/view/adminhtml/email/password_reset_confirmation.html b/app/code/Magento/User/view/adminhtml/email/password_reset_confirmation.html new file mode 100644 index 0000000000000000000000000000000000000000..f4baffcbd7e10c77c1e3642ebd5e0a9849b97d33 --- /dev/null +++ b/app/code/Magento/User/view/adminhtml/email/password_reset_confirmation.html @@ -0,0 +1,24 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Password Reset Confirmation for {{var user.name}} @--> +<!--@vars { +"var user.name":"Account Holder Name", +"store url=\"admin\/auth\/resetpassword\/\" _query_id=$user.id _query_token=$user.rp_token":"Reset Password URL" +} @--> + +{{trans "%name," name=$user.name}} + +{{trans "There was recently a request to change the password for your account."}} + +{{trans "If you requested this change, reset your password here:"}} + +{{store url="admin/auth/resetpassword/" _query_id=$user.id _query_token=$user.rp_token}} + +{{trans "If you did not make this request, you can ignore this email and your password will remain the same."}} + +{{trans "Thank you,"}} +{{var store.getFrontendName()}} diff --git a/app/code/Magento/User/view/email/password_reset.html b/app/code/Magento/User/view/email/password_reset.html deleted file mode 100644 index 956821b89e28a545a2c5119158c92b4e0e489ab1..0000000000000000000000000000000000000000 --- a/app/code/Magento/User/view/email/password_reset.html +++ /dev/null @@ -1,46 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject New password for {{var user.name}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"escapehtml var=$customer.name":"Customer Name", -"var store.getFrontendName()|escape":"Store Name"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> - <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a> - </td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{escapehtml var=$user.name}},</h1> - <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;">There was recently a request to change the password for your account.</p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()|escape}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> - </table> -</div> -</body> diff --git a/app/code/Magento/User/view/email/password_reset_confirmation.html b/app/code/Magento/User/view/email/password_reset_confirmation.html deleted file mode 100644 index 1dad30c7180f55dcc3fdcbe3cc3197e7f579a5fa..0000000000000000000000000000000000000000 --- a/app/code/Magento/User/view/email/password_reset_confirmation.html +++ /dev/null @@ -1,50 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Password Reset Confirmation for {{var user.name}} @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"htmlescape var=$user.name":"Admin Name", -"store url=\"adminhtml/index/resetpassword/\" _query_id=$user.id _query_token=$user.rp_token":"Reset Password URL", -"store url=\"adminhtml/system_account/\"":"Admin Account Url"} -@--> - -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background: #F6F6F6; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin: 0; padding: 0;"> - <div style="background: #F6F6F6; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin: 0; padding: 0;"> - <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding: 20px 0 20px 0"> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a> - </td> - </tr> - <tr> - <td valign="top"> - <h1 style="font-size: 22px; font-weight: normal; line-height: 22px; margin: 0 0 11px 0;">Dear {{escapehtml var=$user.name}},</h1> - <p style="font-size: 12px; line-height: 16px; margin: 0 0 8px 0;">There was recently a request to change the password for your account.</p> - <p style="font-size: 12px; line-height: 16px; margin: 0;">If you requested this password change, please click on the following link to reset your password: <a href="{{store url="admin/auth/resetpassword/" _query_id=$user.id _query_token=$user.rp_token}}" style="color:#1E7EC8;">{{store url="admin/auth/resetpassword/" _query_id=$user.id _query_token=$user.rp_token}}</a></p> - <p style="font-size: 12px; line-height: 16px; margin: 0;">If clicking the link does not work, please copy and paste the URL into your browser instead.</p> - <br /> - <p style="font-size:12px; line-height:16px; margin:0;">If you did not make this request, you can ignore this message and your password will remain the same.</p> - </td> - </tr> - <tr> - <td style="background-color: #EAEAEA; text-align: center;"><p style="font-size:12px; margin:0; text-align: center;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></td> - </tr> - </table> - </td> - </tr> - </table> - </div> -</body> diff --git a/app/code/Magento/Version/i18n/en_US.csv b/app/code/Magento/Version/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml b/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml index f4435da518855528a2bbfb13577e8802eb1d17e7..6fe819b9d6dadb2d203c53c06db47f1f16a21ee1 100644 --- a/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml +++ b/app/code/Magento/Weee/view/frontend/templates/email/items/price/row.phtml @@ -20,23 +20,23 @@ $_order = $_item->getOrder(); <?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <span class="label"><?php echo __('Excl. Tax'); ?>:</span> + <span class="label"><?= __('Excl. Tax') ?>:</span> <?php endif; ?> - <?php echo $_order->formatPrice($block->getRowDisplayPriceExclTax()); ?> + <?= $_order->formatPrice($block->getRowDisplayPriceExclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount'], true, true); ?></span><br /> + <span class="nobr"><?= $tax['title'] ?>: <?= $_order->formatPrice($tax['row_amount'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> <br /> - <span class="nobr"><?php echo __('Total'); ?>:<br /> <?php echo $_order->formatPrice($block->getFinalRowDisplayPriceExclTax()); ?></span> + <span class="nobr"><?= __('Total') ?>:<br /> <?= $_order->formatPrice($block->getFinalRowDisplayPriceExclTax()) ?></span> <?php endif; ?> <?php endif; ?> <?php endif; ?> @@ -44,21 +44,21 @@ $_order = $_item->getOrder(); <?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?> <?php if ($block->displayBothPrices()): ?> - <br /><span class="label"><?php echo __('Incl. Tax'); ?>:</span> + <br /><span class="label"><?= __('Incl. Tax') ?>:</span> <?php endif; ?> - <?php echo $_order->formatPrice($block->getRowDisplayPriceInclTax()); ?> + <?= $_order->formatPrice($block->getRowDisplayPriceInclTax()) ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item)): ?> <br /> <?php if ($block->displayPriceWithWeeeDetails()): ?> <small> <?php foreach ($this->helper('Magento\Weee\Helper\Data')->getApplied($_item) as $tax): ?> - <span class="nobr"><?php echo $tax['title']; ?>: <?php echo $_order->formatPrice($tax['row_amount_incl_tax'], true, true); ?></span><br /> + <span class="nobr"><?= $tax['title'] ?>: <?= $_order->formatPrice($tax['row_amount_incl_tax'], true, true) ?></span><br /> <?php endforeach; ?> </small> <?php endif; ?> <?php if ($block->displayFinalPrice()): ?> - <span class="nobr"><?php echo __('Total Incl. Tax'); ?>:<br /> <?php echo $_order->formatPrice($block->getFinalRowDisplayPriceInclTax()); ?></span> + <span class="nobr"><?= __('Total Incl. Tax') ?>:<br /> <?= $_order->formatPrice($block->getFinalRowDisplayPriceInclTax()) ?></span> <?php endif; ?> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Widget/Model/Template/Filter.php b/app/code/Magento/Widget/Model/Template/Filter.php index 6608b9e40fdf63e6a68f7544f80a87aae7699081..e71e697f49742466dba8af2799006360a6694683 100755 --- a/app/code/Magento/Widget/Model/Template/Filter.php +++ b/app/code/Magento/Widget/Model/Template/Filter.php @@ -80,7 +80,7 @@ class Filter extends \Magento\Cms\Model\Template\Filter */ public function widgetDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); // Determine what name block should have in layout $name = null; @@ -122,7 +122,7 @@ class Filter extends \Magento\Cms\Model\Template\Filter */ public function mediaDirective($construction) { - $params = $this->_getParameters($construction[2]); + $params = $this->getParameters($construction[2]); return $this->_storeManager->getStore() ->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url']; } diff --git a/app/code/Magento/Wishlist/etc/adminhtml/system.xml b/app/code/Magento/Wishlist/etc/adminhtml/system.xml index 18f9dedd71a9326b507d8e5d6cde1f8fec946a23..fa7009173707087c3138a60289ff2d9b0a924edc 100644 --- a/app/code/Magento/Wishlist/etc/adminhtml/system.xml +++ b/app/code/Magento/Wishlist/etc/adminhtml/system.xml @@ -17,8 +17,9 @@ <label>Email Sender</label> <source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model> </field> - <field id="email_template" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> + <field id="email_template" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Email Template</label> + <comment>Email template chosen based on theme fallback when "Default" option is selected.</comment> <source_model>Magento\Config\Model\Config\Source\Email\Template</source_model> </field> <field id="number_limit" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Wishlist/etc/email_templates.xml b/app/code/Magento/Wishlist/etc/email_templates.xml index 6a6df6fdc6b02a2b29cf474ee1df9f6024f934be..7d867f9454ab8bf430357e8fc271300f13c182cd 100644 --- a/app/code/Magento/Wishlist/etc/email_templates.xml +++ b/app/code/Magento/Wishlist/etc/email_templates.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="wishlist_email_email_template" label="Wish List Sharing" file="share_notification.html" type="html" module="Magento_Wishlist"/> + <template id="wishlist_email_email_template" label="Wish List Sharing" file="share_notification.html" type="html" module="Magento_Wishlist" area="frontend"/> </config> diff --git a/app/code/Magento/Wishlist/view/email/share_notification.html b/app/code/Magento/Wishlist/view/email/share_notification.html deleted file mode 100644 index 47bbf250011d4ea11ffbfcf492685817af9b02c5..0000000000000000000000000000000000000000 --- a/app/code/Magento/Wishlist/view/email/share_notification.html +++ /dev/null @@ -1,49 +0,0 @@ -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<!--@subject Take a look at {{var customerName}}'s Wish List @--> -<!--@vars -{"store url=\"\"":"Store Url", -"var logo_url":"Email Logo Image Url", -"var logo_alt":"Email Logo Image Alt", -"var message":"Wish List Message", -"var items":"Wish List Items"} -@--> -<!--@styles -body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; } -@--> - -<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"> -<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%"> - <tr> - <td align="center" valign="top" style="padding:20px 0 20px 0"> - <!-- [ header starts here] --> - <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;"> - <tr> - <td valign="top"> - <a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a> - </td> - </tr> - <!-- [ middle starts here] --> - <tr> - <td valign="top"> - <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Hey,<br/>Take a look at my Wish List from {{var store.getFrontendName()}}.</p> - <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">{{var message}}</p> - {{var items}} - <br/> - <p style="font-size:12px; line-height:16px; margin:0 0 8px 0;text-align: center;"><strong><a href="{{var viewOnSiteLink}}" style="color:#1E7EC8;">View all Wish List items</a></strong></p> - </td> - </tr> - <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{escapehtml var=$customerName}}</strong></p></center></td> - </tr> - </table> - </td> - </tr> -</table> -</div> -</body> diff --git a/app/code/Magento/Wishlist/view/frontend/email/share_notification.html b/app/code/Magento/Wishlist/view/frontend/email/share_notification.html new file mode 100644 index 0000000000000000000000000000000000000000..7f73537fcd9b1f587f820be8408bdeb3a666d73f --- /dev/null +++ b/app/code/Magento/Wishlist/view/frontend/email/share_notification.html @@ -0,0 +1,36 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!--@subject Take a look at {{var customerName}}'s Wish List @--> +<!--@vars { +"var customerName":"Customer Name", +"var viewOnSiteLink":"View Wish List URL", +"var items|raw":"Wish List Items", +"var message|raw":"Wish List Message" +} @--> + +{{template config_path="design/email/header_template"}} + +<p>{{trans "%customer_name wants to share this Wish List from %store_name with you:" customer_name=$customerName store_name=$store.getFrontendName()}}</p> + +{{depend message}} +<table class="message-info"> + <tr> + <td> + <h3>{{trans "Message from %customer_name:" customer_name=$customerName}}</h3> + {{var message|raw}} + </td> + </tr> +</table> +<br /> +{{/depend}} + +{{var items|raw}} +<br/> + +<p><a href="{{var viewOnSiteLink}}">{{trans "View all Wish List items"}}</a></p> + +{{template config_path="design/email/footer_template"}} diff --git a/app/code/Magento/Wishlist/view/frontend/templates/email/items.phtml b/app/code/Magento/Wishlist/view/frontend/templates/email/items.phtml index 88b00c1a071f5ed34bd2a3f384cc210d7cd30bda..a121d33b7615f2c8af12883aabdf8595f906cb8e 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/email/items.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/email/items.phtml @@ -9,38 +9,40 @@ /* @var $block \Magento\Wishlist\Block\Share\Email\Items */ ?> <?php $l = $block->getWishlistItemsCount() ?> -<div style="border:1px solid #E0E0E0; padding:15px; background:#F9F9F9;"> - <table cellspacing="0" cellpadding="0" border="0" width="650"> +<div> + <table> <tr> <?php $i = 0; foreach ($block->getWishlistItems() as $item): $i++ ?> <?php /* @var $item \Magento\Wishlist\Model\Item */ ?> <?php /* @var $_product \Magento\Catalog\Model\Product */ ?> <?php $_product = $item->getProduct(); ?> - <td width="32%" class="col product"> - <p align="center" style="font-size:12px;"> - <a href="<?php echo $block->getProductUrl($_product) ?>"> - <img src="<?php echo $block->getSmallImageUrl($_product); ?>" width="<?php echo $block->getSmallImageSize() ?>" height="<?php echo $block->getSmallImageSize() ?>" style="border:1px solid #ccc;" alt=""/> + <td class="col product"> + <p> + <a href="<?= $block->getProductUrl($_product) ?>"> + <img src="<?= $block->getSmallImageUrl($_product) ?>" height="<?= $block->getSmallImageSize() ?>" alt=""/> </a> </p> - <p align="center" style="font-size:12px;"> - <a href="<?php echo $block->getProductUrl($_product) ?>" style="color:#203548;"> - <strong><?php echo $block->escapeHtml($_product->getName()) ?></strong> + <p> + <a href="<?= $block->getProductUrl($_product) ?>"> + <strong><?= $block->escapeHtml($_product->getName()) ?></strong> </a> </p> <?php if ($block->hasDescription($item)): ?> - <p align="center" style="font-size:12px;"><?php echo __('Comment') ?>: - <br/><?php echo $block->getEscapedDescription($item) ?></p> + <p> + <strong><?= __('Comment') ?>:</strong> + <br/><?= $block->getEscapedDescription($item) ?> + </p> <?php endif; ?> - <p align="center" style="font-size:12px;"> - <a href="<?php echo $block->getProductUrl($_product) ?>" style="color:#1E7EC8;"> - <?php echo __('View Product') ?> + <p> + <a href="<?= $block->getProductUrl($_product) ?>"> + <?= __('View Product') ?> </a> </p> </td> <?php if ($i % 3 != 0): ?> - <td width="2%"></td> + <td></td> <?php else: ?> </tr> <tr> diff --git a/app/design/adminhtml/Magento/backend/web/css/source/variables/_actions.less b/app/design/adminhtml/Magento/backend/web/css/source/variables/_actions.less index a17d2d1461ed8087f508940beeab5fbec10b09cc..d7388a38b8cc16e490d394b6fa8a3e5e7d3905ae 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/variables/_actions.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/variables/_actions.less @@ -13,7 +13,7 @@ @action__padding-top: round(((@field-control__height - (@field-control__font-size * @field-control__line-height) - - ((unit(@field-control__border-width) / @font-rem-ratio) * 2)) / 2), 1); + ((unit(@field-control__border-width) / @font-size-unit-ratio) * 2)) / 2), 1); @action__padding-bottom: @field-control__padding-top; @action__height: 3.3rem; diff --git a/app/design/frontend/Magento/blank/Magento_Bundle/web/css/source/_email.less b/app/design/frontend/Magento/blank/Magento_Bundle/web/css/source/_email.less new file mode 100644 index 0000000000000000000000000000000000000000..de3aee17644d90f13a368bbc875ad36c83075635 --- /dev/null +++ b/app/design/frontend/Magento/blank/Magento_Bundle/web/css/source/_email.less @@ -0,0 +1,36 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Bundle Module Styles +// --------------------------------------------- + +// +// Bundle Items +// --------------------------------------------- + +.email-items { + .bundle-option-label { + > td { + padding: 0 @email-content__padding__base 0 @email-content__padding__l; + } + } + + .bundle-option-value { + > td { + padding: 0 @email-content__padding__base @email-content__padding__base; + + &.item-info { + padding: 0 @email-content__padding__base @email-content__padding__base @email-content__padding__xl; + } + } + } + + tr.bundle-option-value + tr { + > td.item-extra { + padding-top: @email-content__padding__base; + } + } +} diff --git a/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_email.less b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_email.less new file mode 100644 index 0000000000000000000000000000000000000000..0323c2844f738bfdbe370ee764407d95ecd3e562 --- /dev/null +++ b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_email.less @@ -0,0 +1,230 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Sales Module Styles +// _____________________________________________ + +.email-summary { + h1 { + margin-bottom: @indent__xs; + } +} + +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) { + // Shrink order number in order email so it will fit on single line on small screens + .email-summary { + h1 { + font-size: ceil(1.7 * @font-size__base) !important; // 24px + } + } +} + +// +// Order Summary +// ---------------------------------------------- + +.order-details { + width: 100%; + + tr { + > td { + padding: @email-content__padding__base @email-content__padding__base @email-content__padding__base 0; + width: 50%; + + h3 { + margin-top: 0; + } + } + + // Prevent extra spacing on Payment & Shipping Method row + & + tr { + > td { + padding: 0 0 @email-content__padding__base; + } + } + } + + .payment-method { + margin-bottom: @indent__s; + + .title { + font-weight: @font-weight__regular; + } + } +} + +// Remove address and phone number link color on iOS +.address-details a:extend(.no-link a) {}; + +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) { + // Stack columns + .order-details { + td { + display: block; + padding: @email-content__padding__base 0 !important; + width: auto !important; + + h3 { + margin-top: 0 !important; + margin-bottom: @indent__xs !important; + } + } + } +} + +// +// Shipment Tracking +// ---------------------------------------------- + +.shipment-track { + .table(@table__width, 0); + + thead, + tbody { + > tr { + > th, + > td { + background-color: @color-gray95; + padding: @email-content__padding__base; + width: 50%; + } + + & + tr { + th, + td { + padding-top: 0; + } + } + } + } +} + +// +// Items Table +// ---------------------------------------------- + +.email-items { + .table(@table__width, 0); + border: @table__border-width @table__border-style @table__border-color; + + thead, + tfoot { + > tr { + > th, + > td { + background-color: @color-gray95 + } + } + } + + > thead, + > tbody { + > tr { + > th { + padding: @email-content__padding__base; + } + + > td { + padding: @email-content__padding__base; + + &.message-gift { + border-top: none; + padding-top: 0; + } + } + } + } + + > tbody, + > tfoot { + > tr { + > th, + > td { + border-top: @table__border-width @table__border-style @table__border-color; + } + + & + tr { + > th, + > td { + border-top: 0; + } + } + } + } + + p { + margin-bottom: 0; + } + + .product-name { + font-weight: @font-weight__bold; + margin-bottom: @email-content__padding__s; + } + + .has-extra .sku { + margin-bottom: @email-content__padding__base; + } + + .item-info { + dl { + margin-bottom: 0; + padding-left: @email-content__padding__m; + + dt, + dd { + margin-bottom: 0; + padding-bottom: 0; + } + + dd { + padding-left: @email-content__padding__base; + } + } + } + + .item-qty { + text-align: center; + } + + .item-price { + text-align: right; + } + + .item-extra { + padding-top: 0; + } + + .order-totals { + > tr { + > th { + font-weight: @font-weight__regular; + } + + > th, + > td { + padding: @email-content__padding__base; + text-align: right; + } + + & + tr { + th, + td { + padding-top: 0; + } + } + } + + .price { + white-space: nowrap; + } + } +} + +.email-non-inline() { + .email-items { + .table-overflow(); + } +} diff --git a/app/design/frontend/Magento/blank/web/css/email-fonts.less b/app/design/frontend/Magento/blank/web/css/email-fonts.less new file mode 100644 index 0000000000000000000000000000000000000000..bd9e8a1f8529d46db70828fc07efe179f09819e1 --- /dev/null +++ b/app/design/frontend/Magento/blank/web/css/email-fonts.less @@ -0,0 +1,21 @@ +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// +// Fonts for Emails +// _____________________________________________ + +@import 'source/lib/_lib.less'; // Global lib +@import 'source/lib/variables/_email.less'; // Global email variables +@import 'source/_theme.less'; // Global variables override +@import 'source/_variables.less'; // Local theme variables +@import 'source/_email-variables.less'; // Theme variables for emails + +// +// Output @font-face declarations +// --------------------------------------------- + +@media-common: false; // Don't output extra styles from _typography.less +@import 'source/_typography.less'; \ No newline at end of file diff --git a/app/design/frontend/Magento/blank/web/css/email-inline.less b/app/design/frontend/Magento/blank/web/css/email-inline.less index cefdf648c486e8ce4d4a4b3551ac054b40bb8014..c1fd5afa432415a4802d47ed3b537f32da72df0c 100644 --- a/app/design/frontend/Magento/blank/web/css/email-inline.less +++ b/app/design/frontend/Magento/blank/web/css/email-inline.less @@ -3,7 +3,27 @@ * See COPYING.txt for license details. */ -// Temporary placeholder style -td { - color: red; -} +// +// Styles for emails +// _____________________________________________ + +// See comments in source/_email-base.less for explanation of email styles + +@import 'source/lib/_lib.less'; // Global lib +@import 'source/lib/variables/_email.less'; // Global email variables +@import 'source/_theme.less'; // Global variables override +@import 'source/_variables.less'; // Local theme variables +@import 'source/_email-variables.less'; // Theme variables for emails + +// +// Styles for emails +// --------------------------------------------- + +@import 'source/_email-base.less'; // Contains primary email styles +@import 'source/_email-extend.less'; // Contains theme-specific adjustments to email styles + +// +// Module-specific styles for emails +// --------------------------------------------- + +//@magento_import 'source/_email.less'; diff --git a/app/design/frontend/Magento/blank/web/css/email.less b/app/design/frontend/Magento/blank/web/css/email.less index 55459dd25b9e1779f67778eaede4220185a644f8..65e0d61150402f1fab9ab6a45f7db258ce2a272d 100644 --- a/app/design/frontend/Magento/blank/web/css/email.less +++ b/app/design/frontend/Magento/blank/web/css/email.less @@ -3,7 +3,42 @@ * See COPYING.txt for license details. */ -// Temporary placeholder style -td { - font-size: 24px !important; -} +// +// Styles for emails +// _____________________________________________ + +// See comments in source/_email-base.less for explanation of email styles + +@import 'source/lib/_lib.less'; // Global lib +@import 'source/lib/variables/_email.less'; // Global email variables +@import 'source/_theme.less'; // Global variables override +@import 'source/_variables.less'; // Local theme variables +@import 'source/_email-variables.less'; // Theme variables for emails + +// Import these file by reference so that only the styles included in the .email-non-inline() and .media-width() +// mixins will be output. All other styles will be output via the email-inline.less file. + +@import (reference) 'source/_email-base.less'; // Contains primary email styles +@import (reference) 'source/_email-extend.less'; // Contains theme-specific adjustments to email styles + +// +// Module-specific styles for emails +// --------------------------------------------- + +// Import files using (reference) for the same reason stated above +//@magento_import (reference) 'source/_email.less'; + +// +// Media queries collector +// --------------------------------------------- + +@import 'source/lib/_responsive.less'; +// It is impossible to apply media queries as inline styles, so all media queries must be output in this file +@media-target: 'all'; + +// +// Non-inline styles +// --------------------------------------------- + +// Include all styles that have been indicated as non-inline styles +.email-non-inline(); diff --git a/app/design/frontend/Magento/blank/web/css/source/_email-base.less b/app/design/frontend/Magento/blank/web/css/source/_email-base.less new file mode 100644 index 0000000000000000000000000000000000000000..34ae9c09a204f02bbdec4b69eb8f08879d29175c --- /dev/null +++ b/app/design/frontend/Magento/blank/web/css/source/_email-base.less @@ -0,0 +1,286 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// The contents of this file will get split into two output files: email.less and email-inline.less. +// +// email.less +// Styles contained in the .email-non-inline() and .media-width() mixins will be output in the email.less file +// and will be included in a <style> tag in emails. Non-inline styles should be used for styles that can't be applied +// as inline CSS, such as media queries. +// +// email-inline.less +// Styles not included in the mixins mentioned above will be included in the email-inline.less file. +// Since email client support for CSS in <style> tags is limited, the majority of styles should be added as "inline" +// styles. CSS will be applied to transactional email HTML via the Emogrifier library, which only has support for +// certain CSS selectors (source: https://github.com/jjriv/emogrifier#supported-css-selectors): +// +// Supported selectors (examples in parenthesis): +// * ID (#logo) +// * class (.logo) +// * type (h1) +// * descendant (.logo > a) +// * child (.logo a) +// * adjacent (.logo + .second-example) +// * attribute presence (a[title]) +// * attribute value (a[title="example"]) +// * attribute only ([title="example"]) +// +// Unsupported selectors (examples in parenthesis): +// * first-child (div:first-child) +// * last-child (div:last-child) +// * nth-child (div:nth-child(3n+1)) +// * universal (*) +// * pseudo (a:hover, a:active, a:focus, span:before, span:after, etc) + +// +// Resets +// --------------------------------------------- + +// Generic resets + +body { + margin: 0; + padding: 0; +} + +img { + border: 0; + height: auto; + line-height: 100%; + outline: none; + text-decoration: none; +} + +table { + border-collapse: collapse; + + td { + vertical-align: top; + } +} + +// Client-specific resets (from the Salted email template: https://github.com/rodriguezcommaj/salted) + +.email-non-inline() { + // Prevent WebKit and Windows mobile from changing default text sizes + body, + table, + td, + a { + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + } + + // Allow smoother rendering of resized images in Internet Explorer (such as high-resolution logo) + img { + -ms-interpolation-mode: bicubic; + } + + // Remove spacing between tables in Outlook 2007 and up + table, + td { + mso-table-lspace: 0pt; + mso-table-rspace: 0pt; + } +} + +// +// Typography +// --------------------------------------------- + +// See email-fonts.less for @font-face declarations + +@font-size-unit-convert: false; // Prevents font-related measurements from being converted to the incompatible rem unit +.typography-all(); + +body { + font-family: @font-family__base; + font-weight: normal; + text-align: left; +} + +th, +td { + font-family: @font-family__base; +} + +a { + color: @link__color; + text-decoration: @link__text-decoration; +} + +.email-non-inline() { + a:visited { + color: @link__visited__color !important; + text-decoration: @link__visited__text-decoration !important; + } + a:hover { + color: @link__hover__color !important; + text-decoration: @link__hover__text-decoration !important; + } + a:active { + color: @link__active__color !important; + text-decoration: @link__active__text-decoration !important; + } + + // Remove link color on iOS + .no-link a { + color: @text__color !important; + cursor: default !important; + text-decoration: none !important; + } +} + +// +// Layout +// --------------------------------------------- + +html, +body { + background-color: @email__background-color; +} + +.wrapper { + margin: 0 auto; +} + +.wrapper-inner { + padding-bottom: @email-content__padding__l; + width: 100%; +} + +.main { + margin: 0 auto; + text-align: left; // Necessary to prevent all text from centering in Outlook 2003 + width: @email-body__width; +} + +.header { + padding: @email-body__padding @email-body__padding 0; +} + +.main-content { + background-color: @email-content__background-color; + padding: @email-body__padding; +} + +.footer { + padding: 0 @email-body__padding @email-body__padding; // Reduce space between body of email and closing text +} + +// Layout (Mobile) +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) { + html, + body { + // Change background/foreground to same color + background-color: @email-content__background-color; + width: 100% !important; + } + + .main { + max-width: 100% !important; + min-width: 240px; + width: auto !important; + } + + .main-content { + padding: @email-body__padding !important; + } +} + +// +// Buttons +// --------------------------------------------- + +.button { + & > tr > td { + padding-bottom: @indent__s; + } + + .inner-wrapper { + td { + .css(border-radius, @button__border-radius, 1); + background-color: @button-primary__background; + + a { + font-size: @button__font-size; + color: @button-primary__color; + .css(border-radius, @button__border-radius, 1); + border: 1px solid @button-primary__background; + text-decoration: none; + padding: @button__padding; + display: inline-block; + } + } + } +} + +.email-non-inline() { + .button { + .inner-wrapper { + td:hover { + background-color: @button-primary__hover__background !important; + } + + a:active, + td:active { + background-color: @button-primary__active__background !important; + } + } + + a:active, + a:hover, + a:visited { + // Undo general link hover state + color: @button-primary__color !important; + text-decoration: none !important; + border: 1px solid @button-primary__hover__background; + } + } + + .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) { + .button { + .inner-wrapper { + width: 100% !important; + + td { + a { + font-size: @button__font-size + 2; + } + } + } + } + } +} + +// +// Messages +// --------------------------------------------- + +.message-info, +.message-gift { + width: @table__width; + + td { + background-color: @message-email__background; + border: 1px solid @message-email__border-color; + color: @message-email__color; + margin: 0; + padding: @email-content__padding__base; + + a { + color: @message-email-link__color; + } + + h1, + h2, + h3, + h4, + h5, + h6 { + margin-top: 0; + } + } +} diff --git a/app/design/frontend/Magento/blank/web/css/source/_email-extend.less b/app/design/frontend/Magento/blank/web/css/source/_email-extend.less new file mode 100644 index 0000000000000000000000000000000000000000..92e2519da13696e2fb2e4731a74eae49bcaa70e7 --- /dev/null +++ b/app/design/frontend/Magento/blank/web/css/source/_email-extend.less @@ -0,0 +1,21 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Email extend styles +// _____________________________________________ +// +// This file should be used for theme-specific styles for emails that extend or modify the styles in _email.less +// This will allow you to edit email styles without copying and editing the _email.less file + +// Custom fonts are declared here, rather than in _email-base.less, as it allows for custom fonts to be changed/removed +// in custom themes. + +// Font stylesheet @import is wrapped in a media query in order to prevent it from causing problems in Outlook +@media screen { + // Importing fonts from an external CSS file, rather than embedding @font-face declarations inside the <style> tag, + // as the latter will cause font rendering issues if the web fonts are inaccessible. + @import url("@{baseUrl}css/email-fonts.css"); +} \ No newline at end of file diff --git a/app/design/frontend/Magento/blank/web/css/source/_email-variables.less b/app/design/frontend/Magento/blank/web/css/source/_email-variables.less new file mode 100644 index 0000000000000000000000000000000000000000..8953dd5ac483afd5080f995663e98e0004dc63ee --- /dev/null +++ b/app/design/frontend/Magento/blank/web/css/source/_email-variables.less @@ -0,0 +1,19 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Email variable overrides +// _____________________________________________ + +// This file should be used to set theme-specific variables for emails. +// By default, emails will inherit variables from the Magento UI Library and the _theme.less and _variables.less files +// in a custom theme. Use this file if you want to set specific variables for emails. +// For example, you can make the email font, typography, colors, etc unique from the frontend theme. + +// Example usage: +// @link__color: @color-dark-green1; +// @link__text-decoration: underline; +// +// @email__background-color: @color-heathered-grey; // Change background to darker grey color diff --git a/app/design/frontend/Magento/blank/web/css/source/_typography.less b/app/design/frontend/Magento/blank/web/css/source/_typography.less index ba9e1bcd3bd897ba6f43102503435da0f34cf447..95b7f0e4076ca4600b29f67e83a1b9af2a8626f8 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_typography.less +++ b/app/design/frontend/Magento/blank/web/css/source/_typography.less @@ -3,9 +3,6 @@ // * See COPYING.txt for license details. // */ -// When you are not using .magento_reset() mixin you can include typography mixins by calling directly -// .typography-all(); - .font-face( @family-name: @font-family-name__base, @font-path: '@{baseDir}fonts/opensans/light/opensans-300', diff --git a/app/design/frontend/Magento/luma/Magento_Email/web/logo_email.png b/app/design/frontend/Magento/luma/Magento_Email/web/logo_email.png new file mode 100644 index 0000000000000000000000000000000000000000..f4bae90f1ec94ff93b4903169dcae634d395a829 Binary files /dev/null and b/app/design/frontend/Magento/luma/Magento_Email/web/logo_email.png differ diff --git a/app/design/frontend/Magento/luma/web/css/source/_email-extend.less b/app/design/frontend/Magento/luma/web/css/source/_email-extend.less new file mode 100644 index 0000000000000000000000000000000000000000..f958b1c1da9f1d8a0877ca2e108407542dfc0956 --- /dev/null +++ b/app/design/frontend/Magento/luma/web/css/source/_email-extend.less @@ -0,0 +1,34 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Email extend styles +// _____________________________________________ +// +// This file should be used for theme-specific styles for emails that extend or modify the styles in _email.less +// This will allow you to edit email styles without copying and editing the _email.less file + +// Font stylesheet @import is wrapped in a media query in order to prevent it from causing problems in Outlook +@media screen { + // Importing fonts from an external CSS file, rather than embedding @font-face declarations inside the <style> tag, + // as the latter will cause font rendering issues if the web fonts are inaccessible. + @import url("@{baseUrl}css/email-fonts.css"); +} + +.header { + padding-bottom: @email-body__padding; +} + +.main-content { + border: 1px solid @color-gray89; +} + +.footer { + padding: @email-body__padding; + + .closing { + font-weight: @font-weight__bold; + } +} diff --git a/app/design/frontend/Magento/luma/web/css/source/_email-variables.less b/app/design/frontend/Magento/luma/web/css/source/_email-variables.less new file mode 100644 index 0000000000000000000000000000000000000000..4801c62f9232180521f91d4f775d4c651d90837e --- /dev/null +++ b/app/design/frontend/Magento/luma/web/css/source/_email-variables.less @@ -0,0 +1,22 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Email variable overrides +// _____________________________________________ + +// This file should be used to set theme-specific variables for emails. +// By default, emails will inherit variables from the Magento UI Library and the _theme.less and _variables.less files +// in a custom theme. Use this file if you want to set specific variables for emails. +// For example, you can make the email font, typography, colors, etc unique from the frontend theme. + +// Colors +@email__background-color: darken(@color-white, 6%); + +// Headings +@heading__font-weight__base: @font-weight__bold; + +// Tables +@table-head__background-color: @color-gray95; diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 67f69454879eaa8076c22b18db505d99181bc411..c92d3bd491c8f4d3e31eacce3d0c9edefaf5bb91 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -796,6 +796,9 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractBackendControlle $subscriberFactory->create()->subscribeCustomerById(2); $this->getRequest()->setParam('customer', [1, 2]); + // Ensure secret key is disabled (subscription status notification emails turn it off) + $this->_objectManager->get('Magento\Backend\Model\UrlInterface')->turnOffSecretKey(); + // Test $this->dispatch('backend/customer/index/massUnsubscribe'); @@ -857,6 +860,9 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractBackendControlle $subscriberFactory->create()->subscribeCustomerById(2); $this->getRequest()->setParam('customer', [1, 4200, 2]); + // Ensure secret key is disabled (subscription status notification emails turn it off) + $this->_objectManager->get('Magento\Backend\Model\UrlInterface')->turnOffSecretKey(); + // Test $this->dispatch('backend/customer/index/massUnsubscribe'); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer.php index 5e65356227c8c97a49a37adf366c119af7b66e9a..5ca980883cb4bee584ad9a2a3c0d9077a39ee890 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/customer.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer.php @@ -26,5 +26,6 @@ $customer->setWebsiteId(1) ->setDefaultShipping(1) ->setTaxvat('12') ->setGender(0); + $customer->isObjectNew(true); $customer->save(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/two_customers.php b/dev/tests/integration/testsuite/Magento/Customer/_files/two_customers.php index 45cd44adb875cb28059f2a9f671c11dcb90ae9d6..34703ad94460169bc6e2672805bd545aa87b4700 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/two_customers.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/two_customers.php @@ -9,32 +9,19 @@ require 'customer.php'; $customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Customer\Model\Customer'); -$customer->setWebsiteId( - 1 -)->setEntityId( - 2 -)->setEntityTypeId( - 1 -)->setAttributeSetId( - 0 -)->setEmail( - 'customer_two@example.com' -)->setPassword( - 'password' -)->setGroupId( - 1 -)->setStoreId( - 1 -)->setIsActive( - 1 -)->setFirstname( - 'Firstname' -)->setLastname( - 'Lastname' -)->setDefaultBilling( - 1 -)->setDefaultShipping( - 1 -); +$customer->setWebsiteId(1) + ->setEntityId(2) + ->setEntityTypeId(1) + ->setAttributeSetId(0) + ->setEmail('customer_two@example.com') + ->setPassword('password') + ->setGroupId(1) + ->setStoreId(1) + ->setIsActive(1) + ->setFirstname('Firstname') + ->setLastname('Lastname') + ->setDefaultBilling(1) + ->setDefaultShipping(1); + $customer->isObjectNew(true); $customer->save(); diff --git a/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php index 035efbb3bb89879982b67db8f958456ad61b84c2..62a533f2f73618a60490ade2b956b85265231583 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Block/Adminhtml/Template/Edit/FormTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Email\Block\Adminhtml\Template\Edit; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\App\TemplateTypesInterface; + /** * Test class for \Magento\Email\Block\Adminhtml\Template\Edit\Form * @magentoAppArea adminhtml @@ -15,10 +18,10 @@ class FormTest extends \PHPUnit_Framework_TestCase /** @var string[] */ protected $expectedFields; - /** @var Magento\Email\Model\Template */ + /** @var \Magento\Email\Model\Template */ protected $template; - /** @var Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ + /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ protected $objectManager; /** @var \Magento\Framework\Registry */ @@ -44,10 +47,10 @@ class FormTest extends \PHPUnit_Framework_TestCase 'template_styles' ]; - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->objectManager = Bootstrap::getObjectManager(); $this->template = $this->objectManager->get('Magento\Email\Model\Template') ->setId(1) - ->setTemplateType(\Magento\Framework\App\TemplateTypesInterface::TYPE_HTML); + ->setTemplateType(TemplateTypesInterface::TYPE_HTML); $this->registry = $this->objectManager->get('Magento\Framework\Registry'); if ($this->registry->registry('current_email_template') == null) { $this->registry->register('current_email_template', $this->template); @@ -65,17 +68,7 @@ class FormTest extends \PHPUnit_Framework_TestCase */ public function testPrepareFormWithTemplateId() { - $this->expectedFields[] = 'used_currently_for'; - $this->runTest(); - } - - /** - * @covers \Magento\Email\Block\Adminhtml\Template\Edit\Form::_prepareForm - */ - public function testPrepareFormWithoutTemplateId() - { - $this->template->setId(null); - $this->expectedFields[] = 'used_default_for'; + $this->expectedFields[] = 'currently_used_for'; $this->runTest(); } diff --git a/dev/tests/integration/testsuite/Magento/Email/Controller/Adminhtml/Email/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Controller/Adminhtml/Email/TemplateTest.php index 1e7a3ac5d75bb07ac96af5a9beb570ef4cee0901..caf09b919631e6554f637808e6a133de4d7cf9f5 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Controller/Adminhtml/Email/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Controller/Adminhtml/Email/TemplateTest.php @@ -21,7 +21,7 @@ class TemplateTest extends \Magento\TestFramework\TestCase\AbstractBackendContro $this->getRequest()->setPostValue($post); $this->dispatch('backend/admin/email_template/defaultTemplate/?isAjax=true'); $this->assertContains( - '"template_type":2,"template_subject":"Password Reset Confirmation for {{var customer.name}}"', + '"template_type":2,"template_subject":"Reset your', $this->getResponse()->getBody() ); } diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php index 8997cb2be702478fe7a8ffa81ce4de30c9f8ca62..eec2737e1aa00983992a1b9aedbd691d1d9d6f17 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -7,6 +7,7 @@ namespace Magento\Email\Model\Template; use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Phrase; class FilterTest extends \PHPUnit_Framework_TestCase { @@ -16,16 +17,17 @@ class FilterTest extends \PHPUnit_Framework_TestCase protected $_model = null; /** - * @var \Magento\Framework\ObjectManagerInterface + * @var \Magento\TestFramework\ObjectManager */ protected $_objectManager; protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + $this->_model = $this->_objectManager->create( 'Magento\Email\Model\Template\Filter' ); - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); } /** @@ -81,31 +83,6 @@ class FilterTest extends \PHPUnit_Framework_TestCase $this->assertStringMatchesFormat('http://example.com/index.php/backend/translation/ajax/index/%A', $url); } - public function testEscapehtmlDirective() - { - $this->_model->setVariables( - ['first' => '<p><i>Hello</i> <b>world!</b></p>', 'second' => '<p>Hello <strong>world!</strong></p>'] - ); - - $allowedTags = 'i,b'; - - $expectedResults = [ - 'first' => '<p><i>Hello</i> <b>world!</b></p>', - 'second' => '<p>Hello <strong>world!</strong></p>', - ]; - - foreach ($expectedResults as $varName => $expectedResult) { - $result = $this->_model->escapehtmlDirective( - [ - '{{escapehtml var=$' . $varName . ' allowed_tags=' . $allowedTags . '}}', - 'escapehtml', - ' var=$' . $varName . ' allowed_tags=' . $allowedTags, - ] - ); - $this->assertEquals($expectedResult, $result); - } - } - /** * @magentoDataFixture Magento/Email/Model/_files/design/themes.php * @magentoAppIsolation enabled @@ -189,6 +166,54 @@ class FilterTest extends \PHPUnit_Framework_TestCase return $result; } + /** + * @param $directive + * @param $translations + * @param $expectedResult + * @internal param $translatorData + * @dataProvider transDirectiveDataProvider + */ + public function testTransDirective($directive, $translations, $expectedResult) + { + $renderer = Phrase::getRenderer(); + + $translator = $this->getMockBuilder('\Magento\Framework\Translate') + ->disableOriginalConstructor() + ->setMethods(['getData']) + ->getMock(); + + $translator->expects($this->atLeastOnce()) + ->method('getData') + ->will($this->returnValue($translations)); + + $this->_objectManager->addSharedInstance($translator, 'Magento\Framework\Translate'); + $this->_objectManager->removeSharedInstance('Magento\Framework\Phrase\Renderer\Translate'); + Phrase::setRenderer($this->_objectManager->create('Magento\Framework\Phrase\RendererInterface')); + + $this->assertEquals($expectedResult, $this->_model->filter($directive)); + + Phrase::setRenderer($renderer); + } + + /** + * @return array + */ + public function transDirectiveDataProvider() + { + return [ + [ + '{{trans "foobar"}}', + [], + 'foobar', + ], + [ + '{{trans "foobar"}}', + ['foobar' => 'barfoo'], + 'barfoo', + ] + ]; + } + /** * Ensures that the css directive will successfully compile and output contents of a LESS file, * as well as supporting loading files from a theme fallback structure. diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index 5f0741b36e5cd0dff5e268a5ba1251eda2092b04..63a3004bb6b02072edcaa7bb15e94bc1f0d5f082 100755 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -15,36 +15,36 @@ class TemplateTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Email\Model\Template|\PHPUnit_Framework_MockObject_MockObject */ - protected $_model; + protected $model; /** * @var \Zend_Mail|\PHPUnit_Framework_MockObject_MockObject */ - protected $_mail; + protected $mail; /** * @var \Magento\Framework\ObjectManagerInterface */ - protected $_objectManager; + protected $objectManager; protected function setUp() { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); } - protected function _mockModel($filesystem = null) + protected function mockModel($filesystem = null) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); if (!$filesystem) { $filesystem = $objectManager->create('Magento\Framework\Filesystem'); } - $this->_mail = $this->getMock( + $this->mail = $this->getMock( 'Zend_Mail', ['send', 'addTo', 'addBcc', 'setReturnPath', 'setReplyTo'], ['utf-8'] ); - $this->_model = $this->getMockBuilder( + $this->model = $this->getMockBuilder( 'Magento\Email\Model\Template' )->setMethods( ['_getMail'] @@ -64,41 +64,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase ] )->getMock(); $objectManager->get('Magento\Framework\App\State')->setAreaCode('frontend'); - $this->_model->expects($this->any())->method('_getMail')->will($this->returnCallback([$this, 'getMail'])); - $this->_model->setSenderName('sender')->setSenderEmail('sender@example.com')->setTemplateSubject('Subject'); - } - - /** - * Manually set a module directory to allow for testing the loading of email templates from module directories. - * TODO: Improve this method of mocking module folders, as it is fragile/error-prone - * - * @return \Magento\Framework\Filesystem - */ - protected function _getMockedFilesystem($vendor = 'Magento', $module = 'Email', $type = 'view') - { - /* @var $moduleReader \Magento\Framework\Module\Dir\Reader */ - $moduleReader = $this->_objectManager->get('Magento\Framework\Module\Dir\Reader'); - $moduleReader->setModuleDir( - $vendor . '_' . $module, - $type, - realpath(__DIR__) . "/_files/code/$vendor/$module/$type" - ); - $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Framework\App\Filesystem\DirectoryList', - [ - 'root' => DirectoryList::ROOT, - 'config' => [ - DirectoryList::MODULES => [ - DirectoryList::PATH => realpath(__DIR__) . '/_files/code', - ], - ], - ] - ); - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Framework\Filesystem', - ['directoryList' => $directoryList] - ); - return $filesystem; + $this->model->expects($this->any())->method('_getMail')->will($this->returnCallback([$this, 'getMail'])); + $this->model->setSenderName('sender')->setSenderEmail('sender@example.com')->setTemplateSubject('Subject'); } /** @@ -108,14 +75,14 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function getMail() { - return clone $this->_mail; + return clone $this->mail; } public function testSetGetTemplateFilter() { - $this->_mockModel(); - $filter = $this->_model->getTemplateFilter(); - $this->assertSame($filter, $this->_model->getTemplateFilter()); + $this->mockModel(); + $filter = $this->model->getTemplateFilter(); + $this->assertSame($filter, $this->model->getTemplateFilter()); $this->assertEquals( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Store\Model\StoreManagerInterface' @@ -126,19 +93,18 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $filter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Email\Model\Template\Filter' ); - $this->_model->setTemplateFilter($filter); - $this->assertSame($filter, $this->_model->getTemplateFilter()); + $this->model->setTemplateFilter($filter); + $this->assertSame($filter, $this->model->getTemplateFilter()); } public function testLoadDefault() { - $this->_mockModel(); - $this->_model->loadDefault('customer_create_account_email_template'); - $this->assertNotEmpty($this->_model->getTemplateText()); - $this->assertNotEmpty($this->_model->getTemplateSubject()); - $this->assertNotEmpty($this->_model->getOrigTemplateVariables()); - $this->assertInternalType('array', \Zend_Json::decode($this->_model->getOrigTemplateVariables())); - $this->assertNotEmpty($this->_model->getTemplateStyles()); + $this->mockModel(); + $this->model->loadDefault('customer_create_account_email_template'); + $this->assertNotEmpty($this->model->getTemplateText()); + $this->assertNotEmpty($this->model->getTemplateSubject()); + $this->assertNotEmpty($this->model->getOrigTemplateVariables()); + $this->assertInternalType('array', \Zend_Json::decode($this->model->getOrigTemplateVariables())); } /** @@ -147,17 +113,17 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplate() { - $this->_mockModel(); + $this->mockModel(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\App\AreaList' )->getArea( \Magento\Framework\App\Area::AREA_FRONTEND )->load(); - $this->_setNotDefaultThemeForFixtureStore(); + $this->setNotDefaultThemeForFixtureStore(); $expectedViewUrl = 'static/frontend/Magento/luma/en_US/Magento_Theme/favicon.ico'; - $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); - $this->assertStringEndsNotWith($expectedViewUrl, $this->_model->getProcessedTemplate()); - $this->_model->setDesignConfig( + $this->model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); + $this->assertStringEndsNotWith($expectedViewUrl, $this->model->getProcessedTemplate()); + $this->model->setDesignConfig( [ 'area' => 'frontend', 'store' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( @@ -167,7 +133,79 @@ class TemplateTest extends \PHPUnit_Framework_TestCase )->getId(), ] ); - $this->assertStringEndsWith($expectedViewUrl, $this->_model->getProcessedTemplate()); + $this->assertStringEndsWith($expectedViewUrl, $this->model->getProcessedTemplate()); + } + + /** + * Test template directive to ensure that templates can be loaded from modules + * + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Email/Model/_files/design/themes.php + * @magentoAppIsolation enabled + * @dataProvider templateFallbackDataProvider + * + * @param $area + * @param $templateId + * @param $expectedOutput + * @param bool $mockThemeFallback + */ + public function testTemplateFallback($area, $templateId, $expectedOutput, $mockThemeFallback = false) + { + $this->mockModel(); + + if ($mockThemeFallback == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { + $this->setUpAdminThemeFallback(); + } elseif ($mockThemeFallback == \Magento\Framework\App\Area::AREA_FRONTEND) { + $this->setUpThemeFallback($area); + } + + $this->model->setId($templateId); + + $this->assertContains($expectedOutput, $this->model->processTemplate()); + } + + /** + * @return array + */ + public function templateFallbackDataProvider() + { + return [ + 'Template from module - admin' => [ + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'customer_create_account_email_template', + 'To sign in to our site, use these credentials during checkout', + ], + 'Template from module - frontend' => [ + \Magento\Framework\App\Area::AREA_FRONTEND, + 'customer_create_account_email_template', + 'To sign in to our site, use these credentials during checkout', + ], + 'Template from theme - frontend' => [ + \Magento\Framework\App\Area::AREA_FRONTEND, + 'customer_create_account_email_template', + 'customer_create_account_email_template template from Vendor/custom_theme', + \Magento\Framework\App\Area::AREA_FRONTEND, + ], + 'Template from parent theme - frontend' => [ + \Magento\Framework\App\Area::AREA_FRONTEND, + 'customer_create_account_email_confirmation_template', + 'customer_create_account_email_confirmation_template template from Vendor/default', + \Magento\Framework\App\Area::AREA_FRONTEND, + ], + 'Template from grandparent theme - frontend' => [ + \Magento\Framework\App\Area::AREA_FRONTEND, + 'customer_create_account_email_confirmed_template', + 'customer_create_account_email_confirmed_template template from Magento/default', + \Magento\Framework\App\Area::AREA_FRONTEND, + ], + 'Template from grandparent theme - adminhtml' => [ + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'catalog_productalert_cron_error_email_template', + 'catalog_productalert_cron_error_email_template template from Magento/default', + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + ], + + ]; } /** @@ -183,18 +221,28 @@ class TemplateTest extends \PHPUnit_Framework_TestCase * @param $templateText * @param $expectedOutput * @param $storeConfigPath + * @param $mockAdminTheme */ - public function testTemplateDirective($area, $templateText, $expectedOutput, $storeConfigPath = null) - { - $filesystem = $this->_getMockedFilesystem(); - $this->_mockModel($filesystem); - $this->setUpThemeFallback($area); + public function testTemplateDirective( + $area, + $templateText, + $expectedOutput, + $storeConfigPath = null, + $mockAdminTheme = false + ) { + $this->mockModel(); + + if ($mockAdminTheme) { + $this->setUpAdminThemeFallback(); + } else { + $this->setUpThemeFallback($area); + } - $this->_model->setTemplateText($templateText); + $this->model->setTemplateText($templateText); // Allows for testing of templates overridden in backend if ($storeConfigPath) { - $template = $this->_objectManager->create('Magento\Email\Model\Template'); + $template = $this->objectManager->create('Magento\Email\Model\Template'); $templateData = [ 'template_code' => 'some_unique_code', 'template_type' => \Magento\Email\Model\Template::TYPE_HTML, @@ -205,7 +253,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $templateId = $template->getId(); // Store the ID of the newly created template in the system config so that this template will be loaded - $this->_objectManager->get( + $this->objectManager->get( 'Magento\Framework\App\Config\MutableScopeConfigInterface' )->setValue( $storeConfigPath, @@ -215,7 +263,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase ); } - $this->assertContains($expectedOutput, $this->_model->getProcessedTemplate()); + $this->assertContains($expectedOutput, $this->model->getProcessedTemplate()); } /** @@ -227,12 +275,12 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'Template from module folder - adminhtml' => [ \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, '{{template config_path="design/email/footer_template"}}', - 'Footer from module directory', + '<!-- End wrapper table -->', ], 'Template from module folder - frontend' => [ \Magento\Framework\App\Area::AREA_FRONTEND, '{{template config_path="design/email/footer_template"}}', - 'Footer from module directory', + '<!-- End wrapper table -->', ], 'Template overridden in backend - adminhtml' => [ \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, @@ -246,6 +294,28 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'Footer configured in backend - email loaded via frontend', 'design/email/footer_template', ], + 'Template from theme - frontend' => [ + \Magento\Framework\App\Area::AREA_FRONTEND, + '{{template config_path="customer/create_account/email_template"}}', + 'customer_create_account_email_template template from Vendor/custom_theme', + ], + 'Template from parent theme - frontend' => [ + \Magento\Framework\App\Area::AREA_FRONTEND, + '{{template config_path="customer/create_account/email_confirmation_template"}}', + 'customer_create_account_email_confirmation_template template from Vendor/default', + ], + 'Template from grandparent theme - frontend' => [ + \Magento\Framework\App\Area::AREA_FRONTEND, + '{{template config_path="customer/create_account/email_confirmed_template"}}', + 'customer_create_account_email_confirmed_template template from Magento/default', + ], + 'Template from grandparent theme - adminhtml' => [ + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + '{{template config_path="catalog/productalert_cron/error_email_template"}}', + 'catalog_productalert_cron_error_email_template template from Magento/default', + null, + true, + ], ]; } @@ -265,22 +335,46 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testTemplateStylesVariable($area, $expectedOutput, $unexpectedOutputs, $templateForDatabase = []) { - $this->_mockModel($this->_getMockedFilesystem()); - $this->setUpThemeFallback($area); - if (count($templateForDatabase)) { - $template = $this->_objectManager->create('Magento\Email\Model\Template'); + $this->mockModel(); + $this->setUpThemeFallback($area); + + $template = $this->objectManager->create('Magento\Email\Model\Template'); $template->setData($templateForDatabase); $template->save(); $templateId = $template->getId(); - $this->_model->load($templateId); + $this->model->load($templateId); } else { - // <!--@styles @--> parsing only happens when template is loaded from filesystem - $this->_model->loadDefault('design_email_header_template'); + // <!--@styles @--> parsing only via the loadDefault method. Since email template files won't contain + // @styles comments by default, it is necessary to mock an object to return testable contents + $themeDirectory = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\ReadInterface') + ->disableOriginalConstructor() + ->setMethods([ + 'readFile', + ]) + ->getMockForAbstractClass(); + + $themeDirectory->expects($this->once()) + ->method('readFile') + ->will($this->returnValue('<!--@styles p { color: #111; } @--> {{var template_styles}}')); + + $filesystem = $this->getMockBuilder('\Magento\Framework\Filesystem') + ->disableOriginalConstructor() + ->setMethods(['getDirectoryRead']) + ->getMock(); + + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(DirectoryList::ROOT) + ->will($this->returnValue($themeDirectory)); + + $this->mockModel($filesystem); + + $this->model->loadDefault('design_email_header_template'); } - $processedTemplate = $this->_model->getProcessedTemplate(); + $processedTemplate = $this->model->getProcessedTemplate(); foreach ($unexpectedOutputs as $unexpectedOutput) { $this->assertNotContains($unexpectedOutput, $processedTemplate); @@ -336,6 +430,29 @@ class TemplateTest extends \PHPUnit_Framework_TestCase ]; } + /** + * Setup the theme fallback structure and set the Vendor/custom_theme as the current theme for 'fixturestore' store + */ + protected function setUpAdminThemeFallback() + { + // The Vendor/custom_theme adminhtml theme is set in the + // dev/tests/integration/testsuite/Magento/Email/Model/_files/design/themes.php file, as it must be set + // before the adminhtml area is loaded below. + + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + + $adminStore = $this->objectManager->create('Magento\Store\Model\Store') + ->load(\Magento\Store\Model\Store::ADMIN_CODE); + + $this->model->setDesignConfig( + [ + 'area' => 'adminhtml', + 'store' => $adminStore->getId(), + ] + ); + } + /** * Setup the theme fallback structure and set the Vendor/custom_theme as the current theme for 'fixturestore' store * @@ -344,20 +461,20 @@ class TemplateTest extends \PHPUnit_Framework_TestCase protected function setUpThemeFallback($area) { $themes = ['frontend' => 'Vendor/custom_theme']; - $design = $this->_objectManager->create('Magento\Theme\Model\View\Design', ['themes' => $themes]); - $this->_objectManager->addSharedInstance($design, 'Magento\Theme\Model\View\Design'); + $design = $this->objectManager->create('Magento\Theme\Model\View\Design', ['themes' => $themes]); + $this->objectManager->addSharedInstance($design, 'Magento\Theme\Model\View\Design'); // It is important to test from both areas, as emails will get sent from both, so we need to ensure that the // inline CSS files get loaded properly from both areas. \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); - $collection = $this->_objectManager->create('Magento\Theme\Model\Resource\Theme\Collection'); + $collection = $this->objectManager->create('Magento\Theme\Model\Resource\Theme\Collection'); // Hard-coding theme as we want to test the fallback structure to ensure that the parent/grandparent themes of // Vendor/custom_theme will be checked for CSS files $themeId = $collection->getThemeByFullPath('frontend/Vendor/custom_theme')->getId(); - $this->_objectManager->get( + $this->objectManager->get( 'Magento\Framework\App\Config\MutableScopeConfigInterface' )->setValue( \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID, @@ -366,10 +483,10 @@ class TemplateTest extends \PHPUnit_Framework_TestCase 'fixturestore' ); - $this->_model->setDesignConfig( + $this->model->setDesignConfig( [ 'area' => 'frontend', - 'store' => $this->_objectManager->get( + 'store' => $this->objectManager->get( 'Magento\Store\Model\StoreManagerInterface' )->getStore( 'fixturestore' @@ -382,7 +499,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase * Set 'Magento/luma' for the 'fixturestore' store. * Application isolation is required, if a test uses this method. */ - protected function _setNotDefaultThemeForFixtureStore() + protected function setNotDefaultThemeForFixtureStore() { $theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Framework\View\Design\ThemeInterface' @@ -404,17 +521,17 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplateSubject() { - $this->_mockModel(); + $this->mockModel(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\App\AreaList' )->getArea( \Magento\Framework\App\Area::AREA_FRONTEND )->load(); - $this->_setNotDefaultThemeForFixtureStore(); + $this->setNotDefaultThemeForFixtureStore(); $expectedViewUrl = 'static/frontend/Magento/luma/en_US/Magento_Theme/favicon.ico'; - $this->_model->setTemplateSubject('{{view url="Magento_Theme::favicon.ico"}}'); - $this->assertStringEndsNotWith($expectedViewUrl, $this->_model->getProcessedTemplateSubject([])); - $this->_model->setDesignConfig( + $this->model->setTemplateSubject('{{view url="Magento_Theme::favicon.ico"}}'); + $this->assertStringEndsNotWith($expectedViewUrl, $this->model->getProcessedTemplateSubject([])); + $this->model->setDesignConfig( [ 'area' => 'frontend', 'store' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( @@ -424,7 +541,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase )->getId(), ] ); - $this->assertStringEndsWith($expectedViewUrl, $this->_model->getProcessedTemplateSubject([])); + $this->assertStringEndsWith($expectedViewUrl, $this->model->getProcessedTemplateSubject([])); } /** @@ -432,7 +549,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetDefaultEmailLogo() { - $this->_mockModel(); + $this->mockModel(); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\App\AreaList' )->getArea( @@ -440,7 +557,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase )->load(); $this->assertStringEndsWith( 'static/frontend/Magento/blank/en_US/Magento_Email/logo_email.png', - $this->_model->getDefaultEmailLogo() + $this->model->getDefaultEmailLogo() ); } @@ -450,7 +567,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testSetDesignConfigException($config) { - $this->_mockModel(); + $this->mockModel(); // \Magento\Email\Model\Template is an abstract class $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Email\Model\Template'); @@ -459,7 +576,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function setDesignConfigExceptionDataProvider() { - $this->_mockModel(); + $this->mockModel(); $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId(); return [ @@ -471,16 +588,16 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function testSetAndGetId() { - $this->_mockModel(); + $this->mockModel(); $testId = 9999; - $this->_model->setId($testId); - $this->assertEquals($testId, $this->_model->getId()); + $this->model->setId($testId); + $this->assertEquals($testId, $this->model->getId()); } public function testIsValidForSend() { - $this->_mockModel(); - $this->assertTrue($this->_model->isValidForSend()); + $this->mockModel(); + $this->assertTrue($this->model->isValidForSend()); } /** @@ -489,38 +606,38 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetTypeNonExistentType() { - $this->_mockModel(); - $this->_model->setId('foo'); - $this->_model->getType(); + $this->mockModel(); + $this->model->setId('foo'); + $this->model->getType(); } public function testGetTypeHtml() { - $this->_mockModel(); - $this->_model->setId('customer_create_account_email_template'); - $this->assertEquals(\Magento\Framework\App\TemplateTypesInterface::TYPE_HTML, $this->_model->getType()); + $this->mockModel(); + $this->model->setId('customer_create_account_email_template'); + $this->assertEquals(\Magento\Framework\App\TemplateTypesInterface::TYPE_HTML, $this->model->getType()); } public function testGetType() { - $this->_mockModel(); + $this->mockModel(); $templateTypeId = 'test_template'; - $this->_model->setTemplateType($templateTypeId); - $this->assertEquals($templateTypeId, $this->_model->getType()); + $this->model->setTemplateType($templateTypeId); + $this->assertEquals($templateTypeId, $this->model->getType()); } public function testGetSendingException() { - $this->_mockModel(); - $this->assertNull($this->_model->getSendingException()); + $this->mockModel(); + $this->assertNull($this->model->getSendingException()); } public function testGetVariablesOptionArray() { - $this->_mockModel(); + $this->mockModel(); $testTemplateVariables = '{"var data.name":"Sender Name","var data.email":"Sender Email"}'; - $this->_model->setOrigTemplateVariables($testTemplateVariables); - $variablesOptionArray = $this->_model->getVariablesOptionArray(); + $this->model->setOrigTemplateVariables($testTemplateVariables); + $variablesOptionArray = $this->model->getVariablesOptionArray(); $this->assertEquals('{{var data.name}}', $variablesOptionArray[0]['value']); $this->assertEquals('Sender Name', $variablesOptionArray[0]['label']->getArguments()[0]); $this->assertEquals('{{var data.email}}', $variablesOptionArray[1]['value']); @@ -529,12 +646,12 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function testGetVariablesOptionArrayInGroup() { - $this->_mockModel(); + $this->mockModel(); $testTemplateVariables = '{"var data.name":"Sender Name","var data.email":"Sender Email"}'; - $this->_model->setOrigTemplateVariables($testTemplateVariables); - $variablesOptionArray = $this->_model->getVariablesOptionArray(true); + $this->model->setOrigTemplateVariables($testTemplateVariables); + $variablesOptionArray = $this->model->getVariablesOptionArray(true); $this->assertEquals('Template Variables', $variablesOptionArray['label']->getText()); - $this->assertEquals($this->_model->getVariablesOptionArray(), $variablesOptionArray['value']); + $this->assertEquals($this->model->getVariablesOptionArray(), $variablesOptionArray['value']); } /** @@ -543,36 +660,36 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testBeforeSaveEmptyTemplateCode() { - $this->_mockModel(); - $this->_model->beforeSave(); + $this->mockModel(); + $this->model->beforeSave(); } public function testBeforeSave() { - $this->_mockModel(); - $this->_model->setTemplateCode('test template code'); - $this->_model->beforeSave(); + $this->mockModel(); + $this->model->setTemplateCode('test template code'); + $this->model->beforeSave(); } public function testProcessTemplate() { - $this->_mockModel(); - $this->_model->setId('customer_create_account_email_template'); - $this->assertContains('<body style', $this->_model->processTemplate()); + $this->mockModel(); + $this->model->setId('customer_create_account_email_template'); + $this->assertContains('<body', $this->model->processTemplate()); } public function testGetSubject() { - $this->_mockModel(); - $this->_model->setVars(['foo', 'bar', 'baz']); - $this->assertEquals('Subject', $this->_model->getSubject()); + $this->mockModel(); + $this->model->setVars(['foo', 'bar', 'baz']); + $this->assertEquals('Subject', $this->model->getSubject()); } public function testSetOptions() { - $this->_mockModel(); + $this->mockModel(); $options = ['area' => 'test area', 'store' => 1]; - $this->_model->setOptions($options); - $this->assertEquals($options, $this->_model->getDesignConfig()->getData()); + $this->model->setOptions($options); + $this->assertEquals($options, $this->model->getDesignConfig()->getData()); } } diff --git a/app/code/Magento/Newsletter/view/email/subscr_success.html b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/Magento_ProductAlert/email/cron_error.html similarity index 57% rename from app/code/Magento/Newsletter/view/email/subscr_success.html rename to dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/Magento_ProductAlert/email/cron_error.html index c49f1fc754b85c9e046fc138be9b49f77d35c87b..e07d7da3e554b45edbf33b32d6132e17ba7b0e66 100644 --- a/app/code/Magento/Newsletter/view/email/subscr_success.html +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/Magento_ProductAlert/email/cron_error.html @@ -4,5 +4,4 @@ * See COPYING.txt for license details. */ --> -<!--@subject Newsletter subscription success @--> -Newsletter subscription success \ No newline at end of file +catalog_productalert_cron_error_email_template template from Magento/default diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/theme.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/theme.xml index 442a366231c84627a164472830f34089f219788e..3c7b7acc35d47e45f9efbe578dc54b4b5cddbdec 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/theme.xml +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/theme.xml @@ -6,5 +6,5 @@ */ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> - <title>Default</title> + <title>Adminhtml - Magento/default</title> </theme> diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/theme.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/theme.xml new file mode 100644 index 0000000000000000000000000000000000000000..3a01223590af913f372c2d5441142927799c3f4b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/theme.xml @@ -0,0 +1,10 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> + <title>Adminhtml - Vendor/custom_theme</title> + <parent>Vendor/default</parent> +</theme> diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/theme.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/theme.xml new file mode 100644 index 0000000000000000000000000000000000000000..af2167146429d544d1840574ec99ff77886d8b9a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/theme.xml @@ -0,0 +1,10 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> + <title>Adminhtml - Vendor/default</title> + <parent>Magento/default</parent> +</theme> diff --git a/app/code/Magento/Newsletter/view/email/unsub_success.html b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/Magento_Customer/email/account_new_confirmed.html similarity index 55% rename from app/code/Magento/Newsletter/view/email/unsub_success.html rename to dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/Magento_Customer/email/account_new_confirmed.html index 5c67a07985cc0cd53dc506a10b5ca8e9307ce10f..97b285165da6418430dbf54f7028823e86ab0ed0 100644 --- a/app/code/Magento/Newsletter/view/email/unsub_success.html +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/Magento_Customer/email/account_new_confirmed.html @@ -4,5 +4,4 @@ * See COPYING.txt for license details. */ --> -<!--@subject Newsletter unsubscription success @--> -Newsletter unsubscription success \ No newline at end of file +customer_create_account_email_confirmed_template template from Magento/default diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/theme.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/theme.xml index 8eec1253605812e3706d2577533c50cebe7e39cf..1fe27ff452dce946ee923900ef8ce041ba4fba1d 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/theme.xml +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/theme.xml @@ -5,5 +5,5 @@ */ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> - <title>Default</title> + <title>Frontend - Magento/default</title> </theme> diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/Magento_Customer/email/account_new.html b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/Magento_Customer/email/account_new.html new file mode 100644 index 0000000000000000000000000000000000000000..3605eca37ece7dd268ac3e86b1f64f53972b6140 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/Magento_Customer/email/account_new.html @@ -0,0 +1,7 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +customer_create_account_email_template template from Vendor/custom_theme diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/theme.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/theme.xml index e20f6a70ac658c869bb25897a1298a5dbdfd81e2..33d79eeb76f602ab5e9359357c6c9ee1d7d4b7df 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/theme.xml +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/theme.xml @@ -5,6 +5,6 @@ */ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> - <title>Custom Theme</title> + <title>Frontend - Vendor/custom_theme</title> <parent>Vendor/default</parent> </theme> diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/Magento_Customer/email/account_new_confirmation.html b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/Magento_Customer/email/account_new_confirmation.html new file mode 100644 index 0000000000000000000000000000000000000000..4c2b9e00a94662dbfb54d04f42dcb3a3126b960f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/Magento_Customer/email/account_new_confirmation.html @@ -0,0 +1,7 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +customer_create_account_email_confirmation_template template from Vendor/default \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/theme.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/theme.xml index 8220c8175e124809c68c9f9eef5d957aacb3fd86..edd1f837ceb76fdac5f9faa62375bd2a2a65b18c 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/theme.xml +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/theme.xml @@ -5,6 +5,6 @@ */ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd"> - <title>Default</title> + <title>Frontend - Vendor/default</title> <parent>Magento/default</parent> </theme> diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/themes.php index 4ce7fa807ac8b199bc686c9d7badaa867d8fbec4..23fe9964fab17d61c88ce981fc3db02db37f18a9 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/themes.php @@ -6,7 +6,9 @@ use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\App\AreaList') +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +$objectManager->get('Magento\Framework\App\AreaList') ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ->load(\Magento\Framework\App\Area::PART_CONFIG); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize([ @@ -14,11 +16,25 @@ use Magento\Framework\App\Filesystem\DirectoryList; DirectoryList::THEMES => ['path' => realpath(__DIR__)], ], ]); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure( +$objectManager->configure( ['preferences' => ['Magento\Theme\Model\Theme' => 'Magento\Theme\Model\Theme\Data']] ); /** @var $registration \Magento\Theme\Model\Theme\Registration */ -$registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( +$registration = $objectManager->create( 'Magento\Theme\Model\Theme\Registration' ); + +// It is not possible to set custom admin theme via store config, as the default adminhtml theme is set in +// app/code/Magento/Theme/etc/di.xml. To modify the adminhtml theme, we must change the injected "theme" argument here. +$objectManager->configure([ + 'Magento\Theme\Model\View\Design' => [ + 'arguments' => [ + 'themes' => [ + 'frontend' => 'Magento/blank', + 'adminhtml' => 'Vendor/custom_theme', + ], + ] + ], +]); + $registration->register(implode('/', ['*', '*', '*', 'theme.xml'])); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php index 8e7d69bac4701a5f6df6c7f5c530088d557265a2..ca9e76fb3664bc35074b5aedfe0ad8084d378ef3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Design/FileResolution/FallbackTest.php @@ -24,6 +24,21 @@ class FallbackTest extends \PHPUnit_Framework_TestCase private $themeFactory; protected function setUp() + { + /** @var \Magento\Framework\View\Design\Theme\FlyweightFactory $themeFactory */ + $this->themeFactory = Bootstrap::getObjectManager() + ->get('Magento\Framework\View\Design\Theme\FlyweightFactory'); + } + + /** + * Reinitialize environment with test directories + * + * Since the testGetEmailTemplateFile test uses a @magentoDataFixture that reinitializes the environment, we + * must reinitialize the environment only when a test specifically requests it + * + * @return void + */ + protected function reinitializeEnvironment() { Bootstrap::getInstance()->reinitialize([ AppBootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS => [ @@ -35,9 +50,6 @@ class FallbackTest extends \PHPUnit_Framework_TestCase ], ], ]); - /** @var \Magento\Framework\View\Design\Theme\FlyweightFactory $themeFactory */ - $this->themeFactory = Bootstrap::getObjectManager() - ->get('Magento\Framework\View\Design\Theme\FlyweightFactory'); } /** @@ -50,6 +62,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase */ public function testGetTemplateFile($file, $themePath, $module, $expectedFilename) { + $this->reinitializeEnvironment(); /** @var \Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile $model */ $model = Bootstrap::getObjectManager() ->create('Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile'); @@ -111,6 +124,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase */ public function testGetI18nCsvFile($themePath, $locale, $expectedFilename) { + $this->reinitializeEnvironment(); /** @var \Magento\Framework\View\Design\FileResolution\Fallback\File $model */ $model = Bootstrap::getObjectManager()->create('Magento\Framework\View\Design\FileResolution\Fallback\File'); $themeModel = $this->themeFactory->create($themePath); @@ -157,6 +171,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase */ public function testGetViewFile($file, $themePath, $locale, $module, $expectedFilename) { + $this->reinitializeEnvironment(); /** @var \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile $model */ $model = Bootstrap::getObjectManager() ->create('Magento\Framework\View\Design\FileResolution\Fallback\StaticFile'); @@ -237,4 +252,65 @@ class FallbackTest extends \PHPUnit_Framework_TestCase ], ]; } + + /** + * Test for the email template files fallback according to the themes inheritance + * + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Email/Model/_files/design/themes.php + * + * @param string $file + * @param string $themePath + * @param string $module + * @param string|null $expectedFilename + * + * @dataProvider getEmailTemplateFileDataProvider + */ + public function testGetEmailTemplateFile($file, $themePath, $module, $expectedFilename) + { + $area = \Magento\Framework\App\Area::AREA_FRONTEND; + + /** @var \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile $model */ + $model = Bootstrap::getObjectManager() + ->create('Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile'); + + $themeModel = $this->themeFactory->create($themePath); + $locale = \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE; + + $actualFilename = $model->getFile($area, $themeModel, $locale, $file, $module); + if ($expectedFilename) { + $this->assertInternalType('string', $actualFilename); + $this->assertStringMatchesFormat($expectedFilename, $actualFilename); + $this->assertFileExists($actualFilename); + } else { + $this->assertFalse($actualFilename); + } + } + + /** + * @return array + */ + public function getEmailTemplateFileDataProvider() + { + return [ + 'no fallback' => [ + 'account_new.html', + 'Vendor/custom_theme', + 'Magento_Customer', + '%s/frontend/Vendor/custom_theme/Magento_Customer/email/account_new.html', + ], + 'inherit same package & parent theme' => [ + 'account_new_confirmation.html', + 'Vendor/custom_theme', + 'Magento_Customer', + '%s/frontend/Vendor/default/Magento_Customer/email/account_new_confirmation.html', + ], + 'inherit parent package & grandparent theme' => [ + 'account_new_confirmed.html', + 'Vendor/custom_theme', + 'Magento_Customer', + '%s/frontend/Magento/default/Magento_Customer/email/account_new_confirmed.html', + ], + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php index 985b0fd9bad9c0594b81362d179b0c7997a835c6..3ba87cb00b69160e9f52d5532dfcedaa64b0acde 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php @@ -80,8 +80,8 @@ class EmailTest extends \PHPUnit_Framework_TestCase /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */ $transportBuilder = $this->_objectManager->get('Magento\TestFramework\Mail\Template\TransportBuilderMock'); $this->assertContains( - 'Hello John Smi=' . PHP_EOL . 'th', - $transportBuilder->getSentMessage()->getBodyHtml()->getContent() + 'John Smith,', + $transportBuilder->getSentMessage()->getBodyHtml()->getRawContent() ); } @@ -89,7 +89,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase { return [ [true], - [false] + [false], ]; } } diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php index 10b2024b303668c00168d2f466bd8cb123714801..062eade2ca5c3f82b12bed5d563c90a9d2dd0445 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php @@ -53,8 +53,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */ $transportBuilder = $this->_objectManager->get('Magento\TestFramework\Mail\Template\TransportBuilderMock'); $this->assertContains( - 'Hello John Smi=' . PHP_EOL . 'th', - $transportBuilder->getSentMessage()->getBodyHtml()->getContent() + 'John Smith,', + $transportBuilder->getSentMessage()->getBodyHtml()->getRawContent() ); } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php index e323a1f800a4c5b5cb01040af02fbf0493aaea8b..a906c64b5abf79f40fedc616edc619467ce933e8 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/Magento/Email/EmailTemplateConfigFilesTest.php @@ -55,8 +55,8 @@ class EmailTemplateConfigFilesTest extends \PHPUnit_Framework_TestCase $emailConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Email\Model\Template\Config' ); - foreach ($emailConfig->getAvailableTemplates() as $templateId) { - $data[$templateId] = [$templateId]; + foreach ($emailConfig->getAvailableTemplates() as $template) { + $data[$template['value']] = [$template['value']]; } return $data; } diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php index 8e2fd460901ab1db56e5dadeb88006be603d6681..703498cdd5dccae02546a305dbe2e7e4894a63c3 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php @@ -143,8 +143,8 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController ); $this->assertStringMatchesFormat( - '%AThank you, %A' - . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . '%A', + '%A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) + . ' wants to share this Wish List%A', $actualResult ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFilesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFilesTest.php index e4e8b509da43cedb2925339ec0d57e16d40d3475..241dbc1ca02848e19b0bcb3044aca7d37c35f2e1 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFilesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/App/Language/TranslationFilesTest.php @@ -5,6 +5,11 @@ */ namespace Magento\Test\Integrity\App\Language; +use Magento\Framework\App\Utility\Files; +use Magento\Setup\Module\I18n\Dictionary\Options\ResolverFactory; +use Magento\Setup\Module\I18n\Locale; +use Magento\Setup\Module\I18n\Pack\Writer\File\Csv; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -45,11 +50,8 @@ class TranslationFilesTest extends TranslationFiles { $parser = $this->prepareParser(); - $optionResolverFactory = new \Magento\Setup\Module\I18n\Dictionary\Options\ResolverFactory(); - $optionResolver = $optionResolverFactory->create( - \Magento\Framework\App\Utility\Files::init()->getPathToSource(), - true - ); + $optionResolverFactory = new ResolverFactory(); + $optionResolver = $optionResolverFactory->create(Files::init()->getPathToSource(), true); $parser->parse($optionResolver->getOptions()); @@ -77,9 +79,8 @@ class TranslationFilesTest extends TranslationFiles protected function buildFilePath($phrase, $context) { $path = $this->getContext()->buildPathToLocaleDirectoryByContext($phrase->getContextType(), $context); - return \Magento\Framework\App\Utility\Files::init()->getPathToSource() . '/' - . $path . \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE - . '.' . \Magento\Setup\Module\I18n\Pack\Writer\File\Csv::FILE_EXTENSION; + $sourcePath = Files::init()->getPathToSource(); + return $sourcePath . '/' . $path . Locale::DEFAULT_SYSTEM_LOCALE . '.' . Csv::FILE_EXTENSION; } /** @@ -107,6 +108,7 @@ class TranslationFilesTest extends TranslationFiles 'php' => new \Magento\Setup\Module\I18n\Parser\Adapter\Php($phraseCollector), 'js' => new \Magento\Setup\Module\I18n\Parser\Adapter\Js(), 'xml' => new \Magento\Setup\Module\I18n\Parser\Adapter\Xml(), + 'html' => new \Magento\Setup\Module\I18n\Parser\Adapter\Html(), ]; $parserContextual = new \Magento\Setup\Module\I18n\Parser\Contextual( @@ -123,7 +125,7 @@ class TranslationFilesTest extends TranslationFiles /** * @param string $text - * @return mixed + * @return string */ protected function eliminateSpecialChars($text) { diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php index 02f90937a42a39b5b28ea0a06faef351ce9f5fe5..2d8e5fc1a12419fe0ca03824c54fcad2007cb2a9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php @@ -22,7 +22,13 @@ class EmailTemplateTest extends \PHPUnit_Framework_TestCase $this->assertNotRegExp( '/\{\{htmlescape.*?\}\}/i', file_get_contents($file), - 'Directive {{htmlescape}} is obsolete. Use {{escapehtml}} instead.' + 'Directive {{htmlescape}} is obsolete. Use {{var}} instead.' + ); + + $this->assertNotRegExp( + '/\{\{escapehtml.*?\}\}/i', + file_get_contents($file), + 'Directive {{escapehtml}} is obsolete. Use {{var}} instead.' ); }, \Magento\Framework\App\Utility\Files::init()->getEmailTemplates() diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 44bc200898c18b53bdc1bc19dd1296ad7454a77e..942a0b23d3169d60405531afd1dd4ccd5cca4b2d 100755 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -3786,6 +3786,7 @@ return [ ['Magento\GoogleShopping\Test\Unit\Model\MassOperationsTest'], ['Magento\GoogleShopping\Test\Unit\Model\ObserverTest'], ['Magento\GoogleShopping\Test\Unit\Model\ServiceTest'], + ['Magento\Framework\View\Asset\ModuleNotation\Resolver', 'Magento\Framework\View\Asset\NotationResolver\Module'], ['Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\Price\Data'], ['Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Settings'], ['Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tabs\Configurable'], diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index ff1f860d884e9d94e96b9c39aa29458ee025ce52..ccb2deb9bd8e4850186a6331f980e85aabc36700 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -1711,7 +1711,7 @@ return [ [ 'convertModuleNotationToPath', 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation', - 'Magento\Framework\View\Asset\ModuleNotation\Resolver::convertModuleNotationToPath', + 'Magento\Framework\View\Asset\NotationResolver\Module::convertModuleNotationToPath', ], ['getViewFile', 'Magento\Framework\View\FileSystem', 'Magento\Framework\View\Asset\File::getSourceFile()'], [ @@ -2262,9 +2262,22 @@ return [ [ 'getConfigureUrl', 'Magento\Checkout\Block\Cart\Item\Renderer', - '\Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit::getConfigureUrl' + 'Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit::getConfigureUrl', ], ['getCurrenCategoryKey', 'Magento\Catalog\Block\Navigation', 'getCurrentCategoryKey'], + ['getUsedDefaultForPaths', 'Magento\Email\Block\Adminhtml\Template\Edit'], + ['getSystemConfigPathsWhereUsedAsDefault', 'Magento\Email\Model\BackendTemplate'], + ['_findEmailTemplateUsages', 'Magento\Email\Model\BackendTemplate'], + [ + 'getSystemConfigPathsWhereUsedCurrently', + 'Magento\Email\Model\BackendTemplate', + 'Magento\Email\Model\BackendTemplate::getSystemConfigPathsWhereCurrentlyUsed', + ], + [ + 'getUsedCurrentlyForPaths', + 'Magento\Email\Block\Adminhtml\Template\Edit', + 'Magento\Email\Block\Adminhtml\Template\Edit::getCurrentlyUsedForPaths', + ], ['_implodeStreetValue', 'Magento\Customer\Model\Address\AbstractAddress', '_implodeArrayValues',], ['_implodeStreetField', 'Magento\Customer\Model\Address\AbstractAddress', '_implodeArrayField',], ['_applyDesignConfig', 'Magento\Email\Model\AbstractTemplate', 'applyDesignConfig'], @@ -2278,6 +2291,16 @@ return [ ['_getCentinelEciLabel', 'Magento\Paypal\Model\Info'], ['_getPayPalPayflowPro3dSecure', 'Magento\Config\Test\Repository\Config'], ['_getPayPalPaymentsPro3dSecure', 'Magento\Config\Test\Repository\Config'], + [ + 'getCreatedAtFormated', + 'Magento\Sales\Model\Order', + 'Magento\Sales\Model\Order::getCreatedAtFormatted', + ], + [ + '_getConfig', + 'Magento\Store\Model\Store', + 'Magento\Store\Model\Store::getConfig', + ], ['addAdditionalFieldsToResponseFrontend', 'Magento\Authorizenet\Model\Directpost\Observer'], ['_getAuthorizeNet3dSecure', 'Magento\Config\Test\Repository\Config'], [ @@ -2311,6 +2334,9 @@ return [ 'Magento\Customer\Controller\Adminhtml\Index', 'Magento\Customer\Controller\Adminhtml\Index::initCurrentCustomer', ], + ['getChilds', 'Magento\Bundle\Block\Adminhtml\Sales\Order\Items\Renderer', 'getChildren'], + ['getChilds', 'Magento\Bundle\Block\Sales\Order\Items\Renderer', 'getChildren'], + ['getChilds', 'Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems', 'getChildren'], ['prepareIndexdata', 'Magento\Search\Helper\Data'], ['getPriceValues', 'Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\Collection'], ['getPricingValue', 'Magento\ConfigurableProduct\Model\Product\Type\Configurable\OptionValue'], diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php index 6200e3fcf9601c9a5f70d34d03e98979e256d76d..70598646726228e549f17497e88120e2fd9cf53d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_namespaces.php @@ -85,5 +85,6 @@ return [ ['Magento\Framework\Test\Utility', 'Magento\Framework\App\Utility'], ['Magento\GoogleShopping'], ['Magento\Paypal\Block\Standard'], - ['Magento\Paypal\Controller\Standard'] + ['Magento\Paypal\Controller\Standard'], + ['Magento\Framework\View\Asset\ModuleNotation'] ]; diff --git a/lib/internal/Magento/Framework/Acl/Test/Unit/Resource/Config/_files/invalidAclXmlArray.php b/lib/internal/Magento/Framework/Acl/Test/Unit/Resource/Config/_files/invalidAclXmlArray.php index 57b0896342a0205bef4cbe0fa02004086d5b3780..3ea8dced9b520dbc3ac64ebd29befbcb08ad0c29 100644 --- a/lib/internal/Magento/Framework/Acl/Test/Unit/Resource/Config/_files/invalidAclXmlArray.php +++ b/lib/internal/Magento/Framework/Acl/Test/Unit/Resource/Config/_files/invalidAclXmlArray.php @@ -49,7 +49,7 @@ return [ '</resources></acl></config>', [ "Element 'resource', attribute 'id': [facet 'pattern'] The value 'test_Value::show_toolbar' is " . - "not accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "not accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource', attribute 'id': 'test_Value::show_toolbar' is not a valid value of the atomic type " . "'typeId'.", "Element 'resource', attribute 'id': Warning: No precomputed value available, " . @@ -62,7 +62,7 @@ return [ '</resources></acl></config>', [ "Element 'resource', attribute 'id': [facet 'pattern'] The value 'Test_value::show_toolbar' is not " . - "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource', attribute 'id': 'Test_value::show_toolbar' is not a valid value of the atomic type " . "'typeId'.", "Element 'resource', attribute 'id': Warning: No precomputed value available, " . @@ -75,7 +75,7 @@ return [ '</resources></acl></config>', [ "Element 'resource', attribute 'id': [facet 'pattern'] The value 'M@#$%^*_Value::show_toolbar' is not " . - "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource', attribute 'id': 'M@#$%^*_Value::show_toolbar' " . "is not a valid value of the atomic type " . "'typeId'.", @@ -89,7 +89,7 @@ return [ '</resources></acl></config>', [ "Element 'resource', attribute 'id': [facet 'pattern'] The value '_Value::show_toolbar' is not " . - "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource', attribute 'id': '_Value::show_toolbar' " . "is not a valid value of the atomic type 'typeId'.", "Element 'resource', attribute 'id': " . @@ -102,7 +102,7 @@ return [ '</acl></config>', [ "Element 'resource', attribute 'id': [facet 'pattern'] The value 'Value_::show_toolbar' is not " . - "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource', attribute 'id': 'Value_::show_toolbar' " . "is not a valid value of the atomic type 'typeId'.", "Element 'resource', attribute 'id': " . @@ -115,7 +115,7 @@ return [ '</resources></acl></config>', [ "Element 'resource', attribute 'id': [facet 'pattern'] The value 'Test_value:show_toolbar' is not " . - "accepted by the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource', attribute 'id': 'Test_value:show_toolbar' is not a valid value of the atomic " . "type 'typeId'.", "Element 'resource', attribute 'id': " . @@ -127,7 +127,7 @@ return [ '<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::"/></resources>' . '</acl></config>', [ "Element 'resource', attribute 'id': [facet 'pattern'] The value 'Test_Value::' is not accepted by " . - "the pattern '[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", + "the pattern '[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.", "Element 'resource', attribute 'id': 'Test_Value::' is not a valid value of the atomic type 'typeId'.", "Element 'resource', attribute 'id': " . "Warning: No precomputed value available, the value was either invalid " . diff --git a/lib/internal/Magento/Framework/Acl/etc/acl.xsd b/lib/internal/Magento/Framework/Acl/etc/acl.xsd index 80285b344c09b7afb396bb9446f43f04a9b4f5d6..960f6b45f0380b0c7246a3fff91f87b80d7f43c7 100644 --- a/lib/internal/Magento/Framework/Acl/etc/acl.xsd +++ b/lib/internal/Magento/Framework/Acl/etc/acl.xsd @@ -61,7 +61,7 @@ </xs:annotation> <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}" /> + <xs:pattern value="[A-Z]+[a-zA-Z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}" /> </xs:restriction> </xs:simpleType> diff --git a/lib/internal/Magento/Framework/App/State.php b/lib/internal/Magento/Framework/App/State.php index 727b30c68245e7bd24d7c046b18fb4a20398ce73..773a20ad016d881571bbbab3f09d54c91645a5da 100644 --- a/lib/internal/Magento/Framework/App/State.php +++ b/lib/internal/Magento/Framework/App/State.php @@ -49,6 +49,13 @@ class State */ protected $_areaCode; + /** + * Is area code being emulated + * + * @var bool + */ + protected $_isAreaCodeEmulated = false; + /**#@+ * Application modes */ @@ -158,6 +165,16 @@ class State return $this->_areaCode; } + /** + * Checks whether area code is being emulated + * + * @return bool + */ + public function isAreaCodeEmulated() + { + return $this->_isAreaCodeEmulated; + } + /** * Emulate callback inside some area code * @@ -171,13 +188,16 @@ class State { $currentArea = $this->_areaCode; $this->_areaCode = $areaCode; + $this->_isAreaCodeEmulated = true; try { $result = call_user_func_array($callback, $params); } catch (\Exception $e) { $this->_areaCode = $currentArea; + $this->_isAreaCodeEmulated = false; throw $e; } $this->_areaCode = $currentArea; + $this->_isAreaCodeEmulated = false; return $result; } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php index 4bc544940975d7043a8683587af2e8ea10efdc31..11f2a88115a2a44b894371908343b6af89528338 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php @@ -80,6 +80,36 @@ class StateTest extends \PHPUnit_Framework_TestCase return $this->model->getAreaCode(); } + public function testIsAreaCodeEmulated() + { + $areaCode = 'original code'; + $emulatedCode = 'emulated code'; + $this->scopeMock->expects($this->once())->method('setCurrentScope')->with($areaCode); + $this->model->setAreaCode($areaCode); + $this->assertFalse( + $this->model->isAreaCodeEmulated(), + 'By default, area code is not emulated' + ); + $this->assertTrue( + $this->model->emulateAreaCode($emulatedCode, [$this, 'isAreaCodeEmulatedCallback']), + 'isAreaCodeEmulated should return true when being called within the context of an emulated method' + ); + $this->assertFalse( + $this->model->isAreaCodeEmulated(), + 'Now that emulateAreaCode execution has finished, this should return false again' + ); + } + + /** + * Used to test whether the isAreaCodeEmulated method returns true within an emulated context + * + * @return bool + */ + public function isAreaCodeEmulatedCallback() + { + return $this->model->isAreaCodeEmulated(); + } + /** * @expectedException \Exception * @expectedExceptionMessage Some error diff --git a/lib/internal/Magento/Framework/File/Csv.php b/lib/internal/Magento/Framework/File/Csv.php index 4844401ac672ad7d3d66571aa9c903f661fecd3f..a2a1c127e422fd209314bb755df2739c13daad1e 100644 --- a/lib/internal/Magento/Framework/File/Csv.php +++ b/lib/internal/Magento/Framework/File/Csv.php @@ -84,7 +84,7 @@ class Csv { $data = []; if (!file_exists($file)) { - throw new \Exception('File "' . $file . '" do not exists'); + throw new \Exception('File "' . $file . '" does not exist'); } $fh = fopen($file, 'r'); diff --git a/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php b/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php index d478b4af66fa4a12c08ac0e8cdf0cca485553050..4ad73c5a1c0bac46f4aa0d145bf2ca3a11065dc3 100644 --- a/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php +++ b/lib/internal/Magento/Framework/File/Test/Unit/CsvTest.php @@ -54,7 +54,7 @@ class CsvTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Exception - * @expectedExceptionMessage File "FileNameThatShouldNotExist" do not exists + * @expectedExceptionMessage File "FileNameThatShouldNotExist" does not exist */ public function testGetDataFileNonExistent() { diff --git a/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/WriteTest.php b/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/WriteTest.php index 4216bf42b2e1957c97e5212a56225905d8e518a9..afc617934837db35061a105c9f5a9ebb17226b65 100644 --- a/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/WriteTest.php +++ b/lib/internal/Magento/Framework/Filesystem/Test/Unit/File/WriteTest.php @@ -5,7 +5,9 @@ */ namespace Magento\Framework\Filesystem\Test\Unit\File; -use \Magento\Framework\Filesystem\File\Write; +use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Filesystem\File\Write; +use Magento\Framework\Phrase; /** * Class WriteTest @@ -126,12 +128,13 @@ class WriteTest extends \PHPUnit_Framework_TestCase public function testWriteException() { $data = 'data'; + $emptyTranslation = ''; + $this->driver->expects($this->once()) ->method('fileWrite') ->with($this->resource, $data) - ->willThrowException( - new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('')) - ); + ->willThrowException(new FileSystemException(new Phrase($emptyTranslation))); + $this->file->write($data); } @@ -143,12 +146,13 @@ class WriteTest extends \PHPUnit_Framework_TestCase $data = []; $delimiter = ','; $enclosure = '"'; + $emptyTranslation = ''; + $this->driver->expects($this->once()) ->method('filePutCsv') ->with($this->resource, $data, $delimiter, $enclosure) - ->willThrowException( - new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('')) - ); + ->willThrowException(new FileSystemException(new Phrase($emptyTranslation))); + $this->file->writeCsv($data, $delimiter, $enclosure); } @@ -157,12 +161,13 @@ class WriteTest extends \PHPUnit_Framework_TestCase */ public function testFlushException() { + $emptyTranslation = ''; + $this->driver->expects($this->once()) ->method('fileFlush') ->with($this->resource) - ->willThrowException( - new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('')) - ); + ->willThrowException(new FileSystemException(new Phrase($emptyTranslation))); + $this->file->flush(); } diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php index c5c77e09f14a724448695a75d3c61ca58d195d95..79433be98a54aedea2d8e3a6b699d76397a0838e 100644 --- a/lib/internal/Magento/Framework/Filter/Template.php +++ b/lib/internal/Magento/Framework/Filter/Template.php @@ -39,14 +39,14 @@ class Template implements \Zend_Filter_Interface * * @var array */ - protected $_templateVars = []; + protected $templateVars = []; /** * Template processor * * @var callable|null */ - protected $_templateProcessor = null; + protected $templateProcessor = null; /** * @var \Magento\Framework\Stdlib\String @@ -72,7 +72,7 @@ class Template implements \Zend_Filter_Interface public function setVariables(array $variables) { foreach ($variables as $name => $value) { - $this->_templateVars[$name] = $value; + $this->templateVars[$name] = $value; } return $this; } @@ -85,7 +85,7 @@ class Template implements \Zend_Filter_Interface */ public function setTemplateProcessor(callable $callback) { - $this->_templateProcessor = $callback; + $this->templateProcessor = $callback; return $this; } @@ -96,7 +96,7 @@ class Template implements \Zend_Filter_Interface */ public function getTemplateProcessor() { - return is_callable($this->_templateProcessor) ? $this->_templateProcessor : null; + return is_callable($this->templateProcessor) ? $this->templateProcessor : null; } /** @@ -202,12 +202,12 @@ class Template implements \Zend_Filter_Interface */ public function varDirective($construction) { - if (count($this->_templateVars) == 0) { + if (count($this->templateVars) == 0) { // If template prepossessing return $construction[0]; } - $replacedValue = $this->_getVariable($construction[2], ''); + $replacedValue = $this->getVariable($construction[2], ''); return $replacedValue; } @@ -227,7 +227,7 @@ class Template implements \Zend_Filter_Interface public function templateDirective($construction) { // Processing of {template config_path=... [...]} statement - $templateParameters = $this->_getParameters($construction[2]); + $templateParameters = $this->getParameters($construction[2]); if (!isset($templateParameters['config_path']) or !$this->getTemplateProcessor()) { // Not specified template or not set include processor $replacedValue = '{Error in template processing}'; @@ -235,7 +235,7 @@ class Template implements \Zend_Filter_Interface // Including of template $configPath = $templateParameters['config_path']; unset($templateParameters['config_path']); - $templateParameters = array_merge_recursive($templateParameters, $this->_templateVars); + $templateParameters = array_merge_recursive($templateParameters, $this->templateVars); $replacedValue = call_user_func($this->getTemplateProcessor(), $configPath, $templateParameters); } return $replacedValue; @@ -247,12 +247,12 @@ class Template implements \Zend_Filter_Interface */ public function dependDirective($construction) { - if (count($this->_templateVars) == 0) { + if (count($this->templateVars) == 0) { // If template processing return $construction[0]; } - if ($this->_getVariable($construction[1], '') == '') { + if ($this->getVariable($construction[1], '') == '') { return ''; } else { return $construction[2]; @@ -265,11 +265,11 @@ class Template implements \Zend_Filter_Interface */ public function ifDirective($construction) { - if (count($this->_templateVars) == 0) { + if (count($this->templateVars) == 0) { return $construction[0]; } - if ($this->_getVariable($construction[1], '') == '') { + if ($this->getVariable($construction[1], '') == '') { if (isset($construction[3]) && isset($construction[4])) { return $construction[4]; } @@ -285,14 +285,14 @@ class Template implements \Zend_Filter_Interface * @param string $value raw parameters * @return array */ - protected function _getParameters($value) + protected function getParameters($value) { $tokenizer = new Template\Tokenizer\Parameter(); $tokenizer->setString($value); $params = $tokenizer->tokenize(); foreach ($params as $key => $value) { if (substr($value, 0, 1) === '$') { - $params[$key] = $this->_getVariable(substr($value, 1), null); + $params[$key] = $this->getVariable(substr($value, 1), null); } } return $params; @@ -306,7 +306,7 @@ class Template implements \Zend_Filter_Interface * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - protected function _getVariable($value, $default = '{no_value_defined}') + protected function getVariable($value, $default = '{no_value_defined}') { \Magento\Framework\Profiler::start('email_template_processing_variables'); $tokenizer = new Template\Tokenizer\Variable(); @@ -315,12 +315,12 @@ class Template implements \Zend_Filter_Interface $result = $default; $last = 0; for ($i = 0; $i < count($stackVars); $i++) { - if ($i == 0 && isset($this->_templateVars[$stackVars[$i]['name']])) { + if ($i == 0 && isset($this->templateVars[$stackVars[$i]['name']])) { // Getting of template value - $stackVars[$i]['variable'] = & $this->_templateVars[$stackVars[$i]['name']]; - } elseif (isset( - $stackVars[$i - 1]['variable'] - ) && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\Object + $stackVars[$i]['variable'] = & $this->templateVars[$stackVars[$i]['name']]; + } elseif ( + isset($stackVars[$i - 1]['variable']) + && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\Object ) { // If object calling methods or getting properties if ($stackVars[$i]['type'] == 'property') { @@ -333,15 +333,11 @@ class Template implements \Zend_Filter_Interface ); } elseif ($stackVars[$i]['type'] == 'method') { // Calling of object method - if (method_exists( - $stackVars[$i - 1]['variable'], - $stackVars[$i]['name'] - ) || substr( - $stackVars[$i]['name'], - 0, - 3 - ) == 'get' + if ( + method_exists($stackVars[$i - 1]['variable'], $stackVars[$i]['name']) + || substr($stackVars[$i]['name'], 0, 3) == 'get' ) { + $stackVars[$i]['args'] = $this->getStackArgs($stackVars[$i]['args']); $stackVars[$i]['variable'] = call_user_func_array( [$stackVars[$i - 1]['variable'], $stackVars[$i]['name']], $stackVars[$i]['args'] @@ -359,4 +355,22 @@ class Template implements \Zend_Filter_Interface \Magento\Framework\Profiler::stop('email_template_processing_variables'); return $result; } + + /** + * Loops over a set of stack args to process variables into array argument values + * + * @param array $stack + * @return array + */ + protected function getStackArgs($stack) + { + foreach ($stack as $i => $value) { + if (is_array($value)) { + $stack[$i] = $this->getStackArgs($value); + } elseif (substr($value, 0, 1) === '$') { + $stack[$i] = $this->getVariable(substr($value, 1), null); + } + } + return $stack; + } } diff --git a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/AbstractTokenizer.php b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/AbstractTokenizer.php index 873614729ffdbd85db257aa6c92c6f07ddc63d5d..6bf9f04cd8d718c6a3e9c4c028f4b32562db0493 100644 --- a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/AbstractTokenizer.php +++ b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/AbstractTokenizer.php @@ -58,6 +58,24 @@ abstract class AbstractTokenizer return true; } + /** + * Move current index backwards. + * + * If index out of bounds returns false + * + * @param int $distance number of characters to backtrack + * @return bool + */ + public function back($distance) + { + if ($this->_currentIndex - $distance < 0) { + return false; + } + + $this->_currentIndex -= $distance; + return true; + } + /** * Return current char * diff --git a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php index 377219601d2d6481ff560f220b87d7fa71f7eae0..45314729f42df271731cb5644dd513f9c8961836 100644 --- a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php +++ b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php @@ -10,6 +10,13 @@ namespace Magento\Framework\Filter\Template\Tokenizer; */ class Variable extends \Magento\Framework\Filter\Template\Tokenizer\AbstractTokenizer { + /** + * Internal counter used to keep track of how deep in array parsing we are + * + * @var int + */ + protected $arrayDepth = 0; + /** * Tokenize string and return getted variable stack path * @@ -60,7 +67,6 @@ class Variable extends \Magento\Framework\Filter\Template\Tokenizer\AbstractToke * Get string value for method args * * @return string - * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function getString() { @@ -68,9 +74,9 @@ class Variable extends \Magento\Framework\Filter\Template\Tokenizer\AbstractToke if ($this->isWhiteSpace()) { return $value; } - $qouteStart = $this->isQuote(); + $quoteStart = $this->isQuote(); - if ($qouteStart) { + if ($quoteStart) { $breakSymbol = $this->char(); } else { $breakSymbol = false; @@ -78,7 +84,7 @@ class Variable extends \Magento\Framework\Filter\Template\Tokenizer\AbstractToke } while ($this->next()) { - if (!$breakSymbol && ($this->isWhiteSpace() || $this->char() == ',' || $this->char() == ')')) { + if (!$breakSymbol && $this->isStringBreak()) { $this->prev(); break; } elseif ($breakSymbol && $this->char() == $breakSymbol) { @@ -93,6 +99,137 @@ class Variable extends \Magento\Framework\Filter\Template\Tokenizer\AbstractToke return $value; } + /** + * Get array member key or return false if none present + * + * @return bool|string + */ + public function getMemberKey() + { + $value = ''; + if ($this->isWhiteSpace()) { + return $value; + } + + $quoteStart = $this->isQuote(); + + if ($quoteStart) { + $closeQuote = $this->char(); + } else { + $closeQuote = false; + $value .= $this->char(); + } + + while ($this->next()) { + if ($closeQuote) { + if ($this->char() == $closeQuote) { + $closeQuote = false; + continue; + } + $value .= $this->char(); + } elseif ($this->char() == ':') { + $this->next(); + return $value; + } elseif ($this->isStringBreak()) { + $this->prev(); + break; + } else { + $value .= $this->char(); + } + } + + if ($quoteStart) { + $this->back(strlen($value) + 1); + } else { + $this->back(strlen($value) - 1); + } + return false; + } + + /** + * Get array value for method args + * + * Parses arrays demarcated via open/closing brackets. Keys/value pairs are separated by a + * single colon character. Multi-dimensional arrays are supported. Example input: + * + * [key:value, "key2":"value2", [ + * [123, foo], + * ]] + * + * @return array + */ + public function getArray() + { + $values = []; + if (!$this->isArray()) { + return $values; + } + + $this->incArrayDepth(); + + while ($this->next()) { + if ($this->char() == ']') { + break; + } elseif ($this->isWhiteSpace() || $this->char() == ',') { + continue; + } + + $key = $this->getMemberKey(); + + if ($this->isNumeric()) { + $val = $this->getNumber(); + } elseif ($this->isArray()) { + $val = $this->getArray(); + } else { + $val = $this->getString(); + } + + if ($key) { + $values[$key] = $val; + } else { + $values[] = $val; + } + } + + $this->decArrayDepth(); + return $values; + } + + /** + * Return the internal array depth counter + * + * @return int + */ + protected function getArrayDepth() + { + return $this->arrayDepth; + } + + /** + * Increment the internal array depth counter + * + * @return void + */ + protected function incArrayDepth() + { + $this->arrayDepth++; + } + + /** + * Decrement the internal array depth counter + * + * If depth is already 0 do nothing + * + * @return void + */ + protected function decArrayDepth() + { + if ($this->arrayDepth == 0) { + return; + } + $this->arrayDepth--; + } + /** * Return true if current char is a number * @@ -113,6 +250,31 @@ class Variable extends \Magento\Framework\Filter\Template\Tokenizer\AbstractToke return $this->char() == '"' || $this->char() == "'"; } + /** + * Retrun true if current char is opening boundary for an array + * + * @return bool + */ + public function isArray() + { + return $this->char() == '['; + } + + /** + * Return true if current char is closing boundary for string + * + * @return bool + */ + public function isStringBreak() + { + if ($this->getArrayDepth() == 0 && ($this->isWhiteSpace() || $this->char() == ',' || $this->char() == ')')) { + return true; + } elseif ($this->getArrayDepth() > 0 && ($this->char() == ',' || $this->char() == ']')) { + return true; + } + return false; + } + /** * Return array of arguments for method * @@ -127,6 +289,8 @@ class Variable extends \Magento\Framework\Filter\Template\Tokenizer\AbstractToke continue; } elseif ($this->isNumeric()) { $value[] = $this->getNumber(); + } elseif ($this->isArray()) { + $value[] = $this->getArray(); } else { $value[] = $this->getString(); } diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/Template/Tokenizer/VariableTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/Template/Tokenizer/VariableTest.php index 6765a9fb34fdf93201ecaf7c72c541f6ffb9cde7..a6c172f208f8769604d71db03deb90b6249cee9e 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/Template/Tokenizer/VariableTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/Template/Tokenizer/VariableTest.php @@ -38,7 +38,33 @@ class VariableTest extends \PHPUnit_Framework_TestCase "invoke(arg1, arg2, 2, 2.7, -1, 'Mike\\'s')", [['type' => 'method', 'name' => 'invoke', 'args' => ['arg1', 'arg2', 2, 2.7, -1, "Mike's"]]] ], - [" ", []] + [ + 'var.method("value_1", [ _param_1:$bogus.prop, + _param_2:$foo.bar,_param_3:12345, + call:$var.method("param"), + id:foobar, + [123, foobar], + bar:["foo", 1234, $foo.bar], + "foo:bar":[bar, "1234", \'$foo.bar\'], + ])', + [ + ['type' => 'variable', 'name' => 'var'], + ['type' => 'method', 'name' => 'method', 'args' => [ + 'value_1', + [ + '_param_1' => '$bogus.prop', + '_param_2' => '$foo.bar', + '_param_3' => 12345, + 'call' => '$var.method("param")', + 'id' => 'foobar', + 0 => [123, 'foobar'], + 'bar' => ['foo', 1234, '$foo.bar'], + 'foo:bar' => ['bar', "1234", '$foo.bar'], + ], + ]], + ], + ], + [" ", []], ]; } } diff --git a/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php b/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php index b65114a68a0d06c9e76cf272f2a2b5bd5b95608a..ee098f8614b95b2a8bc2b5da32f5182b0461fb2a 100644 --- a/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php +++ b/lib/internal/Magento/Framework/Filter/Test/Unit/TemplateTest.php @@ -125,4 +125,67 @@ EXPECTED_RESULT; // Callback should *not* run as callbacks should be reset $this->assertEquals($value, $this->templateFilter->filter($value)); } + + /** + * @covers \Magento\Framework\Filter\Template::varDirective + * @covers \Magento\Framework\Filter\Template::getVariable + * @covers \Magento\Framework\Filter\Template::getStackArgs + * @dataProvider varDirectiveDataProvider + */ + public function testVarDirective($construction, $variables, $expectedResult) + { + $this->templateFilter->setVariables($variables); + $this->assertEquals($expectedResult, $this->templateFilter->filter($construction)); + } + + public function varDirectiveDataProvider() + { + /* @var $stub \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject */ + $stub = $this->getMockBuilder('\Magento\Framework\Object') + ->disableOriginalConstructor() + ->disableProxyingToOriginalMethods() + ->setMethods(['bar']) + ->getMock(); + + $stub->expects($this->once()) + ->method('bar') + ->will($this->returnCallback(function ($arg) { + return serialize($arg); + })); + + return [ + 'no variables' => [ + '{{var}}', + [], + '{{var}}', + ], + 'invalid variable' => [ + '{{var invalid}}', + ['foobar' => 'barfoo'], + '', + ], + 'string variable' => [ + '{{var foobar}}', + ['foobar' => 'barfoo'], + 'barfoo', + ], + 'array argument to method' => [ + '{{var foo.bar([param_1:value_1, param_2:$value_2, param_3:[a:$b, c:$d]])}}', + [ + 'foo' => $stub, + 'value_2' => 'lorem', + 'b' => 'bee', + 'd' => 'dee', + ], + serialize([ + 'param_1' => 'value_1', + 'param_2' => 'lorem', + 'param_3' => [ + 'a' => 'bee', + 'c' => 'dee', + ], + ]), + ], + ]; + } } diff --git a/lib/internal/Magento/Framework/Image/Test/Unit/Adapter/ImageMagickTest.php b/lib/internal/Magento/Framework/Image/Test/Unit/Adapter/ImageMagickTest.php index 8b6040295019264e3cc6c77fe38a851638e2f391..96ace9e4d648980d6d031d411222e3b7565a74a7 100644 --- a/lib/internal/Magento/Framework/Image/Test/Unit/Adapter/ImageMagickTest.php +++ b/lib/internal/Magento/Framework/Image/Test/Unit/Adapter/ImageMagickTest.php @@ -85,7 +85,9 @@ class ImageMagickTest extends \PHPUnit_Framework_TestCase */ public function testSaveWithException() { - $exception = new FileSystemException(new \Magento\Framework\Phrase('')); + $exception = new FileSystemException( + new \Magento\Framework\Phrase('Unable to write file into directory product/cache. Access forbidden.') + ); $this->writeMock->method('create')->will($this->throwException($exception)); $this->loggerMock->expects($this->once())->method('critical')->with($exception); $this->imageMagic->save('product/cache', 'sample.jpg'); diff --git a/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php b/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php index 65d40b3ce8dbfd059b109781a569c36a7ee2b431..098849a2f25cc144a5fba6f93dc0f392048ae471 100644 --- a/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php +++ b/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/Import.php @@ -9,7 +9,7 @@ namespace Magento\Framework\Less\PreProcessor\Instruction; use Magento\Framework\View\Asset\LocalInterface; -use Magento\Framework\View\Asset\ModuleNotation; +use Magento\Framework\View\Asset\NotationResolver; use Magento\Framework\View\Asset\PreProcessorInterface; /** @@ -24,7 +24,7 @@ class Import implements PreProcessorInterface '#@import\s+(\((?P<type>\w+)\)\s+)?[\'\"](?P<path>(?![/\\\]|\w:[/\\\])[^\"\']+)[\'\"]\s*?(?P<media>.*?);#'; /** - * @var \Magento\Framework\View\Asset\ModuleNotation\Resolver + * @var \Magento\Framework\View\Asset\NotationResolver\Module */ private $notationResolver; @@ -34,9 +34,9 @@ class Import implements PreProcessorInterface protected $relatedFiles = []; /** - * @param ModuleNotation\Resolver $notationResolver + * @param NotationResolver\Module $notationResolver */ - public function __construct(ModuleNotation\Resolver $notationResolver) + public function __construct(NotationResolver\Module $notationResolver) { $this->notationResolver = $notationResolver; } diff --git a/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/MagentoImport.php b/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/MagentoImport.php index 26d95fb2c26d86abfc57ed62f52fd7b33d0336d8..03e355251618724f0d3497b5e85cf56de8ae97a2 100644 --- a/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/MagentoImport.php +++ b/lib/internal/Magento/Framework/Less/PreProcessor/Instruction/MagentoImport.php @@ -20,7 +20,8 @@ class MagentoImport implements PreProcessorInterface /** * PCRE pattern that matches @magento_import LESS instruction */ - const REPLACE_PATTERN = '#//@magento_import\s+[\'\"](?P<path>(?![/\\\]|\w:[/\\\])[^\"\']+)[\'\"]\s*?;#'; + const REPLACE_PATTERN = + '#//@magento_import(?P<reference>\s+\(reference\))?\s+[\'\"](?P<path>(?![/\\\]|\w:[/\\\])[^\"\']+)[\'\"]\s*?;#'; /** * @var DesignInterface @@ -92,14 +93,16 @@ class MagentoImport implements PreProcessorInterface $importsContent = ''; try { $matchedFileId = $matchedContent['path']; + $isReference = !empty($matchedContent['reference']); $relatedAsset = $this->assetRepo->createRelated($matchedFileId, $asset); $resolvedPath = $relatedAsset->getFilePath(); $importFiles = $this->fileSource->getFiles($this->getTheme($relatedAsset), $resolvedPath); /** @var $importFile \Magento\Framework\View\File */ foreach ($importFiles as $importFile) { + $referenceString = $isReference ? '(reference) ' : ''; $importsContent .= $importFile->getModule() - ? "@import '{$importFile->getModule()}::{$resolvedPath}';\n" - : "@import '{$matchedFileId}';\n"; + ? "@import $referenceString'{$importFile->getModule()}::{$resolvedPath}';\n" + : "@import $referenceString'{$matchedFileId}';\n"; } } catch (\LogicException $e) { $this->errorHandler->processException($e); diff --git a/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/ImportTest.php b/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/ImportTest.php index 99c0f0e2f61e78d775474fb9d9daa3e27950074c..367963a47949af3c49ded54298d189a370a5f062 100644 --- a/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/ImportTest.php +++ b/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/ImportTest.php @@ -11,7 +11,7 @@ namespace Magento\Framework\Less\Test\Unit\PreProcessor\Instruction; class ImportTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\View\Asset\ModuleNotation\Resolver|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\View\Asset\NotationResolver\Module|\PHPUnit_Framework_MockObject_MockObject */ private $notationResolver; @@ -28,7 +28,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->notationResolver = $this->getMock( - '\Magento\Framework\View\Asset\ModuleNotation\Resolver', [], [], '', false + '\Magento\Framework\View\Asset\NotationResolver\Module', [], [], '', false ); $this->asset = $this->getMock('\Magento\Framework\View\Asset\File', [], [], '', false); $this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css')); diff --git a/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php b/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php index f4b0be5f57e58cc5c4e1ed47a40841787dd1ef36..e8837987d1406d6ee9a78b8ea6eb946f6b0b0193 100644 --- a/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php +++ b/lib/internal/Magento/Framework/Less/Test/Unit/PreProcessor/Instruction/MagentoImportTest.php @@ -135,6 +135,27 @@ class MagentoImportTest extends \PHPUnit_Framework_TestCase ], "@import 'Magento_Module::some/file.css';\n@import 'Magento_Two::some/file.css';\n", ], + 'non-modular reference notation' => [ + '//@magento_import (reference) "some/file.css";', + 'some/file.css', + 'some/file.css', + [ + ['module' => null, 'filename' => 'some/file.css'], + ['module' => null, 'filename' => 'theme/some/file.css'], + ], + "@import (reference) 'some/file.css';\n@import (reference) 'some/file.css';\n", + ], + 'modular reference' => [ + '//@magento_import (reference) "Magento_Module::some/file.css";', + 'Magento_Module::some/file.css', + 'some/file.css', + [ + ['module' => 'Magento_Module', 'filename' => 'some/file.css'], + ['module' => 'Magento_Two', 'filename' => 'some/file.css'], + ], + "@import (reference) 'Magento_Module::some/file.css';\n" . + "@import (reference) 'Magento_Two::some/file.css';\n", + ], ]; } diff --git a/lib/internal/Magento/Framework/Mail/Template/ConfigInterface.php b/lib/internal/Magento/Framework/Mail/Template/ConfigInterface.php index 8facd1165de75a0d1425e8d32553cd9b73672e1a..53a6704d3b4b1d0aee0110135dc33e4d74f990d6 100644 --- a/lib/internal/Magento/Framework/Mail/Template/ConfigInterface.php +++ b/lib/internal/Magento/Framework/Mail/Template/ConfigInterface.php @@ -43,11 +43,20 @@ interface ConfigInterface */ public function getTemplateModule($templateId); + /** + * Retrieve the area an email template belongs to + * + * @param string $templateId + * @return string + */ + public function getTemplateArea($templateId); + /** * Retrieve full path to an email template file * * @param string $templateId + * @param array|null $designParams * @return string */ - public function getTemplateFilename($templateId); + public function getTemplateFilename($templateId, $designParams = []); } diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php index 5cfae3507d6f443c117bb0a9bd4eb5170d249f69..cb647d4bd9666bae213f803742b5f38c7442ba73 100644 --- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php +++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php @@ -6,10 +6,14 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Mail\Template; +use Magento\Framework\App\TemplateTypesInterface; +use Magento\Framework\Mail\Message; +use Magento\Framework\Mail\MessageInterface; +use Magento\Framework\Mail\TransportInterfaceFactory; +use Magento\Framework\ObjectManagerInterface; + class TransportBuilder { /** @@ -75,17 +79,17 @@ class TransportBuilder /** * @param FactoryInterface $templateFactory - * @param \Magento\Framework\Mail\Message $message - * @param \Magento\Framework\Mail\Template\SenderResolverInterface $senderResolver - * @param \Magento\Framework\ObjectManagerInterface $objectManager - * @param \Magento\Framework\Mail\TransportInterfaceFactory $mailTransportFactory + * @param Message $message + * @param SenderResolverInterface $senderResolver + * @param ObjectManagerInterface $objectManager + * @param TransportInterfaceFactory $mailTransportFactory */ public function __construct( - \Magento\Framework\Mail\Template\FactoryInterface $templateFactory, - \Magento\Framework\Mail\Message $message, - \Magento\Framework\Mail\Template\SenderResolverInterface $senderResolver, - \Magento\Framework\ObjectManagerInterface $objectManager, - \Magento\Framework\Mail\TransportInterfaceFactory $mailTransportFactory + FactoryInterface $templateFactory, + Message $message, + SenderResolverInterface $senderResolver, + ObjectManagerInterface $objectManager, + TransportInterfaceFactory $mailTransportFactory ) { $this->templateFactory = $templateFactory; $this->message = $message; @@ -229,13 +233,9 @@ class TransportBuilder */ protected function getTemplate() { - return $this->templateFactory->get( - $this->templateIdentifier - )->setVars( - $this->templateVars - )->setOptions( - $this->templateOptions - ); + return $this->templateFactory->get($this->templateIdentifier) + ->setVars($this->templateVars) + ->setOptions($this->templateOptions); } /** @@ -247,18 +247,14 @@ class TransportBuilder { $template = $this->getTemplate(); $types = [ - \Magento\Framework\App\TemplateTypesInterface::TYPE_TEXT => \Magento\Framework\Mail\MessageInterface::TYPE_TEXT, - \Magento\Framework\App\TemplateTypesInterface::TYPE_HTML => \Magento\Framework\Mail\MessageInterface::TYPE_HTML, + TemplateTypesInterface::TYPE_TEXT => MessageInterface::TYPE_TEXT, + TemplateTypesInterface::TYPE_HTML => MessageInterface::TYPE_HTML, ]; $body = $template->processTemplate(); - $this->message->setMessageType( - $types[$template->getType()] - )->setBody( - $body - )->setSubject( - $template->getSubject() - ); + $this->message->setMessageType($types[$template->getType()]) + ->setBody($body) + ->setSubject($template->getSubject()); return $this; } diff --git a/lib/internal/Magento/Framework/Translate.php b/lib/internal/Magento/Framework/Translate.php index d125d445688a0b454937de3ce9b2524629d1e8f7..4cf9f524400fe190fe45635c5183f2d3a288fde8 100644 --- a/lib/internal/Magento/Framework/Translate.php +++ b/lib/internal/Magento/Framework/Translate.php @@ -387,6 +387,8 @@ class Translate implements \Magento\Framework\TranslateInterface public function setLocale($locale) { $this->_localeCode = $locale; + $this->_config['locale'] = $locale; + $this->getCacheId(true); return $this; } diff --git a/lib/internal/Magento/Framework/View/Asset/ModuleNotation/Resolver.php b/lib/internal/Magento/Framework/View/Asset/NotationResolver/Module.php similarity index 95% rename from lib/internal/Magento/Framework/View/Asset/ModuleNotation/Resolver.php rename to lib/internal/Magento/Framework/View/Asset/NotationResolver/Module.php index acef54ce8ff013a5e1368d8c2227658d91d18ac7..a20fd25b3bebdbb12f6acc4fdb5cc91c411e1685 100644 --- a/lib/internal/Magento/Framework/View/Asset/ModuleNotation/Resolver.php +++ b/lib/internal/Magento/Framework/View/Asset/NotationResolver/Module.php @@ -4,12 +4,12 @@ * See COPYING.txt for license details. */ -namespace Magento\Framework\View\Asset\ModuleNotation; +namespace Magento\Framework\View\Asset\NotationResolver; use Magento\Framework\View\Asset; use Magento\Framework\View\FileSystem; -class Resolver +class Module { /** * @var \Magento\Framework\View\Asset\Repository diff --git a/lib/internal/Magento/Framework/View/Asset/NotationResolver/Variable.php b/lib/internal/Magento/Framework/View/Asset/NotationResolver/Variable.php new file mode 100644 index 0000000000000000000000000000000000000000..07d5de144aa895a72b4b9d77fc5f0c089a6fdf08 --- /dev/null +++ b/lib/internal/Magento/Framework/View/Asset/NotationResolver/Variable.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\View\Asset\NotationResolver; + +use Magento\Framework\View\Asset; + +/** + * Variable resolver to allow specific placeholders in CSS files + */ +class Variable +{ + /** + * Regex matching {{placeholders}} + */ + const VAR_REGEX = '/{{([_a-z]*)}}/si'; + + /** + * Provides the combined base url and base path from the asset context + */ + const VAR_BASE_URL_PATH = 'base_url_path'; + + /** + * @var \Magento\Framework\View\Asset\Repository + */ + private $assetRepo; + + /** + * @param Asset\Repository $assetRepo + */ + public function __construct(Asset\Repository $assetRepo) + { + $this->assetRepo = $assetRepo; + } + + /** + * Replaces the placeholder variables into the given path + * + * @param string $path + * @return string + */ + public function convertVariableNotation($path) + { + $matches = []; + if (preg_match_all(self::VAR_REGEX, $path, $matches, PREG_SET_ORDER)) { + $replacements = []; + foreach ($matches as $match) { + if (!isset($replacements[$match[0]])) { + $replacements[$match[0]] = $this->getPlaceholderValue($match[1]); + } + } + $path = str_replace(array_keys($replacements), $replacements, $path); + } + return $path; + } + + /** + * Retrieves the value of a given placeholder + * + * @param string $placeholder + * @return string + */ + public function getPlaceholderValue($placeholder) + { + $context = $this->assetRepo->getStaticViewFileContext(); + + switch ($placeholder) { + case self::VAR_BASE_URL_PATH: + return $context->getBaseUrl() . $context->getPath(); + default: + return ''; + } + } +} diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/ModuleNotation.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/ModuleNotation.php index 25e69d4ddfac1c6a166f290a0fe7de425261d2f0..1cb2d2565d806eb938603e5d10465d16274ba886 100644 --- a/lib/internal/Magento/Framework/View/Asset/PreProcessor/ModuleNotation.php +++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/ModuleNotation.php @@ -26,17 +26,17 @@ class ModuleNotation implements Asset\PreProcessorInterface private $cssResolver; /** - * @var \Magento\Framework\View\Asset\ModuleNotation\Resolver + * @var \Magento\Framework\View\Asset\NotationResolver\Module */ private $notationResolver; /** * @param CssResolver $cssResolver - * @param \Magento\Framework\View\Asset\ModuleNotation\Resolver $notationResolver + * @param \Magento\Framework\View\Asset\NotationResolver\Module $notationResolver */ public function __construct( CssResolver $cssResolver, - \Magento\Framework\View\Asset\ModuleNotation\Resolver $notationResolver + \Magento\Framework\View\Asset\NotationResolver\Module $notationResolver ) { $this->cssResolver = $cssResolver; $this->notationResolver = $notationResolver; diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/VariableNotation.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/VariableNotation.php new file mode 100644 index 0000000000000000000000000000000000000000..8abecd1fd831f7f9b4dbbf1e1b507e3eb6b5773a --- /dev/null +++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/VariableNotation.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\View\Asset\PreProcessor; + +use Magento\Framework\View\Asset; +use Magento\Framework\View\Asset\NotationResolver; +use Magento\Framework\View\Url\CssResolver; + +/** + * Support of notation "{{variable}}" in CSS-files + * + * Used to replace placeholder variables (such as {{base_url_path}}) with dynamic values. + */ +class VariableNotation implements Asset\PreProcessorInterface +{ + /** + * @var \Magento\Framework\View\Url\CssResolver + */ + private $cssResolver; + + /** + * @var NotationResolver\Variable + */ + private $notationResolver; + + /** + * Constructor + * + * @param CssResolver $cssResolver + * @param NotationResolver\Variable $notationResolver + */ + public function __construct( + CssResolver $cssResolver, + NotationResolver\Variable $notationResolver + ) { + $this->cssResolver = $cssResolver; + $this->notationResolver = $notationResolver; + } + + /** + * {@inheritdoc} + */ + public function process(Chain $chain) + { + $callback = function ($path) { + return $this->notationResolver->convertVariableNotation($path); + }; + $chain->setContent($this->cssResolver->replaceRelativeUrls($chain->getContent(), $callback)); + } +} diff --git a/lib/internal/Magento/Framework/View/Design/Fallback/RulePool.php b/lib/internal/Magento/Framework/View/Design/Fallback/RulePool.php index 23390f851447640275b38e19e565bbb33fd4f0b4..6280e1c5288c5af5f26b94021f0ff4a0b779ae6c 100644 --- a/lib/internal/Magento/Framework/View/Design/Fallback/RulePool.php +++ b/lib/internal/Magento/Framework/View/Design/Fallback/RulePool.php @@ -28,6 +28,7 @@ class RulePool const TYPE_LOCALE_FILE = 'locale'; const TYPE_TEMPLATE_FILE = 'template'; const TYPE_STATIC_FILE = 'static'; + const TYPE_EMAIL_TEMPLATE = 'email'; /**#@-*/ /** @@ -161,6 +162,25 @@ class RulePool ); } + /** + * Retrieve newly created fallback rule for email templates. + * + * Emails are only loaded in a modular context, so a non-modular rule is not specified. + * + * @return RuleInterface + */ + protected function createEmailTemplateFileRule() + { + $themesDir = rtrim($this->filesystem->getDirectoryRead(DirectoryList::THEMES)->getAbsolutePath(), '/'); + $modulesDir = rtrim($this->filesystem->getDirectoryRead(DirectoryList::MODULES)->getAbsolutePath(), '/'); + return new Composite( + [ + new Theme(new Simple("$themesDir/<area>/<theme_path>/<namespace>_<module>/email")), + new Simple("$modulesDir/<namespace>/<module>/view/<area>/email"), + ] + ); + } + /** * @param string $type * @return RuleInterface @@ -184,6 +204,9 @@ class RulePool case self::TYPE_STATIC_FILE: $rule = $this->createViewFileRule(); break; + case self::TYPE_EMAIL_TEMPLATE: + $rule = $this->createEmailTemplateFileRule(); + break; default: throw new \InvalidArgumentException("Fallback rule '$type' is not supported"); } diff --git a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/EmailTemplateFile.php b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/EmailTemplateFile.php new file mode 100644 index 0000000000000000000000000000000000000000..bdef075927b9acb16ae6145240566fcbc0f2e1d5 --- /dev/null +++ b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/EmailTemplateFile.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\View\Design\FileResolution\Fallback; + +use Magento\Framework\View\Design\ThemeInterface; + +/** + * Model that finds file paths by their fileId + */ +class EmailTemplateFile +{ + /** + * @var \Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Simple + */ + protected $resolver; + + /** + * Constructor + * + * @param \Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Simple $resolver + */ + public function __construct( + \Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Simple $resolver + ) { + $this->resolver = $resolver; + } + + /** + * Get file name, using fallback mechanism + * + * @param string $area + * @param ThemeInterface $themeModel + * @param string $locale + * @param string $file + * @param string|null $module + * @return bool|string + */ + public function getFile($area, ThemeInterface $themeModel, $locale, $file, $module = null) + { + return $this->resolver->resolve($this->getFallbackType(), $file, $area, $themeModel, $locale, $module); + } + + /** + * Get fallback type + * + * @return string + */ + protected function getFallbackType() + { + return \Magento\Framework\View\Design\Fallback\RulePool::TYPE_EMAIL_TEMPLATE; + } +} diff --git a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/File.php b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/File.php index 91663cbdf279991f172857b44efac78b2aadddac..0b44338082528ace404468bd68d189f22f768fa4 100644 --- a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/File.php +++ b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/File.php @@ -35,7 +35,7 @@ class File * @param ThemeInterface $themeModel * @param string $file * @param string|null $module - * @return string|false + * @return string|bool */ public function getFile($area, ThemeInterface $themeModel, $file, $module = null) { diff --git a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/ResolverInterface.php b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/ResolverInterface.php index 6d76434ff2f969ac9bdfe68fbe4255eebd585c80..88b5f838d7905cf6a1905de30196debd15d8ab4b 100644 --- a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/ResolverInterface.php +++ b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/ResolverInterface.php @@ -23,7 +23,7 @@ interface ResolverInterface * @param ThemeInterface|null $theme * @param string|null $locale * @param string|null $module - * @return string|false + * @return string|bool */ public function resolve($type, $file, $area = null, ThemeInterface $theme = null, $locale = null, $module = null); } diff --git a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/TemplateFile.php b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/TemplateFile.php index bbf4bcd58450fe37b4f36b6158e4625463cef3d4..885bc5588d6f5dfff39914c924ff6ac9cc46577a 100644 --- a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/TemplateFile.php +++ b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/TemplateFile.php @@ -64,7 +64,7 @@ class TemplateFile extends File * @param ThemeInterface $themeModel * @param string $file * @param string|null $module - * @return string|false + * @return string|bool */ public function getFile($area, ThemeInterface $themeModel, $file, $module = null) { diff --git a/lib/internal/Magento/Framework/View/FileSystem.php b/lib/internal/Magento/Framework/View/FileSystem.php index 1fa7c01f3ab9bf47cf4636849b6d1f175747dc14..ccbaf9bb68efa68d35c04b25fffc337190202cef 100644 --- a/lib/internal/Magento/Framework/View/FileSystem.php +++ b/lib/internal/Magento/Framework/View/FileSystem.php @@ -30,6 +30,11 @@ class FileSystem */ protected $_staticFileResolution; + /** + * @var \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile + */ + protected $_emailTemplateFileResolution; + /** * View service * @@ -44,6 +49,7 @@ class FileSystem * @param \Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile $fallbackTemplateFile * @param \Magento\Framework\View\Design\FileResolution\Fallback\LocaleFile $fallbackLocaleFile * @param \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile $fallbackStaticFile + * @param \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile $fallbackEmailTemplateFile * @param \Magento\Framework\View\Asset\Repository $assetRepo */ public function __construct( @@ -51,12 +57,14 @@ class FileSystem \Magento\Framework\View\Design\FileResolution\Fallback\TemplateFile $fallbackTemplateFile, \Magento\Framework\View\Design\FileResolution\Fallback\LocaleFile $fallbackLocaleFile, \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile $fallbackStaticFile, + \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile $fallbackEmailTemplateFile, \Magento\Framework\View\Asset\Repository $assetRepo ) { $this->_fileResolution = $fallbackFile; $this->_templateFileResolution = $fallbackTemplateFile; $this->_localeFileResolution = $fallbackLocaleFile; $this->_staticFileResolution = $fallbackStaticFile; + $this->_emailTemplateFileResolution = $fallbackEmailTemplateFile; $this->_assetRepo = $assetRepo; } @@ -100,7 +108,7 @@ class FileSystem * * @param string $fileId * @param array $params - * @return string|false + * @return string|bool */ public function getTemplateFileName($fileId, array $params = []) { @@ -135,6 +143,21 @@ class FileSystem ->getFile($params['area'], $params['themeModel'], $params['locale'], $filePath, $params['module']); } + /** + * Get an email template file + * + * @param string $fileId + * @param array $params + * @param string $module + * @return string|bool + */ + public function getEmailTemplateFileName($fileId, array $params, $module) + { + $this->_assetRepo->updateDesignParams($params); + return $this->_emailTemplateFileResolution + ->getFile($params['area'], $params['themeModel'], $params['locale'], $fileId, $module); + } + /** * Remove excessive "." and ".." parts from a path * diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/ModuleNotation/ResolverTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/ModuleTest.php similarity index 91% rename from lib/internal/Magento/Framework/View/Test/Unit/Asset/ModuleNotation/ResolverTest.php rename to lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/ModuleTest.php index 5c3c71e23a78baf834259ee9ffefae8081375662..48e9ba713a76ee28c8bbad5a9cd234cd3da9a32f 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/ModuleNotation/ResolverTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/ModuleTest.php @@ -6,9 +6,9 @@ // @codingStandardsIgnoreFile -namespace Magento\Framework\View\Test\Unit\Asset\ModuleNotation; +namespace Magento\Framework\View\Test\Unit\Asset\NotationResolver; -class ResolverTest extends \PHPUnit_Framework_TestCase +class ModuleTest extends \PHPUnit_Framework_TestCase { /** * @var \Magento\Framework\View\Asset\File|\PHPUnit_Framework_MockObject_MockObject @@ -21,7 +21,7 @@ class ResolverTest extends \PHPUnit_Framework_TestCase private $assetRepo; /** - * @var \Magento\Framework\View\Asset\ModuleNotation\Resolver; + * @var \Magento\Framework\View\Asset\NotationResolver\Module; */ private $object; @@ -29,7 +29,7 @@ class ResolverTest extends \PHPUnit_Framework_TestCase { $this->asset = $this->getMock('Magento\Framework\View\Asset\File', [], [], '', false); $this->assetRepo = $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false); - $this->object = new \Magento\Framework\View\Asset\ModuleNotation\Resolver($this->assetRepo); + $this->object = new \Magento\Framework\View\Asset\NotationResolver\Module($this->assetRepo); } public function testConvertModuleNotationToPathNoModularSeparator() diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/VariableTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/VariableTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0fc1f524c392fc02a4d581e03d3ab23ade54ab6a --- /dev/null +++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/NotationResolver/VariableTest.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\View\Test\Unit\Asset\NotationResolver; + +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\View\Asset\NotationResolver; + +class VariableTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\View\Asset\File\Context|\PHPUnit_Framework_MockObject_MockObject + */ + private $context; + + /** + * @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject + */ + private $assetRepo; + + /** + * @var \Magento\Framework\View\Asset\NotationResolver\Variable + */ + private $object; + + protected function setUp() + { + $baseUrl = 'http://example.com/pub/static/'; + $path = 'frontend/Magento/blank/en_US'; + + $this->context = $this->getMock( + '\Magento\Framework\View\Asset\File\Context', + null, + [$baseUrl, DirectoryList::STATIC_VIEW, $path] + ); + + $this->assetRepo = $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false); + $this->assetRepo->expects($this->any()) + ->method('getStaticViewFileContext') + ->will($this->returnValue($this->context)); + + $this->object = new \Magento\Framework\View\Asset\NotationResolver\Variable($this->assetRepo); + } + + /** + * @param $path + * @param $expectedResult + * @dataProvider convertVariableNotationDataProvider + */ + public function testConvertVariableNotation($path, $expectedResult) + { + $this->assertEquals($expectedResult, $this->object->convertVariableNotation($path)); + } + + /** + * @return array + */ + public function convertVariableNotationDataProvider() + { + return [ + ['{{base_url_path}}/file.ext', 'http://example.com/pub/static/frontend/Magento/blank/en_US/file.ext'], + ]; + } +} diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php index 5c61c8d4642d6b88d8ffd8da3dc7803ce7c07565..9b73183dccd13b59c7aca11fe44606327b1e8301 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php @@ -41,7 +41,8 @@ class PoolTest extends \PHPUnit_Framework_TestCase 'css' => [ 'Magento\Framework\Css\PreProcessor\Less', - 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation' + 'Magento\Framework\View\Asset\PreProcessor\VariableNotation', + 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation', ], 'less' => [ @@ -50,7 +51,10 @@ class PoolTest extends \PHPUnit_Framework_TestCase ], ], 'css' => [ - 'css' => ['Magento\Framework\View\Asset\PreProcessor\ModuleNotation'] + 'css' => [ + 'Magento\Framework\View\Asset\PreProcessor\VariableNotation', + 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation', + ] ], ] ); @@ -91,7 +95,8 @@ class PoolTest extends \PHPUnit_Framework_TestCase 'css => css' => [ 'css', 'css', [ - 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation' + 'Magento\Framework\View\Asset\PreProcessor\VariableNotation', + 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation', ], ], //all undefined types will be processed by Passthrough preprocessor @@ -103,7 +108,8 @@ class PoolTest extends \PHPUnit_Framework_TestCase 'less', 'css', [ 'Magento\Framework\Css\PreProcessor\Less', - 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation' + 'Magento\Framework\View\Asset\PreProcessor\VariableNotation', + 'Magento\Framework\View\Asset\PreProcessor\ModuleNotation', ], ], 'less => less' => [ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php index a4121826604aa11e55f5697190f0847aa5f6a0a9..93278e4b7185df60982b39d6c1ad58bcbb57ae2a 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php @@ -285,6 +285,16 @@ class RulePoolTest extends \PHPUnit_Framework_TestCase DirectoryList::LIB_WEB, ], ], + // Single test, as emails will always be loaded in a modular context with no locale specificity + 'email' => [ + \Magento\Framework\View\Design\Fallback\RulePool::TYPE_EMAIL_TEMPLATE, + [], + [ + DirectoryList::THEMES . '/area/current_theme_path/namespace_module/email', + DirectoryList::THEMES . '/area/parent_theme_path/namespace_module/email', + DirectoryList::MODULES . '/namespace/module/view/area/email', + ], + ], ]; } } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php b/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php index b3da9460449e60ca457f6cde259537bade2e86fb..dfd16c3c6ad25c7293fd0d5876e475b55e735aa5 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/FileSystemTest.php @@ -38,6 +38,11 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase */ protected $_staticFileResolution; + /** + * @var \Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_emailTemplateFileResolution; + /** * @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject */ @@ -57,6 +62,9 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase $this->_staticFileResolution = $this->getMock( 'Magento\Framework\View\Design\FileResolution\Fallback\StaticFile', [], [], '', false ); + $this->_emailTemplateFileResolution = $this->getMock( + 'Magento\Framework\View\Design\FileResolution\Fallback\EmailTemplateFile', [], [], '', false + ); $this->_assetRepo = $this->getMock('Magento\Framework\View\Asset\Repository', ['extractScope', 'updateDesignParams', 'createAsset'], [], '', false ); @@ -66,6 +74,7 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase $this->_templateFileResolution, $this->_localeFileResolution, $this->_staticFileResolution, + $this->_emailTemplateFileResolution, $this->_assetRepo ); } @@ -246,4 +255,27 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase ], ]; } + + public function testGetEmailTemplateFile() + { + $locale = \Magento\Setup\Module\I18n\Locale::DEFAULT_SYSTEM_LOCALE; + $params = [ + 'area' => 'some_area', + 'themeModel' => $this->getMock( + 'Magento\Framework\View\Design\ThemeInterface', [], [], '', false, false + ), + 'module' => 'Some_Module', + 'locale' => $locale + ]; + $file = 'Some_Module::some_file.ext'; + $expected = 'path/to/some_file.ext'; + + $this->_emailTemplateFileResolution->expects($this->once()) + ->method('getFile') + ->with($params['area'], $params['themeModel'], $locale, $file, 'Some_Module') + ->will($this->returnValue($expected)); + + $actual = $this->_model->getEmailTemplateFileName($file, $params, 'Some_Module'); + $this->assertEquals($expected, $actual); + } } diff --git a/lib/web/css/source/_email-variables.less b/lib/web/css/source/_email-variables.less new file mode 100644 index 0000000000000000000000000000000000000000..9acd4d3c535e4943932940ab8e2c0bc264998bd3 --- /dev/null +++ b/lib/web/css/source/_email-variables.less @@ -0,0 +1,21 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Email variable overrides +// _____________________________________________ + +// This file should be used to set theme-specific variables for emails. +// By default, emails will inherit variables from the Magento UI Library and the _theme.less and _variables.less files +// in a custom theme. Use this file if you want to set specific variables for emails. +// For example, you can make the email font, typography, colors, etc unique from the frontend theme. + +// Example usage: +// @link__color: @color-dark-green1; +// @link__text-decoration: underline; +// +// @email__background-color: @color-heathered-grey; // Change background to darker grey color + +// Should be EMPTY. \ No newline at end of file diff --git a/lib/web/css/source/lib/_responsive.less b/lib/web/css/source/lib/_responsive.less index 105a06e6b5018a5886bc496c713bd3c484a00fc2..3149cfc23829602ce07f6fceccba532624498f26 100644 --- a/lib/web/css/source/lib/_responsive.less +++ b/lib/web/css/source/lib/_responsive.less @@ -12,7 +12,7 @@ // --------------------------------------------- @media-common: true; // Sets whether to output common styles (true|false) -@media-target: all; // Sets target device for styles output (all|desktop|mobile) +@media-target: 'all'; // Sets target device for styles output (all|desktop|mobile) // // Media width mixin used to group styles output based on media queries diff --git a/lib/web/css/source/lib/_typography.less b/lib/web/css/source/lib/_typography.less index 08204252e43b21e99309bb578470c76640a8ec04..5a88af54596b25381d4997afa01d89d2347f2c0e 100644 --- a/lib/web/css/source/lib/_typography.less +++ b/lib/web/css/source/lib/_typography.less @@ -27,7 +27,7 @@ } // Rem font size -.font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and (isunit(@sizeValue, rem)) { +.font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and (isunit(@sizeValue, @font-size-unit)) { font-size: @sizeValue; } @@ -35,15 +35,15 @@ font-size: @sizeValue; } -.font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and not (isunit(@sizeValue, em)) and not (isunit(@sizeValue, rem)) { - .to-rem(@sizeValue); - font-size: @valueRem; +.font-size(@sizeValue) when not (ispercentage(@sizeValue)) and not (@sizeValue = false) and not (isunit(@sizeValue, em)) and not (isunit(@sizeValue, @font-size-unit)) { + .font-size-value(@sizeValue); + font-size: @fontValue; } // Rem line height .line-height(@heightValue) when not (@heightValue = false) and not (ispercentage(@heightValue)) { - .to-rem(@heightValue); - line-height: @valueRem; + .font-size-value(@heightValue); + line-height: @fontValue; } .line-height(@heightValue) when (ispercentage(@heightValue)) and not (@heightValue = false) { @@ -152,12 +152,12 @@ @@_font-style ); & { - .to-rem(@@_margin-top); - margin-top: @valueRem; + .font-size-value(@@_margin-top); + margin-top: @fontValue; } & { - .to-rem(@@_margin-bottom); - margin-bottom: @valueRem; + .font-size-value(@@_margin-bottom); + margin-bottom: @fontValue; } } @@ -178,12 +178,12 @@ p { & { - .to-rem(@p__margin-top); - margin-top: @valueRem; + .font-size-value(@p__margin-top); + margin-top: @fontValue; } & { - .to-rem(@p__margin-bottom); - margin-bottom: @valueRem; + .font-size-value(@p__margin-bottom); + margin-bottom: @fontValue; } } @@ -299,22 +299,22 @@ ul, ol { & { - .to-rem(@list__margin-top); - margin-top: @valueRem; + .font-size-value(@list__margin-top); + margin-top: @fontValue; } & { - .to-rem(@list__margin-bottom); - margin-bottom: @valueRem; + .font-size-value(@list__margin-bottom); + margin-bottom: @fontValue; } //.typography(@list__font-size__base, @list__color__base); > li { & { - .to-rem(@list-item__margin-top); - margin-top: @valueRem; + .font-size-value(@list-item__margin-top); + margin-top: @fontValue; } & { - .to-rem(@list-item__margin-bottom); - margin-bottom: @valueRem; + .font-size-value(@list-item__margin-bottom); + margin-bottom: @fontValue; } } ul, diff --git a/lib/web/css/source/lib/_utilities.less b/lib/web/css/source/lib/_utilities.less index 0b31aaa2f1132525036f04c4e9907ad4ca018927..b310d3f53e01b9f852a55a795b236fb1ef6bb774 100644 --- a/lib/web/css/source/lib/_utilities.less +++ b/lib/web/css/source/lib/_utilities.less @@ -8,13 +8,17 @@ // _____________________________________________ // -// Convert to rem +// Convert values to unit specified in typography variables // --------------------------------------------- - -.to-rem( +.font-size-value( + @_value +) when not (@_value = false) and not (@_value = '') and (@font-size-unit-convert) { + @fontValue: unit(((@_value) * 1), @font-size-unit) / @font-size-unit-ratio; +} +.font-size-value( @_value -) when not (@_value = false) and not (@_value = '') { - @valueRem: (unit(@_value) * 1rem) / @font-rem-ratio; +) when (@font-size-unit-convert = false) { + @fontValue: @_value; } .visibility-hidden() { diff --git a/lib/web/css/source/lib/_variables.less b/lib/web/css/source/lib/_variables.less index c40c9a7cb0ce35df69f44b025d99d9afb4ec979d..3f525c052126bbd23c999399994d00c4ce9d4b4f 100644 --- a/lib/web/css/source/lib/_variables.less +++ b/lib/web/css/source/lib/_variables.less @@ -29,5 +29,5 @@ @import 'variables/_breadcrumbs.less'; @import 'variables/_popups.less'; @import 'variables/_structure.less'; - @import 'variables/_components.less'; + diff --git a/lib/web/css/source/lib/variables/_email.less b/lib/web/css/source/lib/variables/_email.less new file mode 100644 index 0000000000000000000000000000000000000000..84b45d008777daff68ae865817b48802eed4c6b3 --- /dev/null +++ b/lib/web/css/source/lib/variables/_email.less @@ -0,0 +1,32 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Email variables +// _____________________________________________ + +// Base URL path +@baseUrl: "{{base_url_path}}/"; + +// Structure +@email-body__width: 600px; +@email-body__padding: @indent__s; + +// Content +@email-content__padding__base: @indent__s; +@email-content__padding__s: @indent__xs; +@email-content__padding__m: @indent__base; +@email-content__padding__l: @indent__l; +@email-content__padding__xl: @indent__xl; + +// Colors +@email__background-color: @color-white; +@email-content__background-color: @color-white; + +// Messages +@message-email__color: @text__color; +@message-email__background: @message-info__background; +@message-email__border-color: @message-info__border-color; +@message-email-link__color: @message-info-link__color; diff --git a/lib/web/css/source/lib/variables/_typography.less b/lib/web/css/source/lib/variables/_typography.less index e242528a495d694d801757e9273d050eb53004ed..233c122ece1b5ab393e7bca93eefbbe0a6192a5c 100644 --- a/lib/web/css/source/lib/variables/_typography.less +++ b/lib/web/css/source/lib/variables/_typography.less @@ -27,14 +27,17 @@ // Sizes @root__font-size: 62.5%; // Defines ratio between root font size and base font size, 1rem = 10px -@font-size-ratio__base: 1.4; -@font-rem-ratio: unit(@root__font-size * 16/100); - -@font-size__base: unit((@root__font-size / 100) * 16 * @font-size-ratio__base, px); // Base font size value in <b>px</b> -@font-size__xl: ceil(1.5 * @font-size__base); // 21 -@font-size__l: ceil(1.25 * @font-size__base); // 18 -@font-size__s: ceil(.85 * @font-size__base); // 12 -@font-size__xs: floor(.75 * @font-size__base); // 11 +@font-size-ratio__base: 1.4; // Defines ratio of the root font-size to the base font-size + +@font-size-unit: rem; // The unit to which most typography values will be converted by default +@font-size-unit-ratio: unit(@root__font-size * 16/100); // Ratio of the root font-size to the font-size unit +@font-size-unit-convert: true; // Controls whether font-size values are converted to the specified font-size unit + +@font-size__base: unit(@font-size-unit-ratio * @font-size-ratio__base, px); // Base font size value in <b>px</b> +@font-size__xl: ceil(1.5 * @font-size__base); // 21px +@font-size__l: ceil(1.25 * @font-size__base); // 18px +@font-size__s: ceil(.85 * @font-size__base); // 12px +@font-size__xs: floor(.75 * @font-size__base); // 11px // Weights @font-weight__light: 300; diff --git a/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php b/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php index d257486fc3a3c1692798174e43ebde6822952078..b3147dd30dc344f3337ff157d93efc704c16e70c 100644 --- a/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php +++ b/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php @@ -51,6 +51,11 @@ class Resolver implements ResolverInterface 'paths' => [$this->directory . '/app/code/', $this->directory . '/app/design/'], 'fileMask' => '/\.(php|phtml)$/', ], + [ + 'type' => 'html', + 'paths' => [$this->directory . '/app/code/', $this->directory . '/app/design/'], + 'fileMask' => '/\.html$/', + ], [ 'type' => 'js', 'paths' => [ @@ -70,6 +75,7 @@ class Resolver implements ResolverInterface } else { $this->options = [ ['type' => 'php', 'paths' => [$this->directory], 'fileMask' => '/\.(php|phtml)$/'], + ['type' => 'html', 'paths' => [$this->directory], 'fileMask' => '/\.html/'], ['type' => 'js', 'paths' => [$this->directory], 'fileMask' => '/\.(js|phtml)$/'], ['type' => 'xml', 'paths' => [$this->directory], 'fileMask' => '/\.xml$/'], ]; diff --git a/setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Html.php b/setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Html.php new file mode 100644 index 0000000000000000000000000000000000000000..b6ccb4ddb0b82001d27c403b01c88746b91293de --- /dev/null +++ b/setup/src/Magento/Setup/Module/I18n/Parser/Adapter/Html.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Module\I18n\Parser\Adapter; + +use Magento\Email\Model\Template\Filter; + +/** + * Html parser adapter + */ +class Html extends AbstractAdapter +{ + /** + * {@inheritdoc} + */ + protected function _parse() + { + $data = file_get_contents($this->_file); + if ($data === false) { + throw new \Exception('Failed to load file from disk.'); + } + + $results = []; + preg_match_all(Filter::CONSTRUCTION_PATTERN, $data, $results, PREG_SET_ORDER); + for ($i = 0; $i < count($results); $i++) { + if ($results[$i][1] === Filter::TRANS_DIRECTIVE_NAME) { + $directive = []; + if (preg_match(Filter::TRANS_DIRECTIVE_REGEX, $results[$i][2], $directive) !== 1) { + continue; + } + $quote = $directive[1]; + $this->_addPhrase($quote . $directive[2] . $quote); + } + } + } +} diff --git a/setup/src/Magento/Setup/Module/I18n/Parser/Parser.php b/setup/src/Magento/Setup/Module/I18n/Parser/Parser.php index 5766154cd9196908d6ec6430a8b9a0a69a206cfc..4d11c88ecb6c83a4bc43eb4f8fef226321277a1c 100644 --- a/setup/src/Magento/Setup/Module/I18n/Parser/Parser.php +++ b/setup/src/Magento/Setup/Module/I18n/Parser/Parser.php @@ -36,12 +36,20 @@ class Parser extends AbstractParser */ protected function _addPhrase($phraseData) { - $phraseKey = $phraseData['phrase']; + try { + $phraseKey = $phraseData['phrase']; - $this->_phrases[$phraseKey] = $this->_factory->createPhrase([ - 'phrase' => $phraseData['phrase'], - 'translation' => $phraseData['phrase'], - 'quote' => $phraseData['quote'], - ]); + $this->_phrases[$phraseKey] = $this->_factory->createPhrase([ + 'phrase' => $phraseData['phrase'], + 'translation' => $phraseData['phrase'], + 'quote' => $phraseData['quote'], + ]); + } catch (\DomainException $e) { + throw new \DomainException( + "{$e->getMessage()} in {$phraseData['file']}:{$phraseData['line']}", + $e->getCode(), + $e + ); + } } } diff --git a/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php b/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php index cbbbc7fed9f974dec1be8506198ab52227684566..504af8b8b1a56694538e60b651812623cbb2808a 100644 --- a/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php +++ b/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php @@ -53,6 +53,7 @@ class ServiceLocator $phraseCollector = new Parser\Adapter\Php\Tokenizer\PhraseCollector(new Parser\Adapter\Php\Tokenizer()); $adapters = [ 'php' => new Parser\Adapter\Php($phraseCollector), + 'html' => new Parser\Adapter\Html(), 'js' => new Parser\Adapter\Js(), 'xml' => new Parser\Adapter\Xml(), ]; diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Options/ResolverTest.php b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Options/ResolverTest.php index bb6ba63cfb35fbf044fa59243939ade462cd1af8..9f35c509411face2ac0c16a6bc33027cc7895a11 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Options/ResolverTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Options/ResolverTest.php @@ -47,6 +47,11 @@ class ResolverTest extends \PHPUnit_Framework_TestCase 'paths' => [$sourceFirst . '/app/code/', $sourceFirst . '/app/design/'], 'fileMask' => '/\.(php|phtml)$/', ], + [ + 'type' => 'html', + 'paths' => [$sourceFirst . '/app/code/', $sourceFirst . '/app/design/'], + 'fileMask' => '/\.html$/', + ], [ 'type' => 'js', 'paths' => [ @@ -69,6 +74,7 @@ class ResolverTest extends \PHPUnit_Framework_TestCase false, [ ['type' => 'php', 'paths' => [$sourceSecond], 'fileMask' => '/\.(php|phtml)$/'], + ['type' => 'html', 'paths' => [$sourceSecond], 'fileMask' => '/\.html/'], ['type' => 'js', 'paths' => [$sourceSecond], 'fileMask' => '/\.(js|phtml)$/'], ['type' => 'xml', 'paths' => [$sourceSecond], 'fileMask' => '/\.xml$/'] ] diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/HtmlTest.php b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/HtmlTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8a3a1392b71988d0caae5f90fcfedde73fe99b25 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/HtmlTest.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Test\Unit\Module\I18n\Parser\Adapter; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Setup\Module\I18n\Dictionary\Phrase; + +class HtmlTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var string + */ + protected $_testFile; + + /** + * @var int + */ + protected $_stringsCount; + + /** + * @var \Magento\Setup\Module\I18n\Parser\Adapter\Html + */ + protected $_adapter; + + protected function setUp() + { + $this->_testFile = str_replace('\\', '/', realpath(dirname(__FILE__))) . '/_files/email.html'; + $this->_stringsCount = count(file($this->_testFile)); + + $this->_adapter = (new ObjectManager($this))->getObject('Magento\Setup\Module\I18n\Parser\Adapter\Html'); + } + + public function testParse() + { + $expectedResult = [ + [ + 'phrase' => 'Phrase 1', + 'file' => $this->_testFile, + 'line' => null, + 'quote' => Phrase::QUOTE_SINGLE, + ], + [ + 'phrase' => 'Phrase 2 with %a_lot of extra info for the brilliant %customer_name.', + 'file' => $this->_testFile, + 'line' => null, + 'quote' => Phrase::QUOTE_DOUBLE + ], + ]; + + $this->_adapter->parse($this->_testFile); + + $this->assertEquals($expectedResult, $this->_adapter->getPhrases()); + } +} diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/_files/email.html b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/_files/email.html new file mode 100644 index 0000000000000000000000000000000000000000..673743e8d54f37a8bd2feba1ca5a53bb11728a49 --- /dev/null +++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/Adapter/_files/email.html @@ -0,0 +1,24 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<!DOCTYPE html> +<html> +<head lang="en"> + <meta charset="UTF-8"> + <title></title> +</head> +<body> + <p>{{trans 'Phrase 1'}}</p> + <span> + {{trans + "Phrase 2 with %a_lot of extra info for the brilliant %customer_name." + + %a_lot="$order.foo" + %customer_name=$customer_name + }} + </span> +</body> +</html>