Skip to content

Commit e411c1d

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - magento-engcom/magento2ce#1146: #12231: [GitHub] New Cart Rule : Small styles issue because of styles… (by @serhii-balko) - magento-engcom/magento2ce#1245: Misleading feedback when sending tracking information email (by @nmalevanec) - magento-engcom/magento2ce#1247: #7213: [GitHub] WEBAPI: PHP session is always started (by @serhii-balko) - magento-engcom/magento2ce#1045: 7768: Adding 'is_saleable' attribute to sort of product collection causes exception and adding 'is_salable' has no effect. (by @nmalevanec) - #13310: Add the domReady! statement (by @arnoudhgz) Fixed GitHub Issues: - #12231: New Cart Rule : Small styles issue because of styles-old.css (reported by @Triloworld) has been fixed in magento-engcom/magento2ce#1146 by @serhii-balko in 2.2-develop branch Related commits: 1. cdff30d - #5697: [2.1.0] Misleading feedback when sending tracking information email (reported by @peec) has been fixed in magento-engcom/magento2ce#1245 by @nmalevanec in 2.2-develop branch Related commits: 1. f03e614 - #7213: WEBAPI: PHP session is always started 2.1.2 (reported by @boldhedgehog) has been fixed in magento-engcom/magento2ce#1247 by @serhii-balko in 2.2-develop branch Related commits: 1. a282973 2. 6a58610 - #7768: Adding 'is_saleable' attribute to sort of product collection causes exception and adding 'is_salable' has no effect (reported by @dnadle) has been fixed in magento-engcom/magento2ce#1045 by @nmalevanec in 2.2-develop branch Related commits: 1. 6267566
2 parents d0b82cc + cafc476 commit e411c1d

File tree

11 files changed

+127
-7
lines changed

11 files changed

+127
-7
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@ public function addAttributeToSort($attribute, $dir = self::SORT_ORDER_ASC)
16701670

16711671
return $this;
16721672
} elseif ($attribute == 'is_saleable') {
1673-
$this->getSelect()->order("is_saleable " . $dir);
1673+
$this->getSelect()->order("is_salable " . $dir);
16741674
return $this;
16751675
}
16761676

app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require([
22
'jquery',
3-
'Magento_Customer/js/customer-data'
3+
'Magento_Customer/js/customer-data',
4+
'domReady!'
45
], function ($, customerData) {
56
'use strict';
67

app/code/Magento/Customer/etc/webapi_rest/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<arguments>
1414
<argument name="userContexts" xsi:type="array">
1515
<item name="customerSessionUserContext" xsi:type="array">
16-
<item name="type" xsi:type="object">Magento\Customer\Model\Authorization\CustomerSessionUserContext</item>
16+
<item name="type" xsi:type="object">Magento\Customer\Model\Authorization\CustomerSessionUserContext\Proxy</item>
1717
<item name="sortOrder" xsi:type="string">20</item>
1818
</item>
1919
</argument>

app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_edit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
-->
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
9+
<update handle="styles" />
910
<body>
1011
<referenceContainer name="content">
1112
<uiComponent name="sales_rule_form"/>

app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Email.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public function execute()
5757
$this->_objectManager->create(\Magento\Shipping\Model\ShipmentNotifier::class)
5858
->notify($shipment);
5959
$shipment->save();
60-
$this->messageManager->addSuccess(__('You sent the shipment.'));
60+
$this->messageManager->addSuccess(
61+
__('An email confirming the order is underway has been sent to the customer.')
62+
);
6163
}
6264
} catch (\Magento\Framework\Exception\LocalizedException $e) {
6365
$this->messageManager->addError($e->getMessage());

app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/EmailTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public function testEmail()
207207
->will($this->returnValue(true));
208208
$this->messageManager->expects($this->once())
209209
->method('addSuccess')
210-
->with('You sent the shipment.');
210+
->with('An email confirming the order is underway has been sent to the customer.');
211211
$path = '*/*/view';
212212
$arguments = ['shipment_id' => $shipmentId];
213213
$this->prepareRedirect($path, $arguments, 0);

app/code/Magento/Shipping/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Shipments,Shipments
2828
"Cannot add tracking number.","Cannot add tracking number."
2929
"You created the shipping label.","You created the shipping label."
3030
"An error occurred while creating shipping label.","An error occurred while creating shipping label."
31-
"You sent the shipment.","You sent the shipment."
31+
"An email confirming the order is underway has been sent to the customer.","An email confirming the order is underway has been sent to the customer."
3232
"Cannot send shipment information.","Cannot send shipment information."
3333
"There are no shipping labels related to selected orders.","There are no shipping labels related to selected orders."
3434
"New Shipment","New Shipment"

app/code/Magento/User/etc/webapi_rest/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<arguments>
1111
<argument name="userContexts" xsi:type="array">
1212
<item name="adminSessionUserContext" xsi:type="array">
13-
<item name="type" xsi:type="object">Magento\User\Model\Authorization\AdminSessionUserContext</item>
13+
<item name="type" xsi:type="object">Magento\User\Model\Authorization\AdminSessionUserContext\Proxy</item>
1414
<item name="sortOrder" xsi:type="string">30</item>
1515
</item>
1616
</argument>

dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,40 @@ public function testGetProductsWithTierPrice()
124124
$this->assertEquals(50, $tierPrices[2]->getExtensionAttributes()->getPercentageValue());
125125
$this->assertEquals(5, $tierPrices[2]->getValue());
126126
}
127+
128+
/**
129+
* Test addAttributeToSort() with attribute 'is_saleable' works properly on frontend.
130+
*
131+
* @dataProvider addAttributeToSortDataProvider
132+
* @magentoDataFixture Magento/Catalog/_files/multiple_products_with_non_saleable_product.php
133+
* @magentoConfigFixture current_store cataloginventory/options/show_out_of_stock 1
134+
* @magentoAppIsolation enabled
135+
* @magentoAppArea frontend
136+
*/
137+
public function testAddAttributeToSort(string $productSku, string $order)
138+
{
139+
/** @var Collection $productCollection */
140+
$this->collection->addAttributeToSort('is_saleable', $order);
141+
self::assertEquals(2, $this->collection->count());
142+
self::assertSame($productSku, $this->collection->getFirstItem()->getSku());
143+
}
144+
145+
/**
146+
* Provide test data for testAddAttributeToSort().
147+
*
148+
* @return array
149+
*/
150+
public function addAttributeToSortDataProvider()
151+
{
152+
return [
153+
[
154+
'product_sku' => 'simple_saleable',
155+
'order' => Collection::SORT_ORDER_DESC,
156+
],
157+
[
158+
'product_sku' => 'simple_not_saleable',
159+
'order' => Collection::SORT_ORDER_ASC,
160+
]
161+
];
162+
}
127163
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/** @var $product \Magento\Catalog\Model\Product */
8+
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
9+
$product->isObjectNew(true);
10+
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
11+
->setAttributeSetId(4)
12+
->setName('Simple Product')
13+
->setSku('simple_saleable')
14+
->setTaxClassId('none')
15+
->setDescription('description')
16+
->setShortDescription('short description')
17+
->setOptionsContainer('container1')
18+
->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_IN_CART)
19+
->setPrice(10)
20+
->setWeight(1)
21+
->setMetaTitle('meta title')
22+
->setMetaKeyword('meta keyword')
23+
->setMetaDescription('meta description')
24+
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
25+
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
26+
->setWebsiteIds([1])
27+
->setCateroryIds([])
28+
->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1])
29+
->save();
30+
31+
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
32+
$product->isObjectNew(true);
33+
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)
34+
->setAttributeSetId(4)
35+
->setName('Simple Product2')
36+
->setSku('simple_not_saleable')
37+
->setTaxClassId('none')
38+
->setDescription('description')
39+
->setShortDescription('short description')
40+
->setOptionsContainer('container1')
41+
->setMsrpDisplayActualPriceType(\Magento\Msrp\Model\Product\Attribute\Source\Type::TYPE_ON_GESTURE)
42+
->setPrice(20)
43+
->setWeight(1)
44+
->setMetaTitle('meta title')
45+
->setMetaKeyword('meta keyword')
46+
->setMetaDescription('meta description')
47+
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG)
48+
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
49+
->setWebsiteIds([1])
50+
->setCateroryIds([])
51+
->setStockData(['use_config_manage_stock' => 1, 'qty' => 50, 'is_qty_decimal' => 0, 'is_in_stock' => 0])
52+
->save();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
8+
9+
/** @var \Magento\Framework\Registry $registry */
10+
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);
11+
12+
$registry->unregister('isSecureArea');
13+
$registry->register('isSecureArea', true);
14+
15+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
16+
$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
17+
18+
foreach (['simple_saleable', 'simple_not_saleable'] as $sku) {
19+
try {
20+
$product = $productRepository->get($sku, false, null, true);
21+
$productRepository->delete($product);
22+
} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
23+
//Product already removed
24+
}
25+
}
26+
27+
$registry->unregister('isSecureArea');
28+
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)