News:

Support the VirtueMart project and become a member

Main Menu

Shipping cost 0 not visible in cart

Started by gba, January 25, 2018, 15:10:24 PM

Previous topic - Next topic

gba

Hi all!
I noticed, that the shipping costs are rendered empty, if the value is 0 ():
$this->currencyDisplay->createPriceDiv ('salesPriceShipment', '', $this->cart->cartPrices['salesPriceShipment'], FALSE);
Why?
And how can I make VM render 0,00 [CurrSign] instead?
Thanks a lot in advance for any useful hint!
Kind regards,
Gerald

Jörgen

Try something like 0,0001

Regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

gba

Wow - how ugly! ;D
But it seems to work.
Couldn't this cause rounding problems somewhere?
And most interesting:
Why does VM take the decision to display no amount at all on a price being 0 - shouldn't the layout creator be able to decide that?

AH

#3
Yes it is a shame that there is not a choice to display 0

This is controlled by :

\administrator\components\com_virtuemart\plugins\vmpsplugin.php

protected function getPluginHtml ($plugin, $selectedPlugin, $pluginSalesPrice) {


if ($pluginSalesPrice) {

existing code


} else { //added this custom element to deal with shipping free.
         $costDisplay = '<span class="zero_' . $this->_type . '_cost">0.00</span>';
      }


I added the "else" clause
Regards
A

Joomla 4.4.5
php 8.1

gba

Hi!
Thank you for that hack.
Actually I am not fond of core hacks as they mean big expense updating VM.
What does the VM team think about that issue?

Jörgen

Hello

If You make the "cost" small enough it will not show. Rounding to 2 decimals makes sure of that.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

AH

@joergens solution does function

But a value for shipping will be stored for shipping charges in your tables

I personally don't like doing this as the value gets passed to our accounting platform and reported - no matter how small
Regards
A

Joomla 4.4.5
php 8.1