function show_messages() { // display messages if ($this->messages) { if (!$this->errors_to_function) { echo '<ul class="messages">'; foreach ($this->messages as $name => $message) { echo '<li><div class="warning_icon"></div>' . ucfirst(str_ireplace('[field]', $name, $message)) . '</li>'; } echo '</ul><div class="clear"></div>'; } else { Messages::merge($this->errors); } } }
function delete($item_id, $item_table, $table = false) { global $CFG; $table = $table ? $table : 'cart'; $item = DB::getRecord($item_table, $item_id, false, true); $item_name = $item['name']; if (User::isLoggedIn()) { $result = getItem($item_id, $item_table, $table); if ($result) { DB::delete($result['id']); $messages[$item_name] = $CFG->cart_delete_message; Messages::merge($messages); } } else { unset($_SESSION['cart'][$item_table . '_' . $item_id]); $messages[$item_name] = $CFG->cart_delete_message; Messages::merge($messages); } }