Skip to main content

Remove Cart total and display quantity instead

More
3 years 4 weeks ago #354919 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

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #354921 by nicolas
Hi,

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}-->
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:
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>
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:
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) ); }
and add instead the code:
Code:
$cartFooters[] = array( 'CLASS' => 'total_quantity', 'NAME' => 'Total quantity', 'VALUE' => $quantity ); $texts['FOOTER_COLSPAN'] = $texts['FOOTER_COLSPAN'] - 2;
and add:
Code:
$quantity = 0;
before:
Code:
foreach($data->cart->products as $item) {
and add:
Code:
$quantity += $item->order_product_quantity;
after that same line.
The following user(s) said Thank You: verzevoul

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #354943 by verzevoul
Hi!

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.

More
3 years 3 weeks ago - 3 years 3 weeks ago #354947 by Philip
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
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.203 seconds
Powered by Kunena Forum