Skip to content

Commit 7dad27c

Browse files
author
John Carlo Octabio
committed
#108: Clear Shopping Cart - Refactor to fix Static Tests failed result
1 parent 2c4ee78 commit 7dad27c

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

app/code/Magento/Checkout/Block/Cart/Grid.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ protected function _construct()
107107
}
108108

109109
/**
110-
* {@inheritdoc}
110+
* @inheritdoc
111+
*
111112
* @since 100.2.0
112113
*/
113114
protected function _prepareLayout()
@@ -151,7 +152,8 @@ public function getItemsForGrid()
151152
}
152153

153154
/**
154-
* {@inheritdoc}
155+
* @inheritdoc
156+
*
155157
* @since 100.2.0
156158
*/
157159
public function getItems()
@@ -187,7 +189,7 @@ private function isPagerDisplayedOnPage()
187189
*/
188190
public function isClearShoppingCartEnabled()
189191
{
190-
return (bool) $this->_scopeConfig->getValue(
192+
return (bool)$this->_scopeConfig->getValue(
191193
self::XPATH_CONFIG_ENABLE_CLEAR_SHOPPING_CART,
192194
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
193195
);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class="form form-cart">
2121
<?= $block->getBlockHtml('formkey') ?>
2222
<div class="cart table-wrapper<?= $mergedCells == 2 ? ' detailed' : '' ?>">
23-
<?php if ($block->getPagerHtml()) :?>
23+
<?php if ($block->getPagerHtml()): ?>
2424
<div class="cart-products-toolbar cart-products-toolbar-top toolbar"
2525
data-attribute="cart-products-toolbar-top"><?= $block->getPagerHtml() ?>
2626
</div>
@@ -38,25 +38,25 @@
3838
<th class="col subtotal" scope="col"><span><?= $block->escapeHtml(__('Subtotal')) ?></span></th>
3939
</tr>
4040
</thead>
41-
<?php foreach ($block->getItems() as $_item) :?>
41+
<?php foreach ($block->getItems() as $_item): ?>
4242
<?= $block->getItemHtml($_item) ?>
4343
<?php endforeach ?>
4444
</table>
45-
<?php if ($block->getPagerHtml()) :?>
45+
<?php if ($block->getPagerHtml()): ?>
4646
<div class="cart-products-toolbar cart-products-toolbar-bottom toolbar"
4747
data-attribute="cart-products-toolbar-bottom"><?= $block->getPagerHtml() ?>
4848
</div>
4949
<?php endif ?>
5050
</div>
5151
<div class="cart main actions">
52-
<?php if ($block->getContinueShoppingUrl()) :?>
52+
<?php if ($block->getContinueShoppingUrl()): ?>
5353
<a class="action continue"
5454
href="<?= $block->escapeUrl($block->getContinueShoppingUrl()) ?>"
5555
title="<?= $block->escapeHtml(__('Continue Shopping')) ?>">
5656
<span><?= $block->escapeHtml(__('Continue Shopping')) ?></span>
5757
</a>
5858
<?php endif; ?>
59-
<?php if ($block->isClearShoppingCartEnabled()) :?>
59+
<?php if ($block->isClearShoppingCartEnabled()): ?>
6060
<button type="button"
6161
name="update_cart_action"
6262
data-cart-empty=""

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ define([
6363
* Display confirmation modal for clearing the cart
6464
* @private
6565
*/
66-
_clearCartConfirmation: function() {
66+
_clearCartConfirmation: function () {
6767
var self = this;
6868

6969
confirm({
@@ -80,7 +80,7 @@ define([
8080
* Prepares the form and submit to clear the cart
8181
* @public
8282
*/
83-
clearCart: function() {
83+
clearCart: function () {
8484
$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
8585
$(this.options.updateCartActionContainer)
8686
.attr('name', 'update_cart_action').attr('value', 'empty_cart');

0 commit comments

Comments
 (0)