Skip to content

Commit 508832b

Browse files
committed
Merge branch '2.3-develop' into 2.3-develop-19099-issue
2 parents fea9aaf + 6481cec commit 508832b

File tree

41 files changed

+752
-301
lines changed

Some content is hidden

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

41 files changed

+752
-301
lines changed

app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MAGETWO-63898"/>
1919
<group value="analytics"/>
20+
<skip>
21+
<issueId value="MAGETWO-96223"/>
22+
</skip>
2023
</annotations>
2124

2225
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>

app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,7 @@ public function __construct(
122122
*/
123123
public function getAddToWishlistParams($product)
124124
{
125-
$continueUrl = $this->urlEncoder->encode($this->getUrl('customer/account'));
126-
$urlParamName = Action::PARAM_NAME_URL_ENCODED;
127-
128-
$continueUrlParams = [$urlParamName => $continueUrl];
129-
130-
return $this->_wishlistHelper->getAddParams($product, $continueUrlParams);
125+
return $this->_wishlistHelper->getAddParams($product);
131126
}
132127

133128
/**

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Model;
77

8+
use \Magento\Framework\TranslateInterface;
9+
810
/**
911
* Catalog Custom Category design Model
1012
*
@@ -31,14 +33,20 @@ class Design extends \Magento\Framework\Model\AbstractModel
3133
*/
3234
protected $_localeDate;
3335

36+
/**
37+
* @var TranslateInterface
38+
*/
39+
private $translator;
40+
3441
/**
3542
* @param \Magento\Framework\Model\Context $context
3643
* @param \Magento\Framework\Registry $registry
3744
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
3845
* @param \Magento\Framework\View\DesignInterface $design
39-
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
40-
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
46+
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
47+
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
4148
* @param array $data
49+
* @param TranslateInterface|null $translator
4250
*/
4351
public function __construct(
4452
\Magento\Framework\Model\Context $context,
@@ -47,10 +55,13 @@ public function __construct(
4755
\Magento\Framework\View\DesignInterface $design,
4856
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
4957
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
50-
array $data = []
58+
array $data = [],
59+
TranslateInterface $translator = null
5160
) {
5261
$this->_localeDate = $localeDate;
5362
$this->_design = $design;
63+
$this->translator = $translator ?:
64+
\Magento\Framework\App\ObjectManager::getInstance()->get(TranslateInterface::class);
5465
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
5566
}
5667

@@ -63,6 +74,7 @@ public function __construct(
6374
public function applyCustomDesign($design)
6475
{
6576
$this->_design->setDesignTheme($design);
77+
$this->translator->loadData(null, true);
6678
return $this;
6779
}
6880

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogGraphQl\Model\Resolver\Product;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\GraphQl\Config\Element\Field;
13+
use Magento\Framework\GraphQl\Query\ResolverInterface;
14+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
16+
/**
17+
* Returns product's image data
18+
*/
19+
class ProductImage implements ResolverInterface
20+
{
21+
/**
22+
* @inheritdoc
23+
*/
24+
public function resolve(
25+
Field $field,
26+
$context,
27+
ResolveInfo $info,
28+
array $value = null,
29+
array $args = null
30+
): array {
31+
if (!isset($value['model'])) {
32+
throw new LocalizedException(__('"model" value should be specified'));
33+
}
34+
35+
/** @var Product $product */
36+
$product = $value['model'];
37+
$imageType = $field->getName();
38+
39+
return [
40+
'model' => $product,
41+
'image_type' => $imageType,
42+
];
43+
}
44+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogGraphQl\Model\Resolver\Product\ProductImage;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Catalog\Model\ResourceModel\Product as ProductResourceModel;
12+
use Magento\Framework\Exception\LocalizedException;
13+
use Magento\Framework\GraphQl\Config\Element\Field;
14+
use Magento\Framework\GraphQl\Query\ResolverInterface;
15+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
16+
use Magento\Store\Model\StoreManagerInterface;
17+
18+
/**
19+
* Returns product's image label
20+
*/
21+
class Label implements ResolverInterface
22+
{
23+
/**
24+
* @var ProductResourceModel
25+
*/
26+
private $productResource;
27+
28+
/**
29+
* @var StoreManagerInterface
30+
*/
31+
private $storeManager;
32+
33+
/**
34+
* @param ProductResourceModel $productResource
35+
* @param StoreManagerInterface $storeManager
36+
*/
37+
public function __construct(
38+
ProductResourceModel $productResource,
39+
StoreManagerInterface $storeManager
40+
) {
41+
$this->productResource = $productResource;
42+
$this->storeManager = $storeManager;
43+
}
44+
45+
/**
46+
* @inheritdoc
47+
*/
48+
public function resolve(
49+
Field $field,
50+
$context,
51+
ResolveInfo $info,
52+
array $value = null,
53+
array $args = null
54+
) {
55+
if (!isset($value['image_type'])) {
56+
throw new LocalizedException(__('"image_type" value should be specified'));
57+
}
58+
59+
if (!isset($value['model'])) {
60+
throw new LocalizedException(__('"model" value should be specified'));
61+
}
62+
63+
/** @var Product $product */
64+
$product = $value['model'];
65+
$imageType = $value['image_type'];
66+
$imagePath = $product->getData($imageType);
67+
$productId = (int)$product->getEntityId();
68+
69+
// null if image is not set
70+
if (null === $imagePath) {
71+
return $this->getAttributeValue($productId, 'name');
72+
}
73+
74+
$imageLabel = $this->getAttributeValue($productId, $imageType . '_label');
75+
if (null === $imageLabel) {
76+
$imageLabel = $this->getAttributeValue($productId, 'name');
77+
}
78+
79+
return $imageLabel;
80+
}
81+
82+
/**
83+
* Get attribute value
84+
*
85+
* @param int $productId
86+
* @param string $attributeCode
87+
* @return null|string Null if attribute value is not exists
88+
*/
89+
private function getAttributeValue(int $productId, string $attributeCode): ?string
90+
{
91+
$storeId = $this->storeManager->getStore()->getId();
92+
93+
$value = $this->productResource->getAttributeRawValue($productId, $attributeCode, $storeId);
94+
return is_array($value) && empty($value) ? null : $value;
95+
}
96+
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Image.php renamed to app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductImage/Url.php

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\CatalogGraphQl\Model\Resolver\Product;
8+
namespace Magento\CatalogGraphQl\Model\Resolver\Product\ProductImage;
99

1010
use Magento\Catalog\Model\Product;
1111
use Magento\Catalog\Model\Product\ImageFactory;
@@ -15,13 +15,11 @@
1515
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1616

1717
/**
18-
* Returns product's image. If the image is not set, returns a placeholder
18+
* Returns product's image url
1919
*/
20-
class Image implements ResolverInterface
20+
class Url implements ResolverInterface
2121
{
2222
/**
23-
* Product image factory
24-
*
2523
* @var ImageFactory
2624
*/
2725
private $productImageFactory;
@@ -44,23 +42,36 @@ public function resolve(
4442
ResolveInfo $info,
4543
array $value = null,
4644
array $args = null
47-
): array {
45+
) {
46+
if (!isset($value['image_type'])) {
47+
throw new LocalizedException(__('"image_type" value should be specified'));
48+
}
49+
4850
if (!isset($value['model'])) {
4951
throw new LocalizedException(__('"model" value should be specified'));
5052
}
53+
5154
/** @var Product $product */
5255
$product = $value['model'];
53-
$imageType = $field->getName();
54-
$path = $product->getData($imageType);
56+
$imagePath = $product->getData($value['image_type']);
5557

58+
$imageUrl = $this->getImageUrl($value['image_type'], $imagePath);
59+
return $imageUrl;
60+
}
61+
62+
/**
63+
* Get image url
64+
*
65+
* @param string $imageType
66+
* @param string|null $imagePath Null if image is not set
67+
* @return string
68+
*/
69+
private function getImageUrl(string $imageType, ?string $imagePath): string
70+
{
5671
$image = $this->productImageFactory->create();
5772
$image->setDestinationSubdir($imageType)
58-
->setBaseFile($path);
73+
->setBaseFile($imagePath);
5974
$imageUrl = $image->getUrl();
60-
61-
return [
62-
'url' => $imageUrl,
63-
'path' => $path,
64-
];
75+
return $imageUrl;
6576
}
6677
}

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,13 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
257257
meta_title: String @doc(description: "A string that is displayed in the title bar and tab of the browser and in search results lists")
258258
meta_keyword: String @doc(description: "A comma-separated list of keywords that are visible only to search engines")
259259
meta_description: String @doc(description: "A brief overview of the product for search results listings, maximum 255 characters")
260-
image: String @doc(description: "The relative path to the main image on the product page")
261-
small_image: ProductImage @doc(description: "The relative path to the small image, which is used on catalog pages") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Image")
262-
thumbnail: String @doc(description: "The relative path to the product's thumbnail image")
260+
image: ProductImage @doc(description: "The relative path to the main image on the product page") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
261+
small_image: ProductImage @doc(description: "The relative path to the small image, which is used on catalog pages") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
262+
thumbnail: ProductImage @doc(description: "The relative path to the product's thumbnail image") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage")
263263
new_from_date: String @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
264264
new_to_date: String @doc(description: "The end date for new product listings") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\NewFromTo")
265265
tier_price: Float @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached")
266266
options_container: String @doc(description: "If the product has multiple options, determines where they appear on the product page")
267-
image_label: String @doc(description: "The label assigned to a product image")
268-
small_image_label: String @doc(description: "The label assigned to a product's small image")
269-
thumbnail_label: String @doc(description: "The label assigned to a product's thumbnail image")
270267
created_at: String @doc(description: "Timestamp indicating when the product was created")
271268
updated_at: String @doc(description: "Timestamp indicating when the product was updated")
272269
country_of_manufacture: String @doc(description: "The product's country of origin")
@@ -352,9 +349,9 @@ type CustomizableFileValue @doc(description: "CustomizableFileValue defines the
352349
image_size_y: Int @doc(description: "The maximum height of an image")
353350
}
354351

355-
type ProductImage @doc(description: "Product image information. Contains image relative path and URL") {
356-
url: String
357-
path: String
352+
type ProductImage @doc(description: "Product image information. Contains image relative path, URL and label") {
353+
url: String @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage\\Url")
354+
label: String @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductImage\\Label")
358355
}
359356

360357
interface CustomizableOptionInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\CustomizableOptionTypeResolver") @doc(description: "The CustomizableOptionInterface contains basic information about a customizable option. It can be implemented by several types of configurable options.") {

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<element name="shippingMethodRow" type="text" selector=".form.methods-shipping table tbody tr"/>
1515
<element name="checkShippingMethodByName" type="radio" selector="//div[@id='checkout-shipping-method-load']//td[contains(., '{{var1}}')]/..//input" parameterized="true"/>
1616
<element name="shippingMethodRowByName" type="text" selector="//div[@id='checkout-shipping-method-load']//td[contains(., '{{var1}}')]/.." parameterized="true"/>
17-
<element name="shipHereButton" type="button" selector="//button[contains(@class, 'action-select-shipping-item')]/parent::div/following-sibling::div/button[contains(@class, 'action-select-shipping-item')]"/>
17+
<element name="shipHereButton" type="button" selector="//div/following-sibling::div/button[contains(@class, 'action-select-shipping-item')]"/>
1818
<element name="shippingMethodLoader" type="button" selector="//div[contains(@class, 'checkout-shipping-method')]/following-sibling::div[contains(@class, 'loading-mask')]"/>
1919
</section>
2020
</sections>

app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
click="editAddress">
3636
<span translate="'Edit'"></span>
3737
</button>
38+
<!-- ko if: (!isSelected()) -->
3839
<button type="button" click="selectAddress" class="action action-select-shipping-item">
3940
<span translate="'Ship Here'"></span>
4041
</button>
42+
<!-- /ko -->
4143
</div>

app/code/Magento/Customer/etc/db_schema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@
506506
<column xsi:type="int" name="customer_id" padding="11" unsigned="false" nullable="true" identity="false"
507507
comment="Customer Id"/>
508508
<column xsi:type="varchar" name="session_id" nullable="true" length="64" comment="Session ID"/>
509-
<column xsi:type="timestamp" name="last_visit_at" on_update="true" nullable="true" default="CURRENT_TIMESTAMP"
509+
<column xsi:type="timestamp" name="last_visit_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP"
510510
comment="Last Visit Time"/>
511511
<constraint xsi:type="primary" referenceId="PRIMARY">
512512
<column name="visitor_id"/>

app/code/Magento/Customer/view/frontend/web/js/password-strength-indicator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ define([
8383
} else {
8484
isValid = $.validator.validateSingleElement(this.options.cache.input);
8585
zxcvbnScore = zxcvbn(password).score;
86-
displayScore = isValid ? zxcvbnScore : 1;
86+
displayScore = isValid && zxcvbnScore > 0 ? zxcvbnScore : 1;
8787
}
8888
}
8989

app/code/Magento/CustomerImportExport/Model/Import/Address.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ class Address extends AbstractCustomer
101101
*/
102102
protected $_entityTable;
103103

104+
/**
105+
* Region collection instance
106+
*
107+
* @var \Magento\Directory\Model\ResourceModel\Region\Collection
108+
*/
109+
private $_regionCollection;
110+
104111
/**
105112
* Countries and regions
106113
*
@@ -781,7 +788,7 @@ public static function getDefaultAddressAttributeMapping()
781788
}
782789

783790
/**
784-
* check if address for import is empty (for customer composite mode)
791+
* Check if address for import is empty (for customer composite mode)
785792
*
786793
* @param array $rowData
787794
* @return array
@@ -940,7 +947,7 @@ protected function _checkRowDuplicate($customerId, $addressId)
940947
}
941948

942949
/**
943-
* set customer attributes
950+
* Set customer attributes
944951
*
945952
* @param array $customerAttributes
946953
* @return $this

0 commit comments

Comments
 (0)