Clear Cart Button


203
This post adds the “Empty Shopping Cart” button to the shopping cart, which allows you to remove all items from the shopping cart straight away.

Find in: cataog/includes/application_top.php
  }

// include the who's online functions
  require('includes/functions/whos_online.php');
  tep_update_whos_online();

add before

      case 'clear_cart' :     $cart->reset(true);
                              break;

Or in FROSEN Version:

    switch ($_GET['action']) {

// BOL Clear shopping_cart total
      case 'clear_cart' :     
      $cart->reset(true);
      break;
}
// EOL Clear shopping_cart total

Find in: catalog/shopping_cart.php

  <div class="buttonSet">
    <div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fa fa-angle-right', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success'); ?></div>
  </div>

Note the

tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success');

section, there are versions that are hardcoded and do not support the file variables.

These must be done by directly buying the file

tep_href_link('checkout_shipping.php', '', 'SSL'), 'primary', NULL, 'btn-success');

Change to:

  <div class="buttonSet row">
    <div class="col-xs-6"><?php echo tep_draw_button(IMAGE_BUTTON_CLEAR_CART, 'fa fa-trash', tep_href_link(FILENAME_SHOPPING_CART, 'action=clear_cart', 'NOSSL'), 'secondary', array('params' => 'onclick="return confirm('' . CLEAR_CART . '');"')); ?></div>
    <div class="col-xs-6 text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fa fa-angle-right', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary', NULL, 'btn-success'); ?></div>
  </div>

Add in the language file: catalog/includes/languages/english.php

define('IMAGE_BUTTON_CLEAR_CART', 'Clear Cart');
define('CLEAR_CART',' To empty stand of purchases? ');

w3c-Commerce
w3c-Commerce Downloads
  w3c-Commerce Add-ons php8