Hello,
im trying to change the layout of the cart page and need some help with the code.
i need this
to look like this
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
im trying to change the layout of the cart page and need some help with the code.
i need this
to look like this
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
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
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
Attachments
Capture.PNG (28.59 KiB) Viewed 3111 times
For OpenCart & PHP/MySQL support feel free to PM me
Click here for my extentions
Did I help you? Donate here to show support
Sorry, I can't figure out why the bbcode isn't working. Hopefully a mod will be able to edit?
Peter
Peter
For OpenCart & PHP/MySQL support feel free to PM me
Click here for my extentions
Did I help you? Donate here to show support
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
http://forum.opencart.com/viewtopic.php?f=20&t=92202
Who is online
Users browsing this forum: No registered users and 76 guests