The output section of my cart.php looks like this:
Code: Select all
public function callback() {
$this->language->load('module/cart');
$this->load->model('tool/seo_url');
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (isset($this->request->post['remove'])) {
$result = explode('_', $this->request->post['remove']);
$this->cart->remove(trim($result[1]));
} else {
if (isset($this->request->post['option'])) {
$option = $this->request->post['option'];
} else {
$option = array();
}
$this->cart->add($this->request->post['product_id'], $this->request->post['quantity'], $option);
}
}
$output = '';
if ($this->cart->getProducts()) {
foreach ($this->cart->getProducts() as $product) {
$output .= '<a href="index.php?route=checkout/cart">' . $this->cart->countProducts() . ' ' . $this->language->get('text_shoppingbag') . '</a>';
}
$total = 0;
$taxes = $this->cart->getTaxes();
$this->load->model('checkout/extension');
$sort_order = array();
$view = HTTP_SERVER . 'index.php?route=checkout/cart';
$checkout = HTTPS_SERVER . 'index.php?route=checkout/shipping';
$results = $this->model_checkout_extension->getExtensions('total');
foreach ($results as $key => $value) {
$sort_order[$key] = $this->config->get($value['key'] . '_sort_order');
}
array_multisort($sort_order, SORT_ASC, $results);
foreach ($results as $result) {
$this->load->model('total/' . $result['key']);
$this->{'model_total_' . $result['key']}->getTotal($total_data, $total, $taxes);
}
$sort_order = array();
foreach ($total_data as $key => $value) {
$sort_order[$key] = $value['sort_order'];
}
array_multisort($sort_order, SORT_ASC, $total_data);
foreach ($total_data as $total) {
if ($total['title'] != 'Sub-Total:') {
$output .= '<div class="product_total">' . $total['text'] . '</div>';
}
}
} else {
$output .= '<div style="text-align: center;">' . $this->language->get('text_empty') . '</div>';
}
$this->response->setOutput($output, $this->config->get('config_compression'));
}
}
?>