- Posts: 52
- Thank you received: 2
Show sub total after shipping before VAT
12 years 9 months ago #141961
by wynchcote
Show sub total after shipping before VAT was created by wynchcote
-- url of the page with the problem -- : test site
-- HikaShop version -- : 2.2.3
-- Joomla version -- : 2.5.17
-- PHP version -- : 5.3
-- Browser(s) name and version -- : n/a
-- Error-message(debug-mod must be tuned on) -- : n//a
I have configured the HikaShop Starter to show prices ex VAT and to include VAT with shipping options.
Presentation in checkout is nice:
Total
Shipping
VAT
Total
and the VAT is shown in brackets next to the shipping method below the total.
However, I still think some people may be confused about how the VAT is calculated i.e. as % of product and shipping.
For this reason, would like to include a sub-total.
Example:
Sub-total
Shipping
Sub-total
VAT
Total
Thanks,
Ken
-- HikaShop version -- : 2.2.3
-- Joomla version -- : 2.5.17
-- PHP version -- : 5.3
-- Browser(s) name and version -- : n/a
-- Error-message(debug-mod must be tuned on) -- : n//a
I have configured the HikaShop Starter to show prices ex VAT and to include VAT with shipping options.
Presentation in checkout is nice:
Total
Shipping
VAT
Total
and the VAT is shown in brackets next to the shipping method below the total.
However, I still think some people may be confused about how the VAT is calculated i.e. as % of product and shipping.
For this reason, would like to include a sub-total.
Example:
Sub-total
Shipping
Sub-total
VAT
Total
Thanks,
Ken
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
12 years 9 months ago #142072
by Mohamed Thelji
Replied by Mohamed Thelji on topic Show sub total after shipping before VAT
Hi,
The solution will probably be to edit the "Cart" file of the "checkout" view of your front-end template through the page "Hikashop->Display->Views".
The solution will probably be to edit the "Cart" file of the "checkout" view of your front-end template through the page "Hikashop->Display->Views".
Please Log in or Create an account to join the conversation.
12 years 9 months ago #142671
by wynchcote
Replied by wynchcote on topic Show sub total after shipping before VAT
Thanks for the pointer, Jerome.
I have had a go and achieved a kind of result (!) - see attached image using the following code:
---
/*ken*/
<tr>
<?php echo $td; ?>
<td id="hikashop_checkout_cart_total2_title" class="hikashop_cart_subtotal_title hikashop_cart_title">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</td>
<td class="hikashop_cart_subtotal_value">
<?php
$this->row = $this->total;
echo $this->loadTemplate();
?>
</td>
</tr>
/*ken*/
---
inserted as below.
Query 1: how can I do the sum in PHP?
Query 2: Woud making such a change (adding sub-tal) impact on code lower down the cart (e.g. coupons etc if they exist)?
Thanks for taking a look.
Ken
---
Code extract from cart:
---
<tr>
<?php echo $td; ?>
<td id="hikashop_checkout_cart_shipping_title" class="hikashop_cart_shipping_title hikashop_cart_title">
<?php echo JText::_('HIKASHOP_SHIPPING'); ?>
</td>
<td class="hikashop_cart_shipping_value" >
<span class="hikashop_checkout_cart_shipping">
<?php
if(isset($this->value)) {
echo $this->value;
} else {
$shipping_price = null;
foreach($this->shipping as $shipping) {
if(!isset($shipping->shipping_price) && isset($shipping->shipping_price_with_tax) ) {
$shipping->shipping_price = $shipping->shipping_price_with_tax;
}
if(isset($shipping->shipping_price)) {
if($shipping_price === null)
$shipping_price = 0.0;
if(bccomp($taxes,0,5)==0 || !$this->params->get('price_with_tax') || !isset($shipping->shipping_price_with_tax)) {
$shipping_price += $shipping->shipping_price;
} else {
$shipping_price += $shipping->shipping_price_with_tax;
}
}
}
if($shipping_price !== null) {
echo $this->currencyHelper->format($shipping_price, hikashop_getCurrency());
}
}
?>
</span>
</td>
</tr>
/*ken*/
<tr>
<?php echo $td; ?>
<td id="hikashop_checkout_cart_total2_title" class="hikashop_cart_subtotal_title hikashop_cart_title">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</td>
<td class="hikashop_cart_subtotal_value">
<?php
$this->row = $this->total;
echo $this->loadTemplate();
?>
</td>
</tr>
/*ken*/
<?php
}
if(!empty($this->additional)) {
$exclude_additionnal = explode(',', $this->config->get('order_additional_hide', ''));
foreach($this->additional as $k => $additional) {
if(in_array($additional->name, $exclude_additionnal))
continue;
?>
<tr id="hikashop_checkout_cart_additional_<?php echo str_replace(' ','_',$k); ?>_line" >
<?php echo $td; ?>
<td id="hikashop_checkout_cart_additional_<?php echo str_replace(' ','_',$k); ?>_title" class="hikashop_cart_additional_title hikashop_cart_title"><?php
echo JText::_($additional->name);
?></td>
<td class="hikashop_cart_shipping_value" >
<span class="hikashop_checkout_cart_shipping">
<?php
if(!empty($additional->price_value) || empty($additional->value)) {
if(bccomp($taxes,0,5)==0 || !$this->params->get('price_with_tax')){
echo $this->currencyHelper->format(@$additional->price_value,$additional->price_currency_id);
}else{
echo $this->currencyHelper->format(@$additional->price_value_with_tax,$additional->price_currency_id);
}
} else {
echo $additional->value;
}
?>
</span>
</td>
</tr>
I have had a go and achieved a kind of result (!) - see attached image using the following code:
---
/*ken*/
<tr>
<?php echo $td; ?>
<td id="hikashop_checkout_cart_total2_title" class="hikashop_cart_subtotal_title hikashop_cart_title">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</td>
<td class="hikashop_cart_subtotal_value">
<?php
$this->row = $this->total;
echo $this->loadTemplate();
?>
</td>
</tr>
/*ken*/
---
inserted as below.
Query 1: how can I do the sum in PHP?
Query 2: Woud making such a change (adding sub-tal) impact on code lower down the cart (e.g. coupons etc if they exist)?
Thanks for taking a look.
Ken
---
Code extract from cart:
---
<tr>
<?php echo $td; ?>
<td id="hikashop_checkout_cart_shipping_title" class="hikashop_cart_shipping_title hikashop_cart_title">
<?php echo JText::_('HIKASHOP_SHIPPING'); ?>
</td>
<td class="hikashop_cart_shipping_value" >
<span class="hikashop_checkout_cart_shipping">
<?php
if(isset($this->value)) {
echo $this->value;
} else {
$shipping_price = null;
foreach($this->shipping as $shipping) {
if(!isset($shipping->shipping_price) && isset($shipping->shipping_price_with_tax) ) {
$shipping->shipping_price = $shipping->shipping_price_with_tax;
}
if(isset($shipping->shipping_price)) {
if($shipping_price === null)
$shipping_price = 0.0;
if(bccomp($taxes,0,5)==0 || !$this->params->get('price_with_tax') || !isset($shipping->shipping_price_with_tax)) {
$shipping_price += $shipping->shipping_price;
} else {
$shipping_price += $shipping->shipping_price_with_tax;
}
}
}
if($shipping_price !== null) {
echo $this->currencyHelper->format($shipping_price, hikashop_getCurrency());
}
}
?>
</span>
</td>
</tr>
/*ken*/
<tr>
<?php echo $td; ?>
<td id="hikashop_checkout_cart_total2_title" class="hikashop_cart_subtotal_title hikashop_cart_title">
<?php echo JText::_('HIKASHOP_TOTAL'); ?>
</td>
<td class="hikashop_cart_subtotal_value">
<?php
$this->row = $this->total;
echo $this->loadTemplate();
?>
</td>
</tr>
/*ken*/
<?php
}
if(!empty($this->additional)) {
$exclude_additionnal = explode(',', $this->config->get('order_additional_hide', ''));
foreach($this->additional as $k => $additional) {
if(in_array($additional->name, $exclude_additionnal))
continue;
?>
<tr id="hikashop_checkout_cart_additional_<?php echo str_replace(' ','_',$k); ?>_line" >
<?php echo $td; ?>
<td id="hikashop_checkout_cart_additional_<?php echo str_replace(' ','_',$k); ?>_title" class="hikashop_cart_additional_title hikashop_cart_title"><?php
echo JText::_($additional->name);
?></td>
<td class="hikashop_cart_shipping_value" >
<span class="hikashop_checkout_cart_shipping">
<?php
if(!empty($additional->price_value) || empty($additional->value)) {
if(bccomp($taxes,0,5)==0 || !$this->params->get('price_with_tax')){
echo $this->currencyHelper->format(@$additional->price_value,$additional->price_currency_id);
}else{
echo $this->currencyHelper->format(@$additional->price_value_with_tax,$additional->price_currency_id);
}
} else {
echo $additional->value;
}
?>
</span>
</td>
</tr>
Please Log in or Create an account to join the conversation.
12 years 9 months ago - 12 years 9 months ago #142675
by Eliot
Replied by Eliot on topic Show sub total after shipping before VAT
Hi there,
Please avoid posting that much code without tags, it's painful to read
1 - you can simply use "+"
2 - It won't impact the other values since it's only about the display
Please avoid posting that much code without tags, it's painful to read
1 - you can simply use "+"
2 - It won't impact the other values since it's only about the display
Last edit: 12 years 9 months ago by Eliot.
Please Log in or Create an account to join the conversation.
12 years 9 months ago #142677
by wynchcote
Replied by wynchcote on topic Show sub total after shipping before VAT
Sorry Eliot!
Point taken
The issue for a non-php guy like me is what code to use.
Ken:)
Point taken
The issue for a non-php guy like me is what code to use.
Ken:)
Please Log in or Create an account to join the conversation.
12 years 9 months ago #142685
by Eliot
Replied by Eliot on topic Show sub total after shipping before VAT
Something like that should be ok:
Code:
<?php echo $td; ?>
<td id="hikashop_checkout_cart_total2_title" class="hikashop_cart_subtotal_title hikashop_cart_title">
<?php echo JText::_('HIKASHOP_SUBTOTAL'); ?>
</td>
<td class="hikashop_cart_subtotal_value">
<?php
$this->row = $this->total+$shipping_price;
echo $this->loadTemplate();
?>
</td>
</tr>
Please Log in or Create an account to join the conversation.
Time to create page: 0.082 seconds