Page 1 of 1
tweak to shopping cart page help
Posted: Wed Jan 02, 2013 4:34 am
by DannyMacD
Hello,
im trying to change the layout of the cart page and need some help with the code.
i need this
image1.png (37.4 KiB) Viewed 3126 times
to look like this
image2.png (30.29 KiB) Viewed 3126 times
unit price ex VAT
total price ex VAT = unit price ex VAT x Quantity
total price inc VAT = total price ex VAT + VAT (Tax)
any ideas?
many thanks
Re: tweak to shopping cart page help
Posted: Wed Jan 02, 2013 8:25 am
by pedro1993
Okay, this is easier said than done.
I see you have the template/layout side sorted but I will talk you through it.
There are the 3 steps:
[b]1. Add the code that will get the no-tax prices and no-tax totals[/b]
[b]]2. Adding the no-tax prices/totals to the data array. In simple terms, sending the prices to the template file.[/b]
[b]3. Displaying the prices in the table[/b]
[b]1. Add the code that will get the no-tax prices and no-tax totals[/b]
Open the catalog/controller/checkout/cart.php file and search for this code (around line 218):
[code]
// Display prices
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
// Display prices
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$total = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']);
} else {
$total = false;
}
[/code]
Beneath that add this bunch of code:
[code]
// Display prices (no tax)
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$priceNoTax = $this->currency->format($product['price'], $product['tax_class_id'], $this->config->get('config_tax'));
} else {
$priceNoTax = false;
}
// Display total (no tax)
if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
$totalNoTax = $this->currency->format($product['price'], $product['tax_class_id'], $this->config->get('config_tax') * $product['quantity']);
} else {
$totalNoTax = false;
}
[/code]
[b]2. Adding the no-tax prices/totals to the data array. In simple terms, sending the prices to the template file.[/b]
Further down a little you will see 2 lines of code exactly like this:
[code]
'price' => $price,
'total' => $total,
[/code]
Directly underneath that add these two lines:
[code]
'totalNoTax' => $totalNoTax,
'priceNoTax' => $priceNoTax,
[/code]
[b]3. Displaying the prices in the table
a) Add the thead columns[/b]
Replace this bunch of code:
[code]
<td class="price"><?php echo $column_price; ?></td>
<td class="total"><?php echo $column_total; ?></td>
[/code]
with:
[code]
<td class="price"><?php echo $column_price; ?> (Exluding VAT)</td>
<td class="total"><?php echo $column_total; ?> (Excluding VAT)</td>
<td class="total"><?php echo $column_total; ?></td>
[/code]
[b][color=#BF0000]Note: You can change anything within the TD tags. The phrase "exlcuding VAT" won't be translated if you are using other languages.[/color]
b) Edit the tbody columns[/b]
Replace this code:
[code]
<td class="price"><?php echo $product['price']; ?></td>
<td class="total"><?php echo $product['total']; ?></td>
[/code]
with:
[code]
<td class="price"><?php echo $product['priceNoTax']; ?></td>
<td class="total"><?php echo $product['totalNoTax']; ?></td>
<td class="total"><?php echo $product['total']; ?></td>
[/code]
The is a working screenshot attached.
Please let me know how you get on.
Peter
Re: tweak to shopping cart page help
Posted: Wed Jan 02, 2013 8:29 am
by pedro1993
Sorry, I can't figure out why the bbcode isn't working. Hopefully a mod will be able to edit?
Peter
Re: tweak to shopping cart page help
Posted: Wed Jan 02, 2013 10:12 pm
by DannyMacD
it has worked a treat!!!
im also using the amazing Qs Uber checkout. im trying to follow the same process with the checkout_two page. should it just work and be the same?
cant really post code as its a commercial module..
Re: tweak to shopping cart page help
Posted: Fri Jan 04, 2013 5:36 pm
by DannyMacD
so using the code above i have managed to tweak the uber checkout to show what i want it to show.. :0)
Re: tweak to shopping cart page help
Posted: Sun Jan 06, 2013 1:59 am
by Qphoria
So you want to add the column "Total +Vat" ?
Re: tweak to shopping cart page help
Posted: Sun Jan 06, 2013 2:09 am
by DannyMacD
yup, i got it to work now. just having an issue with the plus and minus and update stock buttons:
http://forum.opencart.com/viewtopic.php?f=20&t=92202
Re: tweak to shopping cart page help
Posted: Mon Oct 10, 2016 5:16 pm
by twdre
Is this also possible in opencart 2.03.1
I tried to follow the instuctions the collumnnames are showing and also the totla but not the totals exl tax
Im using Journal2 template
Thank you