Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #13844: Fix issue 13827 (by @julienanquetil)
 - #13817: Allow changing head and body element through xml layout updates (by @cedricziel)
 - #13567: Add integration tests for product urls rewrite generation (by @adrien-louis-r)
 - #13038: Default Welcome message is broken on storefront with enabled translate-inline (by @pareshpansuriya)
 - #13828: Inconsistent Redirect in Admin Notification Controller (by @chickenland)
 - #13787: Issue-13768 Fixed error messages on admin user account page after redirect for force password change (by @nuzil)


Fixed GitHub Issues:
 - #13350: Magento 2.2 Encoding Issue -> Google Analytics (reported by @danielpfarmer) has been fixed in #13844 by @julienanquetil in 2.2-develop branch
   Related commits:
     1. 5843e81
     2. 0d5197f

 - #13827: Google Analytics character encoding issue ( \u0020 ) (reported by @Munszu) has been fixed in #13844 by @julienanquetil in 2.2-develop branch
   Related commits:
     1. 5843e81
     2. 0d5197f

 - #4454: CMS Page with <head> in layout update xml (reported by @zhiyicai) has been fixed in #13817 by @cedricziel in 2.2-develop branch
   Related commits:
     1. 341cdaf

 - #5863: URL Rewrite issues occur very often /catalog/product/view/id/711/s/product-name/category/16/ (reported by @kayintveen) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch
   Related commits:
     1. 1ef4dcc
     2. 864f371

 - #8227: After upgrade to 2.1.3 url rewrite problem multi store (reported by @philipvandebriel) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch
   Related commits:
     1. 1ef4dcc
     2. 864f371

 - #8957: Permanent Redirect for old URL missing via API (reported by @MarcoGrecoBitbull) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch
   Related commits:
     1. 1ef4dcc
     2. 864f371

 - #10073: Magento don't create product redirect if URL key on store view level was changed. (reported by @sergei-sss) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch
   Related commits:
     1. 1ef4dcc
     2. 864f371

 - #13240: Permanent 301 redirect is not generated when product url changes on storeview scope (reported by @koenner01) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch
   Related commits:
     1. 1ef4dcc
     2. 864f371

 - #12711: Default Welcome message is broken on storefront with enabled translate-inline (reported by @alena-marchenko) has been fixed in #13038 by @pareshpansuriya in 2.2-develop branch
   Related commits:
     1. 6144c4f
     2. 7e913f1
     3. cbc704d

 - #13768: Expired backend password - Attention: Something went wrong (reported by @janssensjelle) has been fixed in #13787 by @nuzil in 2.2-develop branch
   Related commits:
     1. 96a8b58
  • Loading branch information
magento-engcom-team authored Feb 28, 2018
2 parents 30462cd + 7e17a4f commit ec47891
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public function execute()
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
}
}
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
$this->_redirect('adminhtml/*/');
}
}
12 changes: 6 additions & 6 deletions app/code/Magento/GoogleAnalytics/Block/Ga.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public function getOrdersTrackingCode()
'price': '%s',
'quantity': %s
});",
$this->escapeJs($item->getSku()),
$this->escapeJs($item->getName()),
$this->escapeJsQuote($item->getSku()),
$this->escapeJsQuote($item->getName()),
$item->getPrice(),
$item->getQtyOrdered()
);
Expand All @@ -146,7 +146,7 @@ public function getOrdersTrackingCode()
'shipping': '%s'
});",
$order->getIncrementId(),
$this->escapeJs($this->_storeManager->getStore()->getFrontendName()),
$this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
$order->getGrandTotal(),
$order->getTaxAmount(),
$order->getShippingAmount()
Expand Down Expand Up @@ -236,15 +236,15 @@ public function getOrdersTrackingData()
foreach ($collection as $order) {
foreach ($order->getAllVisibleItems() as $item) {
$result['products'][] = [
'id' => $this->escapeJs($item->getSku()),
'name' => $this->escapeJs($item->getName()),
'id' => $this->escapeJsQuote($item->getSku()),
'name' => $this->escapeJsQuote($item->getName()),
'price' => $item->getPrice(),
'quantity' => $item->getQtyOrdered(),
];
}
$result['orders'][] = [
'id' => $order->getIncrementId(),
'affiliation' => $this->escapeJs($this->_storeManager->getStore()->getFrontendName()),
'affiliation' => $this->escapeJsQuote($this->_storeManager->getStore()->getFrontendName()),
'revenue' => $order->getGrandTotal(),
'tax' => $order->getTaxAmount(),
'shipping' => $order->getShippingAmount(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $welcomeMessage = $block->getWelcome();
</span>
<!-- /ko -->
<!-- ko ifnot: customer().fullname -->
<span data-bind='html:"<?= $block->escapeHtmlAttr($welcomeMessage) ?>"'></span>
<span data-bind='html:"<?= $block->escapeHtml($welcomeMessage) ?>"'></span>
<?= $block->getBlockHtml('header.additional') ?>
<!-- /ko -->
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function execute(EventObserver $observer)
'adminhtml_system_account_index',
'adminhtml_system_account_save',
'adminhtml_auth_logout',
'mui_index_render'
];
/** @var \Magento\Framework\App\Action\Action $controller */
$controller = $observer->getEvent()->getControllerAction();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\CatalogUrlRewrite\Observer;

use Magento\Store\Model\StoreManagerInterface;
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator;

/**
* @magentoAppArea adminhtml
*/
class ProductProcessUrlRewriteSavingObserverTest extends \PHPUnit\Framework\TestCase
{
/** @var \Magento\Framework\ObjectManagerInterface */
protected $objectManager;

protected function setUp()
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
}

/**
* @param array $filter
* @return array
*/
private function getActualResults(array $filter)
{
/** @var \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder */
$urlFinder = $this->objectManager->get(\Magento\UrlRewrite\Model\UrlFinderInterface::class);
$actualResults = [];
foreach ($urlFinder->findAllByData($filter) as $url) {
$actualResults[] = [
'request_path' => $url->getRequestPath(),
'target_path' => $url->getTargetPath(),
'is_auto_generated' => (int)$url->getIsAutogenerated(),
'redirect_type' => $url->getRedirectType(),
'store_id' => $url->getStoreId()
];
}
return $actualResults;
}

/**
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_rewrite_multistore.php
* @magentoAppIsolation enabled
*/
public function testUrlKeyHasChangedInGlobalContext()
{
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository*/
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
/** @var \Magento\Catalog\Model\Product $product*/
$product = $productRepository->get('product1');

/** @var StoreManagerInterface $storeManager */
$storeManager = $this->objectManager->get(StoreManagerInterface::class);
$storeManager->setCurrentStore(0);

$testStore = $storeManager->getStore('test');
$productFilter = [
UrlRewrite::ENTITY_TYPE => 'product',
];

$expected = [
[
'request_path' => "product-1.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => 1,
],
[
'request_path' => "product-1.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => $testStore->getId(),
],
];
$actual = $this->getActualResults($productFilter);
foreach ($expected as $row) {
$this->assertContains($row, $actual);
}

$product->setData('save_rewrites_history', true);
$product->setUrlKey('new-url');
$product->save();

$expected = [
[
'request_path' => "new-url.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => 1,
],
[
'request_path' => "new-url.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => $testStore->getId(),
],
[
'request_path' => "product-1.html",
'target_path' => "new-url.html",
'is_auto_generated' => 0,
'redirect_type' => 301,
'store_id' => 1,
],
[
'request_path' => "product-1.html",
'target_path' => "new-url.html",
'is_auto_generated' => 0,
'redirect_type' => 301,
'store_id' => $testStore->getId(),
],
];

$actual = $this->getActualResults($productFilter);
foreach ($expected as $row) {
$this->assertContains($row, $actual);
}
}

/**
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_rewrite_multistore.php
* @magentoAppIsolation enabled
*/
public function testUrlKeyHasChangedInStoreviewContextWithPermanentRedirection()
{
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository*/
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
/** @var \Magento\Catalog\Model\Product $product*/
$product = $productRepository->get('product1');

/** @var StoreManagerInterface $storeManager */
$storeManager = $this->objectManager->get(StoreManagerInterface::class);
$storeManager->setCurrentStore(1);

$testStore = $storeManager->getStore('test');

$productFilter = [
UrlRewrite::ENTITY_TYPE => 'product',
];

$product->setData('save_rewrites_history', true);
$product->setUrlKey('new-url');
$product->save();

$expected = [
[
'request_path' => "new-url.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => 1,
],
[
'request_path' => "product-1.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => $testStore->getId(),
],
[
'request_path' => "product-1.html",
'target_path' => "new-url.html",
'is_auto_generated' => 0,
'redirect_type' => 301,
'store_id' => 1,
],
];

$actual = $this->getActualResults($productFilter);
foreach ($expected as $row) {
$this->assertContains($row, $actual);
}
}

/**
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_rewrite_multistore.php
* @magentoAppIsolation enabled
*/
public function testUrlKeyHasChangedInStoreviewContextWithoutPermanentRedirection()
{
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository*/
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
/** @var \Magento\Catalog\Model\Product $product*/
$product = $productRepository->get('product1');

/** @var StoreManagerInterface $storeManager */
$storeManager = $this->objectManager->get(StoreManagerInterface::class);
$storeManager->setCurrentStore(1);

$testStore = $storeManager->getStore('test');

$productFilter = [
UrlRewrite::ENTITY_TYPE => 'product',
];

$product->setData('save_rewrites_history', false);
$product->setUrlKey('new-url');
$product->save();

$expected = [
[
'request_path' => "new-url.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => 1,
],
[
'request_path' => "product-1.html",
'target_path' => "catalog/product/view/id/" . $product->getId(),
'is_auto_generated' => 1,
'redirect_type' => 0,
'store_id' => $testStore->getId(),
],
];

$actual = $this->getActualResults($productFilter);
foreach ($expected as $row) {
$this->assertContains($row, $actual);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Setup\CategorySetup;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;

\Magento\TestFramework\Helper\Bootstrap::getInstance()
->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE);

require __DIR__ . '/../../Store/_files/store.php';

/** @var $installer CategorySetup */
$objectManager = Bootstrap::getObjectManager();
$installer = $objectManager->create(CategorySetup::class);
$storeManager = $objectManager->get(StoreManagerInterface::class);
$storeManager->setCurrentStore(0);

/** @var $product \Magento\Catalog\Model\Product */
$product = $objectManager->create(\Magento\Catalog\Model\Product::class);
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
->setAttributeSetId($installer->getAttributeSetId('catalog_product', 'Default'))
->setStoreId(0)
->setWebsiteIds([1])
->setName('Product1')
->setSku('product1')
->setPrice(10)
->setWeight(18)
->setStockData(['use_config_manage_stock' => 0])
->setUrlKey('product-1')
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);

/** @var ProductRepositoryInterface $productRepository */
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
$productRepository->save($product);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\TestFramework\Helper\Bootstrap;

$objectManager = Bootstrap::getObjectManager();

require __DIR__ . '/../../Store/_files/store_rollback.php';
require __DIR__ . '/../../Store/_files/second_store_rollback.php';
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="urn:magento:framework:View/Layout/etc/elements.xsd"/>
<xs:include schemaLocation="urn:magento:framework:View/Layout/etc/head.xsd"/>
<xs:include schemaLocation="urn:magento:framework:View/Layout/etc/body.xsd"/>

<xs:complexType name="pageLayoutType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="referenceContainer" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="container" type="containerType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="update" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="move" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="head" type="headType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="body" type="bodyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

Expand Down

0 comments on commit ec47891

Please sign in to comment.