you are the man

i got an error 1st cuz we had to define $product in catalog\controller\common\header.php
i added this:
Code: Select all
$this->data['products'] = array();
foreach ($this->cart->getProducts() as $result) {
$option_data = array();
foreach ($result['option'] as $option) {
$option_data[] = array(
'name' => $option['name'],
'value' => $option['value']
);
}
$this->data['products'][] = array(
'key' => $result['key'],
'name' => $result['name'],
'option' => $option_data,
'quantity' => $result['quantity'],
'stock' => $result['stock'],
'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))),
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id']),
);
}
to the rest of the code i added before, so now in header.php i have this:
Code: Select all
protected function index() {
$this->data['products'] = array();
foreach ($this->cart->getProducts() as $result) {
$option_data = array();
foreach ($result['option'] as $option) {
$option_data[] = array(
'name' => $option['name'],
'value' => $option['value']
);
}
$this->data['products'][] = array(
'key' => $result['key'],
'name' => $result['name'],
'option' => $option_data,
'quantity' => $result['quantity'],
'stock' => $result['stock'],
'price' => $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax'))),
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id']),
);
}
$total_data = array();
$total = 0;
$taxes = $this->cart->getTaxes();
$this->load->model('checkout/extension');
$sort_order = array();
$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);
$this->data['totals'] = $total_data;
if (isset($this->session->data['coupon'])) {
$this->load->model('checkout/coupon');
$coupon = $this->model_checkout_coupon->getCoupon($this->session->data['coupon']);
if ($coupon) {
$data['coupon_id'] = $coupon['coupon_id'];
} else {
$data['coupon_id'] = 0;
}
} else {
$data['coupon_id'] = 0;
}
$this->data['ajax'] = $this->config->get('cart_ajax');
$this->id = 'cart';
and in header.tpl i have this:
Code: Select all
<b>
<?php if ($products) { ?>
<a href="index.php?route=checkout/cart" alt="Shopping Bag">Shopping Bag (<?php echo $this->cart->countProducts(); ?>)</a>
<?php
$count=count($totals);
$cartinfo = $totals[$count-1]['title'] . ' ' . $totals[$count-1]['text'];
echo $cartinfo;
?>
<?php } else { ?>
<a href="index.php?route=checkout/cart" alt="Shopping Bag">Shopping Bag (<?php echo $this->cart->countProducts(); ?>)</a>
Total: $0.00
<?php } ?>
</b>
now you need to do this proper for malti-lang

you need to add this to language file:
Shopping Bag
Total:
to do that open catalog\
language\english\common\header.php
and at the end just before ?> add this:
Code: Select all
$_['text_shoppingbag'] = 'Shopping Bag';
$_['text_shoppingbagtotal'] = Total:;
then open catalog\controller\common\header.php
after:
Code: Select all
$this->data['text_advanced'] = $this->language->get('text_advanced');
add this:
Code: Select all
$this->data['text_shoppingbag'] = $this->language->get('text_shoppingbag');
$this->data['text_shoppingbagtotal'] = $this->language->get('text_shoppingbagtotal');
and now open catalog\view\theme\
default\template\common\header.tpl
and change
Shopping Bag with:
and Change
Total: with:
Code: Select all
<?php echo $text_shoppingbagtotal; ?>
good job
kroozing, congratulation on you 1st add-on
