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/Authorizenet/view/frontend/web/template/payment/authorizenet-directpost.html b/app/code/Magento/Authorizenet/view/frontend/web/template/payment/authorizenet-directpost.html index 0ea2ebb85fe98034cba2fdc98a52e3c55d72eecc..e596ced5d783473c5196c3b06b5d9f15763b8795 100644 --- a/app/code/Magento/Authorizenet/view/frontend/web/template/payment/authorizenet-directpost.html +++ b/app/code/Magento/Authorizenet/view/frontend/web/template/payment/authorizenet-directpost.html @@ -54,14 +54,14 @@ <button data-role="review-save" type="submit" data-bind=" - attr: {title: $t('Place order')}, + attr: {title: $t('Place Order')}, enable: (getCode() == isChecked()), click: placeOrder, css: {disabled: !isPlaceOrderActionAllowed()} " class="action primary checkout" disabled> - <span data-bind="text: $t('Place order')"></span> + <span data-bind="text: $t('Place Order')"></span> </button> </div> </div> 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/Braintree/view/frontend/web/template/payment/braintree-paypal-form.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/braintree-paypal-form.html index 2ce6b39838900f17d21965894ca4eeff9a11c4fa..149e1bdfd542001bcbd1a6d9bddd413e4812206d 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/braintree-paypal-form.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/braintree-paypal-form.html @@ -34,14 +34,14 @@ <button data-role="review-save" type="submit" data-bind=" - attr: {title: $t('Place order')}, + attr: {title: $t('Place Order')}, enable: (getCode() == isChecked()), click: placeOrder, css: {disabled: !isPlaceOrderActionAllowed()} " class="action primary checkout" disabled> - <span data-bind="text: $t('Place order')"></span> + <span data-bind="text: $t('Place Order')"></span> </button> </div> </div> diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html index c59b42eac2e721022f281f72e25e62427d1a7e90..8073eb00f64e4e625db30b08a1174bea759c772a 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html @@ -151,12 +151,26 @@ <span><!-- ko text: $t('Card Verification Number')--><!-- /ko --></span> </label> <div class="control"> - <input type="number" class="input-text cvv" name="payment[cc_cid]" value="" - data-bind="attr: {id: getCode() + '_cc_cid', title: $t('Card Verification Number'), 'data-container': getCode() + '-cc-cvv', 'data-validate': JSON.stringify({'required-number':true, 'validate-cc-cvn':'#' + getCode() + '_cc_type'})}, - enable: true, - value: creditCardVerificationNumber"/> - <div class="note"> - <a href="#" class="action cvv" data-bind="attr: {title: $t('What is this?')}, mageInit:{'tooltip': {'content': getCvvImageHtml()}}"><span><!-- ko text: $t('What is this?')--><!-- /ko --></span></a> + <input type="number" + class="input-text cvv" + name="payment[cc_cid]" + value="" + data-bind="attr: {id: getCode() + '_cc_cid', + title: $t('Card Verification Number'), + 'data-container': getCode() + '-cc-cvv', + 'data-validate': JSON.stringify({'required-number':true, 'validate-cc-cvn':'#' + getCode() + '_cc_type'})}, + enable: true, + value: creditCardVerificationNumber" /> + <div class="field-tooltip toggle"> + <span class="field-tooltip-action action-cvv" + tabindex="0" + data-toggle="dropdown" + data-bind="attr: {title: $t('What is this?')}, mageInit: {'dropdown':{'activeClass': '_active'}}"> + <span><!-- ko text: $t('What is this?')--><!-- /ko --></span> + </span> + <div class="field-tooltip-content" + data-target="dropdown" + data-bind="html: getCvvImageHtml()"></div> </div> </div> </div> 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/Api/ProductRepositoryInterface.php b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php index 18cf0bdec693cf4913c73285185bd01933ed40e6..6fddee979e07f89879312fa6ed317acff6acba27 100644 --- a/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php +++ b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php @@ -72,10 +72,4 @@ interface ProductRepositoryInterface * @return \Magento\Catalog\Api\Data\ProductSearchResultsInterface */ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); - - /** - * @param \Magento\Framework\Api\Search\SearchCriteriaInterface $searchCriteria - * @return \Magento\Framework\Api\Search\SearchResultInterface - */ - public function search(\Magento\Framework\Api\Search\SearchCriteriaInterface $searchCriteria); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php index 783c78b0f8784cac5dd38dded247708bec394baa..4a312adfb6366089f024dd06a6e33c6ed65e2f14 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php @@ -6,29 +6,69 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Catalog\Model\Resource\Product\Collection; +use Magento\Framework\Controller\ResultFactory; + class MassDelete extends \Magento\Catalog\Controller\Adminhtml\Product { + /** + * Field id + */ + const ID_FIELD = 'entity_id'; + + /** + * Redirect url + */ + const REDIRECT_URL = 'catalog/*/index'; + + /** + * Resource collection + * + * @var string + */ + protected $collection = 'Magento\Catalog\Model\Resource\Product\Collection'; + /** * @return \Magento\Backend\Model\View\Result\Redirect */ public function execute() { - $productIds = $this->getRequest()->getParam('selected'); - if (!is_array($productIds) || empty($productIds)) { - $this->messageManager->addError(__('Please select product(s).')); - } else { - try { - foreach ($productIds as $productId) { - $product = $this->_objectManager->get('Magento\Catalog\Model\Product')->load($productId); - $product->delete(); - } - $this->messageManager->addSuccess( - __('A total of %1 record(s) have been deleted.', count($productIds)) - ); - } catch (\Exception $e) { - $this->messageManager->addError($e->getMessage()); + $selected = $this->getRequest()->getParam('selected'); + $excluded = $this->getRequest()->getParam('excluded'); + + $collection = $this->_objectManager->create($this->collection); + try { + if (!empty($excluded)) { + $collection->addFieldToFilter(static::ID_FIELD, ['nin' => $excluded]); + $this->massAction($collection); + } elseif (!empty($selected)) { + $collection->addFieldToFilter(static::ID_FIELD, ['in' => $selected]); + $this->massAction($collection); + } else { + $this->messageManager->addError(__('Please select product(s).')); } + } catch (\Exception $e) { + $this->messageManager->addError($e->getMessage()); + } + + /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ + $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); + return $resultRedirect->setPath(static::REDIRECT_URL); + } + + /** + * Cancel selected orders + * + * @param Collection $collection + * @return void + */ + protected function massAction($collection) + { + $count = 0; + foreach ($collection->getItems() as $product) { + $product->delete(); + ++$count; } - return $this->resultRedirectFactory->create()->setPath('catalog/*/index'); + $this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $count)); } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index 4ff34b45814607a812e60d48202115cb5a1a5ee6..56631b4a8faf65ffa2a0b6360ced631e2098ab59 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -432,4 +432,14 @@ abstract class AbstractGroupPrice extends Price return $data; } + + /** + * Get resource model instance + * + * @return \Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice + */ + public function getResource() + { + return $this->_getResource(); + } } diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 9f753c5810db359a80941645ad0332290c13ff4c..28e8e25dfaa6b8273b50b984f0d0ec265a21aa34 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -135,25 +135,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ protected $extensionAttributesJoinProcessor; - /** - * @var \Magento\Framework\Search\Request\Builder - */ - private $requestBuilder; - - /** - * @var \Magento\Framework\Search\SearchEngineInterface - */ - private $searchEngine; - - /** - * @var SearchResponseBuilder - */ - private $searchResponseBuilder; - /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - private $scopeConfig; - /** * @param ProductFactory $productFactory * @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper @@ -176,10 +157,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa * @param \Magento\Eav\Model\Config $eavConfig * @param ImageProcessorInterface $imageProcessor * @param \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $extensionAttributesJoinProcessor - * @param \Magento\Framework\Search\Request\Builder $requestBuilder - * @param \Magento\Framework\Search\SearchEngineInterface $searchEngine - * @param SearchResponseBuilder $searchResponseBuilder - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -202,11 +179,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa ImageContentInterfaceFactory $contentFactory, MimeTypeExtensionMap $mimeTypeExtensionMap, ImageProcessorInterface $imageProcessor, - \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $extensionAttributesJoinProcessor, - \Magento\Framework\Search\Request\Builder $requestBuilder, - \Magento\Framework\Search\SearchEngineInterface $searchEngine, - SearchResponseBuilder $searchResponseBuilder, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $extensionAttributesJoinProcessor ) { $this->productFactory = $productFactory; $this->collectionFactory = $collectionFactory; @@ -228,10 +201,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa $this->mimeTypeExtensionMap = $mimeTypeExtensionMap; $this->imageProcessor = $imageProcessor; $this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor; - $this->requestBuilder = $requestBuilder; - $this->searchEngine = $searchEngine; - $this->searchResponseBuilder = $searchResponseBuilder; - $this->scopeConfig = $scopeConfig; } /** @@ -703,45 +672,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa return $searchResult; } - /** - * @param \Magento\Framework\Api\Search\SearchCriteriaInterface $searchCriteria - * @return \Magento\Framework\Api\Search\SearchResultInterface - */ - public function search(\Magento\Framework\Api\Search\SearchCriteriaInterface $searchCriteria) - { - $this->requestBuilder->setRequestName($searchCriteria->getRequestName()); - - $searchTerm = $searchCriteria->getSearchTerm(); - if (!empty($searchTerm)) { - $this->requestBuilder->bind('search_term', $searchTerm); - } - - $storeId = $this->storeManager->getStore(true)->getId(); - $this->requestBuilder->bindDimension('scope', $storeId); - - foreach ($searchCriteria->getFilterGroups() as $filterGroup) { - foreach ($filterGroup->getFilters() as $filter) { - $this->addFieldToFilter($filter->getField(), $filter->getValue()); - } - } - - $priceRangeCalculation = $this->scopeConfig->getValue( - \Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmFactory::XML_PATH_RANGE_CALCULATION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); - if ($priceRangeCalculation) { - $this->requestBuilder->bind('price_dynamic_algorithm', $priceRangeCalculation); - } - - $this->requestBuilder->setFrom($searchCriteria->getCurrentPage() * $searchCriteria->getPageSize()); - $this->requestBuilder->setSize($searchCriteria->getPageSize()); - $request = $this->requestBuilder->create(); - $searchResponse = $this->searchEngine->search($request); - - return $this->searchResponseBuilder->build($searchResponse) - ->setSearchCriteria($searchCriteria); - } - /** * Helper function that adds a FilterGroup to the collection. * @@ -762,26 +692,4 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa $collection->addFieldToFilter($fields); } } - - /** - * Apply attribute filter to facet collection - * - * @param string $field - * @param null $condition - * @return $this - */ - private function addFieldToFilter($field, $condition = null) - { - if (!is_array($condition) || !in_array(key($condition), ['from', 'to'])) { - $this->requestBuilder->bind($field, $condition); - } else { - if (!empty($condition['from'])) { - $this->requestBuilder->bind("{$field}.from", $condition['from']); - } - if (!empty($condition['to'])) { - $this->requestBuilder->bind("{$field}.to", $condition['to']); - } - } - return $this; - } } 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/Catalog/Plugin/Model/Product/Action/UpdateAttributesFlushCache.php b/app/code/Magento/Catalog/Plugin/Model/Product/Action/UpdateAttributesFlushCache.php new file mode 100644 index 0000000000000000000000000000000000000000..22133ccc921a18fe7e62c4ef658390f2c75a2a91 --- /dev/null +++ b/app/code/Magento/Catalog/Plugin/Model/Product/Action/UpdateAttributesFlushCache.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Plugin\Model\Product\Action; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Action; +use Magento\Indexer\Model\CacheContext; +use Magento\Framework\Event\ManagerInterface as EventManager; + +class UpdateAttributesFlushCache +{ + /** + * @var CacheContext + */ + protected $cacheContext; + + /** + * @var EventManager + */ + protected $eventManager; + + /** + * @param CacheContext $cacheContext + * @param EventManager $eventManager + */ + public function __construct( + CacheContext $cacheContext, + EventManager $eventManager + ) { + $this->cacheContext = $cacheContext; + $this->eventManager = $eventManager; + } + + /** + * @param Action $subject + * @param \Closure $proceed + * @param array $productIds + * @param array $attrData + * @param int $storeId + * @return Action + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundUpdateAttributes( + Action $subject, + \Closure $proceed, + $productIds, + $attrData, + $storeId + ) { + $returnValue = $proceed($productIds, $attrData, $storeId); + + $this->cacheContext->registerEntities(Product::CACHE_TAG, $productIds); + $this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]); + + return $returnValue; + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index 76c6c1ddabf2ee69134219feca9b0183acbc22a5..ad8341e86cfdd703d5379a82366c40fd386afef0 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -130,26 +130,6 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase */ protected $objectManager; - /** - * @var \Magento\Framework\Search\Request\Builder|\PHPUnit_Framework_MockObject_MockObject - */ - protected $requestBuilder; - - /** - * @var \Magento\Search\Model\SearchEngine|\PHPUnit_Framework_MockObject_MockObject - */ - protected $searchEngine; - - /** - * @var \Magento\Catalog\Model\SearchResponseBuilder|\PHPUnit_Framework_MockObject_MockObject - */ - protected $searchResponseBuilder; - - /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $scopeConfig; - /** * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -241,22 +221,6 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase ['getLinkTypes'], [], '', false); $this->imageProcessorMock = $this->getMock('Magento\Framework\Api\ImageProcessorInterface', [], [], '', false); - $this->requestBuilder = $this->getMockBuilder('Magento\Framework\Search\Request\Builder') - ->disableOriginalConstructor() - ->getMock(); - - $this->searchEngine = $this->getMockBuilder('Magento\Search\Model\SearchEngine') - ->disableOriginalConstructor() - ->getMock(); - - $this->searchResponseBuilder = $this->getMockBuilder('Magento\Catalog\Model\SearchResponseBuilder') - ->disableOriginalConstructor() - ->getMock(); - - $this->scopeConfig = $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface') - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $this->storeManager = $this->getMockBuilder('Magento\Store\Model\StoreManagerInterface') ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -280,10 +244,6 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase 'mimeTypeExtensionMap' => $this->mimeTypeExtensionMapMock, 'linkTypeProvider' => $this->linkTypeProviderMock, 'imageProcessor' => $this->imageProcessorMock, - 'requestBuilder' => $this->requestBuilder, - 'searchEngine' => $this->searchEngine, - 'searchResponseBuilder' => $this->searchResponseBuilder, - 'scopeConfig' => $this->scopeConfig, 'storeManager' => $this->storeManager, ] ); @@ -1236,98 +1196,4 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase $this->model->save($this->productMock); $this->assertEquals($expectedResult, $this->initializedProductMock->getMediaGallery('images')); } - - public function testSearch() - { - $requestName = 'requestName'; - $searchTerm = 'searchTerm'; - $storeId = 333; - $filterField = 'filterField'; - $filterValue = 'filterValue'; - $priceRangeCalculation = 'auto'; - - $filter = $this->getMockBuilder('Magento\Framework\Api\Filter') - ->disableOriginalConstructor() - ->getMock(); - $filter->expects($this->once()) - ->method('getField') - ->willReturn($filterField); - $filter->expects($this->once()) - ->method('getValue') - ->willReturn($filterValue); - - $filterGroup = $this->getMockBuilder('Magento\Framework\Api\Search\FilterGroup') - ->disableOriginalConstructor() - ->getMock(); - $filterGroup->expects($this->once()) - ->method('getFilters') - ->willReturn([$filter]); - - $searchCriteria = $this->getMockBuilder('Magento\Framework\Api\Search\SearchCriteriaInterface') - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $searchCriteria->expects($this->once()) - ->method('getRequestName') - ->willReturn($requestName); - $searchCriteria->expects($this->once()) - ->method('getSearchTerm') - ->willReturn($searchTerm); - $searchCriteria->expects($this->once()) - ->method('getFilterGroups') - ->willReturn([$filterGroup]); - - $store = $this->getMockBuilder('Magento\Store\Model\Store') - ->disableOriginalConstructor() - ->getMock(); - $store->expects($this->once()) - ->method('getId') - ->willReturn($storeId); - - $searchResult = $this->getMockBuilder('Magento\Framework\Api\Search\SearchResult') - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $request = $this->getMockBuilder('Magento\Framework\Search\RequestInterface') - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $response = $this->getMockBuilder('Magento\Framework\Search\ResponseInterface') - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $this->requestBuilder->expects($this->once()) - ->method('setRequestName') - ->with($requestName); - $this->requestBuilder->expects($this->once()) - ->method('bindDimension') - ->with('scope', $storeId); - $this->requestBuilder->expects($this->any()) - ->method('bind');; - $this->requestBuilder->expects($this->once()) - ->method('create') - ->willReturn($request); - - $this->searchEngine->expects($this->once()) - ->method('search') - ->with($request) - ->willReturn($response); - - $this->searchResponseBuilder->expects($this->once()) - ->method('build') - ->with($response) - ->willReturn($searchResult); - - $this->storeManager->expects($this->once()) - ->method('getStore') - ->willReturn($store); - - $this->scopeConfig->expects($this->once()) - ->method('getValue') - ->with(AlgorithmFactory::XML_PATH_RANGE_CALCULATION, ScopeInterface::SCOPE_STORE) - ->willReturn($priceRangeCalculation); - - $searchResult = $this->model->search($searchCriteria); - - $this->assertInstanceOf('Magento\Framework\Api\Search\SearchResultInterface', $searchResult); - } } diff --git a/app/code/Magento/Catalog/Test/Unit/Plugin/Model/Product/Action/UpdateAttributesFlushCacheTest.php b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/Product/Action/UpdateAttributesFlushCacheTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3d70aac87798ac25f787812fa5ce1b0460ada648 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Plugin/Model/Product/Action/UpdateAttributesFlushCacheTest.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Test\Unit\Plugin\Model\Product\Action; + +use Magento\Catalog\Model\Product; + +class UpdateAttributesFlushCacheTest extends \PHPUnit_Framework_TestCase +{ + public function testAroundUpdateAttributes() + { + $productIds = [1, 2, 3]; + $attrData = []; + $storeId = 1; + + $productActionMock = $this->getMock('Magento\Catalog\Model\Product\Action', [], [], '', false); + + $cacheContextMock = $this->getMock('Magento\Indexer\Model\CacheContext', [], [], '', false); + $cacheContextMock->expects($this->once()) + ->method('registerEntities') + ->with(Product::CACHE_TAG, $productIds); + + + $eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface'); + $eventManagerMock->expects($this->once()) + ->method('dispatch') + ->with('clean_cache_by_tags', ['object' => $cacheContextMock]); + + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $model = $objectManager->getObject( + 'Magento\Catalog\Plugin\Model\Product\Action\UpdateAttributesFlushCache', + [ + 'cacheContext' => $cacheContextMock, + 'eventManager' => $eventManagerMock, + ] + ); + + $closureMock = function () use ($productActionMock) { + return $productActionMock; + }; + + $model->aroundUpdateAttributes($productActionMock, $closureMock, $productIds, $attrData, $storeId); + } +} diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml index dd16554ac015f2044bb7984990b9e8ca4f0301f5..5cf13196cbd26779ea6c7619a34636e9aef6163b 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/di.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml @@ -76,4 +76,7 @@ </argument> </arguments> </type> + <type name="Magento\Catalog\Model\Product\Action"> + <plugin name="invalidate_pagecache_after_update_product_attributes" type="Magento\Catalog\Plugin\Model\Product\Action\UpdateAttributesFlushCache"/> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/webapi.xml b/app/code/Magento/Catalog/etc/webapi.xml index 8ba7b4635b30aad4fd4c94e9e1229b602468c25d..ec8458cd8c9a7ebeda59b7dfdbde2fbb77b05bf6 100644 --- a/app/code/Magento/Catalog/etc/webapi.xml +++ b/app/code/Magento/Catalog/etc/webapi.xml @@ -39,12 +39,6 @@ <resource ref="anonymous" /> </resources> </route> - <route url="/V1/products/search" method="GET"> - <service class="Magento\Catalog\Api\ProductRepositoryInterface" method="search"/> - <resources> - <resource ref="anonymous" /> - </resources> - </route> <route url="/V1/products/attributes/types" method="GET"> <service class="Magento\Catalog\Api\ProductAttributeTypesListInterface" method="getItems"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js index cb65d9dcee1c12cdb1eb76ba6cc20c6da3b5695e..b7a16ce3db853a02f454b58af0d72e6e6d32dc31 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js @@ -132,6 +132,11 @@ define([ at: 'center top', of: 'body' }, + create: function (event, ui) { + $(document).on('click', '#productGrid_massaction-form button', function () { + $('#import-custom-options-apply-button').trigger('click', 'massActionTrigger'); + }); + }, open: function () { $(this).closest('.ui-dialog').addClass('ui-dialog-active'); @@ -195,19 +200,14 @@ define([ }] }); importContainer.load( - this.options.productGridUrl, { - form_key: this.options.formKey - }, + this.options.productGridUrl, + {form_key: this.options.formKey}, function () { importContainer.dialog('open'); } ); }, - 'click #productGrid_massaction-form button': function () { - $('#import-custom-options-apply-button').trigger('click', 'massActionTrigger'); - }, - /** * Change custom option type */ @@ -470,4 +470,4 @@ define([ } }); -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/product.css b/app/code/Magento/Catalog/view/adminhtml/web/product/product.css index e383de8ce411d5c38a5f1e8b9e59c7cc11ee2599..fce4af6f57f8f08d8ed05262f303fb170c6e870a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/product/product.css +++ b/app/code/Magento/Catalog/view/adminhtml/web/product/product.css @@ -280,13 +280,6 @@ position: static; } -/* Change Attribute Set */ -.admin__scope-old #product_info_tabs li.removed, -.admin__scope-old div.removed, -.admin__scope-old .field.removed { - display: none !important; -} - /* Custom Options -------------------------------------- */ diff --git a/app/code/Magento/Catalog/view/base/web/js/price-box.js b/app/code/Magento/Catalog/view/base/web/js/price-box.js index c2f0e23951cfbb1be1884418627bc1afaf69bcd4..4a5e3a2f8f0ab7cfdad559f8d366f528a4e94c14 100644 --- a/app/code/Magento/Catalog/view/base/web/js/price-box.js +++ b/app/code/Magento/Catalog/view/base/web/js/price-box.js @@ -97,11 +97,11 @@ define([ 'amount': 0, 'adjustments': {} }; - additionalPrice[priceCode].amount = parseInt(additionalPrice[priceCode].amount || 0, 10) + additionalPrice[priceCode].amount = 0 + (additionalPrice[priceCode].amount || 0) + priceValue.amount; _.each(priceValue.adjustments, function (adValue, adCode) { - additionalPrice[priceCode].adjustments[adCode] = - parseInt(additionalPrice[priceCode].adjustments[adCode] || 0, 10) + adValue; + additionalPrice[priceCode].adjustments[adCode] = 0 + + (additionalPrice[priceCode].adjustments[adCode] || 0) + adValue; }); }); }); @@ -117,9 +117,9 @@ define([ origin.adjustments = origin.adjustments || {}; final.adjustments = final.adjustments || {}; - final.amount = parseInt(origin.amount, 10) + option.amount; + final.amount = 0 + origin.amount + option.amount; _.each(option.adjustments, function (pa, paCode) { - final.adjustments[paCode] = parseInt(origin.adjustments[paCode] || 0, 10) + pa; + final.adjustments[paCode] = 0 + (origin.adjustments[paCode] || 0) + pa; }); }, this); } diff --git a/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js b/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js index b774dd8090d1474c4ebf777b83a1c9da7cca66f1..02898a8e87fff11dbfb6607fd39224bcdf9d3395 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js @@ -74,8 +74,8 @@ define([ $('body').trigger(self.options.processStop); } - if (res.redirect) { - window.location = res.redirect; + if (res.backUrl) { + window.location = res.backUrl; return; } if (res.messages) { diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/AbstractAction.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/AbstractAction.php index 573997db6c7a9467fb9b258776e3b23000b495f4..b75aabfcb45a857de4da641b4a8a9d9f944f700b 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock/AbstractAction.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock/AbstractAction.php @@ -8,6 +8,8 @@ namespace Magento\CatalogInventory\Model\Indexer\Stock; +use Magento\Catalog\Model\Category; + /** * Abstract action reindex class * @@ -52,19 +54,36 @@ abstract class AbstractAction */ protected $_isNeedUseIdxTable = false; + /** + * @var \Magento\Indexer\Model\CacheContext + */ + private $cacheContext; + + /** + * @var \Magento\Framework\Event\ManagerInterface + */ + private $eventManager; + + /** * @param \Magento\Framework\App\Resource $resource * @param \Magento\CatalogInventory\Model\Resource\Indexer\StockFactory $indexerFactory * @param \Magento\Catalog\Model\Product\Type $catalogProductType + * @param \Magento\Indexer\Model\CacheContext $cacheContext + * @param \Magento\Framework\Event\ManagerInterface $eventManager */ public function __construct( \Magento\Framework\App\Resource $resource, \Magento\CatalogInventory\Model\Resource\Indexer\StockFactory $indexerFactory, - \Magento\Catalog\Model\Product\Type $catalogProductType + \Magento\Catalog\Model\Product\Type $catalogProductType, + \Magento\Indexer\Model\CacheContext $cacheContext, + \Magento\Framework\Event\ManagerInterface $eventManager ) { $this->_resource = $resource; $this->_indexerFactory = $indexerFactory; $this->_catalogProductType = $catalogProductType; + $this->cacheContext = $cacheContext; + $this->eventManager = $eventManager; } /** @@ -228,6 +247,16 @@ abstract class AbstractAction } } + $select = $adapter->select() + ->distinct(true) + ->from($this->_getTable('catalog_category_product'), ['category_id']) + ->where('product_id IN(?)', $processIds); + + $affectedCategories = $adapter->fetchCol($select); + $this->cacheContext->registerEntities(Category::CACHE_TAG, $affectedCategories); + + $this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]); + return $this; } diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Indexer/Stock/Action/FullTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Indexer/Stock/Action/FullTest.php index a096f71925e83c08696139a9d64d5abed10ec239..af4fb3bba4dabb88fe5099709a28ce1cf38baa4e 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Model/Indexer/Stock/Action/FullTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Indexer/Stock/Action/FullTest.php @@ -25,20 +25,23 @@ class FullTest extends \PHPUnit_Framework_TestCase $adapterMock = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface'); $exceptionMessage = 'exception message'; - $exception = new \Exception($exceptionMessage); $adapterMock->expects($this->once()) ->method('delete') - ->will($this->throwException($exception)); + ->will($this->throwException(new \Exception($exceptionMessage))); $resourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($adapterMock)); - $model = new \Magento\CatalogInventory\Model\Indexer\Stock\Action\Full( - $resourceMock, - $indexerFactoryMock, - $productTypeMock + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $model = $objectManager->getObject( + 'Magento\CatalogInventory\Model\Indexer\Stock\Action\Full', + [ + 'resource' => $resourceMock, + 'indexerFactory' => $indexerFactoryMock, + 'catalogProductType' => $productTypeMock, + ] ); $this->setExpectedException('\Magento\Framework\Exception\LocalizedException', $exceptionMessage); diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php index cef79f4f73706fba4969a990a42bc5836f244701..ef70bb6fc518f2f6c8d0319b75721350d6b60e3b 100755 --- a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php @@ -612,6 +612,17 @@ class IndexBuilder $select->where('rp.product_id=?', $productId); } + /** + * Join group price to result + */ + $groupPriceAttr = $this->eavConfig->getAttribute(Product::ENTITY, 'group_price'); + $select->joinLeft( + ['gp' => $groupPriceAttr->getBackend()->getResource()->getMainTable()], + 'gp.entity_id=rp.product_id AND gp.customer_group_id=rp.customer_group_id AND ' + . $this->getReadAdapter()->getCheckSql('gp.website_id=0', 'TRUE', 'gp.website_id=rp.website_id'), + 'value' + ); + /** * Join default price and websites prices to result */ @@ -653,7 +664,10 @@ class IndexBuilder [] ); $select->columns([ - 'default_price' => $this->getReadAdapter()->getIfNullSql($tableAlias . '.value', 'pp_default.value'), + 'default_price' => $this->getReadAdapter()->getIfNullSql( + 'gp.value', + $this->getReadAdapter()->getIfNullSql($tableAlias . '.value', 'pp_default.value') + ), ]); return $read->query($select); diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php index 8c41a3c24276dcad12e5733216b5eb2a21cc3640..3687d55d4710fba30b24b144e14c0691e972730f 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/IndexBuilderTest.php @@ -148,7 +148,7 @@ class IndexBuilderTest extends \PHPUnit_Framework_TestCase $this->priceCurrency = $this->getMock('Magento\Framework\Pricing\PriceCurrencyInterface'); $this->dateFormat = $this->getMock('Magento\Framework\Stdlib\DateTime', [], [], '', false); $this->dateTime = $this->getMock('Magento\Framework\Stdlib\DateTime\DateTime', [], [], '', false); - $this->eavConfig = $this->getMock('Magento\Eav\Model\Config', [], [], '', false); + $this->eavConfig = $this->getMock('Magento\Eav\Model\Config', ['getAttribute'], [], '', false); $this->product = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->productFactory = $this->getMock('Magento\Catalog\Model\ProductFactory', ['create'], [], '', false); @@ -182,7 +182,6 @@ class IndexBuilderTest extends \PHPUnit_Framework_TestCase $this->combine->expects($this->any())->method('validate')->will($this->returnValue(true)); $this->attribute->expects($this->any())->method('getBackend')->will($this->returnValue($this->backend)); - $this->eavConfig->expects($this->any())->method('getAttribute')->will($this->returnValue($this->attribute)); $this->productFactory->expects($this->any())->method('create')->will($this->returnValue($this->product)); $this->indexBuilder = new \Magento\CatalogRule\Model\Indexer\IndexBuilder( @@ -206,6 +205,45 @@ class IndexBuilderTest extends \PHPUnit_Framework_TestCase */ public function testUpdateCatalogRuleGroupWebsiteData() { + $groupPriceAttrMock = $this->getMock( + 'Magento\Catalog\Model\Entity\Attribute', + ['getBackend'], + [], + '', + false + ); + $backendModelMock = $this->getMock( + 'Magento\Catalog\Model\Product\Attribute\Backend\GroupPrice', + ['getResource'], + [], + '', + false + ); + $resourceMock = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\GroupPrice', + ['getMainTable'], + [], + '', + false + ); + $resourceMock->expects($this->once()) + ->method('getMainTable') + ->will($this->returnValue('catalog_product_entity_group_price')); + $backendModelMock->expects($this->once()) + ->method('getResource') + ->will($this->returnValue($resourceMock)); + $groupPriceAttrMock->expects($this->once()) + ->method('getBackend') + ->will($this->returnValue($backendModelMock)); + $this->eavConfig->expects($this->at(0)) + ->method('getAttribute') + ->with(\Magento\Catalog\Model\Product::ENTITY, 'group_price') + ->will($this->returnValue($groupPriceAttrMock)); + $this->eavConfig->expects($this->at(1)) + ->method('getAttribute') + ->with(\Magento\Catalog\Model\Product::ENTITY, 'price') + ->will($this->returnValue($this->attribute)); + $this->select->expects($this->once())->method('insertFromSelect')->with('catalogrule_group_website'); $this->indexBuilder->reindexByIds([1]); diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/IndexStructure.php b/app/code/Magento/CatalogSearch/Model/Indexer/IndexStructure.php index 2f3320648ad62b043412713649868ec794284d71..4c0166ea9c0fb4bff54aa8456c62d41c6b9ea8b5 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/IndexStructure.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/IndexStructure.php @@ -10,7 +10,7 @@ use Magento\Framework\App\Resource; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Search\Request\Dimension; -use Magento\Search\Model\ScopeResolver\IndexScopeResolver; +use Magento\Indexer\Model\ScopeResolver\IndexScopeResolver; class IndexStructure { diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/IndexerHandler.php b/app/code/Magento/CatalogSearch/Model/Indexer/IndexerHandler.php index 47d49900ef231036e3f0406bda471f8d4f513fe5..cbaeb578ac1220fb02fb443ddc6bd43bbb3ea748 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/IndexerHandler.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/IndexerHandler.php @@ -12,7 +12,7 @@ use Magento\Framework\IndexerInterface; use Magento\Framework\Search\Request\Dimension; use Magento\Framework\Search\Request\IndexScopeResolverInterface; use Magento\Indexer\Model\SaveHandler\Batch; -use Magento\Search\Model\ScopeResolver\IndexScopeResolver; +use Magento\Indexer\Model\ScopeResolver\IndexScopeResolver; class IndexerHandler implements IndexerInterface { @@ -61,7 +61,7 @@ class IndexerHandler implements IndexerInterface * @param Resource|Resource $resource * @param Config $eavConfig * @param Batch $batch - * @param IndexScopeResolver $indexScopeResolver + * @param \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver $indexScopeResolver * @param array $data * @param int $batchSize */ diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Mview/Action.php b/app/code/Magento/CatalogSearch/Model/Indexer/Mview/Action.php new file mode 100644 index 0000000000000000000000000000000000000000..03f0fb14eadced11386b44cf80806db7afe29e3f --- /dev/null +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Mview/Action.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogSearch\Model\Indexer\Mview; + + +use Magento\CatalogSearch\Model\Indexer\Fulltext; +use Magento\Framework\Mview\ActionInterface; +use Magento\Indexer\Model\IndexerInterfaceFactory; + +class Action implements ActionInterface +{ + /** + * @var IndexerInterfaceFactory + */ + private $indexerFactory; + + /** + * @param IndexerInterfaceFactory $indexerFactory + */ + public function __construct(IndexerInterfaceFactory $indexerFactory) + { + $this->indexerFactory = $indexerFactory; + } + + /** + * Execute materialization on ids entities + * + * @param int[] $ids + * @return void + * @api + */ + public function execute($ids) + { + /** @var \Magento\Indexer\Model\IndexerInterface $indexer */ + $indexer = $this->indexerFactory->create()->load(Fulltext::INDEXER_ID); + $indexer->reindexList($ids); + } +} diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Engine.php b/app/code/Magento/CatalogSearch/Model/Resource/Engine.php index 74c767a5ab9942454d18f89f666acf2ab80c38d7..a3c39528a1d0f16a8e65b3cac43a0e5b94339725 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Engine.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Engine.php @@ -27,7 +27,7 @@ class Engine implements EngineInterface protected $catalogProductVisibility; /** - * @var \Magento\Search\Model\ScopeResolver\IndexScopeResolver + * @var \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver */ private $indexScopeResolver; @@ -35,11 +35,11 @@ class Engine implements EngineInterface * Construct * * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility - * @param \Magento\Search\Model\ScopeResolver\IndexScopeResolver $indexScopeResolver + * @param \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver $indexScopeResolver */ public function __construct( \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, - \Magento\Search\Model\ScopeResolver\IndexScopeResolver $indexScopeResolver + \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver $indexScopeResolver ) { $this->catalogProductVisibility = $catalogProductVisibility; $this->indexScopeResolver = $indexScopeResolver; diff --git a/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php b/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php index 4e6648b6f5c0805fa270b1ba20a4c1e862a6ee20..6ae4e1ba0cf88ac0a3a9f747c83ae6e1f57f7fa8 100644 --- a/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php +++ b/app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php @@ -12,11 +12,10 @@ use Magento\Framework\DB\Select; use Magento\Framework\Search\Adapter\Mysql\ConditionManager; use Magento\Framework\Search\Adapter\Mysql\IndexBuilderInterface; use Magento\Framework\Search\Request\Dimension; -use Magento\Framework\Search\Request\Query\Bool; use Magento\Framework\Search\Request\QueryInterface; use Magento\Framework\Search\Request\QueryInterface as RequestQueryInterface; use Magento\Framework\Search\RequestInterface; -use Magento\Search\Model\ScopeResolver\IndexScopeResolver; +use Magento\Indexer\Model\ScopeResolver\IndexScopeResolver; use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php index 33ca04f2b95d2d435131ae19b30cba5676eaabb4..5e93d20132e38849d704ccd9d48dc58b83563659 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/IndexBuilderTest.php @@ -84,7 +84,7 @@ class IndexBuilderTest extends \PHPUnit_Framework_TestCase $this->storeManager = $this->getMockBuilder('Magento\Store\Model\StoreManagerInterface')->getMock(); - $this->scopeResolver = $this->getMockBuilder('\Magento\Search\Model\ScopeResolver\IndexScopeResolver') + $this->scopeResolver = $this->getMockBuilder('\Magento\Indexer\Model\ScopeResolver\IndexScopeResolver') ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/Indexer/IndexStructureTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/Indexer/IndexStructureTest.php index a589de77d66c63b267260970eba6c4898a6ef8d3..1acbcbc51d1e93e6f8c4e8bcca1960cc0abd9f42 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/Indexer/IndexStructureTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Model/Search/Indexer/IndexStructureTest.php @@ -16,7 +16,7 @@ use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class IndexStructureTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Search\Model\ScopeResolver\IndexScopeResolver|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver|\PHPUnit_Framework_MockObject_MockObject */ private $indexScopeResolver; /** @@ -46,11 +46,11 @@ class IndexStructureTest extends \PHPUnit_Framework_TestCase ->method('getConnection') ->with(\Magento\Framework\App\Resource::DEFAULT_WRITE_RESOURCE) ->willReturn($this->adapter); - $this->indexScopeResolver = $this->getMockBuilder('\Magento\Search\Model\ScopeResolver\IndexScopeResolver') + $this->indexScopeResolver = $this->getMockBuilder('\Magento\Indexer\Model\ScopeResolver\IndexScopeResolver') ->setMethods(['resolve']) ->disableOriginalConstructor() ->getMock(); - $this->flatScopeResolver = $this->getMockBuilder('\Magento\Search\Model\ScopeResolver\FlatScopeResolver') + $this->flatScopeResolver = $this->getMockBuilder('\Magento\Indexer\Model\ScopeResolver\FlatScopeResolver') ->setMethods(['resolve']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/CatalogSearch/etc/mview.xml b/app/code/Magento/CatalogSearch/etc/mview.xml index dac32882981e509d2df360180f9754f818352fa6..8e9fb605186ddb7392a5d87ff38efac9df69f7f4 100644 --- a/app/code/Magento/CatalogSearch/etc/mview.xml +++ b/app/code/Magento/CatalogSearch/etc/mview.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Mview/etc/mview.xsd"> - <view id="catalogsearch_fulltext" class="Magento\CatalogSearch\Model\Indexer\Fulltext" group="indexer"> + <view id="catalogsearch_fulltext" class="\Magento\CatalogSearch\Model\Indexer\Mview\Action" group="indexer"> <subscriptions> <table name="catalog_product_entity" entity_column="entity_id" /> <table name="catalog_product_entity_int" entity_column="entity_id" /> 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/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index fd79502fbcb0d30195e19be88f619b2f7491c56c..8c8636d87d8be418d8b0f6dc884e0401700f7b3d 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -76,6 +76,11 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ protected $quoteRepository; + /** + * @var \Magento\Checkout\Model\Cart\CollectQuote + */ + protected $collectQuote; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession @@ -88,6 +93,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart * @param AddressRepositoryInterface $addressRepository * @param CustomerRepositoryInterface $customerRepository * @param QuoteRepository $quoteRepository + * @param \Magento\Checkout\Model\Cart\CollectQuote $collectQuote * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -103,6 +109,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart AddressRepositoryInterface $addressRepository, CustomerRepositoryInterface $customerRepository, QuoteRepository $quoteRepository, + \Magento\Checkout\Model\Cart\CollectQuote $collectQuote, array $data = [] ) { $this->priceCurrency = $priceCurrency; @@ -113,12 +120,12 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart $this->addressRepository = $addressRepository; $this->customerRepository = $customerRepository; $this->quoteRepository = $quoteRepository; + $this->collectQuote = $collectQuote; parent::__construct($context, $customerSession, $checkoutSession, $data); $this->_isScopePrivate = true; } - /** - * Get config + /** Get config * * @param string $path * @return string|null @@ -364,22 +371,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ protected function _beforeToHtml() { - if ($this->_customerSession->isLoggedIn()) { - $customer = $this->customerRepository->getById($this->_customerSession->getCustomerId()); - if ($defaultShipping = $customer->getDefaultShipping()) { - $address = $this->addressRepository->getById($defaultShipping); - if ($address) { - /** @var \Magento\Quote\Api\Data\EstimateAddressInterface $estimatedAddress */ - $estimatedAddress = $this->estimatedAddressFactory->create(); - $estimatedAddress->setCountryId($address->getCountryId()); - $estimatedAddress->setPostcode($address->getPostcode()); - $estimatedAddress->setRegion((string)$address->getRegion()->getRegion()); - $estimatedAddress->setRegionId($address->getRegionId()); - $this->shippingMethodManager->estimateByAddress($this->getQuote()->getId(), $estimatedAddress); - $this->quoteRepository->save($this->getQuote()); - } - } - } + $this->collectQuote->collect($this->getQuote()); return parent::_beforeToHtml(); } 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/Block/Registration.php b/app/code/Magento/Checkout/Block/Registration.php index a54c576873982ac8c8d40a710f53dd288d6b78e2..60ae21ce65721325b7da2aace9f359f596c475aa 100644 --- a/app/code/Magento/Checkout/Block/Registration.php +++ b/app/code/Magento/Checkout/Block/Registration.php @@ -29,12 +29,24 @@ class Registration extends \Magento\Framework\View\Element\Template */ protected $accountManagement; + /** + * @var \Magento\Sales\Api\OrderRepositoryInterface + */ + protected $orderRepository; + + /** + * @var \Magento\Sales\Model\Order\Address\Validator + */ + protected $addressValidator; + /** * @param Template\Context $context * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\Registration $registration * @param \Magento\Customer\Api\AccountManagementInterface $accountManagement + * @param \Magento\Sales\Api\OrderRepositoryInterface $orderRepository + * @param \Magento\Sales\Model\Order\Address\Validator $addressValidator * @param array $data */ public function __construct( @@ -43,12 +55,16 @@ class Registration extends \Magento\Framework\View\Element\Template \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Registration $registration, \Magento\Customer\Api\AccountManagementInterface $accountManagement, + \Magento\Sales\Api\OrderRepositoryInterface $orderRepository, + \Magento\Sales\Model\Order\Address\Validator $addressValidator, array $data = [] ) { $this->checkoutSession = $checkoutSession; $this->customerSession = $customerSession; $this->registration = $registration; $this->accountManagement = $accountManagement; + $this->orderRepository = $orderRepository; + $this->addressValidator = $addressValidator; parent::__construct($context, $data); } @@ -81,9 +97,28 @@ class Registration extends \Magento\Framework\View\Element\Template $this->customerSession->isLoggedIn() || !$this->registration->isAllowed() || !$this->accountManagement->isEmailAvailable($this->getEmailAddress()) + || !$this->validateAddresses() ) { return ''; } return parent::toHtml(); } + + /** + * Validate order addresses + * + * @return bool + */ + protected function validateAddresses() + { + $order = $this->orderRepository->get($this->checkoutSession->getLastOrderId()); + $addresses = $order->getAddresses(); + foreach ($addresses as $address) { + $result = $this->addressValidator->validateForCustomer($address); + if (is_array($result) && !empty($result)) { + return false; + } + } + return true; + } } diff --git a/app/code/Magento/Checkout/Controller/Cart/Add.php b/app/code/Magento/Checkout/Controller/Cart/Add.php index 97c2a346efc987f653bfec9d76659ebc9b080824..05bafe1daa1ae6d614fadff393de49607e1194ba 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Add.php +++ b/app/code/Magento/Checkout/Controller/Cart/Add.php @@ -169,7 +169,7 @@ class Add extends \Magento\Checkout\Controller\Cart $result = []; if ($backUrl || $backUrl = $this->getBackUrl()) { - $result['redirect'] = $backUrl; + $result['backUrl'] = $backUrl; } else { if ($product && !$product->getIsSalable()) { $result['product'] = [ 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/Model/Cart/CollectQuote.php b/app/code/Magento/Checkout/Model/Cart/CollectQuote.php new file mode 100644 index 0000000000000000000000000000000000000000..170f2e6a9cb0825fbd22053fe445eb39c9a4a602 --- /dev/null +++ b/app/code/Magento/Checkout/Model/Cart/CollectQuote.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Checkout\Model\Cart; + +class CollectQuote +{ + /** + * @var \Magento\Customer\Model\Session + */ + protected $customerSession; + + /** + * @var \Magento\Customer\Api\CustomerRepositoryInterface + */ + protected $customerRepository; + + /** + * @var \Magento\Customer\Api\AddressRepositoryInterface + */ + protected $addressRepository; + + /** + * @var \Magento\Quote\Api\Data\EstimateAddressInterfaceFactory + */ + protected $estimatedAddressFactory; + + /** + * @var \Magento\Quote\Api\ShippingMethodManagementInterface + */ + protected $shippingMethodManager; + + /** + * @var \Magento\Quote\Model\QuoteRepository + */ + protected $quoteRepository; + + /** + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository + * @param \Magento\Customer\Api\AddressRepositoryInterface $addressRepository + * @param \Magento\Quote\Api\Data\EstimateAddressInterfaceFactory $estimatedAddressFactory + * @param \Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethodManager + * @param \Magento\Quote\Model\QuoteRepository $quoteRepository + */ + public function __construct( + \Magento\Customer\Model\Session $customerSession, + \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, + \Magento\Customer\Api\AddressRepositoryInterface $addressRepository, + \Magento\Quote\Api\Data\EstimateAddressInterfaceFactory $estimatedAddressFactory, + \Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethodManager, + \Magento\Quote\Model\QuoteRepository $quoteRepository + ) { + $this->customerSession = $customerSession; + $this->customerRepository = $customerRepository; + $this->addressRepository = $addressRepository; + $this->estimatedAddressFactory = $estimatedAddressFactory; + $this->shippingMethodManager = $shippingMethodManager; + $this->quoteRepository = $quoteRepository; + } + + /** + * @param \Magento\Quote\Model\Quote $quote + * @return void + */ + public function collect(\Magento\Quote\Model\Quote $quote) + { + if ($this->customerSession->isLoggedIn()) { + $customer = $this->customerRepository->getById($this->customerSession->getCustomerId()); + if ($defaultShipping = $customer->getDefaultShipping()) { + $address = $this->addressRepository->getById($defaultShipping); + if ($address) { + /** @var \Magento\Quote\Api\Data\EstimateAddressInterface $estimatedAddress */ + $estimatedAddress = $this->estimatedAddressFactory->create(); + $estimatedAddress->setCountryId($address->getCountryId()); + $estimatedAddress->setPostcode($address->getPostcode()); + $estimatedAddress->setRegion((string)$address->getRegion()->getRegion()); + $estimatedAddress->setRegionId($address->getRegionId()); + $this->shippingMethodManager->estimateByAddress($quote->getId(), $estimatedAddress); + $this->quoteRepository->save($quote); + } + } + } + } +} diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php index 13fbfbc990be11852eef14ff41ee0bcbcc708484..eee32ec716ca518dcfe8f5636863f6641e336b21 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/ShippingTest.php @@ -85,6 +85,9 @@ class ShippingTest extends \PHPUnit_Framework_TestCase /** @var Quote |\PHPUnit_Framework_MockObject_MockObject */ protected $quote; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $collectQuote; + protected function setUp() { $this->prepareContext(); @@ -117,8 +120,13 @@ class ShippingTest extends \PHPUnit_Framework_TestCase $this->customerRepository = $this->getMockBuilder('Magento\Customer\Api\CustomerRepositoryInterface') ->getMockForAbstractClass(); + $this->collectQuote = $this->getMockBuilder('Magento\Checkout\Model\Cart\CollectQuote') + ->disableOriginalConstructor() + ->getMock(); + $this->prepareQuoteRepository(); + $this->model = new Shipping( $this->context, $this->customerSession, @@ -130,7 +138,8 @@ class ShippingTest extends \PHPUnit_Framework_TestCase $this->shippingMethodManager, $this->addressReporitory, $this->customerRepository, - $this->quoteRepository + $this->quoteRepository, + $this->collectQuote ); } @@ -259,182 +268,19 @@ class ShippingTest extends \PHPUnit_Framework_TestCase ->with('advanced/modules_disable_output/Magento_Checkout', ScopeInterface::SCOPE_STORE) ->willReturn(false); - $this->customerSession->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(false); - - $this->assertEquals('', $this->model->toHtml()); - } - - public function testBeforeToHtmlNoDefaultShippingAddress() - { - $customerId = 1; - $defaultShipping = 0; - - $this->eventManager->expects($this->once()) - ->method('dispatch') - ->with('view_block_abstract_to_html_before', ['block' => $this->model]) - ->willReturnSelf(); - - $this->scopeConfig->expects($this->once()) - ->method('getValue') - ->with('advanced/modules_disable_output/Magento_Checkout', ScopeInterface::SCOPE_STORE) - ->willReturn(false); - - $this->customerSession->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->customerSession->expects($this->once()) - ->method('getCustomerId') - ->willReturn($customerId); - - $customerData = $this->getMockBuilder('Magento\Customer\Api\Data\CustomerInterface') - ->setMethods([ - 'getDefaultShipping', - ]) - ->getMockForAbstractClass(); - $customerData->expects($this->once()) - ->method('getDefaultShipping') - ->willReturn($defaultShipping); - - $this->customerRepository->expects($this->once()) - ->method('getById') - ->with($customerId) - ->willReturn($customerData); - - $this->assertEquals('', $this->model->toHtml()); - } - - /** - * @param int $customerId - * @param int $defaultShipping - * @param int $countryId - * @param string $postcode - * @param string $region - * @param int $regionId - * @param int $quoteId - * @dataProvider dataProviderBeforeToHtml - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testBeforeToHtml( - $customerId, - $defaultShipping, - $countryId, - $postcode, - $region, - $regionId, - $quoteId - ) { - $this->eventManager->expects($this->once()) - ->method('dispatch') - ->with('view_block_abstract_to_html_before', ['block' => $this->model]) - ->willReturnSelf(); - - $this->scopeConfig->expects($this->once()) - ->method('getValue') - ->with('advanced/modules_disable_output/Magento_Checkout', ScopeInterface::SCOPE_STORE) - ->willReturn(false); - - $this->customerSession->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->customerSession->expects($this->once()) - ->method('getCustomerId') - ->willReturn($customerId); - - $customerDataMock = $this->getMockBuilder('Magento\Customer\Api\Data\CustomerInterface') - ->setMethods([ - 'getDefaultShipping', - ]) - ->getMockForAbstractClass(); - $customerDataMock->expects($this->once()) - ->method('getDefaultShipping') - ->willReturn($defaultShipping); - - $this->customerRepository->expects($this->once()) - ->method('getById') - ->with($customerId) - ->willReturn($customerDataMock); - - $this->addressReporitory->expects($this->once()) - ->method('getById') - ->with($defaultShipping) - ->willReturn($this->address); - - $regionMock = $this->getMockBuilder('Magento\Customer\Api\Data\RegionInterface') - ->setMethods([ - 'getRegion', - ]) - ->getMockForAbstractClass(); - $regionMock->expects($this->once()) - ->method('getRegion') - ->willReturn($region); - - $this->address->expects($this->once()) - ->method('getCountryId') - ->willReturn($countryId); - $this->address->expects($this->once()) - ->method('getPostcode') - ->willReturn($postcode); - $this->address->expects($this->once()) - ->method('getRegion') - ->willReturn($regionMock); - $this->address->expects($this->once()) - ->method('getRegionId') - ->willReturn($regionId); - - $this->estimatedAddress->expects($this->once()) - ->method('setCountryId') - ->with($countryId) - ->willReturnSelf(); - $this->estimatedAddress->expects($this->once()) - ->method('setPostcode') - ->with($postcode) - ->willReturnSelf(); - $this->estimatedAddress->expects($this->once()) - ->method('setRegion') - ->with($region) - ->willReturnSelf(); - $this->estimatedAddress->expects($this->once()) - ->method('setRegionId') - ->with($regionId) - ->willReturnSelf(); - - $this->checkoutSession->expects($this->once()) + $quote = $this->getMockBuilder('Magento\Quote\Model\Quote') + ->disableOriginalConstructor() + ->getMock(); + $this->checkoutSession->expects($this->any()) ->method('getQuote') - ->willReturn($this->quote); - - $this->quote->expects($this->once()) - ->method('getId') - ->willReturn($quoteId); - - $this->shippingMethodManager->expects($this->once()) - ->method('estimateByAddress') - ->with($quoteId, $this->estimatedAddress) - ->willReturnSelf(); - - $this->quoteRepository->expects($this->once()) - ->method('save') - ->with($this->quote) - ->willReturnSelf(); + ->willReturn($quote); + $this->collectQuote->expects($this->once()) + ->method('collect') + ->with($quote); $this->assertEquals('', $this->model->toHtml()); } - /** - * @return array - */ - public function dataProviderBeforeToHtml() - { - return [ - [1, 1, 1, '12345', '', 1, 1], - [1, 1, 1, '12345', '', 0, 1], - [1, 1, 1, '', '', 0, 1], - [1, 1, 1, '12345', 'California', 0, 1], - [1, 1, 1, '12345', 'California', 1, 1], - ]; - } - /** * @param int $count * @param bool $expectedResult 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/Model/Config/Backend/Currency/Base.php b/app/code/Magento/Config/Model/Config/Backend/Currency/Base.php index 8bc0a9a1271e456bc922ac7c450ee3fafbc6bf45..2ab2b63e5ff629b0cec38313f91df81a13b9fb5a 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Currency/Base.php +++ b/app/code/Magento/Config/Model/Config/Backend/Currency/Base.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Backend Directory currency backend model * Allows dispatching before and after events for each controller action @@ -14,6 +12,33 @@ namespace Magento\Config\Model\Config\Backend\Currency; class Base extends AbstractCurrency { + /** @var \Magento\Directory\Model\CurrencyFactory */ + private $currencyFactory; + + /** + * @param \Magento\Framework\Model\Context $context + * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\App\Config\ScopeConfigInterface $config + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory + * @param \Magento\Framework\Model\Resource\AbstractResource $resource + * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Framework\Model\Context $context, + \Magento\Framework\Registry $registry, + \Magento\Framework\App\Config\ScopeConfigInterface $config, + \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Directory\Model\CurrencyFactory $currencyFactory, + \Magento\Framework\Model\Resource\AbstractResource $resource = null, + \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + array $data = [] + ) { + parent::__construct($context, $registry, $config, $scopeConfig, $resource, $resourceCollection, $data); + $this->currencyFactory = $currencyFactory; + } + /** * Check base currency is available in installed currencies * @@ -22,9 +47,14 @@ class Base extends AbstractCurrency */ public function afterSave() { - if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - throw new \Magento\Framework\Exception\LocalizedException(__('Sorry, we haven\'t installed the base currency you selected.')); + $value = $this->getValue(); + if (!in_array($value, $this->_getInstalledCurrencies())) { + throw new \Magento\Framework\Exception\LocalizedException( + __('Sorry, we haven\'t installed the base currency you selected.') + ); } + + $this->currencyFactory->create()->saveRates([$value =>[$value => 1]]); return $this; } } 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/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index a02d5af3c3916da9bea09c5aef080cce4f38c648..b67361c4fcc8a740dddceeadaed4fe4b4e3429a5 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -187,8 +187,9 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView 'amount' => $this->_registerJsPrice($this->_convertPrice($regularPrice->getAmount()->getValue())), ], 'basePrice' => [ - 'amount' => - $this->_registerJsPrice($this->_convertPrice($finalPrice->getAmount()->getBaseAmount())), + 'amount' => $this->_registerJsPrice( + $this->_convertPrice($finalPrice->getAmount()->getBaseAmount()) + ), ], 'finalPrice' => [ 'amount' => $this->_registerJsPrice($this->_convertPrice($finalPrice->getAmount()->getValue())), @@ -197,7 +198,6 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView 'productId' => $currentProduct->getId(), 'chooseText' => __('Choose an Option...'), 'images' => isset($options['images']) ? $options['images'] : [], - 'baseImage' => $options['baseImage'], ]; if ($currentProduct->hasPreconfiguredValues() && !empty($attributesData['defaultValues'])) { diff --git a/app/code/Magento/ConfigurableProduct/Helper/Data.php b/app/code/Magento/ConfigurableProduct/Helper/Data.php index ed0c999f3761ec267791a2f79336965107d0b743..0a30e2f5a5c8d2398b928463cbad080d9148851b 100644 --- a/app/code/Magento/ConfigurableProduct/Helper/Data.php +++ b/app/code/Magento/ConfigurableProduct/Helper/Data.php @@ -58,7 +58,6 @@ class Data $options['images'][$productAttributeId][$attributeValue][$productId] = $imageUrl; } } - $options['baseImage'] = $baseImageUrl; return $options; } diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php index 4d2d219bc2258d8a5af681f5e8ab4512cce0964f..031dac827c83563ccc7dbd5fcd2d9d9bf29d9cba 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Helper/DataTest.php @@ -82,11 +82,10 @@ class DataTest extends \PHPUnit_Framework_TestCase ); $provider = []; $provider[] = [ - ['baseImage' => 'http://example.com/base_img_url'], + [], [ 'allowed_products' => [], 'current_product_mock' => $currentProductMock, - 'baseImage' => 'http://example.com/base_img_url' ], ]; @@ -163,12 +162,10 @@ class DataTest extends \PHPUnit_Framework_TestCase 'attribute_id_2' => [ 'attribute_code_value_2' => ['product_id_1', 'product_id_2'], ], - 'baseImage' => 'http://example.com/base_img_url', ], [ 'allowed_products' => $allowedProducts, 'current_product_mock' => $currentProductMock, - 'baseImage' => 'http://example.com/base_img_url' ], ]; return $provider; diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index 0b1449f2bc2733d3c7ebb006e0a66887bc51d360..34cbd39eff804f1bf15ced403f4acf96b0563c0a 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -10,7 +10,8 @@ define([ "priceUtils", "priceBox", "jquery/ui", - "jquery/jquery.parsequery" + "jquery/jquery.parsequery", + "mage/gallery" ], function($, _, mageTemplate, utils){ $.widget('mage.configurable', { @@ -69,6 +70,10 @@ define([ this.options.values = this.options.spConfig.defaultValues || {}; this.options.parentImage = $('[data-role=base-image-container] img').attr('src'); + + this.initialGalleryImages = $(this.options.mediaGallerySelector).data('mageGallery') + ? $(this.options.mediaGallerySelector).gallery('option', 'images') + : []; this.inputSimpleProduct = this.element.find(this.options.selectSimpleProduct); }, @@ -226,12 +231,7 @@ define([ _changeProductImage: function () { var images = this.options.spConfig.images, imagesArray = null, - galleryElement = $(this.options.mediaGallerySelector), - baseImage = { - small: this.options.spConfig.baseImage, - medium: this.options.spConfig.baseImage, - large: this.options.spConfig.baseImage - }; + galleryElement = $(this.options.mediaGallerySelector); $.each(this.options.settings, function (k, v) { var selectValue = parseInt(v.value, 10), attributeId = v.id.replace(/[a-z]*/, ''); @@ -251,18 +251,16 @@ define([ }); var result = []; - $.each(imagesArray || baseImage, function (k, v) { + $.each(imagesArray || {}, function (k, v) { result.push({ small: v, medium: v, large: v }); }); - if (result.length !== 1) { - result = [baseImage]; - } + if (galleryElement.length && galleryElement.data('mageGallery')) { - galleryElement.gallery('option', 'images', result); + galleryElement.gallery('option', 'images', result.length > 0 ? result : this.initialGalleryImages); } }, 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/Customer/view/frontend/web/js/customer-data.js b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js index 3fc839a52be45cbd2cf3aa9e67fa1be27c052875..2ab04102c3dc2e348619af7f728e6f1eff5c6181 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js +++ b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js @@ -134,7 +134,7 @@ define([ var sections = sectionConfig.getAffectedSections(settings.url); if (sections) { customerData.invalidate(sections); - var redirects = ['redirect']; + var redirects = ['redirect', 'backUrl']; if (_.isObject(xhr.responseJSON) && !_.isEmpty(_.pick(xhr.responseJSON, redirects))) { return ; } 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/Indexer/Model/IndexStructure.php b/app/code/Magento/Indexer/Model/IndexStructure.php index d7c673cf504654d05eae352fb49e2d67d19cf887..0443b6deecd771009f0905145464c067c71bf34d 100644 --- a/app/code/Magento/Indexer/Model/IndexStructure.php +++ b/app/code/Magento/Indexer/Model/IndexStructure.php @@ -11,8 +11,8 @@ use Magento\Framework\App\Resource; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Search\Request\Dimension; -use Magento\Search\Model\ScopeResolver\FlatScopeResolver; -use Magento\Search\Model\ScopeResolver\IndexScopeResolver; +use Magento\Indexer\Model\ScopeResolver\FlatScopeResolver; +use Magento\Indexer\Model\ScopeResolver\IndexScopeResolver; class IndexStructure { @@ -21,7 +21,7 @@ class IndexStructure */ private $resource; /** - * @var IndexScopeResolver + * @var \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver */ private $indexScopeResolver; /** @@ -41,7 +41,7 @@ class IndexStructure /** * @param Resource|Resource $resource * @param IndexScopeResolver $indexScopeResolver - * @param FlatScopeResolver $flatScopeResolver + * @param \Magento\Indexer\Model\ScopeResolver\FlatScopeResolver $flatScopeResolver * @param array $columnTypesMap */ public function __construct( diff --git a/app/code/Magento/Indexer/Model/SaveHandler/IndexerHandler.php b/app/code/Magento/Indexer/Model/SaveHandler/IndexerHandler.php index 9059a96aadf5659a1e227e336bd85c7a550c318f..37257f1f560714816e3b61637141ad44a4c65c89 100644 --- a/app/code/Magento/Indexer/Model/SaveHandler/IndexerHandler.php +++ b/app/code/Magento/Indexer/Model/SaveHandler/IndexerHandler.php @@ -11,8 +11,8 @@ use Magento\Framework\IndexerInterface; use Magento\Indexer\Model\IndexStructure; use Magento\Framework\Search\Request\Dimension; use Magento\Framework\Search\Request\IndexScopeResolverInterface; -use Magento\Search\Model\ScopeResolver\FlatScopeResolver; -use Magento\Search\Model\ScopeResolver\IndexScopeResolver; +use Magento\Indexer\Model\ScopeResolver\FlatScopeResolver; +use Magento\Indexer\Model\ScopeResolver\IndexScopeResolver; class IndexerHandler implements IndexerInterface { @@ -60,8 +60,8 @@ class IndexerHandler implements IndexerInterface * @param IndexStructure $indexStructure * @param Resource $resource * @param Batch $batch - * @param IndexScopeResolver $indexScopeResolver - * @param FlatScopeResolver $flatScopeResolver + * @param \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver $indexScopeResolver + * @param \Magento\Indexer\Model\ScopeResolver\FlatScopeResolver $flatScopeResolver * @param array $data * @param int $batchSize */ diff --git a/app/code/Magento/Search/Model/ScopeResolver/FlatScopeResolver.php b/app/code/Magento/Indexer/Model/ScopeResolver/FlatScopeResolver.php similarity index 89% rename from app/code/Magento/Search/Model/ScopeResolver/FlatScopeResolver.php rename to app/code/Magento/Indexer/Model/ScopeResolver/FlatScopeResolver.php index 98241dae0b2e6ccb8715c84cf16c9ab6827b14c5..8e415be17131e8340e5ccbc0b30722469dc825ca 100644 --- a/app/code/Magento/Search/Model/ScopeResolver/FlatScopeResolver.php +++ b/app/code/Magento/Indexer/Model/ScopeResolver/FlatScopeResolver.php @@ -4,10 +4,11 @@ * See COPYING.txt for license details. */ -namespace Magento\Search\Model\ScopeResolver; +namespace Magento\Indexer\Model\ScopeResolver; use Magento\Framework\Search\Request\Dimension; use Magento\Framework\Search\Request\IndexScopeResolverInterface; +use Magento\Indexer\Model\ScopeResolver\IndexScopeResolver; class FlatScopeResolver implements IndexScopeResolverInterface { diff --git a/app/code/Magento/Search/Model/ScopeResolver/IndexScopeResolver.php b/app/code/Magento/Indexer/Model/ScopeResolver/IndexScopeResolver.php similarity index 97% rename from app/code/Magento/Search/Model/ScopeResolver/IndexScopeResolver.php rename to app/code/Magento/Indexer/Model/ScopeResolver/IndexScopeResolver.php index 381f20c79ed97310fb9afb2c3ba3cf0954f2e428..696d6af0041b2dd1695b56b5a49c08a7f21ca7ce 100644 --- a/app/code/Magento/Search/Model/ScopeResolver/IndexScopeResolver.php +++ b/app/code/Magento/Indexer/Model/ScopeResolver/IndexScopeResolver.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Search\Model\ScopeResolver; +namespace Magento\Indexer\Model\ScopeResolver; use Magento\Framework\App\Resource; diff --git a/app/code/Magento/Indexer/Test/Unit/Model/IndexStructureTest.php b/app/code/Magento/Indexer/Test/Unit/Model/IndexStructureTest.php index a6884d22d03bf136b28200a0df6e8ace767bf9a3..aa002ea18a56c384eccbf2c121d2e4e691a6cd79 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/IndexStructureTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/IndexStructureTest.php @@ -16,12 +16,12 @@ use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class IndexStructureTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Search\Model\ScopeResolver\IndexScopeResolver|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver|\PHPUnit_Framework_MockObject_MockObject */ private $indexScopeResolver; /** - * @var \Magento\Search\Model\ScopeResolver\FlatScopeResolver|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Indexer\Model\ScopeResolver\FlatScopeResolver|\PHPUnit_Framework_MockObject_MockObject */ private $flatScopeResolver; @@ -53,11 +53,11 @@ class IndexStructureTest extends \PHPUnit_Framework_TestCase ->method('getConnection') ->with('write') ->willReturn($this->adapter); - $this->indexScopeResolver = $this->getMockBuilder('\Magento\Search\Model\ScopeResolver\IndexScopeResolver') + $this->indexScopeResolver = $this->getMockBuilder('\Magento\Indexer\Model\ScopeResolver\IndexScopeResolver') ->setMethods(['resolve']) ->disableOriginalConstructor() ->getMock(); - $this->flatScopeResolver = $this->getMockBuilder('\Magento\Search\Model\ScopeResolver\FlatScopeResolver') + $this->flatScopeResolver = $this->getMockBuilder('\Magento\Indexer\Model\ScopeResolver\FlatScopeResolver') ->setMethods(['resolve']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Search/Test/Unit/Model/ScopeResolver/IndexScopeResolverTest.php b/app/code/Magento/Indexer/Test/Unit/Model/ScopeResolver/IndexScopeResolverTest.php similarity index 93% rename from app/code/Magento/Search/Test/Unit/Model/ScopeResolver/IndexScopeResolverTest.php rename to app/code/Magento/Indexer/Test/Unit/Model/ScopeResolver/IndexScopeResolverTest.php index 9c3dc151b999884c0348e29d5d9b3c90029955d3..a64005d658ebac18cc46d6cdaf3f1b300c44c54e 100644 --- a/app/code/Magento/Search/Test/Unit/Model/ScopeResolver/IndexScopeResolverTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/ScopeResolver/IndexScopeResolverTest.php @@ -4,13 +4,13 @@ * See COPYING.txt for license details. */ -namespace Magento\Search\Test\Unit\Model\ScopeResolver; +namespace Magento\Indexer\Test\Unit\Model\ScopeResolver; use Magento\Framework\Search\Request\Dimension; use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager; /** - * Test for \Magento\Search\Model\ScopeResolver\IndexScopeResolver + * Test for \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver */ class IndexScopeResolverTest extends \PHPUnit_Framework_TestCase { @@ -25,7 +25,7 @@ class IndexScopeResolverTest extends \PHPUnit_Framework_TestCase private $resource; /** - * @var \Magento\Search\Model\ScopeResolver\IndexScopeResolver + * @var \Magento\Indexer\Model\ScopeResolver\IndexScopeResolver */ private $target; @@ -45,7 +45,7 @@ class IndexScopeResolverTest extends \PHPUnit_Framework_TestCase $objectManager = new ObjectManager($this); $this->target = $objectManager->getObject( - '\Magento\Search\Model\ScopeResolver\IndexScopeResolver', + '\Magento\Indexer\Model\ScopeResolver\IndexScopeResolver', [ 'resource' => $this->resource, 'scopeResolver' => $this->scopeResolver diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index b3d895056ef1cdccd1e683a3d5477c78a2fb738a..b7f27e0e6bf74fb4f9739d465afb670ca251651c 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -5,7 +5,6 @@ "php": "~5.5.0|~5.6.0", "magento/module-store": "0.74.0-beta16", "magento/module-backend": "0.74.0-beta16", - "magento/module-search": "0.74.0-beta16", "magento/module-page-cache": "0.74.0-beta16", "magento/framework": "0.74.0-beta16", "magento/magento-composer-installer": "*" diff --git a/app/code/Magento/Indexer/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index 3eb6e8433c1cee29f3f4d8e46ab94bb28196ca64..f03aca19f0cc4ce32b6ce1b4b168d3d1ab391c37 100644 --- a/app/code/Magento/Indexer/etc/module.xml +++ b/app/code/Magento/Indexer/etc/module.xml @@ -9,7 +9,6 @@ <module name="Magento_Indexer" setup_version="2.0.0"> <sequence> <module name="Magento_Store"/> - <module name="Magento_Search"/> </sequence> </module> </config> 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/Payment/view/frontend/web/template/payment/cc-form.html b/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html index 0b7e69fa0bd0acb5bcbdc48eabf1633cfdb325c1..c630d0039928ea9aaf53c035d5279f59fb529ee1 100644 --- a/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html +++ b/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html @@ -99,15 +99,27 @@ <span><!-- ko text: $t('Card Verification Number')--><!-- /ko --></span> </label> <div class="control _with-tooltip"> - <input type="number" autocomplete="off" class="input-text cvv" name="payment[cc_cid]" value="" - data-bind="attr: {id: getCode() + '_cc_cid', title: $t('Card Verification Number'), 'data-container': getCode() + '-cc-cvv', 'data-validate': JSON.stringify({'required-number':true, 'validate-card-cvv':'#' + getCode() + '_cc_type'})}, - enable: isActive($parents), - value: creditCardVerificationNumber"/> + <input type="number" + autocomplete="off" + class="input-text cvv" + name="payment[cc_cid]" + value="" + data-bind="attr: {id: getCode() + '_cc_cid', + title: $t('Card Verification Number'), + 'data-container': getCode() + '-cc-cvv', + 'data-validate': JSON.stringify({'required-number':true, 'validate-card-cvv':'#' + getCode() + '_cc_type'})}, + enable: isActive($parents), + value: creditCardVerificationNumber" /> <div class="field-tooltip toggle"> - <span class="field-tooltip-action action-cvv" data-bind="attr: {title: $t('What is this?')}"> + <span class="field-tooltip-action action-cvv" + tabindex="0" + data-toggle="dropdown" + data-bind="attr: {title: $t('What is this?')}, mageInit: {'dropdown':{'activeClass': '_active'}}"> <span><!-- ko text: $t('What is this?')--><!-- /ko --></span> </span> - <div class="field-tooltip-content" data-bind="html: getCvvImageHtml()"></div> + <div class="field-tooltip-content" + data-target="dropdown" + data-bind="html: getCvvImageHtml()"></div> </div> </div> </div> diff --git a/app/code/Magento/Payment/view/frontend/web/template/payment/iframe.html b/app/code/Magento/Payment/view/frontend/web/template/payment/iframe.html index b9abaa6694130fb7fdd959b431f45965d9c2a5ec..82774b93a59fe3d483ba3f4d3ee0987d45b4b3e9 100644 --- a/app/code/Magento/Payment/view/frontend/web/template/payment/iframe.html +++ b/app/code/Magento/Payment/view/frontend/web/template/payment/iframe.html @@ -29,9 +29,9 @@ <div class="actions-toolbar" id="review-buttons-container"> <div class="primary"> <button data-role="review-save" type="submit" - data-bind="attr: {title: $t('Place order')}" + data-bind="attr: {title: $t('Place Order')}" class="button action primary checkout"> - <span data-bind="text: $t('Place order')"></span> + <span data-bind="text: $t('Place Order')"></span> </button> <button type="submit" id="originalPlaceOrder" class="hidden" data-bind="click: originalPlaceOrder($parents[1])"></button> diff --git a/app/code/Magento/Paypal/Block/Bml/Form.php b/app/code/Magento/Paypal/Block/Bml/Form.php index ae480bef552174c2e8a65e09aa062360ee885531..81cdc979bac6d23d6a1a79b8a82dd1926071b64f 100644 --- a/app/code/Magento/Paypal/Block/Bml/Form.php +++ b/app/code/Magento/Paypal/Block/Bml/Form.php @@ -31,7 +31,7 @@ class Form extends Express\Form 'https://www.securecheckout.billmelater.com/paycapture-content/' . 'fetch?hash=AU826TU8&content=/bmlweb/ppwpsiw.html' )->setPaymentAcceptanceMarkSrc( - 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppc-acceptance-small.png' + 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppc-acceptance-medium.png' )->setPaymentWhatIs(__('See terms')); $this->_initializeRedirectTemplateWithMark($mark); diff --git a/app/code/Magento/Paypal/Model/AbstractConfig.php b/app/code/Magento/Paypal/Model/AbstractConfig.php index 4eacc5284c807a1759e4c226ab3c0e7397f64d6a..36f4f9c2b0d508b959ae8e82ea645c6001ddd2bb 100644 --- a/app/code/Magento/Paypal/Model/AbstractConfig.php +++ b/app/code/Magento/Paypal/Model/AbstractConfig.php @@ -47,7 +47,7 @@ abstract class AbstractConfig implements ConfigInterface /** * @var string */ - private $pathPattern; + protected $pathPattern; /** * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig diff --git a/app/code/Magento/Paypal/Model/Config.php b/app/code/Magento/Paypal/Model/Config.php index d6cde85f3505aaced9da7f9d889c4a00841c115c..e894c5a39b65ded62840f8d08eedb3ca8ac0fb96 100644 --- a/app/code/Magento/Paypal/Model/Config.php +++ b/app/code/Magento/Paypal/Model/Config.php @@ -971,7 +971,7 @@ class Config extends AbstractConfig case self::PAYMENT_MARK_LARGE: break; default: - $staticSize = self::PAYMENT_MARK_SMALL; + $staticSize = self::PAYMENT_MARK_MEDIUM; } return sprintf( diff --git a/app/code/Magento/Paypal/Model/PayflowConfig.php b/app/code/Magento/Paypal/Model/PayflowConfig.php index 796227fcd153e5d65b024adbb5b0cb38e59664c1..257cb2075984d69000ed59f56e66dcd7ba0ba225 100644 --- a/app/code/Magento/Paypal/Model/PayflowConfig.php +++ b/app/code/Magento/Paypal/Model/PayflowConfig.php @@ -11,7 +11,7 @@ use Magento\Payment\Model\Method\AbstractMethod; * Class PayflowConfig * @todo ELiminate current configuration class */ -class PayflowConfig extends AbstractConfig +class PayflowConfig extends Config { /**#@-*/ @@ -89,4 +89,19 @@ class PayflowConfig extends AbstractConfig return parent::isMethodActive(Config::METHOD_PAYMENT_PRO) || parent::isMethodActive(Config::METHOD_PAYFLOWPRO); } + + /** + * Map any supported payment method into a config path by specified field name + * + * @param string $fieldName + * @return string|null + */ + protected function _getSpecificConfigPath($fieldName) + { + if ($this->pathPattern) { + return sprintf($this->pathPattern, $this->_methodCode, $fieldName); + } + + return "payment/{$this->_methodCode}/{$fieldName}"; + } } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Paypal/Test/Unit/Model/ConfigTest.php index 65f23998cce8d309126f5edbba2afb17ffd0e347..03df793c371cd4c2d5ae30ef88b411190daf93f2 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/ConfigTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/ConfigTest.php @@ -347,7 +347,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ], [ 'en_US', null, null, Config::EC_FLAVOR_STATIC, false, Config::EC_BUTTON_TYPE_MARK, - 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-small.png' + 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' ], [ 'en_US', null, null, Config::EC_FLAVOR_STATIC, true, Config::EC_BUTTON_TYPE_SHORTCUT, @@ -413,8 +413,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamic-image&buttontype=ecmark&locale=en_GB' ], [ - 'en_US', null, null, 'small', Config::EC_FLAVOR_STATIC, true, - 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-small.png' + 'en_US', null, null, 'medium', Config::EC_FLAVOR_STATIC, true, + 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' ], [ 'en_US', null, null, 'medium', Config::EC_FLAVOR_STATIC, true, @@ -426,7 +426,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ], [ 'en_GB', null, null, 'affected', Config::EC_FLAVOR_STATIC, true, - 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-small.png' + 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' ], ]; } diff --git a/app/code/Magento/Paypal/Test/Unit/Model/PayflowConfigTest.php b/app/code/Magento/Paypal/Test/Unit/Model/PayflowConfigTest.php index 76165512dd4d885781bac9eea8b22240784448cb..1b52d78fafff5463f9143736051c4834f177f422 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/PayflowConfigTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/PayflowConfigTest.php @@ -6,6 +6,7 @@ namespace Magento\Paypal\Test\Unit\Model; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Paypal\Model\PayflowConfig; use Magento\Payment\Model\MethodInterface; use Magento\Payment\Model\Method\AbstractMethod; @@ -41,7 +42,13 @@ class PayflowConfigTest extends \PHPUnit_Framework_TestCase $this->methodInterfaceMock = $this->getMockBuilder('Magento\Payment\Model\MethodInterface') ->getMockForAbstractClass(); - $this->config = new PayflowConfig($this->scopeConfigMock); + $om = new ObjectManager($this); + $this->config = $om->getObject( + 'Magento\Paypal\Model\PayflowConfig', + [ + 'scopeConfig' => $this->scopeConfigMock + ] + ); } /** @@ -163,6 +170,11 @@ class PayflowConfigTest extends \PHPUnit_Framework_TestCase { $this->config->setStoreId(5); + $this->scopeConfigMock->expects($this->any()) + ->method('getValue') + ->with('paypal/general/merchant_country') + ->will($this->returnValue('US')); + $i = 0; foreach ($expectsMethods as $method => $isActive) { $this->scopeConfigMock->expects($this->at($i++)) diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_au.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_au.xml index 5ea58d76f2d6720e8975f0add49abe86c63ce558..afc43cd0033d236ffb10bb22b733f6cf393da911 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_au.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_au.xml @@ -10,11 +10,11 @@ <!--PayPal Website Payments Standard--> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="paypal_payflowpro_au">paypal_payflowpro_au</argument> <argument name="payments_pro_hosted_solution_au">payments_pro_hosted_solution_au</argument> @@ -23,17 +23,17 @@ </event> </events> <relation target="paypal_payflowpro_au"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payments_pro_hosted_solution_au"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="paypal_payflowpro_au">paypal_payflowpro_au</argument> <argument name="payments_pro_hosted_solution_au">payments_pro_hosted_solution_au</argument> @@ -44,11 +44,11 @@ <!--PayPal Payflow Pro--> <payment id="paypal_payflowpro_au"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payments_pro_hosted_solution_au">payments_pro_hosted_solution_au</argument> <argument name="wps_other">wps_other</argument> @@ -56,14 +56,14 @@ </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payments_pro_hosted_solution_au"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> <argument name="payments_pro_hosted_solution_au">payments_pro_hosted_solution_au</argument> @@ -73,11 +73,11 @@ <!--PayPal Website Payments Pro Hosted Solution--> <payment id="payments_pro_hosted_solution_au"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="paypal_payflowpro_au">paypal_payflowpro_au</argument> <argument name="wps_other">wps_other</argument> @@ -85,14 +85,14 @@ </event> </events> <relation target="paypal_payflowpro_au"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> <argument name="paypal_payflowpro_au">paypal_payflowpro_au</argument> @@ -102,22 +102,22 @@ <!--PayPal Express Checkout--> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_ca.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_ca.xml index 767235735a54e190420b96330fa38cc2280a76fa..7302ba739cbed5daa51c9dc158c558ed0c2a6b1a 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_ca.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_ca.xml @@ -10,11 +10,11 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wpp_ca">wpp_ca</argument> <argument name="paypal_payflowpro_ca">paypal_payflowpro_ca</argument> @@ -24,20 +24,20 @@ </event> </events> <relation target="wpp_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="paypal_payflowpro_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payflow_link_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wpp_ca">wpp_ca</argument> <argument name="paypal_payflowpro_ca">paypal_payflowpro_ca</argument> @@ -49,11 +49,11 @@ <!-- Website Payments Pro --> <payment id="wpp_ca"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> <argument name="paypal_payflowpro_ca">paypal_payflowpro_ca</argument> @@ -62,17 +62,17 @@ </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="paypal_payflowpro_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payflow_link_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> <argument name="paypal_payflowpro_ca">paypal_payflowpro_ca</argument> @@ -83,11 +83,11 @@ <!-- Payflow Pro --> <payment id="paypal_payflowpro_ca"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> <argument name="wpp_ca">wpp_ca</argument> @@ -96,17 +96,17 @@ </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wpp_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payflow_link_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> <argument name="wpp_ca">wpp_ca</argument> @@ -117,11 +117,11 @@ <!-- Payflow Link (Includes Express Checkout) --> <payment id="payflow_link_ca"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> <argument name="wpp_ca">wpp_ca</argument> @@ -130,31 +130,30 @@ </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wpp_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="paypal_payflowpro_ca"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/disable" event="activate"/> - <rule type="paypal/express/lock-configuration" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/disable" event="activate-rule"/> + <rule type="paypal/express/lock-configuration" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="payflow_link_ca">payflow_link_ca</argument> </rule> - <rule type="paypal/express/unlock-configuration" event="deactivate"> + <rule type="paypal/express/unlock-configuration" event="deactivate-rule"> <argument name="payflow_link_ca">payflow_link_ca</argument> </rule> - <rule type="paypal/express/lock-configuration-conditional" event=":load"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> - <rule type="payflow/express/enable" event="activate"/> - <rule type="payflow/express/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> + <rule type="payflow/express/enable" event="activate-rule"/> + <rule type="payflow/express/disable" event="deactivate-rule"/> <rule type="payflow/express/lock-conditional" event=":load"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> @@ -167,22 +166,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_other">wps_other</argument> <argument name="payflow_link_ca">payflow_link_ca</argument> </rule> @@ -190,6 +189,9 @@ <argument name="wps_other">wps_other</argument> <argument name="payflow_link_ca">payflow_link_ca</argument> </rule> + <rule type="paypal/express/lock-configuration-conditional" event=":load"> + <argument name="payflow_link_ca">payflow_link_ca</argument> + </rule> </relation> </payment> </rules> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_de.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_de.xml index 23805484711cbed522311e12f39ab146e8478083..82a093c1f412f8f25ecd6155557921b12b4d5dd0 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_de.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_de.xml @@ -9,12 +9,12 @@ xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Paypal/etc/rules.xsd"> <payment id="express_checkout_de"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"/> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"/> </events> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> </relation> </payment> </rules> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_es.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_es.xml index ceac68e6c89efbb0d650a98eebc769b12dbf0303..17e5381648f1a5ee9b30d2e9a1ea73445b977a86 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_es.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_es.xml @@ -10,22 +10,22 @@ <!-- Website Payments Pro Hosted Solution (Includes Express Checkout) --> <payment id="payments_pro_hosted_solution_es"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> @@ -34,11 +34,11 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payments_pro_hosted_solution_es">payments_pro_hosted_solution_es</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -46,14 +46,14 @@ </event> </events> <relation target="payments_pro_hosted_solution_es"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="payments_pro_hosted_solution_es">payments_pro_hosted_solution_es</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -63,22 +63,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_other">wps_other</argument> </rule> <rule type="conflict" event=":load"> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_fr.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_fr.xml index a1ccc8f5f657be767c8273cfbe41f8ab7a4e461a..29886c00ab57bb0a1d703ff52ac82dbfe55e5f38 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_fr.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_fr.xml @@ -10,22 +10,22 @@ <!-- Website Payments Pro Hosted Solution (Includes Express Checkout) --> <payment id="payments_pro_hosted_solution_fr"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> @@ -34,11 +34,11 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payments_pro_hosted_solution_fr">payments_pro_hosted_solution_fr</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -46,14 +46,14 @@ </event> </events> <relation target="payments_pro_hosted_solution_fr"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="payments_pro_hosted_solution_fr">payments_pro_hosted_solution_fr</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -63,22 +63,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_other">wps_other</argument> </rule> <rule type="conflict" event=":load"> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_gb.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_gb.xml index 6045bddce2e3962ed57d1d020bbc170553276997..b55168d882848958b79d474f4a308d88e542b08f 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_gb.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_gb.xml @@ -10,22 +10,22 @@ <!-- Website Payments Pro Hosted Solution (Includes Express Checkout) --> <payment id="payments_pro_hosted_solution_with_express_checkout"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_express">wps_express</argument> </predicate> </event> </events> <relation target="wps_express"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_express">wps_express</argument> </rule> @@ -34,11 +34,11 @@ <!-- Website Payments Standard --> <payment id="wps_express"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payments_pro_hosted_solution_with_express_checkout">payments_pro_hosted_solution_with_express_checkout</argument> <argument name="express_checkout_us">express_checkout_us</argument> @@ -46,14 +46,14 @@ </event> </events> <relation target="payments_pro_hosted_solution_with_express_checkout"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_us"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="payments_pro_hosted_solution_with_express_checkout">payments_pro_hosted_solution_with_express_checkout</argument> <argument name="express_checkout_us">express_checkout_us</argument> @@ -63,22 +63,22 @@ <!-- Express Checkout --> <payment id="express_checkout_us"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_express">wps_express</argument> </predicate> </event> </events> <relation target="wps_express"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_express">wps_express</argument> </rule> <rule type="conflict" event=":load"> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_hk.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_hk.xml index 974bcf8bfe756044d991285252960b873eeda6a4..0fdb5250d0c5042bafb98ef2f6963484060724a8 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_hk.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_hk.xml @@ -10,22 +10,22 @@ <!-- Website Payments Pro Hosted Solution (Includes Express Checkout) --> <payment id="payments_pro_hosted_solution_hk"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> @@ -34,11 +34,11 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payments_pro_hosted_solution_hk">payments_pro_hosted_solution_hk</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -46,14 +46,14 @@ </event> </events> <relation target="payments_pro_hosted_solution_hk"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="payments_pro_hosted_solution_hk">payments_pro_hosted_solution_hk</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -63,22 +63,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_other">wps_other</argument> </rule> <rule type="conflict" event=":load"> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_it.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_it.xml index 4d88054b781efde268e9a86ee66b015fe74da04d..63ae9f5e02478a4e6aa6ef5c4ec28fbc36df0c0b 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_it.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_it.xml @@ -10,22 +10,22 @@ <!-- Website Payments Pro Hosted Solution (Includes Express Checkout) --> <payment id="payments_pro_hosted_solution_it"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> @@ -34,11 +34,11 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payments_pro_hosted_solution_it">payments_pro_hosted_solution_it</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -46,14 +46,14 @@ </event> </events> <relation target="payments_pro_hosted_solution_it"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="payments_pro_hosted_solution_it">payments_pro_hosted_solution_it</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -63,22 +63,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_other">wps_other</argument> </rule> <rule type="conflict" event=":load"> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_jp.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_jp.xml index ac502c272186d20a9df4a64a25a90bd653fed02b..ca74b2579cbff1779468916b7be456986644a92b 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_jp.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_jp.xml @@ -10,22 +10,22 @@ <!-- Website Payments Pro Hosted Solution (Includes Express Checkout) --> <payment id="payments_pro_hosted_solution_jp"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> @@ -34,11 +34,11 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payments_pro_hosted_solution_jp">payments_pro_hosted_solution_jp</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -46,14 +46,14 @@ </event> </events> <relation target="payments_pro_hosted_solution_jp"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="payments_pro_hosted_solution_jp">payments_pro_hosted_solution_jp</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -63,22 +63,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_other">wps_other</argument> </rule> <rule type="conflict" event=":load"> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_nz.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_nz.xml index 4c0f0af0a8eccfa9eee6a8120f496a69d60297b6..8833c4f7edf3b761e54f1d0f60cc0109bb942761 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_nz.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_nz.xml @@ -10,22 +10,22 @@ <!-- Website Payments Pro Hosted Solution (Includes Express Checkout) --> <payment id="paypal_payflowpro_nz"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> @@ -34,11 +34,11 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="paypal_payflowpro_nz">paypal_payflowpro_nz</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -46,14 +46,14 @@ </event> </events> <relation target="paypal_payflowpro_nz"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="paypal_payflowpro_nz">paypal_payflowpro_nz</argument> <argument name="express_checkout_other">express_checkout_other</argument> @@ -63,22 +63,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wps_other">wps_other</argument> </rule> <rule type="conflict" event=":load"> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_other.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_other.xml index e5b0f41cc5fab6a71e8ae8dee086135b5e3bdb5d..df49f08a3b89bae10bacb756e6880d6d312fc264 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_other.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_other.xml @@ -10,22 +10,22 @@ <!-- Website Payments Standard --> <payment id="wps_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="express_checkout_other">express_checkout_other</argument> </predicate> </event> </events> <relation target="express_checkout_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="express_checkout_other">express_checkout_other</argument> </rule> @@ -34,22 +34,22 @@ <!-- Express Checkout --> <payment id="express_checkout_other"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_other">wps_other</argument> </predicate> </event> </events> <relation target="wps_other"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> <rule type="conflict" event=":load"> <argument name="wps_other">wps_other</argument> </rule> diff --git a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_us.xml b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_us.xml index 8a8ea7c31cb1a225de0e972749d4b75f8da85da4..65ec357646179c5a1910a008c7bfd754154baec4 100644 --- a/app/code/Magento/Paypal/etc/adminhtml/rules/payment_us.xml +++ b/app/code/Magento/Paypal/etc/adminhtml/rules/payment_us.xml @@ -10,11 +10,11 @@ <!-- PayPal Payments Advanced (Includes Express Checkout) --> <payment id="payflow_advanced"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wpp_usuk">wpp_usuk</argument> <argument name="wps_express">wps_express</argument> @@ -28,45 +28,43 @@ <event value="1" name="activate-bml"/> </events> <relation target="wpp_usuk"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wps_express"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="paypal_payflowpro_with_express_checkout"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payflow_link_us"> - <rule type="disable" event="activate"/> - <rule type="payflow/express/disable-conditional" event="deactivate"/> - <rule type="payflow/bml/disable-conditional" event="deactivate"/> + <rule type="disable" event="activate-rule"/> + <rule type="payflow/express/disable-conditional" event="deactivate-rule"/> + <rule type="payflow/bml/disable-conditional" event="deactivate-rule"/> <rule type="payflow/bml/enable-conditional" event="activate-bml"> <argument name="payflow_advanced">payflow_advanced</argument> </rule> <rule type="payflow/bml/disable-conditional" event="deactivate-bml"/> </relation> <relation target="express_checkout_us"> - <rule type="paypal/express/disable" event="activate"/> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/lock-configuration" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="paypal/express/disable" event="activate-rule"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/lock-configuration" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> <argument name="payflow_link_us">payflow_link_us</argument> </rule> - <rule type="paypal/express/unlock-configuration" event="deactivate"> + <rule type="paypal/express/unlock-configuration" event="deactivate-rule"> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> <argument name="payflow_link_us">payflow_link_us</argument> </rule> - <rule type="paypal/express/mark-enable" event=":load"/> - <rule type="paypal/express/lock-configuration-conditional" event=":load"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="payflow/bml/enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> - <rule type="payflow/bml/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="payflow/bml/enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> + <rule type="payflow/bml/disable" event="deactivate-rule"/> <rule type="payflow/express/disable-conditional" event=":load"/> <rule type="payflow/bml/disable-conditional" event=":load"/> <rule type="conflict" event=":load"> @@ -81,11 +79,11 @@ <!-- PayPal Payments Pro (Includes Express Checkout) --> <payment id="wpp_usuk"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wps_express">wps_express</argument> @@ -99,45 +97,43 @@ <event value="1" name="activate-bml"/> </events> <relation target="payflow_advanced"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wps_express"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="paypal_payflowpro_with_express_checkout"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payflow_link_us"> - <rule type="disable" event="activate"/> - <rule type="payflow/express/disable-conditional" event="deactivate"/> - <rule type="payflow/bml/disable-conditional" event="deactivate"/> + <rule type="disable" event="activate-rule"/> + <rule type="payflow/express/disable-conditional" event="deactivate-rule"/> + <rule type="payflow/bml/disable-conditional" event="deactivate-rule"/> <rule type="payflow/bml/enable-conditional" event="activate-bml"> <argument name="wpp_usuk">wpp_usuk</argument> </rule> <rule type="payflow/bml/disable-conditional" event="deactivate-bml"/> </relation> <relation target="express_checkout_us"> - <rule type="paypal/express/disable" event="activate"/> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/lock-configuration" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="paypal/express/disable" event="activate-rule"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/lock-configuration" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> <argument name="payflow_link_us">payflow_link_us</argument> </rule> - <rule type="paypal/express/unlock-configuration" event="deactivate"> + <rule type="paypal/express/unlock-configuration" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> <argument name="payflow_link_us">payflow_link_us</argument> </rule> - <rule type="paypal/express/mark-enable" event=":load"/> - <rule type="paypal/express/lock-configuration-conditional" event=":load"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="payflow/bml/enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> - <rule type="payflow/bml/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="payflow/bml/enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> + <rule type="payflow/bml/disable" event="deactivate-rule"/> <rule type="payflow/express/disable-conditional" event=":load"/> <rule type="payflow/bml/disable-conditional" event=":load"/> <rule type="conflict" event=":load"> @@ -152,11 +148,11 @@ <!-- PayPal Payments Standard --> <payment id="wps_express"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> @@ -167,25 +163,25 @@ </event> </events> <relation target="payflow_advanced"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wpp_usuk"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="paypal_payflowpro_with_express_checkout"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payflow_link_us"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_us"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/bml/enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> - <rule type="paypal/bml/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/bml/enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> + <rule type="paypal/bml/disable" event="deactivate-rule"/> <rule type="paypal/bml/disable-conditional" event=":load"/> <rule type="conflict" event=":load"> <argument name="payflow_advanced">payflow_advanced</argument> @@ -199,11 +195,11 @@ <!-- PayPal Payflow Pro (Includes Express Checkout) --> <payment id="paypal_payflowpro_with_express_checkout"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> @@ -217,45 +213,43 @@ <event value="1" name="activate-bml"/> </events> <relation target="payflow_advanced"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wpp_usuk"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wps_express"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="payflow_link_us"> - <rule type="disable" event="activate"/> - <rule type="payflow/express/disable-conditional" event="deactivate"/> - <rule type="payflow/bml/disable-conditional" event="deactivate"/> + <rule type="disable" event="activate-rule"/> + <rule type="payflow/express/disable-conditional" event="deactivate-rule"/> + <rule type="payflow/bml/disable-conditional" event="deactivate-rule"/> <rule type="payflow/bml/enable-conditional" event="activate-bml"> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> </rule> <rule type="payflow/bml/disable-conditional" event="deactivate-bml"/> </relation> <relation target="express_checkout_us"> - <rule type="paypal/express/disable" event="activate"/> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/lock-configuration" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="paypal/express/disable" event="activate-rule"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/lock-configuration" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="payflow_link_us">payflow_link_us</argument> </rule> - <rule type="paypal/express/unlock-configuration" event="deactivate"> + <rule type="paypal/express/unlock-configuration" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="payflow_link_us">payflow_link_us</argument> </rule> - <rule type="paypal/express/mark-enable" event=":load"/> - <rule type="paypal/express/lock-configuration-conditional" event=":load"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="payflow/bml/enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> - <rule type="payflow/bml/disable" event="deactivate"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="payflow/bml/enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> + <rule type="payflow/bml/disable" event="deactivate-rule"/> <rule type="payflow/express/disable-conditional" event=":load"/> <rule type="payflow/bml/disable-conditional" event=":load"/> <rule type="conflict" event=":load"> @@ -270,11 +264,11 @@ <!-- PayPal Payflow Link (Includes Express Checkout) --> <payment id="payflow_link_us"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> @@ -288,44 +282,43 @@ <event value="1" name="activate-express"/> </events> <relation target="payflow_advanced"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wpp_usuk"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="wps_express"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="paypal_payflowpro_with_express_checkout"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target="express_checkout_us"> - <rule type="paypal/express/disable" event="activate"/> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/express/lock-configuration" event="activate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="paypal/express/disable" event="activate-rule"/> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/express/lock-configuration" event="activate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> </rule> - <rule type="paypal/express/unlock-configuration" event="deactivate"> + <rule type="paypal/express/unlock-configuration" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> </rule> - <rule type="paypal/express/lock-configuration-conditional" event=":load"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="payflow/express/enable" event="activate"/> - <rule type="payflow/bml/enable" event="activate"/> - <rule type="simple/disable" event="deactivate"/> - <rule type="payflow/express/enable-conditional" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="payflow/express/enable" event="activate-rule"/> + <rule type="payflow/bml/enable" event="activate-rule"/> + <rule type="simple/disable" event="deactivate-rule"/> + <rule type="payflow/express/enable-conditional" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> </rule> - <rule type="payflow/bml/enable-conditional" event="deactivate"> + <rule type="payflow/bml/enable-conditional" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> @@ -346,24 +339,24 @@ <!-- PayPal Express Checkout --> <payment id="express_checkout_us"> <events selector="[data-enable='payment']"> - <event value="0" name="deactivate"/> - <event value="1" name="activate"> + <event value="0" name="deactivate-rule"/> + <event value="1" name="activate-rule"> <predicate name="confirm" message="There is already another PayPal solution enabled. Enable this solution instead?" - event="deactivate" + event="deactivate-rule" > <argument name="wps_express">wps_express</argument> </predicate> </event> </events> <relation target="wps_express"> - <rule type="disable" event="activate"/> + <rule type="disable" event="activate-rule"/> </relation> <relation target=":self"> - <rule type="simple/mark-enable" event="activate"/> - <rule type="paypal/bml/enable" event="activate"/> - <rule type="paypal/bml/disable" event="deactivate"/> - <rule type="paypal/express/mark-disable" event="deactivate"> + <rule type="simple/mark-enable" event="activate-rule"/> + <rule type="paypal/bml/enable" event="activate-rule"/> + <rule type="paypal/bml/disable" event="deactivate-rule"/> + <rule type="paypal/express/mark-disable" event="deactivate-rule"> <argument name="payflow_advanced">payflow_advanced</argument> <argument name="wpp_usuk">wpp_usuk</argument> <argument name="wps_express">wps_express</argument> @@ -378,6 +371,12 @@ <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> <argument name="payflow_link_us">payflow_link_us</argument> </rule> + <rule type="paypal/express/lock-configuration-conditional" event=":load"> + <argument name="payflow_advanced">payflow_advanced</argument> + <argument name="wpp_usuk">wpp_usuk</argument> + <argument name="paypal_payflowpro_with_express_checkout">paypal_payflowpro_with_express_checkout</argument> + <argument name="payflow_link_us">payflow_link_us</argument> + </rule> </relation> </payment> </rules> diff --git a/app/code/Magento/Paypal/view/adminhtml/templates/system/config/fieldset/hint.phtml b/app/code/Magento/Paypal/view/adminhtml/templates/system/config/fieldset/hint.phtml index c26ae17b00038e1544a6a0d484d4587897c7c6b9..93da7852446f5d15e71288e0afc275c9d12b9006 100644 --- a/app/code/Magento/Paypal/view/adminhtml/templates/system/config/fieldset/hint.phtml +++ b/app/code/Magento/Paypal/view/adminhtml/templates/system/config/fieldset/hint.phtml @@ -23,7 +23,7 @@ ?> <script> require(['jquery', 'prototype'], function(jQuery){ - paypalToggleSolution = function(id, url) { + window.paypalToggleSolution = function (id, url) { var doScroll = false; Fieldset.toggleCollapse(id, url); if ($(this).hasClassName("open")) { diff --git a/app/code/Magento/Paypal/view/adminhtml/web/js/rules/conflict.js b/app/code/Magento/Paypal/view/adminhtml/web/js/rules/conflict.js index 783c841a05c7e4d1e1f11f0b1e8b1d78784d0059..98c79243d483266581e0d52bc1d1041fc9b4ce7a 100644 --- a/app/code/Magento/Paypal/view/adminhtml/web/js/rules/conflict.js +++ b/app/code/Magento/Paypal/view/adminhtml/web/js/rules/conflict.js @@ -22,7 +22,11 @@ if (!isDisabled && !executed) { executed = true; - alert("The following error(s) occured:\n\rSome PayPal solutions conflict.\n\rPlease re-enable the previously enabled payment solutions."); + alert( + "The following error(s) occured:\n\r" + + "Some PayPal solutions conflict.\n\r" + + "Please re-enable the previously enabled payment solutions." + ); } } }; diff --git a/app/code/Magento/Paypal/view/adminhtml/web/js/rules/paypal/express/lock-configuration-conditional.js b/app/code/Magento/Paypal/view/adminhtml/web/js/rules/paypal/express/lock-configuration-conditional.js index c5f3b9d101d5a98afc15a2d141d4d938e16abd7c..bd2c2f62a29f5b20a08910fdf3e2504c584bfdff 100644 --- a/app/code/Magento/Paypal/view/adminhtml/web/js/rules/paypal/express/lock-configuration-conditional.js +++ b/app/code/Magento/Paypal/view/adminhtml/web/js/rules/paypal/express/lock-configuration-conditional.js @@ -7,7 +7,19 @@ define([ ], function (lockConfiguration) { "use strict"; return function ($target, $owner, data) { - if ($owner.find(data.enableButton).val() == 1) { + var isDisabled = true; + + _.every(data.argument, function (name) { + if (data.solutionsElements[name] + && data.solutionsElements[name].find(data.enableButton).val() == 1 + ) { + isDisabled = false; + return isDisabled; + } + return isDisabled; + }, this); + + if (!isDisabled) { lockConfiguration($target, $owner, data); } }; diff --git a/app/code/Magento/Paypal/view/adminhtml/web/js/rules/paypal/express/mark-enable.js b/app/code/Magento/Paypal/view/adminhtml/web/js/rules/paypal/express/mark-enable.js deleted file mode 100644 index 658f4924aeea49961d64aa135211de9394c3ddf4..0000000000000000000000000000000000000000 --- a/app/code/Magento/Paypal/view/adminhtml/web/js/rules/paypal/express/mark-enable.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -define([ - 'Magento_Paypal/js/rules/simple/mark-enable' -], function (markEnable) { - "use strict"; - return function ($target, $owner, data) { - if ($owner.find(data.enableButton).val() == 1) { - markEnable($target, $owner, data); - } - }; -}); diff --git a/app/code/Magento/Paypal/view/adminhtml/web/js/solution.js b/app/code/Magento/Paypal/view/adminhtml/web/js/solution.js index 63265c889f9b670d08de1e63b962f50a608f2361..a5a98e899e9d46ac3d07c66f28990226468900e2 100644 --- a/app/code/Magento/Paypal/view/adminhtml/web/js/solution.js +++ b/app/code/Magento/Paypal/view/adminhtml/web/js/solution.js @@ -6,10 +6,9 @@ define([ "jquery", "Magento_Ui/js/lib/class", "Magento_Paypal/js/rule", - "Magento_Paypal/js/rules/disable", "mageUtils", "underscore" -], function ($, Class, Rule, disableSolution, utils, _) { +], function ($, Class, Rule, utils, _) { "use strict"; return Class.extend({ defaults: { @@ -56,15 +55,15 @@ define([ * Initialization events */ initEvents: function () { - _.each(this.config.events, function (elementEvents, selector) { var solution = this, selectorButton = solution.$self.find(selector), - $self = solution.$self; - _.each(elementEvents, function (elementEvent, name) { - selectorButton.on(this.systemEvent, function(event) { - var predicate = elementEvent.predicate; - var result = true; + $self = solution.$self, + events = elementEvents; + selectorButton.on(solution.systemEvent, function (event) { + _.each(events, function (elementEvent, name) { + var predicate = elementEvent.predicate, + result = true; if ($(this).val() === elementEvent.value) { if (predicate.name) { require([ @@ -80,11 +79,10 @@ define([ } else { $self.trigger(name); } - } + } + }, this); }); - }, this); }, this); - return this; }, /** diff --git a/app/code/Magento/Paypal/view/frontend/web/template/payment/payflow-express-bml.html b/app/code/Magento/Paypal/view/frontend/web/template/payment/payflow-express-bml.html index 313e700845e6358cef5db7f84d9d4444c792a93e..47cecc72a36b89a9abb29b1b04e0f4d305a28fce 100644 --- a/app/code/Magento/Paypal/view/frontend/web/template/payment/payflow-express-bml.html +++ b/app/code/Magento/Paypal/view/frontend/web/template/payment/payflow-express-bml.html @@ -12,7 +12,7 @@ data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" /> <label data-bind="attr: {'for': getCode()}" class="label"> <!-- PayPal Logo --> - <img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppc-acceptance-small.png" + <img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppc-acceptance-medium.png" data-bind="attr: {alt: $t('Acceptance Mark')}" class="payment-icon"/> <!-- PayPal Logo --> diff --git a/app/code/Magento/Paypal/view/frontend/web/template/payment/payflowpro-form.html b/app/code/Magento/Paypal/view/frontend/web/template/payment/payflowpro-form.html index 0292ef42cfd55d0cff8b7b7944c97595e7c6c00d..5ebcba12664785178c1fdf5f7562e1b51ab6d4d8 100644 --- a/app/code/Magento/Paypal/view/frontend/web/template/payment/payflowpro-form.html +++ b/app/code/Magento/Paypal/view/frontend/web/template/payment/payflowpro-form.html @@ -53,14 +53,14 @@ <button data-role="review-save" type="submit" data-bind=" - attr: {title: $t('Place order')}, + attr: {title: $t('Place Order')}, enable: (getCode() == isChecked()), click: placeOrder, css: {disabled: !isPlaceOrderActionAllowed()} " class="action primary checkout" disabled> - <span data-bind="text: $t('Place order')"></span> + <span data-bind="text: $t('Place Order')"></span> </button> </div> </div> diff --git a/app/code/Magento/Paypal/view/frontend/web/template/payment/paypal-express-bml.html b/app/code/Magento/Paypal/view/frontend/web/template/payment/paypal-express-bml.html index 313e700845e6358cef5db7f84d9d4444c792a93e..47cecc72a36b89a9abb29b1b04e0f4d305a28fce 100644 --- a/app/code/Magento/Paypal/view/frontend/web/template/payment/paypal-express-bml.html +++ b/app/code/Magento/Paypal/view/frontend/web/template/payment/paypal-express-bml.html @@ -12,7 +12,7 @@ data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" /> <label data-bind="attr: {'for': getCode()}" class="label"> <!-- PayPal Logo --> - <img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppc-acceptance-small.png" + <img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppc-acceptance-medium.png" data-bind="attr: {alt: $t('Acceptance Mark')}" class="payment-icon"/> <!-- PayPal Logo --> 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/Block/Adminhtml/Order/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Grid.php index ca83df2fe053b89ad6e244f541cfb74443757406..f3b8531f03bb63da928fad392e9a8983043cb509 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Grid.php @@ -12,51 +12,4 @@ namespace Magento\Sales\Block\Adminhtml\Order; */ class Grid extends \Magento\Backend\Block\Widget\Grid { - /** - * @var \Magento\Framework\View\Element\UiComponentFactory - */ - protected $componentFactory; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Framework\View\Element\UiComponentFactory $componentFactory - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Backend\Helper\Data $backendHelper, - \Magento\Framework\View\Element\UiComponentFactory $componentFactory, - array $data = [] - ) { - $this->componentFactory = $componentFactory; - parent::__construct($context, $backendHelper, $data); - } - - /** - * @return $this - * @throws \Magento\Framework\Exception\LocalizedException - */ - protected function _prepareCollection() - { - $component = $this->componentFactory->create('sales_order_grid'); - $this->prepareComponent($component); - $component->render(); - $collection = $component->getContext()->getDataProvider()->getCollection(); - $this->setData('dataSource', $collection); - - return parent::_prepareCollection(); - } - - /** - * @param \Magento\Framework\View\Element\UiComponentInterface $componentElement - * @return void - */ - protected function prepareComponent(\Magento\Framework\View\Element\UiComponentInterface $componentElement) - { - foreach ($componentElement->getChildComponents() as $childComponent) { - $this->prepareComponent($childComponent); - } - $componentElement->prepare(); - } } diff --git a/app/code/Magento/Sales/Controller/AbstractController/OrderLoader.php b/app/code/Magento/Sales/Controller/AbstractController/OrderLoader.php index 567433355f3ed1a97c2959c2b2c5088e285a6e33..cb24f26d365d5cacd076b16212d432f63e8ef0a7 100644 --- a/app/code/Magento/Sales/Controller/AbstractController/OrderLoader.php +++ b/app/code/Magento/Sales/Controller/AbstractController/OrderLoader.php @@ -9,6 +9,7 @@ namespace Magento\Sales\Controller\AbstractController; use Magento\Framework\App\RequestInterface; use Magento\Framework\Registry; use Magento\Framework\Controller\Result\ForwardFactory; +use Magento\Framework\Controller\Result\RedirectFactory; class OrderLoader implements OrderLoaderInterface { @@ -37,25 +38,33 @@ class OrderLoader implements OrderLoaderInterface */ protected $resultForwardFactory; + /** + * @var RedirectFactory + */ + protected $redirectFactory; + /** * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param OrderViewAuthorizationInterface $orderAuthorization * @param Registry $registry * @param \Magento\Framework\UrlInterface $url * @param ForwardFactory $resultForwardFactory + * @param RedirectFactory $redirectFactory */ public function __construct( \Magento\Sales\Model\OrderFactory $orderFactory, OrderViewAuthorizationInterface $orderAuthorization, Registry $registry, \Magento\Framework\UrlInterface $url, - ForwardFactory $resultForwardFactory + ForwardFactory $resultForwardFactory, + RedirectFactory $redirectFactory ) { $this->orderFactory = $orderFactory; $this->orderAuthorization = $orderAuthorization; $this->registry = $registry; $this->url = $url; $this->resultForwardFactory = $resultForwardFactory; + $this->redirectFactory = $redirectFactory; } /** @@ -78,7 +87,7 @@ class OrderLoader implements OrderLoaderInterface return true; } /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); + $resultRedirect = $this->redirectFactory->create(); return $resultRedirect->setUrl($this->url->getUrl('*/*/history')); } } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/AbstractMassAction.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/AbstractMassAction.php index fdc6bdcbdabf51de424178ee5b21995740be0533..fe4f2aeb163b674aa5c8ca27c58cd8625402bc67 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/AbstractMassAction.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/AbstractMassAction.php @@ -21,7 +21,7 @@ abstract class AbstractMassAction extends \Magento\Backend\App\Action /** * Redirect url */ - const REDIRECT_URL = '*/*/'; + const REDIRECT_URL = 'sales/order/'; /** * Resource collection 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/Model/Order/Address/Validator.php b/app/code/Magento/Sales/Model/Order/Address/Validator.php index 4317f60f290b8f369aa763d9aff9370831448e01..22dd1afa697f32213d8910ef5280ae50fa3d271b 100644 --- a/app/code/Magento/Sales/Model/Order/Address/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Address/Validator.php @@ -75,7 +75,7 @@ class Validator } /** - * Validate address attribute for payment operations + * Validate address attribute for customer creation * * @return bool|array * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -83,7 +83,7 @@ class Validator * * @param Address $address */ - public function validateForPayment(Address $address) + public function validateForCustomer(Address $address) { if ($address->getShouldIgnoreValidation()) { return true; diff --git a/app/code/Magento/Sales/Model/Resource/AbstractGrid.php b/app/code/Magento/Sales/Model/Resource/AbstractGrid.php index 53afa0147c7756ac9cd388da9d4406da6c1efa74..33e1dbc2278167926970e7b5b3760320db16be0c 100644 --- a/app/code/Magento/Sales/Model/Resource/AbstractGrid.php +++ b/app/code/Magento/Sales/Model/Resource/AbstractGrid.php @@ -57,6 +57,15 @@ abstract class AbstractGrid extends AbstractDb implements GridInterface return $this->connection; } + /** + * Returns grid table name + * + * @return string + */ + public function getGridTable() + { + return $this->getTable($this->gridTableName); + } /** * Purge grid row * diff --git a/app/code/Magento/Sales/Model/Resource/Order.php b/app/code/Magento/Sales/Model/Resource/Order.php index f44ca611da317a9068111add4782c16dec481591..7aa6ec68f8232a594f4a0c2bde261c9a60b9acc6 100644 --- a/app/code/Magento/Sales/Model/Resource/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Order.php @@ -126,7 +126,9 @@ class Order extends SalesResource implements OrderResourceInterface $parent = $item->getQuoteParentItemId(); if ($parent && !$item->getParentItem()) { $item->setParentItem($object->getItemByQuoteItemId($parent)); - } elseif (!$parent) { + } + $childItems = $item->getChildrenItems(); + if (empty($childItems)) { $itemsCount++; } } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/GridTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/GridTest.php index 98ba820ade67fd143dabb1215e1462ad9ff59cce..2a3ddf1b44011c8c460571ffc4e7732a2cab3d92 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/GridTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/GridTest.php @@ -11,11 +11,6 @@ namespace Magento\Sales\Test\Unit\Block\Adminhtml\Order; */ class GridTest extends \PHPUnit_Framework_TestCase { - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $componentFactory; - /** * @var \Magento\Sales\Block\Adminhtml\Order\Grid */ @@ -33,9 +28,6 @@ class GridTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->componentFactory = $this->getMockBuilder('Magento\Framework\View\Element\UiComponentFactory') - ->disableOriginalConstructor() - ->getMock(); $this->requestMock = $this->getMockBuilder('Magento\Framework\App\RequestInterface') ->disableOriginalConstructor() ->setMethods(['has']) @@ -47,7 +39,6 @@ class GridTest extends \PHPUnit_Framework_TestCase ->method('getRequest') ->willReturn($this->requestMock); $arguments = [ - 'componentFactory' => $this->componentFactory, 'context' => $this->contextMock ]; $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); @@ -57,45 +48,9 @@ class GridTest extends \PHPUnit_Framework_TestCase public function testPrepareCollection() { - $contextMock = $this->getMockBuilder('Magento\Framework\View\Element\UiComponent\ContextInterface') - ->disableOriginalConstructor() - ->getMock(); $collectionMock = $this->getMockBuilder('Magento\Sales\Model\Resource\Order\Grid\Collection') ->disableOriginalConstructor() ->getMock(); - $providerName = 'Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider'; - $dataProviderMock = $this->getMockBuilder($providerName) - ->disableOriginalConstructor() - ->getMock(); - $componentMock = $this->getMockBuilder('Magento\Framework\View\Element\UiComponentInterface') - ->disableOriginalConstructor() - ->getMock(); - $childComponentMock = $this->getMockBuilder('Magento\Framework\View\Element\UiComponentInterface') - ->disableOriginalConstructor() - ->getMock(); - $this->componentFactory->expects($this->once()) - ->method('create') - ->with('sales_order_grid') - ->willReturn($componentMock); - $componentMock->expects($this->once()) - ->method('getChildComponents') - ->willReturn([$childComponentMock]); - $childComponentMock->expects($this->once()) - ->method('getChildComponents') - ->willReturn([]); - $childComponentMock->expects($this->once()) - ->method('prepare'); - $componentMock->expects($this->once()) - ->method('render'); - $componentMock->expects($this->once()) - ->method('getContext') - ->willReturn($contextMock); - $contextMock->expects($this->once()) - ->method('getDataProvider') - ->willReturn($dataProviderMock); - $dataProviderMock->expects($this->once()) - ->method('getCollection') - ->willReturn($collectionMock); $this->requestMock->expects($this->any()) ->method('has') ->withAnyParameters() @@ -120,9 +75,7 @@ class GridTest extends \PHPUnit_Framework_TestCase ->willReturn($blockMock); $this->block->setData('id', 1); $this->block->setLayout($layoutMock); - $this->assertInstanceOf( - 'Magento\Sales\Model\Resource\Order\Grid\Collection', - $this->block->getPreparedCollection() - ); + $this->block->setCollection($collectionMock); + $this->assertEquals($collectionMock, $this->block->getPreparedCollection()); } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceTest.php index 0c64b01b99d7822b5e0dd5db92bb5bb52b3cc170..ce8fe0cf97dd036e93447e51b665d6d473d2d7c4 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/InvoiceTest.php @@ -8,6 +8,7 @@ namespace Magento\Sales\Test\Unit\Model\Order; +use Magento\Sales\Model\Order\Invoice; use Magento\Sales\Model\Resource\OrderFactory; /** @@ -22,6 +23,17 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase */ protected $model; + /** + * Same as $model but Order was not set + * @var \Magento\Sales\Model\Order\Invoice + */ + protected $modelWithoutOrder; + + /** + * @var string + */ + protected $entityType = 'invoice'; + /** * @var OrderFactory |\PHPUnit_Framework_MockObject_MockObject */ @@ -35,25 +47,50 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Sales\Model\Order\Payment */ - protected $_paymentMock; + protected $paymentMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Event\ManagerInterface + */ + protected $eventManagerMock; + + /** + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + */ + protected $helperManager; protected function setUp() { - $helperManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->helperManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->orderMock = $this->getMockBuilder( 'Magento\Sales\Model\Order' )->disableOriginalConstructor()->setMethods( - ['getPayment', '__wakeup', 'load', 'setHistoryEntityName'] + [ + 'getPayment', '__wakeup', 'load', 'setHistoryEntityName', 'getStore', 'getBillingAddress', + 'getShippingAddress' + ] )->getMock(); - $this->_paymentMock = $this->getMockBuilder( + $this->orderMock->expects($this->any()) + ->method('setHistoryEntityName') + ->with($this->entityType) + ->will($this->returnSelf()); + + $this->paymentMock = $this->getMockBuilder( 'Magento\Sales\Model\Order\Payment' )->disableOriginalConstructor()->setMethods( - ['canVoid', '__wakeup'] + ['canVoid', '__wakeup', 'canCapture', 'capture', 'pay', 'hasForcedState', 'getForcedState'] )->getMock(); $this->orderFactory = $this->getMock('Magento\Sales\Model\OrderFactory', ['create'], [], '', false); + $this->eventManagerMock = $this->getMock('\Magento\Framework\Event\ManagerInterface', [], [], '', false); + $contextMock = $this->getMock('\Magento\Framework\Model\Context', [], [], '', false); + $contextMock->expects($this->any()) + ->method('getEventDispatcher') + ->willReturn($this->eventManagerMock); + $arguments = [ + 'context' => $contextMock, 'orderFactory' => $this->orderFactory, 'orderResourceFactory' => $this->getMock( 'Magento\Sales\Model\Resource\OrderFactory', @@ -91,8 +128,9 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase false ), ]; - $this->model = $helperManager->getObject('Magento\Sales\Model\Order\Invoice', $arguments); + $this->model = $this->helperManager->getObject('Magento\Sales\Model\Order\Invoice', $arguments); $this->model->setOrder($this->orderMock); + $this->modelWithoutOrder = $this->helperManager->getObject('Magento\Sales\Model\Order\Invoice', $arguments); } /** @@ -101,20 +139,10 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase */ public function testCanVoid($canVoid) { - $entityName = 'invoice'; - $this->orderMock->expects($this->once())->method('getPayment')->will($this->returnValue($this->_paymentMock)); - $this->orderMock->expects($this->once()) - ->method('setHistoryEntityName') - ->with($entityName) - ->will($this->returnSelf()); - $this->_paymentMock->expects( - $this->once() - )->method( - 'canVoid', - '__wakeup' - )->will( - $this->returnValue($canVoid) - ); + $this->orderMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock); + $this->paymentMock->expects($this->once()) + ->method('canVoid', '__wakeup') + ->willReturn($canVoid); $this->model->setState(\Magento\Sales\Model\Order\Invoice::STATE_PAID); $this->assertEquals($canVoid, $this->model->canVoid()); @@ -139,20 +167,36 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase public function testGetOrder() { - $orderId = 100000041; - $this->model->setOrderId($orderId); - $entityName = 'invoice'; - $this->orderMock->expects($this->atLeastOnce()) + $this->orderMock->expects($this->once()) ->method('setHistoryEntityName') - ->with($entityName) + ->with($this->entityType) ->will($this->returnSelf()); $this->assertEquals($this->orderMock, $this->model->getOrder()); } + public function testGetOrderLoadedById() + { + $orderId = 100000041; + $this->modelWithoutOrder->setOrderId($orderId); + $this->orderMock->expects($this->once()) + ->method('load') + ->with($orderId) + ->willReturnSelf(); + $this->orderMock->expects($this->once()) + ->method('setHistoryEntityName') + ->with($this->entityType) + ->willReturnSelf(); + $this->orderFactory->expects($this->once()) + ->method('create') + ->willReturn($this->orderMock); + + $this->assertEquals($this->orderMock, $this->modelWithoutOrder->getOrder()); + } + public function testGetEntityType() { - $this->assertEquals('invoice', $this->model->getEntityType()); + $this->assertEquals($this->entityType, $this->model->getEntityType()); } public function testGetIncrementId() @@ -160,4 +204,203 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $this->model->setIncrementId('test_increment_id'); $this->assertEquals('test_increment_id', $this->model->getIncrementId()); } + + public function testSetOrder() + { + $orderId = 1111; + $storeId = 2221; + $this->orderMock->setId($orderId); + $this->orderMock->setStoreId($storeId); + $this->assertNull($this->model->getOrderId()); + $this->assertNull($this->model->getStoreId()); + + $this->assertEquals($this->model, $this->model->setOrder($this->orderMock)); + $this->assertEquals($this->orderMock, $this->model->getOrder()); + $this->assertEquals($orderId, $this->model->getOrderId()); + $this->assertEquals($storeId, $this->model->getStoreId()); + } + + public function testGetStore() + { + $store = $this->helperManager->getObject('\Magento\Store\Model\Store', []); + $this->orderMock->expects($this->once())->method('getStore')->willReturn($store); + $this->assertEquals($store, $this->model->getStore()); + + } + + public function testGetShippingAddress() + { + $address = $this->helperManager->getObject('\Magento\Sales\Model\Order\Address', []); + $this->orderMock->expects($this->once())->method('getShippingAddress')->willReturn($address); + $this->assertEquals($address, $this->model->getShippingAddress()); + + } + + /** + * @dataProvider canCaptureDataProvider + * @param string $state + * @param bool|null $canPaymentCapture + * @param bool $expectedResult + */ + public function testCanCapture($state, $canPaymentCapture, $expectedResult) + { + $this->model->setState($state); + if (null !== $canPaymentCapture) { + $this->orderMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock); + $this->paymentMock->expects($this->once())->method('canCapture')->willReturn($canPaymentCapture); + } else { + $this->orderMock->expects($this->never())->method('getPayment'); + $this->paymentMock->expects($this->never())->method('canCapture'); + } + $this->assertEquals($expectedResult, $this->model->canCapture()); + } + + /** + * Data provider for testCanCapture + * + * @return array + */ + public function canCaptureDataProvider() + { + return [ + [Invoice::STATE_OPEN, true, true], + [Invoice::STATE_OPEN, false, false], + [Invoice::STATE_CANCELED, null, false], + [Invoice::STATE_CANCELED, null, false], + [Invoice::STATE_PAID, null, false], + [Invoice::STATE_PAID, null, false] + ]; + } + + /** + * @dataProvider canCancelDataProvider + * @param string $state + * @param bool $expectedResult + */ + public function testCanCancel($state, $expectedResult) + { + $this->model->setState($state); + $this->assertEquals($expectedResult, $this->model->canCancel()); + } + + /** + * Data provider for testCanCancel + * + * @return array + */ + public function canCancelDataProvider() + { + return [ + [Invoice::STATE_OPEN, true], + [Invoice::STATE_CANCELED, false], + [Invoice::STATE_PAID, false] + ]; + } + + /** + * @dataProvider canRefundDataProvider + * @param string $state + * @param float $baseGrandTotal + * @param float $baseTotalRefunded + * @param bool $expectedResult + */ + public function testCanRefund($state, $baseGrandTotal, $baseTotalRefunded, $expectedResult) + { + $this->model->setState($state); + $this->model->setBaseGrandTotal($baseGrandTotal); + $this->model->setBaseTotalRefunded($baseTotalRefunded); + $this->assertEquals($expectedResult, $this->model->canRefund()); + } + + /** + * Data provider for testCanRefund + * + * @return array + */ + public function canRefundDataProvider() + { + return [ + [Invoice::STATE_OPEN, 0.00, 0.00, false], + [Invoice::STATE_CANCELED, 1.00, 0.01, false], + [Invoice::STATE_PAID, 1.00, 0.00, true], + //[Invoice::STATE_PAID, 1.00, 1.00, false] + [Invoice::STATE_PAID, 1.000101, 1.0000, true], + [Invoice::STATE_PAID, 1.0001, 1.00, false], + [Invoice::STATE_PAID, 1.00, 1.0001, false], + ]; + } + + public function testCaptureNotPaid() + { + $this->model->setIsPaid(false); + $this->orderMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock); + $this->paymentMock->expects($this->once())->method('capture')->with($this->model)->willReturnSelf(); + $this->paymentMock->expects($this->never())->method('pay'); + $this->assertEquals($this->model, $this->model->capture()); + } + + public function testCapturePaid() + { + $this->model->setIsPaid(true); + $this->orderMock->expects($this->any())->method('getPayment')->willReturn($this->paymentMock); + $this->paymentMock->expects($this->any())->method('capture')->with($this->model)->willReturnSelf(); + $this->mockPay(false, null); + $this->assertEquals($this->model, $this->model->capture()); + } + + public function mockPay($hasForcedState, $forcedState) + { + $this->orderMock->expects($this->any())->method('getPayment')->willReturn($this->paymentMock); + $this->paymentMock->expects($this->once())->method('hasForcedState')->willReturn($hasForcedState); + if ($hasForcedState) { + $this->paymentMock->expects($this->once())->method('getForcedState')->willReturn($forcedState); + } else { + $this->paymentMock->expects($this->never())->method('getForcedState'); + } + $this->paymentMock->expects($this->once())->method('pay')->with($this->model)->willReturnSelf(); + $this->eventManagerMock + ->expects($this->once()) + ->method('dispatch') + ->with('sales_order_invoice_pay'); + } + + /** + * @dataProvider payDataProvider + * @param bool $hasForcedState + * @param float string|null $forcedState + * @param float $orderTotalPaid + * @param float $orderBaseTotalPaid + * @param float $grandTotal + * @param float $baseGrandTotal + * @param float $expectedState + */ + public function testPay( + $hasForcedState, + $forcedState, + $orderTotalPaid, + $orderBaseTotalPaid, + $grandTotal, + $baseGrandTotal, + $expectedState + ) { + $this->mockPay($hasForcedState, $forcedState); + $this->model->setGrandTotal($grandTotal); + $this->model->setBaseGrandTotal($baseGrandTotal); + $this->orderMock->setTotalPaid($orderTotalPaid); + $this->orderMock->setBaseTotalPaid($orderBaseTotalPaid); + $this->assertFalse($this->model->wasPayCalled()); + $this->assertEquals($this->model, $this->model->pay()); + $this->assertTrue($this->model->wasPayCalled()); + $this->assertEquals($expectedState, $this->model->getState()); + #second call of pay() method must do nothing + $this->model->pay(); + } + + public function payDataProvider() + { + //ToDo: fill data provider and uncomment assertings totals in testPay + return [ + [true, 'payment_state', 10.99, 1.00, 10.99, 1.00, 'payment_state'] + ]; + } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php index 2612afa5dd8dd4717367639427060134bb87bcba..61a08ea6c877d233fdc63c859474e6e407ae4afb 100755 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php @@ -135,6 +135,9 @@ class PaymentTest extends \PHPUnit_Framework_TestCase 'canCapture', 'canRefund', 'canOrder', + 'order', + 'isInitializeNeeded', + 'initialize', ] ) ->getMock(); @@ -152,7 +155,11 @@ class PaymentTest extends \PHPUnit_Framework_TestCase 'getBaseGrandTotal', 'getShippingAmount', 'getBaseShippingAmount', - 'getBaseTotalRefunded' + 'getBaseTotalRefunded', + 'getItemsCollection', + 'getOrder', + 'register', + 'capture', ] ) ->getMock(); @@ -175,8 +182,12 @@ class PaymentTest extends \PHPUnit_Framework_TestCase 'getInvoiceCollection', 'addRelatedObject', 'getState', + 'getStatus', 'addStatusHistoryComment', 'registerCancellation', + 'getCustomerNote', + 'prepareInvoice', + 'getPaymentsCollection', ] ) ->getMock(); @@ -278,6 +289,223 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->payment, $this->payment->place()); } + public function testPlaceActionOrder() + { + $newOrderStatus = 'new_status'; + $customerNote = 'blabla'; + $sum = 10; + $this->orderMock->expects($this->any())->method('getTotalDue')->willReturn($sum); + $this->orderMock->expects($this->any())->method('getBaseTotalDue')->willReturn($sum); + $this->helperMock->expects($this->once()) + ->method('getMethodInstance') + ->will($this->returnValue($this->paymentMethodMock)); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(\Magento\Payment\Model\Method\AbstractMethod::ACTION_ORDER); + $this->paymentMethodMock->expects($this->any()) + ->method('getConfigData') + ->with('order_status', null) + ->willReturn($newOrderStatus); + $this->mockGetDefaultStatus(Order::STATE_PROCESSING, $newOrderStatus, ['first', 'second']); + $this->orderMock->expects($this->any()) + ->method('setState') + ->with(Order::STATE_PROCESSING) + ->willReturnSelf(); + $this->orderMock->expects($this->any()) + ->method('setStatus') + ->with($newOrderStatus) + ->willReturnSelf(); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(null); + $this->orderMock->expects($this->once())->method('getBaseCurrency')->willReturn($this->currencyMock); + $this->currencyMock->method('formatTxt')->willReturn($sum); + $this->paymentMethodMock->expects($this->once()) + ->method('order') + ->with($this->payment, $sum) + ->willReturnSelf(); + $this->eventManagerMock->expects($this->at(0)) + ->method('dispatch') + ->with('sales_order_payment_place_start', ['payment' => $this->payment]); + $this->eventManagerMock->expects($this->at(1)) + ->method('dispatch') + ->with('sales_order_payment_place_end', ['payment' => $this->payment]); + $statusHistory = $this->getMockForAbstractClass( + 'Magento\Sales\Api\Data\OrderStatusHistoryInterface' + ); + $this->orderMock->expects($this->any())->method('getCustomerNote')->willReturn($customerNote); + $this->orderMock->expects($this->any()) + ->method('addStatusHistoryComment') + ->withConsecutive( + [__('Ordered amount of %1', $sum)], + [$customerNote] + ) + ->willReturn($statusHistory); + $this->orderMock->expects($this->any()) + ->method('setIsCustomerNotified') + ->with(true) + ->willReturn($statusHistory); + $this->assertEquals($this->payment, $this->payment->place()); + } + + public function testPlaceActionAuthorizeInitializeNeeded() + { + $newOrderStatus = 'new_status'; + $customerNote = 'blabla'; + $sum = 10; + $this->orderMock->expects($this->any())->method('getBaseGrandTotal')->willReturn($sum); + $this->orderMock->expects($this->any())->method('getTotalDue')->willReturn($sum); + $this->orderMock->expects($this->any())->method('getBaseTotalDue')->willReturn($sum); + $this->helperMock->expects($this->once()) + ->method('getMethodInstance') + ->will($this->returnValue($this->paymentMethodMock)); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(\Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE); + $this->paymentMethodMock->expects($this->any()) + ->method('getConfigData') + ->withConsecutive( + ['order_status'], + ['payment_action'] + )->willReturn($newOrderStatus); + $this->paymentMethodMock->expects($this->once())->method('isInitializeNeeded')->willReturn(true); + $this->paymentMethodMock->expects($this->once())->method('initialize'); + $this->mockGetDefaultStatus(Order::STATE_NEW, $newOrderStatus, ['first', 'second']); + $this->orderMock->expects($this->any()) + ->method('setState') + ->with(Order::STATE_NEW) + ->willReturnSelf(); + $this->orderMock->expects($this->any()) + ->method('setStatus') + ->with($newOrderStatus) + ->willReturnSelf(); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(null); + $this->eventManagerMock->expects($this->at(0)) + ->method('dispatch') + ->with('sales_order_payment_place_start', ['payment' => $this->payment]); + $this->eventManagerMock->expects($this->at(1)) + ->method('dispatch') + ->with('sales_order_payment_place_end', ['payment' => $this->payment]); + $statusHistory = $this->getMockForAbstractClass( + 'Magento\Sales\Api\Data\OrderStatusHistoryInterface' + ); + $this->orderMock->expects($this->any())->method('getCustomerNote')->willReturn($customerNote); + $this->orderMock->expects($this->any()) + ->method('addStatusHistoryComment') + ->withConsecutive( + [$customerNote], + [__('Authorized amount of %1', $sum)] + ) + ->willReturn($statusHistory); + $this->orderMock->expects($this->any()) + ->method('setIsCustomerNotified') + ->with(true) + ->willReturn($statusHistory); + $this->assertEquals($this->payment, $this->payment->place()); + } + + public function testPlaceActionAuthorizeFraud() + { + $newOrderStatus = 'new_status'; + $customerNote = 'blabla'; + $sum = 10; + $this->orderMock->expects($this->any())->method('getTotalDue')->willReturn($sum); + $this->orderMock->expects($this->any())->method('getBaseTotalDue')->willReturn($sum); + $this->helperMock->expects($this->once()) + ->method('getMethodInstance') + ->will($this->returnValue($this->paymentMethodMock)); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(\Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE); + $this->paymentMethodMock->expects($this->any()) + ->method('getConfigData') + ->with('order_status', null) + ->willReturn($newOrderStatus); + $statusHistory = $this->getMockForAbstractClass( + 'Magento\Sales\Api\Data\OrderStatusHistoryInterface' + ); + $this->orderMock->expects($this->any())->method('getCustomerNote')->willReturn($customerNote); + $this->orderMock->expects($this->any()) + ->method('addStatusHistoryComment') + ->withConsecutive( + [__('Order is suspended as its authorizing amount %1 is suspected to be fraudulent.', $sum)] + ) + ->willReturn($statusHistory); + $this->mockGetDefaultStatus(Order::STATE_PROCESSING, Order::STATUS_FRAUD, ['first', 'second']); + $this->orderMock->expects($this->any()) + ->method('setState') + ->with(Order::STATE_PROCESSING) + ->willReturnSelf(); + $this->orderMock->expects($this->any()) + ->method('setStatus') + ->withConsecutive( + [Order::STATUS_FRAUD] + )->willReturnSelf(); + $this->orderMock->expects($this->atLeastOnce()) + ->method('getStatus') + ->willReturn(Order::STATUS_FRAUD); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(null); + $this->orderMock->expects($this->once())->method('getBaseCurrency')->willReturn($this->currencyMock); + $this->currencyMock->method('formatTxt')->willReturn($sum); + $this->assertEquals($this->payment, $this->payment->place()); + //maybe we don't need write authorised sum when fraud was detected + $this->assertEquals($sum, $this->payment->getAmountAuthorized()); + } + + public function testPlaceActionAuthorizeCapture() + { + $newOrderStatus = 'new_status'; + $customerNote = 'blabla'; + $sum = 10; + $this->orderMock->expects($this->any())->method('getTotalDue')->willReturn($sum); + $this->orderMock->expects($this->any())->method('getBaseTotalDue')->willReturn($sum); + $this->helperMock->expects($this->once()) + ->method('getMethodInstance') + ->will($this->returnValue($this->paymentMethodMock)); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(\Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE_CAPTURE); + $this->paymentMethodMock->expects($this->any()) + ->method('getConfigData') + ->with('order_status', null) + ->willReturn($newOrderStatus); + $statusHistory = $this->getMockForAbstractClass( + 'Magento\Sales\Api\Data\OrderStatusHistoryInterface' + ); + $this->invoiceMock->expects($this->once())->method('register')->willReturnSelf(); + $this->invoiceMock->expects($this->once())->method('capture')->willReturnSelf(); + $this->paymentMethodMock->expects($this->once())->method('canCapture')->willReturn(true); + $this->orderMock->expects($this->any())->method('prepareInvoice')->willReturn($this->invoiceMock); + $this->orderMock->expects($this->once())->method('addRelatedObject')->with($this->invoiceMock); + $this->orderMock->expects($this->any())->method('getCustomerNote')->willReturn($customerNote); + $this->orderMock->expects($this->any()) + ->method('addStatusHistoryComment') + ->with($customerNote) + ->willReturn($statusHistory); + $this->mockGetDefaultStatus(Order::STATE_PROCESSING, $newOrderStatus, ['first', 'second']); + $this->orderMock->expects($this->any()) + ->method('setState') + ->with(Order::STATE_PROCESSING) + ->willReturnSelf(); + $this->orderMock->expects($this->any()) + ->method('setStatus') + ->with($newOrderStatus) + ->willReturnSelf(); + $this->paymentMethodMock->expects($this->once()) + ->method('getConfigPaymentAction') + ->willReturn(null); + + $this->assertEquals($this->payment, $this->payment->place()); + + $this->assertEquals($this->invoiceMock, $this->payment->getCreatedInvoice()); + $this->assertEquals($sum, $this->payment->getAmountAuthorized()); + $this->assertEquals($sum, $this->payment->getBaseAmountAuthorized()); + } + public function testAuthorize() { $storeID = 1; @@ -1110,6 +1338,12 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->payment->canCapture()); } + public function testCannotCapture() + { + $this->paymentMethodMock->expects($this->once())->method('canCapture')->willReturn(false); + $this->assertFalse($this->payment->canCapture()); + } + public function testPay() { $expects = [ @@ -1456,7 +1690,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase if (!empty($allStatuses)) { $orderConfigMock->expects($this->any()) ->method('getStateStatuses') - ->with(Order::STATE_NEW) + ->with($state) ->will($this->returnValue($allStatuses)); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Status/HistoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Status/HistoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..38d2772d7dadd8ddc1062c6f2f1550773be1cffd --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Status/HistoryTest.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Unit\Model\Order\Status; + +use Magento\Sales\Model\Order\Status\History; + +/** + * Class HistoryTest + */ +class HistoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \Magento\Sales\Model\Order | \PHPUnit_Framework_MockObject_MockObject + */ + protected $order; + + /** + * @var History + */ + protected $model; + + /** + * @var \Magento\Store\Model\StoreManagerInterface | \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManager; + + protected function setUp() + { + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->order = $this->getMock('Magento\Sales\Model\Order', [], [], '', false); + $this->storeManager = $this->getMockForAbstractClass( + 'Magento\Store\Model\StoreManagerInterface', + [], + '', + false + ); + + + + $this->model = $this->objectManager->getObject( + 'Magento\Sales\Model\Order\Status\History', + ['storeManager' => $this->storeManager] + ); + } + + public function testSetOrder() + { + $storeId = 1; + $this->order->expects($this->once())->method('getStoreId')->willReturn($storeId); + $this->model->setOrder($this->order); + $this->assertEquals($this->order, $this->model->getOrder()); + } + + public function testSetIsCustomerNotified() + { + $this->model->setIsCustomerNotified(true); + $this->assertEquals(true, $this->model->getIsCustomerNotified()); + } + + public function testSetIsCustomerNotifiedNotApplicable() + { + $this->model->setIsCustomerNotified(); + $this->assertEquals($this->model->isCustomerNotificationNotApplicable(), $this->model->getIsCustomerNotified()); + } + + public function testGetStatusLabel() + { + $status = 'pending'; + $this->assertNull($this->model->getStatusLabel()); + $this->model->setStatus($status); + $config = $this->getMock('Magento\Sales\Model\Order\Config', [], [], '', false); + $config->expects($this->once())->method('getStatusLabel')->with($status)->willReturn($status); + $this->order->expects($this->once())->method('getConfig')->willReturn($config); + $this->model->setOrder($this->order); + $this->assertEquals($status, $this->model->getStatusLabel()); + } + + public function testGetStoreFromStoreManager() + { + $resultStore = 1; + $this->storeManager->expects($this->once())->method('getStore')->willReturn($resultStore); + $this->assertEquals($resultStore, $this->model->getStore()); + } + + public function testGetStoreFromOrder() + { + $resultStore = 1; + $this->model->setOrder($this->order); + $this->order->expects($this->once())->method('getStore')->willReturn($resultStore); + $this->assertEquals($resultStore, $this->model->getStore()); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php index 647427af5956808ff1eb5505bf46ceadb7d1b23d..d8c2ec39e9b4a9665bab2d68a3380ae0f5fd5e13 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php @@ -38,10 +38,18 @@ class OrderTest extends \PHPUnit_Framework_TestCase * @var \Magento\Sales\Model\Order|\PHPUnit_Framework_MockObject_MockObject */ protected $orderMock; + /** + * @var \Magento\Sales\Model\Order\Item|\PHPUnit_Framework_MockObject_MockObject + */ + protected $orderItemMock; /** * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ protected $storeMock; + /** + * @var \Magento\Store\Model\Website|\PHPUnit_Framework_MockObject_MockObject + */ + protected $websiteMock; /** * @var \Magento\Store\Model\Group|\PHPUnit_Framework_MockObject_MockObject */ @@ -71,8 +79,28 @@ class OrderTest extends \PHPUnit_Framework_TestCase { $this->resourceMock = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); $this->orderMock = $this->getMock('Magento\Sales\Model\Order', [], [], '', false); + $this->orderItemMock = $this->getMock( + 'Magento\Sales\Model\Order\Item', + ['getQuoteParentItemId', 'setTotalItemCount', 'getChildrenItems'], + [], + '', + false + ); $this->storeMock = $this->getMock('Magento\Store\Model\Store', [], [], '', false); - $this->storeGroupMock = $this->getMock('Magento\Store\Model\Group', [], [], '', false); + $this->storeGroupMock = $this->getMock( + 'Magento\Store\Model\Group', + ['getName', 'getDefaultStoreId'], + [], + '', + false + ); + $this->websiteMock = $this->getMock( + 'Magento\Store\Model\Website', + ['getName'], + [], + '', + false + ); $this->adapterMock = $this->getMock( 'Magento\Framework\DB\Adapter\Pdo\Mysql', [ @@ -138,7 +166,24 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function testSave() { - + $this->orderMock->expects($this->exactly(3)) + ->method('getId') + ->willReturn(null); + $this->orderItemMock->expects($this->once()) + ->method('getChildrenItems') + ->willReturn([]); + $this->orderItemMock->expects($this->once()) + ->method('getQuoteParentItemId') + ->willReturn(null); + $this->orderMock->expects($this->once()) + ->method('setTotalItemCount') + ->with(1); + $this->storeGroupMock->expects($this->once()) + ->method('getDefaultStoreId') + ->willReturn(1); + $this->orderMock->expects($this->once()) + ->method('getAllItems') + ->willReturn([$this->orderItemMock]); $this->orderMock->expects($this->once()) ->method('validateBeforeSave') ->willReturnSelf(); @@ -151,12 +196,15 @@ class OrderTest extends \PHPUnit_Framework_TestCase $this->orderMock->expects($this->once()) ->method('getEntityType') ->willReturn('order'); - $this->orderMock->expects($this->once()) + $this->orderMock->expects($this->exactly(2)) ->method('getStore') ->willReturn($this->storeMock); - $this->storeMock->expects($this->once()) + $this->storeMock->expects($this->exactly(2)) ->method('getGroup') ->willReturn($this->storeGroupMock); + $this->storeMock->expects($this->once()) + ->method('getWebsite') + ->willReturn($this->websiteMock); $this->storeGroupMock->expects($this->once()) ->method('getDefaultStoreId') ->willReturn(1); 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/adminhtml/layout/sales_order_invoice_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_invoice_grid_block.xml index 3cbec907dc9bfeefbf9342c6631b65789b75ff82..89365d27a1124b0abc5c3d2baf51421731a9a2b8 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_invoice_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_invoice_grid_block.xml @@ -70,13 +70,13 @@ <argument name="column_css_class" xsi:type="string">col-status</argument> </arguments> </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="base_grand_total"> + <block class="Magento\Backend\Block\Widget\Grid\Column" as="grand_total"> <arguments> - <argument name="id" xsi:type="string">base_grand_total</argument> + <argument name="id" xsi:type="string">grand_total</argument> <argument name="header" xsi:type="string" translate="true">Amount</argument> <argument name="type" xsi:type="string">currency</argument> - <argument name="currency" xsi:type="string">base_currency_code</argument> - <argument name="index" xsi:type="string">base_grand_total</argument> + <argument name="currency" xsi:type="string">order_currency_code</argument> + <argument name="index" xsi:type="string">grand_total</argument> <argument name="header_css_class" xsi:type="string">col-qty</argument> <argument name="column_css_class" xsi:type="string">col-qty</argument> </arguments> 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/Api/SearchInterface.php b/app/code/Magento/Search/Api/SearchInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..4e53ba17fde129c834b3f319c96c3fc14494440f --- /dev/null +++ b/app/code/Magento/Search/Api/SearchInterface.php @@ -0,0 +1,20 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Search\Api; + +/** + * @api + */ +interface SearchInterface +{ + /** + * Make Full Text Search and return found Documents + * + * @param \Magento\Framework\Api\Search\SearchCriteriaInterface $searchCriteria + * @return \Magento\Framework\Api\Search\SearchResultInterface + */ + public function search(\Magento\Framework\Api\Search\SearchCriteriaInterface $searchCriteria); +} diff --git a/app/code/Magento/Search/Model/Search.php b/app/code/Magento/Search/Model/Search.php new file mode 100644 index 0000000000000000000000000000000000000000..58f6d2a6c39d48e5d8fa0e8390875a091d62877c --- /dev/null +++ b/app/code/Magento/Search/Model/Search.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Search\Model; + +use Magento\Framework\Api\Search\SearchCriteriaInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Search\Request\Builder; +use Magento\Framework\Search\SearchEngineInterface; +use Magento\Search\Api\SearchInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; + +class Search implements SearchInterface +{ + /** + * @var Builder + */ + private $requestBuilder; + + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @var SearchEngineInterface + */ + private $searchEngine; + + /** + * @var SearchResponseBuilder + */ + private $searchResponseBuilder; + + /** + * @param Builder $requestBuilder + * @param StoreManagerInterface $storeManager + * @param SearchEngineInterface $searchEngine + * @param SearchResponseBuilder $searchResponseBuilder + */ + public function __construct( + Builder $requestBuilder, + StoreManagerInterface $storeManager, + SearchEngineInterface $searchEngine, + SearchResponseBuilder $searchResponseBuilder + ) { + $this->requestBuilder = $requestBuilder; + $this->storeManager = $storeManager; + $this->searchEngine = $searchEngine; + $this->searchResponseBuilder = $searchResponseBuilder; + } + + /** + * {@inheritdoc} + */ + public function search(SearchCriteriaInterface $searchCriteria) + { + $this->requestBuilder->setRequestName($searchCriteria->getRequestName()); + + $storeId = $this->storeManager->getStore(true)->getId(); + $this->requestBuilder->bindDimension('scope', $storeId); + + foreach ($searchCriteria->getFilterGroups() as $filterGroup) { + foreach ($filterGroup->getFilters() as $filter) { + $this->addFieldToFilter($filter->getField(), $filter->getValue()); + } + } + + $this->requestBuilder->setFrom($searchCriteria->getCurrentPage() * $searchCriteria->getPageSize()); + $this->requestBuilder->setSize($searchCriteria->getPageSize()); + $request = $this->requestBuilder->create(); + $searchResponse = $this->searchEngine->search($request); + + return $this->searchResponseBuilder->build($searchResponse) + ->setSearchCriteria($searchCriteria); + } + + /** + * Apply attribute filter to facet collection + * + * @param string $field + * @param null $condition + * @return $this + */ + private function addFieldToFilter($field, $condition = null) + { + if (!is_array($condition) || !in_array(key($condition), ['from', 'to'])) { + $this->requestBuilder->bind($field, $condition); + } else { + if (!empty($condition['from'])) { + $this->requestBuilder->bind("{$field}.from", $condition['from']); + } + if (!empty($condition['to'])) { + $this->requestBuilder->bind("{$field}.to", $condition['to']); + } + } + return $this; + } +} diff --git a/app/code/Magento/Catalog/Model/SearchResponseBuilder.php b/app/code/Magento/Search/Model/SearchResponseBuilder.php similarity index 98% rename from app/code/Magento/Catalog/Model/SearchResponseBuilder.php rename to app/code/Magento/Search/Model/SearchResponseBuilder.php index 36e552b32409e908a1a71e79902a26582f7aeeb7..bf827763ebb6987848f82b772fe2c1747f8ea543 100644 --- a/app/code/Magento/Catalog/Model/SearchResponseBuilder.php +++ b/app/code/Magento/Search/Model/SearchResponseBuilder.php @@ -3,7 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Catalog\Model; +namespace Magento\Search\Model; use Magento\Framework\Api\Search\SearchResultInterface; use Magento\Framework\Api\Search\DocumentFactory; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/SearchResponseBuilderTest.php b/app/code/Magento/Search/Test/Unit/Model/SearchResponseBuilderTest.php similarity index 96% rename from app/code/Magento/Catalog/Test/Unit/Model/SearchResponseBuilderTest.php rename to app/code/Magento/Search/Test/Unit/Model/SearchResponseBuilderTest.php index 72021021884e68fbe193b6eb6177b2608742d558..d0e3b7f183d0c8be2f540144826fe02b5ce25206 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/SearchResponseBuilderTest.php +++ b/app/code/Magento/Search/Test/Unit/Model/SearchResponseBuilderTest.php @@ -3,7 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Catalog\Test\Unit\Model; +namespace Magento\Search\Test\Unit\Model; use Magento\Framework\Api\Search\SearchResultInterface; use Magento\Framework\Search\Response\QueryResponse; @@ -12,7 +12,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class SearchResponseBuilderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Catalog\Model\SearchResponseBuilder + * @var \Magento\Search\Model\SearchResponseBuilder */ private $model; @@ -36,7 +36,7 @@ class SearchResponseBuilderTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $this->model = (new ObjectManager($this))->getObject('Magento\Catalog\Model\SearchResponseBuilder', [ + $this->model = (new ObjectManager($this))->getObject('Magento\Search\Model\SearchResponseBuilder', [ 'documentFactory' => $this->documentFactory, 'searchResultFactory' => $this->searchResultFactory, ]); diff --git a/app/code/Magento/Search/Test/Unit/Model/SearchTest.php b/app/code/Magento/Search/Test/Unit/Model/SearchTest.php new file mode 100644 index 0000000000000000000000000000000000000000..02af8490fcc954117b6b555f3573a0a2ee9859ec --- /dev/null +++ b/app/code/Magento/Search/Test/Unit/Model/SearchTest.php @@ -0,0 +1,150 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Search\Test\Unit\Model; + +use Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmFactory; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Store\Model\ScopeInterface; + +class SearchTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Search\Model\Search + */ + protected $model; + + /** + * @var \Magento\Framework\Search\Request\Builder|\PHPUnit_Framework_MockObject_MockObject + */ + protected $requestBuilder; + + /** + * @var \Magento\Search\Model\SearchEngine|\PHPUnit_Framework_MockObject_MockObject + */ + protected $searchEngine; + + /** + * @var \Magento\Search\Model\SearchResponseBuilder|\PHPUnit_Framework_MockObject_MockObject + */ + protected $searchResponseBuilder; + + /** + * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManager; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + + $this->requestBuilder = $this->getMockBuilder('Magento\Framework\Search\Request\Builder') + ->disableOriginalConstructor() + ->getMock(); + + $this->searchEngine = $this->getMockBuilder('Magento\Search\Model\SearchEngine') + ->disableOriginalConstructor() + ->getMock(); + + $this->searchResponseBuilder = $this->getMockBuilder('Magento\Search\Model\SearchResponseBuilder') + ->disableOriginalConstructor() + ->getMock(); + + $this->storeManager = $this->getMockBuilder('Magento\Store\Model\StoreManagerInterface') + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->model = $objectManager->getObject('Magento\Search\Model\Search', [ + 'requestBuilder' => $this->requestBuilder, + 'searchEngine' => $this->searchEngine, + 'searchResponseBuilder' => $this->searchResponseBuilder, + 'storeManager' => $this->storeManager, + ]); + } + + public function testSearch() + { + $requestName = 'requestName'; + $storeId = 333; + $filterField = 'filterField'; + $filterValue = 'filterValue'; + + $filter = $this->getMockBuilder('Magento\Framework\Api\Filter') + ->disableOriginalConstructor() + ->getMock(); + $filter->expects($this->once()) + ->method('getField') + ->willReturn($filterField); + $filter->expects($this->once()) + ->method('getValue') + ->willReturn($filterValue); + + $filterGroup = $this->getMockBuilder('Magento\Framework\Api\Search\FilterGroup') + ->disableOriginalConstructor() + ->getMock(); + $filterGroup->expects($this->once()) + ->method('getFilters') + ->willReturn([$filter]); + + $searchCriteria = $this->getMockBuilder('Magento\Framework\Api\Search\SearchCriteriaInterface') + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $searchCriteria->expects($this->once()) + ->method('getRequestName') + ->willReturn($requestName); + $searchCriteria->expects($this->once()) + ->method('getFilterGroups') + ->willReturn([$filterGroup]); + + $store = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->getMock(); + $store->expects($this->once()) + ->method('getId') + ->willReturn($storeId); + + $searchResult = $this->getMockBuilder('Magento\Framework\Api\Search\SearchResult') + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $request = $this->getMockBuilder('Magento\Framework\Search\RequestInterface') + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $response = $this->getMockBuilder('Magento\Framework\Search\ResponseInterface') + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->requestBuilder->expects($this->once()) + ->method('setRequestName') + ->with($requestName); + $this->requestBuilder->expects($this->once()) + ->method('bindDimension') + ->with('scope', $storeId); + $this->requestBuilder->expects($this->any()) + ->method('bind'); + $this->requestBuilder->expects($this->once()) + ->method('create') + ->willReturn($request); + + $this->searchEngine->expects($this->once()) + ->method('search') + ->with($request) + ->willReturn($response); + + $this->searchResponseBuilder->expects($this->once()) + ->method('build') + ->with($response) + ->willReturn($searchResult); + + $this->storeManager->expects($this->once()) + ->method('getStore') + ->willReturn($store); + + $searchResult = $this->model->search($searchCriteria); + + $this->assertInstanceOf('Magento\Framework\Api\Search\SearchResultInterface', $searchResult); + } +} diff --git a/app/code/Magento/Search/etc/di.xml b/app/code/Magento/Search/etc/di.xml index a8b7dfd5bc687879ef00d13673fae36764758d81..26f8d94c1a502521dd3787da8069527f823471cd 100644 --- a/app/code/Magento/Search/etc/di.xml +++ b/app/code/Magento/Search/etc/di.xml @@ -7,6 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <preference for="Magento\Search\Api\SearchInterface" type="Magento\Search\Model\Search"/> <type name="Magento\Framework\Module\Setup\Migration"> <arguments> <argument name="compositeModules" xsi:type="array"> diff --git a/app/code/Magento/Search/etc/webapi.xml b/app/code/Magento/Search/etc/webapi.xml new file mode 100644 index 0000000000000000000000000000000000000000..d06beccfa8d80ad2d498bbbaaaa41047d800e3a5 --- /dev/null +++ b/app/code/Magento/Search/etc/webapi.xml @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> + + <route url="/V1/search" method="GET"> + <service class="Magento\Search\Api\SearchInterface" method="search"/> + <resources> + <resource ref="anonymous" /> + </resources> + </route> + +</routes> 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/Shipping/view/frontend/web/template/checkout/shipping/shipping-policy.html b/app/code/Magento/Shipping/view/frontend/web/template/checkout/shipping/shipping-policy.html index 2cbe9af66082875918159428833dee017e075ebf..22deac392831ca05a8b738283d7e26adfe34ee92 100644 --- a/app/code/Magento/Shipping/view/frontend/web/template/checkout/shipping/shipping-policy.html +++ b/app/code/Magento/Shipping/view/frontend/web/template/checkout/shipping/shipping-policy.html @@ -4,11 +4,16 @@ * See COPYING.txt for license details. */ --> -<div class="shipping-policy-block field-tooltip" data-bind="visible: config.isEnabled"> - <span class="field-tooltip-action"> +<div class="shipping-policy-block field-tooltip" + data-bind="visible: config.isEnabled"> + <span class="field-tooltip-action" + tabindex="0" + data-toggle="dropdown" + data-bind="mageInit: {'dropdown':{'activeClass': '_active'}}"> <!-- ko text: $t('See our Shipping Policy') --><!-- /ko --> </span> - <div class="field-tooltip-content"> + <div class="field-tooltip-content" + data-target="dropdown"> <span data-bind="html: config.shippingPolicyContent"></span> </div> </div> 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/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/DeleteFilesTest.php b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/DeleteFilesTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2a69f64be343ee3f155b2862cc2f227b5ad3b1b5 --- /dev/null +++ b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/DeleteFilesTest.php @@ -0,0 +1,104 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Theme\Test\Unit\Controller\Adminhtml\System\Design\Wysiwyg\Files; + +class DeleteFilesTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files */ + protected $controller; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\PHPUnit_Framework_MockObject_MockObject*/ + protected $objectManager; + + /** @var \Magento\Theme\Helper\Storage|\PHPUnit_Framework_MockObject_MockObject */ + protected $storage; + + /** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $request; + + /** @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject */ + protected $response; + + public function setUp() + { + $this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface'); + $this->storage = $this->getMock('Magento\Theme\Model\Wysiwyg\Storage', [], [], '', false); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); + $this->request = $this->getMockForAbstractClass( + 'Magento\Framework\App\RequestInterface', + [], + '', + false, + false, + true, + ['isPost', 'getParam'] + ); + + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->controller = $helper->getObject( + 'Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files\DeleteFiles', + [ + 'objectManager' => $this->objectManager, + 'request' => $this->request, + 'response' => $this->response, + ] + ); + } + + public function testExecuteWithWrongRequest() + { + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(false); + + $jsonData = $this->getMock('Magento\Framework\Json\Helper\Data', [], [], '', false); + $jsonData->expects($this->once()) + ->method('jsonEncode') + ->with(['error' => true, 'message' => 'Wrong request']) + ->willReturn('{"error":"true","message":"Wrong request"}'); + + $this->objectManager->expects($this->once()) + ->method('get') + ->with('Magento\Framework\Json\Helper\Data') + ->willReturn($jsonData); + + $this->response->expects($this->once()) + ->method('representJson') + ->with('{"error":"true","message":"Wrong request"}'); + + $this->controller->execute(); + } + + public function testExecute() + { + $this->request->expects($this->once()) + ->method('isPost') + ->willReturn(true); + $this->request->expects($this->once()) + ->method('getParam') + ->with('files') + ->willReturn('{"files":"file"}'); + + $jsonData = $this->getMock('Magento\Framework\Json\Helper\Data', [], [], '', false); + $jsonData->expects($this->once()) + ->method('jsonDecode') + ->with('{"files":"file"}') + ->willReturn(['files' => 'file']); + $this->objectManager->expects($this->at(0)) + ->method('get') + ->with('Magento\Framework\Json\Helper\Data') + ->willReturn($jsonData); + $this->objectManager->expects($this->at(1)) + ->method('get') + ->with('Magento\Theme\Model\Wysiwyg\Storage') + ->willReturn($this->storage); + $this->storage->expects($this->once()) + ->method('deleteFile') + ->with('file'); + + $this->controller->execute(); + } +} diff --git a/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/DeleteFolderTest.php b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/DeleteFolderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9bd042cfe2e5864a6f86e5afa848ad63b9ca1a79 --- /dev/null +++ b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/DeleteFolderTest.php @@ -0,0 +1,71 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Theme\Test\Unit\Controller\Adminhtml\System\Design\Wysiwyg\Files; + +class DeleteFolderTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files */ + protected $controller; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\PHPUnit_Framework_MockObject_MockObject*/ + protected $objectManager; + + /** @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject */ + protected $response; + + /** @var \Magento\Theme\Helper\Storage|\PHPUnit_Framework_MockObject_MockObject */ + protected $storage; + + /** @var \Magento\Theme\Helper\Storage|\PHPUnit_Framework_MockObject_MockObject */ + protected $storageHelper; + + public function setUp() + { + $this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface'); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); + $this->storage = $this->getMock('Magento\Theme\Model\Wysiwyg\Storage', [], [], '', false); + $this->storageHelper = $this->getMock('Magento\Theme\Helper\Storage', [], [], '', false); + + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->controller = $helper->getObject( + 'Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files\DeleteFolder', + [ + 'objectManager' => $this->objectManager, + 'response' => $this->response, + 'storage' => $this->storageHelper + ] + ); + } + + public function testExecute() + { + $this->storageHelper->expects($this->once()) + ->method('getCurrentPath') + ->willReturn('/current/path/'); + + $this->objectManager->expects($this->at(0)) + ->method('get') + ->with('Magento\Theme\Model\Wysiwyg\Storage') + ->willReturn($this->storage); + $this->storage->expects($this->once()) + ->method('deleteDirectory') + ->with('/current/path/') + ->willThrowException(new \Exception('Message')); + + $jsonData = $this->getMock('Magento\Framework\Json\Helper\Data', [], [], '', false); + $jsonData->expects($this->once()) + ->method('jsonEncode') + ->with(['error' => true, 'message' => 'Message']) + ->willReturn('{"error":"true","message":"Message"}'); + + $this->objectManager->expects($this->at(1)) + ->method('get') + ->with('Magento\Framework\Json\Helper\Data') + ->willReturn($jsonData); + + $this->controller->execute(); + } +} diff --git a/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/IndexTest.php b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/IndexTest.php new file mode 100644 index 0000000000000000000000000000000000000000..63884649f39f4baf66a5886619757abb381a529a --- /dev/null +++ b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/IndexTest.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Theme\Test\Unit\Controller\Adminhtml\System\Design\Wysiwyg\Files; + +class IndexTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files */ + protected $controller; + + /** @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $view; + + public function setUp() + { + $this->view = $this->getMock('\Magento\Framework\App\ViewInterface', [], [], '', false); + + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->controller = $helper->getObject( + 'Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files\Index', + [ + 'view' => $this->view, + ] + ); + } + + public function testExecute() + { + $this->view ->expects($this->once()) + ->method('loadLayout') + ->with('overlay_popup'); + $this->view ->expects($this->once()) + ->method('renderLayout'); + + $this->controller->execute(); + } +} diff --git a/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/OnInsertTest.php b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/OnInsertTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0061013ed728c00cc216b889f9dcd4ec2b4e28c4 --- /dev/null +++ b/app/code/Magento/Theme/Test/Unit/Controller/Adminhtml/System/Design/Wysiwyg/Files/OnInsertTest.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Theme\Test\Unit\Controller\Adminhtml\System\Design\Wysiwyg\Files; + +class OnInsertTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files */ + protected $controller; + + /** @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $view; + + /** @var \PHPUnit_Framework_MockObject_MockObject|\PHPUnit_Framework_MockObject_MockObject */ + protected $objectManager; + + /** @var \Magento\Theme\Helper\Storage|\PHPUnit_Framework_MockObject_MockObject */ + protected $storageHelper; + + /** @var \Magento\Framework\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject */ + protected $response; + + public function setUp() + { + $this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface'); + $this->view = $this->getMock('\Magento\Framework\App\ViewInterface', [], [], '', false); + $this->storageHelper = $this->getMock('Magento\Theme\Helper\Storage', [], [], '', false); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', ['setBody'], [], '', false); + + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->controller = $helper->getObject( + 'Magento\Theme\Controller\Adminhtml\System\Design\Wysiwyg\Files\OnInsert', + [ + 'objectManager' => $this->objectManager, + 'view' => $this->view, + 'response' => $this->response + ] + ); + } + + public function testExecute() + { + $this->objectManager->expects($this->once()) + ->method('get') + ->with('Magento\Theme\Helper\Storage') + ->willReturn($this->storageHelper); + $this->storageHelper + ->expects($this->once()) + ->method('getRelativeUrl') + ->willReturn('http://relative.url/'); + $this->response->expects($this->once()) + ->method('setBody') + ->with('http://relative.url/'); + + $this->controller->execute(); + } +} diff --git a/app/code/Magento/Ui/etc/di.xml b/app/code/Magento/Ui/etc/di.xml index d81fb2c0bd00a7d2681ffdcb66148924494922bd..df69d1edebb07d1c3c082f2b6fd0f8920fea7c9d 100644 --- a/app/code/Magento/Ui/etc/di.xml +++ b/app/code/Magento/Ui/etc/di.xml @@ -180,7 +180,7 @@ <type name="Magento\Framework\Data\Argument\Interpreter\Composite"> <arguments> <argument name="interpreters" xsi:type="array"> - <item name="object" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Object</item> + <item name="object" xsi:type="object">configurableObjectArgumentInterpreterProxy</item> <item name="configurableObject" xsi:type="object">configurableObjectArgumentInterpreterProxy</item> <item name="array" xsi:type="object">arrayArgumentInterpreterProxy</item> <item name="boolean" xsi:type="object">Magento\Framework\Data\Argument\Interpreter\Boolean</item> 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/Ui/view/base/web/js/grid/filters/filters.js b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js index 13f6704f34d37fb5ae8773e7c2628d402a28a5dd..7cdb49ff39e1c2c414ec93c3b39d2586eeabfaee 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/filters/filters.js @@ -40,8 +40,12 @@ define([ return Collapsible.extend({ defaults: { template: 'ui/grid/filters/filters', - applied: {}, - filters: {}, + applied: { + placeholder: true + }, + filters: { + placeholder: true + }, chipsConfig: { name: '${ $.name }_chips', provider: '${ $.chipsConfig.name }', @@ -151,25 +155,11 @@ define([ * @returns {Filters} Chainable. */ cancel: function () { - this.convertToObject(); this.set('filters', utils.copy(this.applied)); return this; }, - /** - * Convert empty array to empty object. - * - * @returns {Filters} Chainable. - */ - convertToObject: function() { - if ( _.isArray(this.applied) && _.isEmpty(this.applied) ) { - this.applied = {}; - } - - return this; - }, - /** * Tells wether filters pannel should be opened. * diff --git a/app/code/Magento/Ui/view/base/web/js/grid/search/search.js b/app/code/Magento/Ui/view/base/web/js/grid/search/search.js index 852bae6d580647a66e1106d9168af69617b821bd..71e0570311aea9a9b4144a51340504846d7acd38 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/search/search.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/search/search.js @@ -16,6 +16,7 @@ define([ template: 'ui/grid/search/search', placeholder: $t('Search by keyword'), label: $t('Keyword'), + value: '', imports: { inputValue: 'value', updatePreview: 'value' diff --git a/app/code/Magento/Ui/view/frontend/web/templates/form/element/helper/tooltip.html b/app/code/Magento/Ui/view/frontend/web/templates/form/element/helper/tooltip.html index b2ef214e944a5e63c14f8b00f6d4297280baa284..cc0a600888c1829ef2de7e034f420b8b74bbb45d 100644 --- a/app/code/Magento/Ui/view/frontend/web/templates/form/element/helper/tooltip.html +++ b/app/code/Magento/Ui/view/frontend/web/templates/form/element/helper/tooltip.html @@ -5,9 +5,23 @@ */ --> <div class="field-tooltip toggle"> - <a class="field-tooltip-action action-help" target="_blank" data-bind="attr: {href: tooltip.link}"> - </a> - <div class="field-tooltip-content"> + + <!-- ko if: (tooltip.link)--> + <a class="field-tooltip-action action-help" + target="_blank" + data-toggle="dropdown" + data-bind="attr: {href: tooltip.link}, mageInit: {'dropdown':{'activeClass': '_active'}}"></a> + <!-- /ko --> + + <!-- ko if: (!tooltip.link)--> + <span class="field-tooltip-action action-help" + tabindex="0" + data-toggle="dropdown" + data-bind="mageInit: {'dropdown':{'activeClass': '_active'}}"></span> + <!-- /ko --> + + <div class="field-tooltip-content" + data-target="dropdown"> <!-- ko text: tooltip.description --><!-- /ko --> </div> </div> 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/Test/Unit/Model/ItemTest.php b/app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php index 76b46f13538da68b31514bce752b669cda2b9194..f31a0ced59d6143fc7f1db6a97f1f3d6338f2423 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Model/ItemTest.php @@ -165,7 +165,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase $this->model->addOption($option); $this->assertEquals(1, count($this->model->getOptions())); $this->model->removeOption($code); - $actualOptions = $this->model->getOptions(); + $actualOptions = $this->model->getOptions(); $actualOption = array_pop($actualOptions); $this->assertTrue($actualOption->isDeleted()); } @@ -185,7 +185,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase ->getMock(); return [ ['first_key', ['code' => 'first_key', 'value' => 'first_data']], - ['second_key',$optionMock], + ['second_key', $optionMock], ['third_key', new \Magento\Framework\Object(['code' => 'third_key', 'product' => $productMock])], ]; } @@ -262,4 +262,63 @@ class ItemTest extends \PHPUnit_Framework_TestCase $this->assertFalse($result); } + + public function testSetAndSaveItemOptions() + { + $this->assertEmpty($this->model->getOptions()); + $firstOptionMock = $this->getMockBuilder('Magento\Wishlist\Model\Item\Option') + ->disableOriginalConstructor() + ->setMethods(['getCode', 'isDeleted', 'delete', '__wakeup']) + ->getMock(); + $firstOptionMock->expects($this->any()) + ->method('getCode') + ->willReturn('first_code'); + $firstOptionMock->expects($this->any()) + ->method('isDeleted') + ->willReturn(true); + $firstOptionMock->expects($this->once()) + ->method('delete'); + + $secondOptionMock = $this->getMockBuilder('Magento\Wishlist\Model\Item\Option') + ->disableOriginalConstructor() + ->setMethods(['getCode', 'save', '__wakeup']) + ->getMock(); + $secondOptionMock->expects($this->any()) + ->method('getCode') + ->willReturn('second_code'); + $secondOptionMock->expects($this->once()) + ->method('save'); + + $this->model->setOptions([$firstOptionMock, $secondOptionMock]); + $this->assertNull($this->model->isOptionsSaved()); + $this->model->saveItemOptions(); + $this->assertTrue($this->model->isOptionsSaved()); + } + + public function testGetProductWithException() + { + $this->setExpectedException('Magento\Framework\Exception\LocalizedException', __('Cannot specify product.')); + $this->model->getProduct(); + } + + public function testGetProduct() + { + $productId = 1; + $storeId = 0; + $this->model->setData('product_id', $productId); + $this->model->setData('store_id', $storeId); + $productMock = $this->getMockBuilder('Magento\Catalog\Model\Product') + ->disableOriginalConstructor() + ->getMock(); + $productMock->expects($this->any()) + ->method('setFinalPrice') + ->with(null); + $productMock->expects($this->any()) + ->method('setCustomOprtions') + ->with([]); + $this->productRepository->expects($this->once()) + ->method('getById') + ->willReturn($productMock); + $this->assertEquals($productMock, $this->model->getProduct()); + } } 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/Magento_Catalog/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less index bfdae677b798e4b9b90e54c00a62ee0d84bc1e2b..8fdf8ecbf2e8750384aa9f3b0c322ef90e17ea7b 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less +++ b/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less @@ -10,3 +10,10 @@ } } } + +/* Change Attribute Set */ +#product_info_tabs li.removed, +div.removed, +.field.removed { + display: none !important; +} diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less index 6b61accec5875976a780ef4169fc472b595ec6fb..c9ced7dba320629247a6d27e622bb7d7187668e2 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less @@ -482,6 +482,10 @@ } } +.ui-widget-overlay { + &:extend(.abs-modal-overlay all); +} + .overlay_magento { &:extend(.abs-modal-overlay all); z-index: 800 !important; 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_Checkout/web/css/source/module/checkout/_tooltip.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less index d867cc3387355f400f35932bbad34242d21c4c06..cc9d6c7a0876c7702b9aada9ac1e9cab19eaf948 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less @@ -37,13 +37,14 @@ & when (@media-common = true) { .field-tooltip { + cursor: pointer; position: absolute; right: 0; top: 1px; - &:hover { + &._active { .css(z-index, @checkout-tooltip__hover__z-index); - cursor: pointer; + .field-tooltip-content { display: block; } @@ -56,19 +57,23 @@ .field-tooltip-action { .icon-font( - @checkout-tooltip-icon__content, - @_icon-font-size: @checkout-tooltip-icon__font-size, - @_icon-font-text-hide: true, - @_icon-font-color: @checkout-tooltip-icon__color, - @_icon-font-color-hover: @checkout-tooltip-icon__hover__color, - @_icon-font-color-active: false + @checkout-tooltip-icon__content, + @_icon-font-size: @checkout-tooltip-icon__font-size, + @_icon-font-text-hide: true, + @_icon-font-color: @checkout-tooltip-icon__color, + @_icon-font-color-hover: @checkout-tooltip-icon__hover__color, + @_icon-font-color-active: false ); + &:focus { - &:before { - .css(color, @checkout-tooltip-icon__hover__color); - } - + .field-tooltip-content { - display: block; + ._keyfocus & { + .css(z-index, @checkout-tooltip__hover__z-index); + + .field-tooltip-content { + display: block; + } + &:before { + .css(color, @checkout-tooltip-icon__hover__color); + } } } } 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/_extends.less b/app/design/frontend/Magento/blank/web/css/source/_extends.less index 19705339dae3c4f0430aac361f16a2952ef1350c..0983be45a276f5216ecf108e4024013ad0323ed2 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_extends.less +++ b/app/design/frontend/Magento/blank/web/css/source/_extends.less @@ -1046,18 +1046,6 @@ input { .css(margin-right, @indent__s); width: calc(~"100% - (@{checkout-tooltip-icon__font-size} + @{indent__s} + @{indent__xs})"); - &:focus { - + .field-tooltip { - .field-tooltip-action { - &:before { - .css(color, @checkout-tooltip-icon__hover__color); - } - } - .field-tooltip-content { - display: block; - } - } - } } } 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/app/design/frontend/Magento/luma/web/css/source/_extends.less b/app/design/frontend/Magento/luma/web/css/source/_extends.less index 04018f6977c016c96c9444e206a8eb64ba787fff..bdd133e5cc3fcc9a182333062090ce1417b545da 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_extends.less +++ b/app/design/frontend/Magento/luma/web/css/source/_extends.less @@ -1434,18 +1434,6 @@ input { .css(margin-right, @indent__s); width: calc(~"100% - (@{checkout-tooltip-icon__font-size} + @{indent__s} + @{indent__xs})"); - &:focus { - + .field-tooltip { - .field-tooltip-action { - &:before { - .css(color, @checkout-tooltip-icon__hover__color); - } - } - .field-tooltip-content { - display: block; - } - } - } } } diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php index 8321bbcefac2433e340c02a7f89a8abbec04ef2c..0a6125fd5fbf923b783d1b77ba86455419279c24 100644 --- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php +++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php @@ -42,6 +42,7 @@ class Soap implements \Magento\TestFramework\TestCase\Webapi\AdapterInterface $objectManager = Bootstrap::getObjectManager(); $this->_soapConfig = $objectManager->get('Magento\Webapi\Model\Soap\Config'); $this->_converter = $objectManager->get('Magento\Framework\Api\SimpleDataObjectConverter'); + ini_set('default_socket_timeout', 120); } /** diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php index 8adda8f9d9b7322f3683bf5aba9bc6d56219b0c1..d33e1456bc363e80830d3d1a32229fbccaaebc69 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php @@ -36,48 +36,6 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract ], ]; - /** - * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php - */ - public function testSearch() - { - $searchCriteria = [ - 'searchCriteria' => [ - 'search_term' => 'simple', - 'request_name' => 'quick_search_container', - 'filter_groups' => [], - 'page_size' => 20000000000000, - 'current_page' => 1, - ], - ]; - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($searchCriteria), - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'Search', - ], - ]; - - $response = $this->_webApiCall($serviceInfo, $searchCriteria); - - $this->assertArrayHasKey('search_criteria', $response); - $this->assertArrayHasKey('total_count', $response); - $this->assertArrayHasKey('items', $response); - - $this->assertEquals($searchCriteria['searchCriteria'], $response['search_criteria']); - $this->assertTrue($response['total_count'] > 0); - $this->assertTrue(count($response['items']) > 0); - - $this->assertNotNull($response['items'][0]['id']); - $this->assertEquals('relevance', $response['items'][0]['custom_attributes'][0]['attribute_code']); - $this->assertTrue($response['items'][0]['custom_attributes'][0]['value'] > 0); - } - /** * @magentoApiDataFixture Magento/Catalog/_files/products_related.php */ diff --git a/dev/tests/api-functional/testsuite/Magento/Search/Api/SearchTest.php b/dev/tests/api-functional/testsuite/Magento/Search/Api/SearchTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ae6fd1cfc39eb5b9577675a77ff15dd5a24cd802 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/Search/Api/SearchTest.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Search\Api; + +use Magento\TestFramework\TestCase\WebapiAbstract; + +class SearchTest extends WebapiAbstract +{ + const SERVICE_NAME = 'searchV1'; + const SERVICE_VERSION = 'V1'; + const RESOURCE_PATH = '/V1/search'; + + /** + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + * @covers \Magento\Search\Model\Search::search + */ + public function testCatalogSearch() + { + $searchCriteria = [ + 'searchCriteria' => [ + 'request_name' => 'quick_search_container', + 'filter_groups' => [ + [ + 'filters' => [ + [ + 'field' => 'search_term', + 'value' => 'simple', + ], + [ + 'field' => 'price_dynamic_algorithm', + 'value' => 'auto', + ] + ] + ] + ], + 'page_size' => 20000000000000, + 'current_page' => 1, + ], + ]; + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($searchCriteria), + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Search', + ], + ]; + + $response = $this->_webApiCall($serviceInfo, $searchCriteria); + + $this->assertArrayHasKey('search_criteria', $response); + $this->assertArrayHasKey('total_count', $response); + $this->assertArrayHasKey('items', $response); + + $this->assertEquals($searchCriteria['searchCriteria'], $response['search_criteria']); + $this->assertTrue($response['total_count'] > 0); + $this->assertTrue(count($response['items']) > 0); + + $this->assertNotNull($response['items'][0]['id']); + $this->assertEquals('relevance', $response['items'][0]['custom_attributes'][0]['attribute_code']); + $this->assertTrue($response['items'][0]['custom_attributes'][0]['value'] > 0); + } +} diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php index a2e6205071db7f2a9b4f1b80444ebfb1ac304c8a..9fbf676b355ed107dcb1db23c847ff5499643e04 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/View/Type/ConfigurableTest.php @@ -69,7 +69,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('Magento\Catalog\Model\Product', $product); } } - + /** * @magentoAppIsolation enabled */ @@ -79,7 +79,6 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $this->assertNotEmpty($config); $this->assertArrayHasKey('productId', $config); $this->assertEquals(1, $config['productId']); - $this->assertArrayHasKey('baseImage', $config); $this->assertArrayHasKey('attributes', $config); $this->assertArrayHasKey('template', $config); $this->assertArrayHasKey('prices', $config); 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 452cf6ab1c532ce79988c6752afee8cad3367230..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'], @@ -2326,4 +2352,9 @@ return [ ['loadPrices', 'Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable'], ['_parseVariationPrices', '\Magento\ConfigurableImportExport\Model\Import\Product\Type\Configurable'], ['_collectSuperDataPrice', '\Magento\ConfigurableImportExport\Model\Import\Product\Type\Configurable'], + [ + 'validateForPayment', + 'Magento\Sales\Model\Order\Address\Validator', + 'Magento\Sales\Model\Order\Address\Validator::validateForCustomer' + ], ]; 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/Api/Search/SearchCriteria.php b/lib/internal/Magento/Framework/Api/Search/SearchCriteria.php index 626e830864d9f4e6296f567f96a648e509f4d8b2..dece9d9876bade3198f2915607385994f21b552d 100644 --- a/lib/internal/Magento/Framework/Api/Search/SearchCriteria.php +++ b/lib/internal/Magento/Framework/Api/Search/SearchCriteria.php @@ -10,25 +10,8 @@ use Magento\Framework\Api\Search\SearchCriteriaInterface; class SearchCriteria extends BaseSearchCriteria implements SearchCriteriaInterface { - const SEARCH_TERM = 'search_term'; const REQUEST_NAME = 'request_name'; - /** - * {@inheritdoc} - */ - public function getSearchTerm() - { - return $this->_get(self::SEARCH_TERM); - } - - /** - * {@inheritdoc} - */ - public function setSearchTerm($searchTerm) - { - return $this->setData(self::SEARCH_TERM, $searchTerm); - } - /** * {@inheritdoc} */ diff --git a/lib/internal/Magento/Framework/Api/Search/SearchCriteriaInterface.php b/lib/internal/Magento/Framework/Api/Search/SearchCriteriaInterface.php index e952763d3fd93ca208a02325ac106ebbce01277c..1c8fe9772fb403957a06945e7e72938b300e9ef3 100644 --- a/lib/internal/Magento/Framework/Api/Search/SearchCriteriaInterface.php +++ b/lib/internal/Magento/Framework/Api/Search/SearchCriteriaInterface.php @@ -9,17 +9,6 @@ use Magento\Framework\Api\SearchCriteriaInterface as BaseSearchCriteriaInterface interface SearchCriteriaInterface extends BaseSearchCriteriaInterface { - /** - * @return string - */ - public function getSearchTerm(); - - /** - * @param string $searchTerm - * @return $this - */ - public function setSearchTerm($searchTerm); - /** * @return string */ 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/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 21db76cc7545bd52760186d17b04ef6f9dbc0f8c..85246e5521462c2d6b986d4428c05e060ff78ea8 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -1801,9 +1801,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $fields = $cols; } - // quote column names - // $cols = array_map(array($this, 'quoteIdentifier'), $cols); - // prepare ON DUPLICATE KEY conditions foreach ($fields as $k => $v) { $field = $value = null; 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/Element/UiComponent/Argument/Interpreter/ConfigurableObject.php b/lib/internal/Magento/Framework/View/Element/UiComponent/Argument/Interpreter/ConfigurableObject.php index f2d2779be11166b93310f688199c584c3b63c44f..78e4e7a15ff84cd5a89547d2ffa6ede3d2a48cce 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/Argument/Interpreter/ConfigurableObject.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/Argument/Interpreter/ConfigurableObject.php @@ -40,17 +40,22 @@ class ConfigurableObject implements InterpreterInterface */ public function evaluate(array $data) { - if (!isset($data['argument'])) { - throw new \InvalidArgumentException('Node "argument" required for this type.'); + if (isset($data['value'])) { + $className = $data['value']; + $arguments = []; + } else { + if (!isset($data['argument'])) { + throw new \InvalidArgumentException('Node "argument" required for this type.'); + } + foreach ($data['argument'] as $name => $argument) { + $arguments[$name] = $this->argumentInterpreter->evaluate($argument); + } + if (!isset($arguments['class'])) { + throw new \InvalidArgumentException('Node "argument" with name "class" is required for this type.'); + } + $className = $arguments['class']; + unset($arguments['class']); } - foreach ($data['argument'] as $name => $argument) { - $arguments[$name] = $this->argumentInterpreter->evaluate($argument); - } - if (!isset($arguments['class'])) { - throw new \InvalidArgumentException('Node "argument" with name "class" is required for this type.'); - } - $className = $arguments['class']; - unset($arguments['class']); return $this->objectManager->create($className, $arguments); } 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/lib/web/mage/dropdowns.js b/lib/web/mage/dropdowns.js index 83f692461544fb7fd59084946fcb7072971402cd..85f9214c4b4a62122522a984ee8bbee8f2f1650b 100644 --- a/lib/web/mage/dropdowns.js +++ b/lib/web/mage/dropdowns.js @@ -108,7 +108,7 @@ define([ if(options.autoclose === true) { self.reset({elems: actionElem.not(elem)}); } - self[elem.hasClass('active') ? 'closeDropdown' : 'openDropdown'](elem); + self[elem.hasClass(options.activeClass) ? 'closeDropdown' : 'openDropdown'](elem); return false; }); 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>