Skip to content

Commit d95424a

Browse files
committed
Merge pull request #280 from magento-folks/bug-fixes-s67
[Folks] Bug fixes s67
2 parents 6ab300f + 0266747 commit d95424a

File tree

6 files changed

+46
-45
lines changed

6 files changed

+46
-45
lines changed

app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function execute()
6666
);
6767
$this->messageManager->addSuccess($message);
6868
}
69-
return $this->_goBack();
69+
return $this->_goBack($this->_url->getUrl('checkout/cart'));
7070
}
7171
} catch (\Magento\Framework\Exception\LocalizedException $e) {
7272
if ($this->_checkoutSession->getUseNotice(true)) {

app/code/Magento/Checkout/view/frontend/templates/cart/form.phtml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757
class="action update">
5858
<span><?php echo __('Update Shopping Cart'); ?></span>
5959
</button>
60-
<!--[if lt IE 8]>
6160
<input type="hidden" value="" id="update_cart_action_container" />
62-
<![endif]-->
6361
</div>
6462
</form>
6563
<?php echo $block->getChildHtml('shopping.cart.table.after'); ?>

app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
9999
title="<?php echo $block->escapeHtml(__('Qty')); ?>"
100100
class="input-text qty"
101101
maxlength="12"
102-
data-validate="{required:true,'validate-greater-than-zero':true}" />
102+
data-validate="{required:true,'validate-greater-than-zero':true}"
103+
data-role="cart-item-qty"/>
103104
</div>
104105
</div>
105106
<?php $cols++; ?>

app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,21 @@ define([
1111

1212
$.widget('mage.shoppingCart', {
1313
_create: function() {
14-
if ($(this.options.updateCartActionContainer).length > 0) { /* <!--[if lt IE 8]> Only */
15-
$(this.options.emptyCartButton).on('click', $.proxy(function() {
16-
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
17-
$(this.options.updateCartActionContainer)
18-
.attr('name', 'update_cart_action').attr('value', 'empty_cart');
14+
$(this.options.emptyCartButton).on('click', $.proxy(function() {
15+
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
16+
$(this.options.updateCartActionContainer)
17+
.attr('name', 'update_cart_action').attr('value', 'empty_cart');
18+
}, this));
19+
var items = $.find("[data-role='cart-item-qty']");
20+
for (var i = 0; i < items.length; i++) {
21+
$(items[i]).on('keypress', $.proxy(function(event) {
22+
var keyCode = (event.keyCode ? event.keyCode : event.which);
23+
if(keyCode == 13) {
24+
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
25+
$(this.options.updateCartActionContainer)
26+
.attr('name', 'update_cart_action').attr('value', 'update_qty');
27+
28+
}
1929
}, this));
2030
}
2131
$(this.options.continueShoppingButton).on('click', $.proxy(function() {

app/code/Magento/Downloadable/view/frontend/templates/checkout/cart/item/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
8787
<?php endif; ?>
8888
<td class="col qty" data-th="<?php echo $block->escapeHtml(__('Qty')); ?>">
8989
<div class="control qty">
90-
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $block->getQty() ?>" type="number" size="4" title="<?php echo __('Qty') ?>" class="input-text qty" maxlength="12" data-validate="{'required-number':true,'validate-greater-than-zero':true}"/>
90+
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $block->getQty() ?>" type="number" size="4" title="<?php echo __('Qty') ?>" class="input-text qty" maxlength="12" data-validate="{'required-number':true,'validate-greater-than-zero':true}" data-role="cart-item-qty"/>
9191
</div>
9292
<?php $cols++; ?>
9393
</td>

app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,32 @@ protected function setUp()
7777
* @param boolean $cacheEnabled
7878
* @param int $loadCalls
7979
* @param string $cachedValue
80-
* @param array $factoryCalls
8180
* @dataProvider getAttributeCacheDataProvider
8281
* @return void
8382
*/
84-
public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue, $factoryCalls)
83+
public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue)
8584
{
85+
$attributeCollectionMock = $this->getMockBuilder('Magento\Eav\Model\Resource\Entity\Attribute\Collection')
86+
->disableOriginalConstructor()
87+
->setMethods(['getData', 'setEntityTypeFilter'])
88+
->getMock();
89+
$attributeCollectionMock
90+
->expects($this->any())
91+
->method('setEntityTypeFilter')
92+
->will($this->returnSelf());
93+
$attributeCollectionMock
94+
->expects($this->any())
95+
->method('getData')
96+
->willReturn([]);
97+
$entityAttributeMock = $this->getMockBuilder('Magento\Eav\Model\Entity\Attribute')
98+
->setMethods(['dummy'])
99+
->disableOriginalConstructor()
100+
->getMock();
101+
$factoryCalls = [
102+
['Magento\Eav\Model\Resource\Entity\Attribute\Collection', [], $attributeCollectionMock],
103+
['Magento\Eav\Model\Entity\Attribute', [], $entityAttributeMock],
104+
];
105+
86106
$this->stateMock
87107
->expects($this->atLeastOnce())
88108
->method('isEnabled')
@@ -95,7 +115,7 @@ public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue, $
95115
->willReturn($cachedValue);
96116

97117
$collectionStub = new Object([
98-
['entity_type_code' => 'type_code_1', 'entity_type_id' => 1]
118+
['entity_type_code' => 'type_code_1', 'entity_type_id' => 1],
99119
]);
100120
$this->collectionFactoryMock
101121
->expects($this->any())
@@ -108,7 +128,7 @@ public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue, $
108128
->willReturn(new Object(['id' => 101]));
109129

110130
$this->universalFactoryMock
111-
->expects($this->exactly(count($factoryCalls)))
131+
->expects($this->atLeastOnce())
112132
->method('create')
113133
->will($this->returnValueMap($factoryCalls));
114134

@@ -125,54 +145,26 @@ public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue, $
125145
*/
126146
public function getAttributeCacheDataProvider()
127147
{
128-
$attributeCollectionMock = $this->getMockBuilder('Magento\Eav\Model\Resource\Entity\Attribute\Collection')
129-
->disableOriginalConstructor()
130-
->setMethods(['getData', 'setEntityTypeFilter'])
131-
->getMock();
132-
$attributeCollectionMock
133-
->expects($this->any())
134-
->method('setEntityTypeFilter')
135-
->will($this->returnSelf());
136-
$attributeCollectionMock
137-
->expects($this->any())
138-
->method('getData')
139-
->willReturn([]);
140-
$entityAttributeMock = $this->getMockBuilder('Magento\Eav\Model\Entity\Attribute')
141-
->setMethods(['dummy'])
142-
->disableOriginalConstructor()
143-
->getMock();
144-
145148
return [
146149
'cache-disabled' => [
147150
false,
148151
0,
149152
false,
150-
[
151-
['Magento\Eav\Model\Resource\Entity\Attribute\Collection', [], $attributeCollectionMock],
152-
['Magento\Eav\Model\Entity\Attribute', [], $entityAttributeMock]
153-
]
154153
],
155154
'cache-miss' => [
156155
true,
157156
1,
158157
false,
159-
[
160-
['Magento\Eav\Model\Resource\Entity\Attribute\Collection', [], $attributeCollectionMock],
161-
['Magento\Eav\Model\Entity\Attribute', [], $entityAttributeMock]
162-
]
163158
],
164159
'cached' => [
165160
true,
166161
1,
167162
serialize(
168163
[
169-
['attribute_code' => 'attribute_code_1', 'attribute_id' => 1]
164+
['attribute_code' => 'attribute_code_1', 'attribute_id' => 1],
170165
]
171166
),
172-
[
173-
['Magento\Eav\Model\Entity\Attribute', [], $entityAttributeMock]
174-
]
175-
]
167+
],
176168
];
177169
}
178170

@@ -185,7 +177,7 @@ public function testClear()
185177
$this->equalTo(
186178
[
187179
\Magento\Eav\Model\Cache\Type::CACHE_TAG,
188-
\Magento\Eav\Model\Entity\Attribute::CACHE_TAG
180+
\Magento\Eav\Model\Entity\Attribute::CACHE_TAG,
189181
]
190182
)
191183
);

0 commit comments

Comments
 (0)