Hi all,
I have installed ubercart with the module cart links enabled, and want to add a product, and then empty the cart, without the notification message if there is already something in the cart. therefore we have this hook in uc_cart_links:
<?php
/**
* Preprocesses a Cart Link and confirm with the user if a destructive action
* is included.
*
* @see uc_cart_links_form_submit()
*/
function uc_cart_links_form($form, &$form_state, $arg1) {
// Fail if the link is restricted.
$data = variable_get('uc_cart_links_restrictions', '');
if (!empty($data)) {
$restrictions = explode("\n", variable_get('uc_cart_links_restrictions', ''));
$restrictions = array_map('trim', $restrictions);
if (!empty($restrictions) && !in_array($arg1, $restrictions)) {
$url = variable_get('uc_cart_links_invalid_page', '');
if (empty($url)) {
$url = '';
}
unset($_GET['destination']);
drupal_goto($url);
}
}
// Confirm with the user if the form contains a destructive action.
$items = uc_cart_get_contents();
if (variable_get('uc_cart_links_empty', TRUE) && !empty($items)) {
$actions = explode('-', urldecode($arg1));
foreach ($actions as $action) {
$action = drupal_substr($action, 0, 1);
if ($action == 'e' || $action == 'E') {