show price without discount

  • Posts: 5
  • Thank you received: 1
2 weeks 3 days ago #308223

-- HikaShop version -- : 4.1
-- Joomla version -- : 3.9

Hello,
I am trying to display the price without discount in the checkout, for this I he¡avre edited
checkout / show_block_cart.php view and added a new line like this:

<td class="hikashop_cart_subtotal_value" data-title="<?php echo JText::_('SUBTOTAL'); ?>">
<span class="hikashop_checkout_cart_subtotal"><?php
echo $this->currencyClass->format(@$cart->total->prices[0]->price_value_without_discount,@$cart->total->prices[0]->price_currency_id);
?></span>
</td>

The problem is that always get 0€ in this field

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

  • Posts: 66303
  • Thank you received: 9727
  • MODERATOR
2 weeks 2 days ago #308225

Hi,

The price_value_without_discount on the total of the cart is the price without coupon applied. And if you don't have any coupon applied it is not set.
The total of the cart without discounts is not calculated anywhere, so you would have to calculate it in your custom code I'm afraid by looping on the $cart->products array.

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

  • Posts: 5
  • Thank you received: 1
2 weeks 2 days ago #308246

Thanks Nicolas I will try...

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

  • Posts: 5
  • Thank you received: 1
2 weeks 1 day ago #308279

Finally I think I get it:

$price_without_discount = 0;
foreach($cart->products as $i => $product) {

if(empty($product->cart_product_quantity))
continue;
if($group && !empty($product->cart_product_option_parent_id))
continue;

$price_without_discount += $product->prices[0]->price_value_without_discount;
}

Last edit: 2 weeks 1 day ago by fernandoIncerco.
The following user(s) said Thank You: nicolas

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

Time to create page: 0.061 seconds
Powered by Kunena Forum