Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - magento/magento2#14816: [Forwardport] magento/magento2#4389 Widget cache error (by @ihor-sviziev)
 - magento/magento2#14814: [Forwardport] Fix to allow use decimals less then 1 in subproducts qty. (by @ihor-sviziev)
 - magento/magento2#14813: [Forwardport] Display Wrong Data On Cart Update Page (by @ihor-sviziev)


Fixed GitHub Issues:
 - magento/magento2#4389: Widget cache error (reported by @twslade) has been fixed in magento/magento2#14816 by @ihor-sviziev in 2.3-develop branch
   Related commits:
     1. 7241aa4

 - magento/magento2#14692: 'validate-grouped-qty' validation is meaningless (reported by @likemusic) has been fixed in magento/magento2#14814 by @ihor-sviziev in 2.3-develop branch
   Related commits:
     1. c3a1415
  • Loading branch information
magento-engcom-team authored Apr 24, 2018
2 parents c46a17c + 321f8e2 commit 65eb999
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $_product->getId() ?>" />
<input type="hidden" name="selected_configurable_option" value="" />
<input type="hidden" name="related_product" id="related-products-field" value="" />
<input type="hidden" name="item" value="<?= /* @noEscape */ $block->getRequest()->getParam('id') ?>" />
<?= $block->getBlockHtml('formkey') ?>
<?= $block->getChildHtml('form_top') ?>
<?php if (!$block->hasOptions()):?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ public function getCacheKeyInfo()
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
$this->getProductsPerPage(),
$conditions,
$this->json->serialize($this->getRequest()->getParams())
$this->json->serialize($this->getRequest()->getParams()),
$this->getTemplate(),
$this->getTitle()
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ protected function setUp()
{
$this->collectionFactory =
$this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()->getMock();
->setMethods(['create'])
->disableOriginalConstructor()->getMock();
$this->visibility = $this->getMockBuilder(\Magento\Catalog\Model\Product\Visibility::class)
->setMethods(['getVisibleInCatalogIds'])
->disableOriginalConstructor()
Expand Down Expand Up @@ -144,6 +144,8 @@ public function testGetCacheKeyInfo()
$this->productsList->setData('conditions', 'some_serialized_conditions');

$this->productsList->setData('page_var_name', 'page_number');
$this->productsList->setTemplate('test_template');
$this->productsList->setData('title', 'test_title');
$this->request->expects($this->once())->method('getParam')->with('page_number')->willReturn(1);

$this->request->expects($this->once())->method('getParams')->willReturn('request_params');
Expand All @@ -166,7 +168,9 @@ public function testGetCacheKeyInfo()
1,
5,
'some_serialized_conditions',
json_encode('request_params')
json_encode('request_params'),
'test_template',
'test_title'
];
$this->assertEquals($cacheKey, $this->productsList->getCacheKeyInfo());
}
Expand Down Expand Up @@ -251,9 +255,10 @@ public function testGetPagerHtml()
* Test public `createCollection` method and protected `getPageSize` method via `createCollection`
*
* @param bool $pagerEnable
* @param int $productsCount
* @param int $productsPerPage
* @param int $expectedPageSize
* @param int $productsCount
* @param int $productsPerPage
* @param int $expectedPageSize
*
* @dataProvider createCollectionDataProvider
*/
public function testCreateCollection($pagerEnable, $productsCount, $productsPerPage, $expectedPageSize)
Expand Down Expand Up @@ -382,6 +387,7 @@ public function testGetIdentities()

/**
* @param $collection
*
* @return \PHPUnit_Framework_MockObject_MockObject
*/
private function getConditionsForCollection($collection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ require([

var selectors = {
qtySelector: '#product_addtocart_form [name="qty"]',
productIdSelector: '#product_addtocart_form [name="product"]'
productIdSelector: '#product_addtocart_form [name="product"]',
itemIdSelector: '#product_addtocart_form [name="item"]'
},
cartData = customerData.get('cart'),
productId = $(selectors.productIdSelector).val(),
itemId = $(selectors.itemIdSelector).val(),
productQty,
productQtyInput,

Expand Down Expand Up @@ -40,8 +42,10 @@ require([
return;
}
product = data.items.find(function (item) {
return item['product_id'] === productId ||
item['item_id'] === productId;
if (item['item_id'] === itemId) {
return item['product_id'] === productId ||
item['item_id'] === productId;
}
});

if (!product) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ define([

var selectors = {
formSelector: '#product_addtocart_form',
productIdSelector: '#product_addtocart_form [name="product"]'
productIdSelector: '#product_addtocart_form [name="product"]',
itemIdSelector: '#product_addtocart_form [name="item"]'
},
cartData = customerData.get('cart'),
productId = $(selectors.productIdSelector).val(),
itemId = $(selectors.itemIdSelector).val(),

/**
* set productOptions according to cart data from customer-data
Expand All @@ -24,8 +26,10 @@ define([
if (!(data && data.items && data.items.length && productId)) {
return false;
}
changedProductOptions = _.find(data.items, function (item) {
return item['product_id'] === productId;
changedProductOptions = data.items.find(function (item) {
if (item['item_id'] === itemId) {
return item['product_id'] === productId;
}
});
changedProductOptions = changedProductOptions && changedProductOptions.options &&
changedProductOptions.options.reduce(function (obj, val) {
Expand Down
2 changes: 1 addition & 1 deletion lib/web/mage/validation/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

if (val && val.length > 0) {
result = true;
valInt = parseInt(val, 10) || 0;
valInt = parseFloat(val) || 0;

if (valInt >= 0) {
total += valInt;
Expand Down

0 comments on commit 65eb999

Please sign in to comment.