Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
To make decimal prices
#1
hi,
Excuse me, this is probably a stupid question, but I would like to make decimal pricing in the offers, but in what format should I put: 1.5 or 1.5?
Thank you in advance for answering this stupid question.
Théotix
Reply
#2
--- Edit --- See my responce below. this is currently not possible.
Thanks for reading my post guys!
EddiesLife247 - YouTube Producer - THT Support Team
WEB: http://eddieslife247.co.uk/

Supporting TheHostingTool Community!

Need help, i don't mind pms but please post support questions in the general support board.
Reply
#3
And Can I make price under 1€/$ ? for exemple 0.50 is possible ?
Reply
#4
I have just tried todo the following

Quote:You would need to edit the database
go to > tht_packages
Click Edit
Edit the Additional with the following
monthly=0.5
Click Go to save changes

Unfortunatly this did not reflect on the order process.
Thanks for reading my post guys!
EddiesLife247 - YouTube Producer - THT Support Team
WEB: http://eddieslife247.co.uk/

Supporting TheHostingTool Community!

Need help, i don't mind pms but please post support questions in the general support board.
Reply
#5
Decimal prices can now be entered into the database (as of v1.2.5) but I'm not sure if that'll actually change anything.
Kevin Mark - TheHostingTool Lead Developer
Reply
#6
As of r316 invoice amounts are now treated as floating-point numbers.
Kevin Mark - TheHostingTool Lead Developer
Reply
#7
(02-02-2013, 07:41 PM)Kevin Wrote: As of r316 invoice amounts are now treated as floating-point numbers.

When I set it at 1.95 it removes the dot and becomes 195 dollar. Instead of 1.95 dollar.
Reply
#8
This is in v1.2.5? Clear your cache. I can confirm this works on Chrome and Firefox.
/includes/javascript/misc.js should look something like this:
Code:
function onlyNumbers(evt)
{
    var e = event || evt; // for trans-browser compatibility
    var charCode = e.which || e.keyCode;

    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46)
        return false;

    return true;

}

...
Kevin Mark - TheHostingTool Lead Developer
Reply
#9
(02-03-2013, 04:08 PM)Kevin Wrote: This is in v1.2.5? Clear your cache. I can confirm this works on Chrome and Firefox.
/includes/javascript/misc.js should look something like this:
Code:
function onlyNumbers(evt)
{
    var e = event || evt; // for trans-browser compatibility
    var charCode = e.which || e.keyCode;

    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46)
        return false;

    return true;

}

...
That's exactly the same I have in the misc.js. Cleared the cache multiple times, still no good luck. Using Chrome. I think it's in the <input> form. It shouldn't be a number, just a text as you save it in the database. But make a function it doesn't include ABCDEFGH.. etc etc.

Here's a PHP function I use on some other systems of mine:
Code:
function isValidPrice($price) {
    return preg_match('/^[0-9]+(\.[0-9]+)?$/', $price);
}

- Kevin Houghton
Reply
#10
No, the input field is set to accept decimals. Browsers that don't understand the "number" field should interpret it as a text field.
<input name="monthly" type="number" step="any" id="monthly" size="5" onkeypress="return onlyNumbers();">
When exactly is the decimal not working? When you hit the period key? When you submit the form? When you submit the form (and it appears to work) and then it ended up not saving?

I can confirm it works just fine on Chrome 26.0.1397.2 and Firefox 18.0.1. Firefox doesn't understand the number field, so it makes it a normal textbox.
Kevin Mark - TheHostingTool Lead Developer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)