Skip to content

Commit 681e7ae

Browse files
author
OlgaVasyltsun
committed
Merge remote-tracking branch 'origin/MAGETWO-98185' into 2.2.8-develop-pr78
2 parents 2bdd692 + 62a5a11 commit 681e7ae

File tree

8 files changed

+28
-188
lines changed

8 files changed

+28
-188
lines changed

app/code/Magento/CatalogInventory/Test/Mftf/Data/ProductStockOptionsData.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/code/Magento/CatalogInventory/Test/Mftf/Metadata/product_stock_options-meta.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.

app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
namespace Magento\Wishlist\Block\Customer\Wishlist\Item\Column;
88

9-
use Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter;
10-
119
/**
1210
* Wishlist block customer item cart column
1311
*
@@ -37,28 +35,4 @@ public function getProductItem()
3735
{
3836
return $this->getItem()->getProduct();
3937
}
40-
41-
/**
42-
* Get min and max qty for wishlist form.
43-
*
44-
* @return array
45-
*/
46-
public function getMinMaxQty(): array
47-
{
48-
$stockItem = $this->stockRegistry->getStockItem(
49-
$this->getItem()->getProduct()->getId(),
50-
$this->getItem()->getProduct()->getStore()->getWebsiteId()
51-
);
52-
53-
$params = [];
54-
55-
$params['minAllowed'] = (float)$stockItem->getMinSaleQty();
56-
if ($stockItem->getMaxSaleQty()) {
57-
$params['maxAllowed'] = (float)$stockItem->getMaxSaleQty();
58-
} else {
59-
$params['maxAllowed'] = (float)StockDataFilter::MAX_QTY_VALUE;
60-
}
61-
62-
return $params;
63-
}
6438
}

app/code/Magento/Wishlist/Test/Mftf/ActionGroup/StorefrontCustomerWishlistActionGroup.xml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,4 @@
8787
<click selector="{{StorefrontCustomerWishlistProductSection.productUpdateWishList}}" stepKey="submitUpdateWishlist"/>
8888
<see selector="{{StorefrontMessagesSection.success}}" userInput="{{product.name}} has been updated in your Wish List." stepKey="successMessage"/>
8989
</actionGroup>
90-
91-
<actionGroup name="StorefrontCustomerEditProductInWishlistMakeQuantityValidationError">
92-
<arguments>
93-
<argument name="product"/>
94-
<argument name="description" type="string"/>
95-
<argument name="quantity" type="string"/>
96-
<argument name="errorNum" type="string"/>
97-
</arguments>
98-
<scrollToTopOfPage stepKey="scrollToTop1"/>
99-
<moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productInfoByName(product.name)}}" stepKey="mouseOverOnProduct" />
100-
<fillField selector="{{StorefrontCustomerWishlistProductSection.productDescription(product.name)}}" userInput="{{description}}" stepKey="fillDescription"/>
101-
<fillField selector="{{StorefrontCustomerWishlistProductSection.productQuantity(product.name)}}" userInput="{{quantity}}" stepKey="fillQuantity"/>
102-
<moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productAddAllToCart}}" stepKey="mouseOver1"/>
103-
<click selector="{{StorefrontCustomerWishlistProductSection.productUpdateWishList}}" stepKey="clickAddToWishlistButton"/>
104-
<waitForElement selector="{{StorefrontCustomerWishlistProductSection.productQtyError(product.name)}}" stepKey="waitForErrorMessage"/>
105-
<scrollToTopOfPage stepKey="scrollToTop2"/>
106-
107-
<!--Check error message-->
108-
<moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productInfoByName(product.name)}}" stepKey="wishlistMoveMouseOverProduct" />
109-
<see selector="{{StorefrontCustomerWishlistProductSection.productQtyError(product.name)}}" userInput="The maximum you may purchase is {{errorNum}}." stepKey="checkQtyError"/>
110-
<moveMouseOver selector="{{StorefrontCustomerWishlistProductSection.productAddAllToCart}}" stepKey="mouseOver2"/>
111-
</actionGroup>
11290
</actionGroups>

app/code/Magento/Wishlist/Test/Mftf/Section/StorefrontCustomerWishlistProductSection.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
<element name="productImageByImageName" type="text" selector="//main//li//a//img[contains(@src, '{{var1}}')]" parameterized="true"/>
1818
<element name="productDescription" type="input" selector="//a[contains(text(), '{{productName}}')]/ancestor::div[@class='product-item-info']//textarea[@class='product-item-comment']" parameterized="true"/>
1919
<element name="productQuantity" type="input" selector="//a[contains(text(), '{{productName}}')]/ancestor::div[@class='product-item-info']//input[@class='input-text qty']" parameterized="true"/>
20-
<element name="productEditButtonByName" type="button" selector="//li[.//a[contains(text(), '{{var1}}')]]//span[contains(text(), 'Edit')]" parameterized="true"/>
2120
<element name="productUpdateWishList" type="button" selector=".column.main .actions-toolbar .action.update" timeout="30"/>
2221
<element name="productAddAllToCart" type="button" selector=".column.main .actions-toolbar .action.tocart" timeout="30"/>
23-
<element name="productQtyError" type="text" selector="//li[.//a[contains(text(), '{{var1}}')]]//div[@class='mage-error']" parameterized="true" timeout="30"/>
2422
</section>
2523
</sections>

app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontCheckAmountLimitWishlistTest.xml

Lines changed: 0 additions & 60 deletions
This file was deleted.

app/code/Magento/Wishlist/view/frontend/templates/item/column/cart.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/** @var \Magento\Wishlist\Model\Item $item */
1212
$item = $block->getItem();
1313
$product = $item->getProduct();
14-
$allowedQty = $block->getMinMaxQty();
1514
?>
1615
<?php foreach ($block->getChildNames() as $childName): ?>
1716
<?= /* @noEscape */ $block->getLayout()->renderElement($childName, false) ?>
@@ -22,7 +21,7 @@ $allowedQty = $block->getMinMaxQty();
2221
<div class="field qty">
2322
<label class="label" for="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
2423
<div class="control">
25-
<input type="number" data-role="qty" id="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" class="input-text qty" data-validate="{'required-number':true,'validate-greater-than-zero':true, 'validate-item-quantity':{'minAllowed':<?= /* @noEscape */ $allowedQty['minAllowed'] ?>,'maxAllowed':<?= /* @noEscape */ $allowedQty['maxAllowed'] ?>}}"
24+
<input type="number" data-role="qty" id="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" class="input-text qty" data-validate="{'required-number':true 'validate-greater-than-zero':true}"
2625
name="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" value="<?= /* @noEscape */ (int)($block->getAddToCartQty($item) * 1) ?>">
2726
</div>
2827
</div>

app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ define([
6363
isFileUploaded = false,
6464
self = this;
6565

66+
if (event.handleObj.selector == this.options.qtyInfo) { //eslint-disable-line eqeqeq
67+
this._updateAddToWishlistButton({});
68+
event.stopPropagation();
69+
70+
return;
71+
}
6672
$(event.handleObj.selector).each(function (index, element) {
6773
if ($(element).is('input[type=text]') ||
6874
$(element).is('input[type=email]') ||
@@ -83,7 +89,9 @@ define([
8389
}
8490
});
8591

86-
this.bindFormSubmit(isFileUploaded);
92+
if (isFileUploaded) {
93+
this.bindFormSubmit();
94+
}
8795
this._updateAddToWishlistButton(dataToAdd);
8896
event.stopPropagation();
8997
},
@@ -187,45 +195,34 @@ define([
187195

188196
/**
189197
* Bind form submit.
190-
*
191-
* @param {Boolean} isFileUploaded
192198
*/
193-
bindFormSubmit: function (isFileUploaded) {
199+
bindFormSubmit: function () {
194200
var self = this;
195201

196202
$('[data-action="add-to-wishlist"]').on('click', function (event) {
197203
var element, params, form, action;
198204

199-
if (!$($(self.options.qtyInfo).closest('form')).valid()) {
200-
event.stopPropagation();
201-
event.preventDefault();
202-
203-
return;
204-
}
205-
206-
if (isFileUploaded) {
207-
208-
element = $('input[type=file]' + self.options.customOptionsInfo);
209-
params = $(event.currentTarget).data('post');
210-
form = $(element).closest('form');
211-
action = params.action;
205+
event.stopPropagation();
206+
event.preventDefault();
212207

213-
if (params.data.id) {
214-
$('<input>', {
215-
type: 'hidden',
216-
name: 'id',
217-
value: params.data.id
218-
}).appendTo(form);
219-
}
208+
element = $('input[type=file]' + self.options.customOptionsInfo);
209+
params = $(event.currentTarget).data('post');
210+
form = $(element).closest('form');
211+
action = params.action;
220212

221-
if (params.data.uenc) {
222-
action += 'uenc/' + params.data.uenc;
223-
}
213+
if (params.data.id) {
214+
$('<input>', {
215+
type: 'hidden',
216+
name: 'id',
217+
value: params.data.id
218+
}).appendTo(form);
219+
}
224220

225-
$(form).attr('action', action).submit();
226-
event.stopPropagation();
227-
event.preventDefault();
221+
if (params.data.uenc) {
222+
action += 'uenc/' + params.data.uenc;
228223
}
224+
225+
$(form).attr('action', action).submit();
229226
});
230227
}
231228
});

0 commit comments

Comments
 (0)