Login or create new account.

By registering on joomprod.com, you will have immediate access to all our free products and to the public side of our support forum.

Enjoy our subscriptions.

Each of our subscriptions allow you to enjoy the private side of the support forum and all the update of our products for a period ranging from 3 months to 1 year.

Payment And immediate download.

After subscribing to one of our subscription, the products are immediately downloadable.

Login

Or Register
Accueil / forum / Public Forum / Main Forum / change the type of field for price

Support Availability Because we must sleep sometimes

Working days: Monday to Friday.
Reply time: Depending on the complexity of your support issue it's usually between a few hours to 48 hours.

Support is only guaranteed to paid subscribers

AdsManager - End of life

It is with great regrets that we have chosen to end the developpement of Adsmanager and its other associated components.

AdsManager is born 10 years ago and, as of today, the number of new subscriptions and downloads have fallen and we cannot maintain the component anymore.

All active subscribers will be able to continue enjoying support until the end of their subscription.

The components will be free and no support will be provided anymore for the other users.

×

Notice

The forum is in read only mode.

× OLD Forum post could be checked here : forum.joomprod.com

change the type of field for price

More
8 years 7 months ago #21997 by francota
change the type of field for price was created by francota
Hello
I have a problem with the field price in the my website...better my users don't understand how to use "." and "," for cents and thousands.
Hovever I wast thinking to change the type of the field from price to text field, in this way they can write 1,000.00 or 1.000,00 without problem.
If i change the type of the field couold I have problem with ads already published??

THanks
FRank
More
8 years 6 months ago #22019 by juloaadmin
Replied by juloaadmin on topic change the type of field for price
No problem to change the type of the field. But they will have to enter € or $ manually.

if you want to change behavior about allow characters
you can edit helpers/field.php

case 'price':
if ($field->editable == 0)
$read_only = "readonly=true";
else
$read_only = "";

if ($field->required == 1) {
$input = "<input class='adsmanager_required form-control' required id='f$name' type='number' test='number' name='$name' size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n";
} else {
$input = "<input class='adsmanager form-control' id='f$name' type='number' name='$name' test='number' size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n";
}


replace type="number" by type="text", this will allowed all characters
More
8 years 6 months ago #22034 by francota
Replied by francota on topic change the type of field for price
Thank fro your answer and you are right...I forgot about the symbol of € or $ :unsure:
If I let the field price, there is a way to permit the users to use "."or "," it in the position that they want for thousad or cents??

Thanks
FRank
More
8 years 6 months ago #22051 by juloaadmin
Replied by juloaadmin on topic change the type of field for price
Yes, use the code I gave you, replace type="number" by type="text" and remove test='number'
More
8 years 6 months ago - 8 years 6 months ago #22082 by francota
Replied by francota on topic change the type of field for price
hello I did some test with your code but without succes :(
I changed the original code in this way
case 'price':
				if ($field->editable == 0)
					$read_only = "readonly=true";
				else
					$read_only = "";
 
                if ($field->required == 1) {
					$input = "<input class='adsmanager_required form-control' required id='f$name' type='text'   name='$name' size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n"; 
                } else {
					$input = "<input class='adsmanager form-control' id='f$name' type='text' name='$name'   size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n";
But now if I put in the price field, example 1,024 the result after publishing is 1,24 same before :blush:
What wrong??
Thanks frank
Last edit: 8 years 6 months ago by francota.
More
8 years 6 months ago #22093 by juloaadmin
Replied by juloaadmin on topic change the type of field for price
You will have to change also in showFieldValue

case 'price':
if (($value !== "")&&($value !== null)) {
if($options == null || !isset($options->currency_symbol) || $options->currency_symbol == '')
$price = sprintf(TText::_('ADSMANAGER_CURRENCY'),number_format(floatval($value), 2, '.', ' '));
else
$price = $this->formatPrice($value, $options);
//for Right to Left language
$return .= str_replace(" ","&nbsp;",$price);
}
break;


replace by :

case 'price':
if (($value !== "")&&($value !== null)) {
if($options == null || !isset($options->currency_symbol) || $options->currency_symbol == '')
$price = sprintf(TText::_('ADSMANAGER_CURRENCY'),$value);
Moderators: perry
Time to create page: 0.353 seconds
Powered by Kunena Forum