i just dont know if the if the price of the # of items should stay the same even after adding shipping or tax.
i mean shouldnt be the total of all (items+shipping+tax- coupon) displied instead of JUST the total of items
on the 2nd pic you can see the coupon is showing in header, and again the Total is OLNY showing the total of items ignoring there are shipping and coupon dedution.
i have i feeling the total in header is the sub-total not the overall total. we need to show the overall total. right?
you are going in the right track and i am sure you can manage to do it right this time
good job so far kroozing
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
In header.tpl
Change
Code: Select all
<?php if ($total['title'] != 'Total:') { ?>
Code: Select all
<?php if ($total['title'] != 'Sub-Total:') { ?>
but how to display ONLY the Overall TOTAL after it does all the additions and subtraction (shipping.tax and coupon)?kroozing wrote:if you want to show the overall subtotal of the cart including any deductions and including the shipping.
In header.tpl
ChangeToCode: Select all
<?php if ($total['title'] != 'Total:') { ?>
this will still show the additional coupons but we'll deal with that if the total is performing correctly.Code: Select all
<?php if ($total['title'] != 'Sub-Total:') { ?>
Ex:
if the cart in block shows this
Sub-Total: $35.00
Tax: $3.00
Flat Shipping Rate: $2.00
Coupon (-10%): -$4.00
Total: $36.00
then in header it should ONLY show this
2 item(s): $36.00
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
take a look
please demo buy product 1 and product 2 and then take a look at the code in the header.
see image attached also
Attachments
header-cart3.png (49.89 KiB) Viewed 6755 times
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
so far 1 discount code, i will add more later?
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
I will be home in about an hour so I will post it then.
Let try to hide the variable not the translation if you know what I mean.
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
there is a bug in it.
i replaced with this:
Code: Select all
<?php
$cartinfo = $totals[3]['text'];// line 86
echo $cartinfo; ?>
Notice: Undefined offset: 3 in /home/vol13/0fees.net/fees0_5920608/htdocs/store/catalog/view/theme/default2/template/common/header.tpl on line 86
knowing that the cart is empty still. then i added a product and still that error there, then i choose shipping and now the error is gone
so the only way for this to work without getting an error is when the cart has all three (shipping,VAT and total)
now you need to make it if the cart is empty then it should show $0.00, and if i choose a product then it show the cart total in header, and if there is VAT applied to product then it will show the total cullcolated vat in it. and if shipping is selected then it should show the total of all three.
i hope you understand it hehehe
i am sure you can get it
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
this is the only code you need in the header.tpl
Code: Select all
<?php if ($products) { ?>
<br />
<div style="text-align: right;"><a href="index.php?route=checkout/cart" alt="Shopping Bag">Shopping Bag (<?php echo $this->cart->countProducts(); ?>)</a></div>
<?php
$count=count($totals);
$cartinfo = $totals[$count-1]['title'] . ' ' . $totals[$count-1]['text'];
echo $cartinfo;
?>
<?php } else { ?>
<br />
<div style="text-align: right;"><a href="index.php?route=checkout/cart" alt="Shopping Bag">Shopping Bag (<?php echo $this->cart->countProducts(); ?>)</a></div>
Total: $0.00
<?php } ?>
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';
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>
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:;
after:
Code: Select all
$this->data['text_advanced'] = $this->language->get('text_advanced');
Code: Select all
$this->data['text_shoppingbag'] = $this->language->get('text_shoppingbag');
$this->data['text_shoppingbagtotal'] = $this->language->get('text_shoppingbagtotal');
and change Shopping Bag with:
Code: Select all
<?php echo $text_shoppingbag; ?>
Code: Select all
<?php echo $text_shoppingbagtotal; ?>
good job kroozing, congratulation on you 1st add-on
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
instead of this:
Code: Select all
Total: $0.00
<?php } ?>
Code: Select all
:
<?php
foreach ($totals as $total) {
if ($total['title'] != 'Sub-Total:') {
echo $total['text'];
}
}
} ?>
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
I currently have:
Code: Select all
foreach ($total_data as $total) {
$output .= '<div class="product_total">' . $total['text'] . '</div>';
}
take a look
ALL Templates :: 1.5.1+ Templates :: 50%-75% PRICE DROP ONLY at OpencartStuff.com
I'm trying to do what has been generally discussed here except I'd like to know how to hide unit price and subtotal in the cart module as opposed to the header. (I'm assuming its the cart module as I've only just started using opencart). I'm using opencart v 1.4.9.4
Any help would be appreciated
Users browsing this forum: No registered users and 64 guests