bigin / ItemManager_2.0

ItemManager (IM) is a simple flat-file framework for GetSimple-CMS that allows you to develop completely customizable PHP applications bundled with GetSimple-CMS.
MIT License
5 stars 3 forks source link

Money field problem #10

Closed mittus closed 6 years ago

mittus commented 6 years ago

If I have empty value, I can't save item and I see "Error: Invalid value format for the Fieldtype NAME"

bigin commented 6 years ago

This issue should be fixed on development branch by 6cfbbd4. You can also patch your files: /plugins/imanager/lib/processors/inputs/InputMoney.php and /plugins/imanager/lib/processors/fields/FieldMoney.php - Please check if this works.

PS. I also implemented new methods to format the output of the money field, here's an example:

$imanager = imanager();
// Change it to your category id
$imanager->getItemMapper()->alloc(5);
// change to your item id
$item = $imanager->getItemMapper()->getSimpleItem(1);

// Output float
echo $item->money;

// Money format
//echo FieldMoney::toMoneyFormatRaw($item->money);

// Money format with notation
//echo FieldMoney::toMoneyFormatRaw($item->money, 'French notation');

// Money format with currency
//echo FieldMoney::toMoneyFormat($item->money, '£');

// Money format with currency and notation
// echo FieldMoney::toMoneyFormat($item->money, '€', 'German notation');
mittus commented 6 years ago

Now It works!

bigin commented 6 years ago

thx