OrdaSoft forum
Welcome, Guest
Please Login or Register.    Lost Password?

VehicleManager component support

Go to bottom Favoured: 0

Price with decimal?

ftl (User)
America's #1 Virtual Dealership
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Fast Track Leasing Location: Florida
Price with decimal? 12 Years, 8 Months ago
Karma: 0  
Is it possible to display the price as $250.00 instead of $250?

We already have the '$' as the unit, so wondering what are the options.

Also what's the easiest way to remove fields like ADDRESS and LISTING TYPE, etc. without deleting in case want to go back?
Should I just use "//" marks

thanks in advance,

jon

new-car-brokers.com
Logged Logged
The administrator has disabled public write access.
admin (Admin)
Admin
Posts: 8243
graph
User Offline Click here to see the profile of this user
Re:Price with decimal? 12 Years, 8 Months ago
Karma: 101  
Hi Jon,

For Price we use 2 field 1- for Price 2 - for Price currency.

In first field you may add some like 25.56 in second: $
So you will take on frontend 25.56$

For add comment to PHP you need use:
/* code */
or
// code

For add comment to HTML you need use:
<!-- code -->

Thanks,
OrdaSoft team
Logged Logged
The administrator has disabled public write access.
ftl (User)
America's #1 Virtual Dealership
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Fast Track Leasing Location: Florida
Re:Price with decimal? 12 Years, 8 Months ago
Karma: 0  
Yes, I understand the 2 different fields but I realize the Price field does not allow or except .00 for some reason.

Any ideas??

Thank you for the code comments
Logged Logged
The administrator has disabled public write access.
admin (Admin)
Admin
Posts: 8243
graph
User Offline Click here to see the profile of this user
Re:Price with decimal? 12 Years, 8 Months ago
Karma: 101  
For show Price like 123.00 (with two zero at end )

You need go to file:
{yours site}/com_vehiclemanager/vehiclemanager.class.php

and replace code
Code:

$this->price=floatval(preg_replace('/[s,]/','',$this->price));


to code
Code:

    $this->price = preg_replace("/,/",".",$this->price);  
    $this->price= preg_replace('/[s,]/','',$this->price);

    if ((float) $this->price ) :
        $val = round((float) $this->price, 2 );
        list($a, $b) = explode('.', $val);
        if (strlen($b) < 2 ) $b = str_pad($b, 2, '0', STR_PAD_RIGHT);
        $this->price = "$a.$b" ;
    else : // do whatever you want with values that do not have a float
        $this->price;
    endif; 



Thanks,
OrdaSoft team
Logged Logged
The administrator has disabled public write access.
ftl (User)
America's #1 Virtual Dealership
Junior Boarder
Posts: 21
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Fast Track Leasing Location: Florida
Re:Price with decimal? 12 Years, 8 Months ago
Karma: 0  
That worked. Perfect!

One other question:

The year of issue stops at 2011. How do you add/extend to 2012??

Much appreciated,

jon
Logged Logged
The administrator has disabled public write access.
admin (Admin)
Admin
Posts: 8243
graph
User Offline Click here to see the profile of this user
Re:Price with decimal? 12 Years, 8 Months ago
Karma: 101  
For set YEAR in vehicle manager to 2012(next year after now) you need open file:

{yours site}/administrator/components/com_vehiclemanager/admin.vehiclemanager.html.php


and find and replace code
Code:

for($i= 0;$num<=date('Y');$i++)

to code
Code:

for($i= 0;$num<=date('Y')+1;$i++)


Thanks,
OrdaSoft team
Logged Logged
The administrator has disabled public write access.
Go to top
»