- Posts: 1184
- Thank you received: 13
Remove Cart total and display quantity instead
3 years 4 weeks ago #354919
by verzevoul
Remove Cart total and display quantity instead was created by verzevoul
-- HikaShop version -- : 4.7.5
-- Joomla version -- : 3.10.12
Hello!
I want to remove the subtotal and total field from the cart/emails etc and instead display there the product quantity amount.
Is this possible?
Thank you
-- Joomla version -- : 3.10.12
Hello!
I want to remove the subtotal and total field from the cart/emails etc and instead display there the product quantity amount.
Is this possible?
Thank you
Please Log in or Create an account to join the conversation.
3 years 3 weeks ago #354921
by nicolas
Replied by nicolas on topic Remove Cart total and display quantity instead
Hi,
Removing all that is quite easy. You can just remove the part:
in the HTML version of the emails to remove the subtotal / tax / total rows.
Then, if you want to remove the price and total price columns, you can further delete these:
Adding an extra row with the total quantity of the products in the order is more complex though.
You would need to keep the first piece of code above, and instead, modify the PHP of the preload section. There, you would have to delete the code:
and add instead the code:
and add:
before:
and add:
after that same line.
Removing all that is quite easy. You can just remove the part:
Code:
<!--{START:ORDER_FOOTER}-->
<tr>
<td class="hika_template_color {LINEVAR:CLASS}_label" colspan="{TXT:FOOTER_COLSPAN}" style="text-align:right;font-size:12px;font-weight:bold;">{LINEVAR:NAME}</td>
<td class="{LINEVAR:CLASS}_value" style="text-align:right">{LINEVAR:VALUE}</td>
</tr>
<!--{END:ORDER_FOOTER}-->
Then, if you want to remove the price and total price columns, you can further delete these:
Code:
<td class="hika_template_color" style="border-bottom:1px solid #ddd;padding-bottom:3px;text-align:right;font-size:12px;font-weight:bold;">{TXT:PRODUCT_PRICE}</td>
Code:
<td class="hika_template_color" style="border-bottom:1px solid #ddd;padding-bottom:3px;text-align:right;font-size:12px;font-weight:bold;">{TXT:PRODUCT_TOTAL}</td>
Code:
<td style="border-bottom:1px solid #ddd;padding-bottom:3px;text-align:right">{LINEVAR:PRODUCT_PRICE}</td>
Code:
<td style="border-bottom:1px solid #ddd;padding-bottom:3px;text-align:right">{LINEVAR:PRODUCT_TOTAL}</td>
You would need to keep the first piece of code above, and instead, modify the PHP of the preload section. There, you would have to delete the code:
Code:
if(bccomp(sprintf('%F',$data->cart->order_discount_price),0,5) != 0 || bccomp(sprintf('%F',$data->cart->order_shipping_price),0,5) != 0 || bccomp(sprintf('%F',$data->cart->order_payment_price),0,5) != 0 || ($data->cart->full_total->prices[0]->price_value!=$data->cart->full_total->prices[0]->price_value_with_tax) || !empty($data->cart->additional)){
$cartFooters[] = array(
'CLASS' => 'subtotal',
'NAME' => JText::_('SUBTOTAL'),
'VALUE' => $currencyHelper->format($subtotal,$data->cart->order_currency_id)
);
}
if(bccomp(sprintf('%F',$data->cart->order_discount_price),0,5) != 0) {
if($config->get('price_with_tax')) {
$t = $currencyHelper->format($data->cart->order_discount_price*-1,$data->cart->order_currency_id);
}else{
$t = $currencyHelper->format(($data->cart->order_discount_price-@$data->cart->order_discount_tax)*-1,$data->cart->order_currency_id);
}
$cartFooters[] = array(
'CLASS' => 'coupon',
'NAME' => JText::_('HIKASHOP_COUPON'),
'VALUE' => $t
);
}
if(bccomp(sprintf('%F',$data->cart->order_shipping_price),0,5) != 0){
if($config->get('price_with_tax')) {
$t = $currencyHelper->format($data->cart->order_shipping_price,$data->cart->order_currency_id);
}else{
$t = $currencyHelper->format($data->cart->order_shipping_price-@$data->cart->order_shipping_tax,$data->cart->order_currency_id);
}
$cartFooters[] = array(
'CLASS' => 'shipping',
'NAME' => JText::_('HIKASHOP_SHIPPING'),
'VALUE' => $t
);
}
if(bccomp(sprintf('%F',$data->cart->order_payment_price),0,5) != 0){
if($config->get('price_with_tax')) {
$t = $currencyHelper->format($data->cart->order_payment_price, $data->cart->order_currency_id);
} else {
$t = $currencyHelper->format($data->cart->order_payment_price - @$data->cart->order_payment_tax, $data->cart->order_currency_id);
}
$cartFooters[] = array(
'CLASS' => 'payment',
'NAME' => JText::_('HIKASHOP_PAYMENT'),
'VALUE' => $t
);
}
if(!empty($data->cart->additional)) {
$exclude_additionnal = explode(',', $config->get('order_additional_hide', ''));
foreach($data->cart->additional as $additional) {
if(in_array($additional->order_product_name, $exclude_additionnal))
continue;
if( (!empty($additional->order_product_price) && ($additional->order_product_price > 0) ) || empty($additional->order_product_options)) {
if($config->get('price_with_tax')){
$t = $currencyHelper->format($additional->order_product_price + @$additional->order_product_tax, $data->cart->order_currency_id);
}else{
$t = $currencyHelper->format($additional->order_product_price, $data->cart->order_currency_id);
}
} else {
$t = $additional->order_product_options;
}
$cartFooters[] = array(
'CLASS' => 'additional'.preg_replace('#[^a-z0-9_]#i','', strip_tags($additional->order_product_name)),
'NAME' => JText::_($additional->order_product_name),
'VALUE' => $t
);
}
}
if($data->cart->full_total->prices[0]->price_value!=$data->cart->full_total->prices[0]->price_value_with_tax) {
if($config->get('detailed_tax_display') && !empty($data->cart->order_tax_info)) {
foreach($data->cart->order_tax_info as $k => $tax) {
$cartFooters[] = array(
'CLASS' => 'tax_'.$k,
'NAME' => hikashop_translate($tax->tax_namekey),
'VALUE' => $currencyHelper->format($tax->tax_amount,$data->cart->order_currency_id)
);
}
} else {
$cartFooters[] = array(
'CLASS' => 'total_without_tax',
'NAME' => JText::_('ORDER_TOTAL_WITHOUT_VAT'),
'VALUE' => $currencyHelper->format($data->cart->full_total->prices[0]->price_value,$data->cart->order_currency_id)
);
}
$cartFooters[] = array(
'CLASS' => 'total_with_tax',
'NAME' => JText::_('ORDER_TOTAL_WITH_VAT'),
'VALUE' => $currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->cart->order_currency_id)
);
} else {
$cartFooters[] = array(
'CLASS' => 'total_with_tax',
'NAME' => JText::_('HIKASHOP_TOTAL'),
'VALUE' => $currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->cart->order_currency_id)
);
}
Code:
$cartFooters[] = array(
'CLASS' => 'total_quantity',
'NAME' => 'Total quantity',
'VALUE' => $quantity
);
$texts['FOOTER_COLSPAN'] = $texts['FOOTER_COLSPAN'] - 2;
Code:
$quantity = 0;
Code:
foreach($data->cart->products as $item) {
Code:
$quantity += $item->order_product_quantity;
The following user(s) said Thank You: verzevoul
Please Log in or Create an account to join the conversation.
3 years 3 weeks ago #354943
by verzevoul
Replied by verzevoul on topic Remove Cart total and display quantity instead
Hi!
Great Nicolas that works!
I would like to do it also in orders Invoices and the checkout cart.
Thank you
Great Nicolas that works!
I would like to do it also in orders Invoices and the checkout cart.
Thank you
Please Log in or Create an account to join the conversation.
3 years 3 weeks ago - 3 years 3 weeks ago #354947
by Philip
Replied by Philip on topic Remove Cart total and display quantity instead
Hello,
You have to keep the scheme provided by Nicolas, and of course adapt it in your relative context to create override view.
now for :
- Your Order Invoices => order/backend template/backend => order\invoice
- Your Checkout cart => checkout/frontend template/frontend => checkout/cart
Regards
You have to keep the scheme provided by Nicolas, and of course adapt it in your relative context to create override view.
now for :
- Your Order Invoices => order/backend template/backend => order\invoice
- Your Checkout cart => checkout/frontend template/frontend => checkout/cart
Regards
Last edit: 3 years 3 weeks ago by Philip.
The following user(s) said Thank You: verzevoul
Please Log in or Create an account to join the conversation.
Time to create page: 0.195 seconds