Author Topic: [Virtuemart 2.0.6] show zero prices  (Read 5297 times)

jenjis

  • Beginner
  • *
  • Posts: 2
[Virtuemart 2.0.6] show zero prices
« on: October 03, 2012, 15:13:15 pm »
Hi,
how can i show in product details the value "0"?
when the product has no price set, the price div shows no information!

and, please, someone can say me where is the createPriceDiv function?

Thanks

sleepigrl

  • Jr. Member
  • **
  • Posts: 50
Re: [Virtuemart 2.0.6] show zero prices
« Reply #1 on: October 03, 2012, 16:05:21 pm »
I'm interested in this as well.  I have some products where the price is determined entirely by the options chosen in custom fields.  The price is correct when added to the cart, but the user can't see it on the product details view.

sleepigrl

  • Jr. Member
  • **
  • Posts: 50
Re: [Virtuemart 2.0.6] show zero prices
« Reply #2 on: October 03, 2012, 16:49:41 pm »
Found it!

The createpricediv function is in administrator/components/com_virtuemart/helpers/currencydisplay.php

I changed two lines there and am able to display a zero price (or leave the price blank until custom field prices are chosen).

This line (360) prevents the price div from being created if the price is empty (0 = empty/false):
Code: [Select]
if(empty($product_price)) return '';
changed to:
Code: [Select]
//if(empty($product_price)) return '';



@line 387 there is another check for an empty price:
Code: [Select]
if(!empty($price)){
$vis = "block";
$priceFormatted = $this->priceDisplay($price,0,(float)$quantity,false,$this->_priceConfig[$name][1] );
} else {
$priceFormatted = '';
$vis = "none";
}

I modified this to show the price block in either case:

Code: [Select]
if(!empty($price)){
$vis = "block";
$priceFormatted = $this->priceDisplay($price,0,(float)$quantity,false,$this->_priceConfig[$name][1] );
} else {
$priceFormatted = '';
$vis = "block";
}

I also experimented with changing the $priceFormatted value to something like $priceFormatted ='$0.00', which worked fine, but since I don't actually need to show the zero price (just the price with the included options), I'm leaving it as is for now.

Seems like it would really be better to check to see whether the product_price is NULL rather than "empty."  I think that would allow zero prices to be shown.

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26992
  • Always on vacation
    • Jenkin Hill Internet
Re: [Virtuemart 2.0.6] show zero prices
« Reply #3 on: October 03, 2012, 23:35:37 pm »
All I do is set the product price to 0.00 - the the product price displays as zero. No need to hack any files.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.4.0.9935 on Joomla 3.8.12 PHP 7.0.31
Testing VM 3.4.0.9941 on Joomla 3.8.12

sleepigrl

  • Jr. Member
  • **
  • Posts: 50
Re: [Virtuemart 2.0.6] show zero prices
« Reply #4 on: October 03, 2012, 23:41:22 pm »
Jenkinhill, what version of VM are you using? 

For me, using VM 2.0.10, putting a zero in the product price has one of two effects:
  • If "Call for Price" is turned on in config, I see that
  • If "Call for Price" is turned off, I don't see any price and the price div isn't created at all.

In addition, in the default template, the "Add to Cart" button does not show for products with a zero price.  That's easy enough to fix via template override. 

Are you using a template override to show the zero price?  If so, can you tell me what field you're using? 


jenjis

  • Beginner
  • *
  • Posts: 2
Re: [Virtuemart 2.0.6] show zero prices
« Reply #5 on: October 08, 2012, 13:07:28 pm »
Found it!

The createpricediv function is in administrator/components/com_virtuemart/helpers/currencydisplay.php

I changed two lines there and am able to display a zero price (or leave the price blank until custom field prices are chosen).

[...]

Thank you!
you've been very helpful! :D


however in 2.0.6 the solution is a bit different:

in administrator/components/com_virtuemart/helpers/currencydisplay.php

the line to comment is 719
Code: [Select]
//if(empty($product_price)) return '';
and the second block is at line 767.

furthermore in components/com_virtuemart/views/productdetails/tmpl/default.php
the line 421
Code: [Select]
if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices)) {
has to become

Code: [Select]
if (!VmConfig::get('use_as_catalog', 0)) {


Bye!!!

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: [Virtuemart 2.0.6] show zero prices
« Reply #6 on: November 06, 2012, 07:18:20 am »
All I do is set the product price to 0.00 - the the product price displays as zero. No need to hack any files.

Sadly, that doesnt work.

IT doesnt take if we put 0.
Blissful!

laytintudong

  • Beginner
  • *
  • Posts: 1
    • Auto update website content
Re: [Virtuemart 2.0.6] show zero prices
« Reply #7 on: November 06, 2012, 08:02:40 am »
Ok, thanks
<a href="http://hocseohanoi.com">Auto update website content, E-content joomla,  Manual e-content</a>

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: [Virtuemart 2.0.6] show zero prices
« Reply #8 on: November 06, 2012, 08:04:35 am »
Found it!

The createpricediv function is in administrator/components/com_virtuemart/helpers/currencydisplay.php

I changed two lines there and am able to display a zero price (or leave the price blank until custom field prices are chosen).

[...]

Thank you!
you've been very helpful! :D


however in 2.0.6 the solution is a bit different:

in administrator/components/com_virtuemart/helpers/currencydisplay.php

the line to comment is 719
Code: [Select]
//if(empty($product_price)) return '';
and the second block is at line 767.

furthermore in components/com_virtuemart/views/productdetails/tmpl/default.php
the line 421
Code: [Select]
if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices)) {
has to become

Code: [Select]
if (!VmConfig::get('use_as_catalog', 0)) {


Bye!!!

YOU ARE AWESOME!! THAT HACK WORKED PERFECT.
Blissful!

stresskills

  • Beginner
  • *
  • Posts: 19
    • My work from HB
Re: [Virtuemart 2.0.6] show zero prices
« Reply #9 on: February 28, 2014, 01:06:34 am »
Found it!

The createpricediv function is in administrator/components/com_virtuemart/helpers/currencydisplay.php

I changed two lines there and am able to display a zero price (or leave the price blank until custom field prices are chosen).

[...]

Thank you!
you've been very helpful! :D


however in 2.0.6 the solution is a bit different:

in administrator/components/com_virtuemart/helpers/currencydisplay.php

the line to comment is 719
Code: [Select]
//if(empty($product_price)) return '';
and the second block is at line 767.

furthermore in components/com_virtuemart/views/productdetails/tmpl/default.php
the line 421
Code: [Select]
if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices)) {
has to become

Code: [Select]
if (!VmConfig::get('use_as_catalog', 0)) {


Bye!!!

YOU ARE AWESOME!! THAT HACK WORKED PERFECT.

Anyone know how to do this for 2.0.24 or current version by chance?
"If you think you can do a thing or think you can't do a thing, you're right." Henry Ford

nordmograph

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 166
    • Nordmograph
  • VirtueMart Version: 3 on Joomla3
Re: [Virtuemart 2.0.6] show zero prices
« Reply #10 on: March 14, 2016, 12:37:45 pm »
Old topic, but I needed it for VM3.0.12, so here it is
in administrator/components/com_virtuemart/helpers/currencydisplay.php

replace
Code: [Select]
if(!empty($price) or $name == 'billTotal' or $name == 'billTaxAmount'){with
Code: [Select]
// if(!empty($price) or $name == 'billTotal' or $name == 'billTaxAmount'){
and

Code: [Select]
/* } else {
                $priceFormatted = '';
                $vis = " vm-nodisplay";
            }*/

davide81

  • Beginner
  • *
  • Posts: 5
Re: [Virtuemart 2.0.6] show zero prices
« Reply #11 on: January 11, 2018, 10:01:15 am »
Hi, I use VirtueMart 3.2.12


I made the changes for the version VM3.0.12 Posted by: nordmograph but for this version they do not work.
I still do not see prices. I noticed that if I enter 0 in the product it is not saved and the field remains empty.

Best Regards

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1720
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: [Virtuemart 2.0.6] show zero prices
« Reply #12 on: January 11, 2018, 10:39:57 am »
Hello

Try with the price 0.00005

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

davide81

  • Beginner
  • *
  • Posts: 5
Re: [Virtuemart 2.0.6] show zero prices
« Reply #13 on: January 11, 2018, 12:34:14 pm »
Hello,
yes with 0.00005 the price was shown, but in the price field I see 5.0E-5 and I need to change it in all the product manually.

I'd like to be able to view the price by leaving 0
Thank you

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1720
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: [Virtuemart 2.0.6] show zero prices
« Reply #14 on: January 11, 2018, 13:19:55 pm »
What Do You want to do ?

Where Do You want to display 0? Because I see 0.00 in my prices.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)