Skip to content

Commit 820f76e

Browse files
authored
Merge branch '2.4-develop' into compr248beta1
2 parents c6273db + de4dfb8 commit 820f76e

File tree

18 files changed

+325
-62
lines changed

18 files changed

+325
-62
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ***********************************************************************
17+
*/
18+
-->
19+
20+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
22+
<actionGroup name="AdminFillCatalogProductsListWidgetSkuActionGroup">
23+
<annotations>
24+
<description>Fill catalog products list widget sku.</description>
25+
</annotations>
26+
27+
<arguments>
28+
<argument name="sku" type="string" defaultValue=""/>
29+
</arguments>
30+
31+
<waitForElementVisible selector="{{WidgetSection.AddParam}}" stepKey="waitForAddParamElement"/>
32+
<click selector="{{WidgetSection.AddParam}}" stepKey="clickOnAddParamElement"/>
33+
<waitForElementVisible selector="{{WidgetSection.ConditionsDropdown}}"
34+
stepKey="waitForConditionsDropdownVisible"/>
35+
<selectOption selector="{{WidgetSection.ConditionsDropdown}}" userInput="SKU" stepKey="selectSkuAsCondition"/>
36+
<waitForElementVisible selector="{{WidgetSection.RuleParam}}" stepKey="waitForRuleParamElementVisible"/>
37+
<click selector="{{WidgetSection.RuleParam}}" stepKey="clickToAddRuleParam"/>
38+
<fillField selector=".rule-param-edit input" userInput="{{sku}}" stepKey="fillSkuField"/>
39+
<click selector="{{AdminNewWidgetSection.applyParameter}}" stepKey="clickApplyButton"/>
40+
</actionGroup>
41+
</actionGroups>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ***********************************************************************
17+
*/
18+
-->
19+
20+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
22+
<test name="StorefrontBundleAddToCartFromWidget">
23+
<annotations>
24+
<features value="Bundle"/>
25+
<stories value="Bundle product details page"/>
26+
<title value="Customer should be able to add a bundle product to the cart from widget"/>
27+
<description value="Customer should be able to add a bundle product to the cart from widget"/>
28+
<severity value="CRITICAL"/>
29+
<testCaseId value="AC-10867"/>
30+
<useCaseId value="ACP2E-2615"/>
31+
<group value="WYSIWYGDisabled"/>
32+
<group value="Bundle"/>
33+
</annotations>
34+
<before>
35+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
36+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
37+
</before>
38+
<after>
39+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteBundleProductBySku">
40+
<argument name="sku" value="{{BundleProductWithSlashSku.sku}}"/>
41+
</actionGroup>
42+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
44+
</after>
45+
46+
<!-- Start creating a bundle product -->
47+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductList"/>
48+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct">
49+
<argument name="product" value="BundleProduct"/>
50+
</actionGroup>
51+
<actionGroup ref="FillProductNameAndSkuInProductFormActionGroup" stepKey="fillNameAndSku">
52+
<argument name="product" value="BundleProductWithSlashSku"/>
53+
</actionGroup>
54+
55+
<!-- Add Option One, a "Drop-down" type option -->
56+
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOptionWithOneProduct">
57+
<argument name="x" value="0"/>
58+
<argument name="n" value="1"/>
59+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
60+
<argument name="prodTwoSku" value=""/>
61+
<argument name="optionTitle" value="Option One"/>
62+
<argument name="inputType" value="select"/>
63+
</actionGroup>
64+
65+
<!-- Save product, edit Homepage CMS page and add products widget -->
66+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
67+
<amOnPage url="{{AdminCmsPageEditPage.url(CmsHomePageContent.page_id)}}" stepKey="navigateToEditCmsHomePage"/>
68+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" />
69+
<actionGroup ref="AdminInsertWidgetToCmsPageContentActionGroup" stepKey="insertWidgetToCmsPageContentActionGroup">
70+
<argument name="widgetType" value="Catalog Products List"/>
71+
</actionGroup>
72+
<actionGroup ref="AdminFillCatalogProductsListWidgetSkuActionGroup" stepKey="selectProductForListing">
73+
<argument name="sku" value="{{BundleProductWithSlashSku.sku}}"/>
74+
</actionGroup>
75+
<actionGroup ref="AdminClickInsertWidgetActionGroup" stepKey="clickInsertWidgetButton2"/>
76+
<actionGroup ref="SaveCmsPageActionGroup" stepKey="clickSaveButton"/>
77+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the page." stepKey="seeSuccess"/>
78+
79+
<!-- Go to storefront homepage and add to cart -->
80+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomePage"/>
81+
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverProduct"/>
82+
<actionGroup ref="StorefrontClickAddToCartButtonActionGroup" stepKey="addToCart"/>
83+
<waitForPageLoad stepKey="waitForProductAdded"/>
84+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="seeSuccessMessage"/>
85+
</test>
86+
</tests>

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Catalog\Model\ResourceModel\Product\Collection;
1616
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
1717
use Magento\Catalog\Pricing\Price\FinalPrice;
18+
use Magento\Catalog\ViewModel\Product\OptionsData;
1819
use Magento\CatalogWidget\Model\Rule;
1920
use Magento\Framework\App\ActionInterface;
2021
use Magento\Framework\App\Http\Context as HttpContext;
@@ -130,6 +131,11 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
130131
*/
131132
private $categoryRepository;
132133

134+
/**
135+
* @var OptionsData
136+
*/
137+
private OptionsData $optionsData;
138+
133139
/**
134140
* @param Context $context
135141
* @param CollectionFactory $productCollectionFactory
@@ -143,6 +149,7 @@ class ProductsList extends AbstractProduct implements BlockInterface, IdentityIn
143149
* @param LayoutFactory|null $layoutFactory
144150
* @param EncoderInterface|null $urlEncoder
145151
* @param CategoryRepositoryInterface|null $categoryRepository
152+
* @param OptionsData|null $optionsData
146153
*
147154
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
148155
*/
@@ -158,7 +165,8 @@ public function __construct(
158165
Json $json = null,
159166
LayoutFactory $layoutFactory = null,
160167
EncoderInterface $urlEncoder = null,
161-
CategoryRepositoryInterface $categoryRepository = null
168+
CategoryRepositoryInterface $categoryRepository = null,
169+
OptionsData $optionsData = null
162170
) {
163171
$this->productCollectionFactory = $productCollectionFactory;
164172
$this->catalogProductVisibility = $catalogProductVisibility;
@@ -171,6 +179,7 @@ public function __construct(
171179
$this->urlEncoder = $urlEncoder ?: ObjectManager::getInstance()->get(EncoderInterface::class);
172180
$this->categoryRepository = $categoryRepository ?? ObjectManager::getInstance()
173181
->get(CategoryRepositoryInterface::class);
182+
$this->optionsData = $optionsData ?: ObjectManager::getInstance()->get(OptionsData::class);
174183
parent::__construct(
175184
$context,
176185
$data
@@ -306,6 +315,17 @@ public function getAddToCartPostParams(Product $product)
306315
];
307316
}
308317

318+
/**
319+
* Return product options
320+
*
321+
* @param Product $product
322+
* @return array
323+
*/
324+
public function getOptionsData(Product $product): array
325+
{
326+
return $this->optionsData->getOptionsData($product);
327+
}
328+
309329
/**
310330
* @inheritdoc
311331
*/

app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ use Magento\Wishlist\Helper\Data;
7474
<?php if ($_item->isSaleable()): ?>
7575
<?php $postParams = $block->getAddToCartPostParams($_item); ?>
7676
<form data-role="tocart-form" data-product-sku="<?= $escaper->escapeHtml($_item->getSku()) ?>" action="<?= $escaper->escapeUrl($postParams['action']) ?>" method="post">
77+
<?php $options = $block->getOptionsData($_item); ?>
78+
<?php foreach ($options as $optionItem): ?>
79+
<input type="hidden"
80+
name="<?= $escaper->escapeHtml($optionItem['name']) ?>"
81+
value="<?= $escaper->escapeHtml($optionItem['value']) ?>">
82+
<?php endforeach; ?>
7783
<input type="hidden" name="product" value="<?= $escaper->escapeHtmlAttr($postParams['data']['product']) ?>">
7884
<input type="hidden" name="<?= /* @noEscape */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @noEscape */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>">
7985
<?= $block->getBlockHtml('formkey') ?>
@@ -107,13 +113,13 @@ use Magento\Wishlist\Helper\Data;
107113
<div class="actions-secondary" data-role="add-to-links">
108114
<?php if ($this->helper(Data::class)->isAllow() && $showWishlist): ?>
109115
<a href="#"
110-
data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>">
116+
data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>' class="action towishlist" data-action="add-to-wishlist" title="<?= $escaper->escapeHtmlAttr(__('Add to Wish List')) ?>">
111117
<span><?= $escaper->escapeHtml(__('Add to Wish List')) ?></span>
112118
</a>
113119
<?php endif; ?>
114120
<?php if ($block->getAddToCompareUrl() && $showCompare): ?>
115121
<?php $compareHelper = $this->helper(Compare::class);?>
116-
<a href="#" class="action tocompare" data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $block->escapeHtmlAttr(__('Add to Compare')) ?>">
122+
<a href="#" class="action tocompare" data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>' title="<?= $escaper->escapeHtmlAttr(__('Add to Compare')) ?>">
117123
<span><?= $escaper->escapeHtml(__('Add to Compare')) ?></span>
118124
</a>
119125
<?php endif; ?>

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class Dob extends AbstractWidget
2323
/**
2424
* Constants for borders of date-type customer attributes
2525
*/
26-
const MIN_DATE_RANGE_KEY = 'date_range_min';
26+
public const MIN_DATE_RANGE_KEY = 'date_range_min';
2727

28-
const MAX_DATE_RANGE_KEY = 'date_range_max';
28+
public const MAX_DATE_RANGE_KEY = 'date_range_max';
2929

3030
/**
3131
* @var array
@@ -303,6 +303,7 @@ public function getHtmlExtraParams()
303303
public function getDateFormat()
304304
{
305305
$dateFormat = $this->setTwoDayPlaces($this->_localeDate->getDateFormatWithLongYear());
306+
$dateFormat = $this->setTwoMonthPlaces($dateFormat);
306307
/** Escape RTL characters which are present in some locales and corrupt formatting */
307308
$escapedDateFormat = preg_replace('/[^MmDdYy\/\.\-]/', '', $dateFormat);
308309

@@ -440,4 +441,19 @@ private function setTwoDayPlaces(string $format): string
440441
$format
441442
);
442443
}
444+
445+
/**
446+
* Set 2 places for month value in format string
447+
*
448+
* @param string $format
449+
* @return string
450+
*/
451+
private function setTwoMonthPlaces(string $format): string
452+
{
453+
return preg_replace(
454+
'/(?<!M)M(?!M)/',
455+
'MM',
456+
$format
457+
);
458+
}
443459
}

app/code/Magento/Customer/Test/Mftf/Data/DateData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="EN_US_DATE">
1212
<data key="short">9/21/93</data>
13-
<data key="short4DigitYear">9/21/1993</data>
13+
<data key="short4DigitYear">09/21/1993</data>
1414
<data key="medium">Sep 21, 1993</data>
1515
<data key="long">September 21, 1993</data>
1616
<data key="full">Tuesday, September 21, 1993</data>

app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DobTest extends TestCase
5252
private const YEAR = '2014';
5353

5454
// Value of date('Y', strtotime(self::DATE))
55-
private const DATE_FORMAT = 'M/dd/y';
55+
private const DATE_FORMAT = 'MM/dd/y';
5656

5757
/** Constants used by Dob::setDateInput($code, $html) */
5858
private const DAY_HTML =

app/code/Magento/Sales/Api/Data/ShipmentInterface.php

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
* Shipment interface.
1010
*
1111
* A shipment is a delivery package that contains products. A shipment document accompanies the shipment. This
12-
* document lists the products and their quantities in the delivery package.
12+
* document lists the products and their quantities in the delivery package. This interface creates shipment
13+
* record without items quantity (total_qty) validation. To validate total shipped quantity for each item
14+
* in the order you must use newer `POST /V1/order/:orderId/ship` endpoint.
1315
* @api
1416
* @since 100.0.2
1517
*/
@@ -21,75 +23,75 @@ interface ShipmentInterface extends \Magento\Framework\Api\ExtensibleDataInterfa
2123
/*
2224
* Entity ID.
2325
*/
24-
const ENTITY_ID = 'entity_id';
26+
public const ENTITY_ID = 'entity_id';
2527
/*
2628
* Store ID.
2729
*/
28-
const STORE_ID = 'store_id';
30+
public const STORE_ID = 'store_id';
2931
/*
3032
* Total weight.
3133
*/
32-
const TOTAL_WEIGHT = 'total_weight';
34+
public const TOTAL_WEIGHT = 'total_weight';
3335
/*
34-
* Total quantity.
36+
* Total quantity. Can be greater than ordered quantity (not validated).
3537
*/
36-
const TOTAL_QTY = 'total_qty';
38+
public const TOTAL_QTY = 'total_qty';
3739
/*
3840
* Email sent flag.
3941
*/
40-
const EMAIL_SENT = 'email_sent';
42+
public const EMAIL_SENT = 'email_sent';
4143
/*
4244
* Order ID.
4345
*/
44-
const ORDER_ID = 'order_id';
46+
public const ORDER_ID = 'order_id';
4547
/*
4648
* Customer ID.
4749
*/
48-
const CUSTOMER_ID = 'customer_id';
50+
public const CUSTOMER_ID = 'customer_id';
4951
/*
5052
* Shipping address ID.
5153
*/
52-
const SHIPPING_ADDRESS_ID = 'shipping_address_id';
54+
public const SHIPPING_ADDRESS_ID = 'shipping_address_id';
5355
/*
5456
* Billing address ID.
5557
*/
56-
const BILLING_ADDRESS_ID = 'billing_address_id';
58+
public const BILLING_ADDRESS_ID = 'billing_address_id';
5759
/*
5860
* Shipment status.
5961
*/
60-
const SHIPMENT_STATUS = 'shipment_status';
62+
public const SHIPMENT_STATUS = 'shipment_status';
6163
/*
6264
* Increment ID.
6365
*/
64-
const INCREMENT_ID = 'increment_id';
66+
public const INCREMENT_ID = 'increment_id';
6567
/*
6668
* Created-at timestamp.
6769
*/
68-
const CREATED_AT = 'created_at';
70+
public const CREATED_AT = 'created_at';
6971
/*
7072
* Updated-at timestamp.
7173
*/
72-
const UPDATED_AT = 'updated_at';
74+
public const UPDATED_AT = 'updated_at';
7375
/*
7476
* Packages.
7577
*/
76-
const PACKAGES = 'packages';
78+
public const PACKAGES = 'packages';
7779
/*
7880
* Shipping label.
7981
*/
80-
const SHIPPING_LABEL = 'shipping_label';
82+
public const SHIPPING_LABEL = 'shipping_label';
8183
/*
8284
* Items.
8385
*/
84-
const ITEMS = 'items';
86+
public const ITEMS = 'items';
8587
/*
8688
* Tracks.
8789
*/
88-
const TRACKS = 'tracks';
90+
public const TRACKS = 'tracks';
8991
/*
9092
* Comments.
9193
*/
92-
const COMMENTS = 'comments';
94+
public const COMMENTS = 'comments';
9395

9496
/**
9597
* Gets the billing address ID for the shipment.

dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/validation.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ define([
1616

1717
dataProvider = [
1818
{
19-
format: 'M/d/Y',
19+
format: 'MM/d/Y',
2020
date: '09/2/18',
2121
expects: true
2222
},

0 commit comments

Comments
 (0)