Author Topic: Shipping cost 0 not visible in cart  (Read 917 times)

gba

  • Jr. Member
  • **
  • Posts: 290
Shipping cost 0 not visible in cart
« on: January 25, 2018, 15:10:24 pm »
Hi all!
I noticed, that the shipping costs are rendered empty, if the value is 0 ():
Code: [Select]
$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

  • Global Moderator
  • Full Member
  • *
  • Posts: 2387
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Shipping cost 0 not visible in cart
« Reply #1 on: January 25, 2018, 15:34:17 pm »
Try something like 0,0001

Regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

gba

  • Jr. Member
  • **
  • Posts: 290
Re: Shipping cost 0 not visible in cart
« Reply #2 on: January 25, 2018, 15:41:52 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2987
  • VirtueMart Version: 3.6.3
Re: Shipping cost 0 not visible in cart
« Reply #3 on: January 25, 2018, 17:45:18 pm »
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 3.9.12
php 7.2

gba

  • Jr. Member
  • **
  • Posts: 290
Re: Shipping cost 0 not visible in cart
« Reply #4 on: January 25, 2018, 19:09:29 pm »
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

  • Global Moderator
  • Full Member
  • *
  • Posts: 2387
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Shipping cost 0 not visible in cart
« Reply #5 on: January 25, 2018, 19:58:09 pm »
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.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2987
  • VirtueMart Version: 3.6.3
Re: Shipping cost 0 not visible in cart
« Reply #6 on: January 25, 2018, 21:32:33 pm »
@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 3.9.12
php 7.2