Currency signs not showing up

Discuss everything related to ApPHP Restaurant Site script.

Moderators: ne_moj, alexmst, zewa, vadimako, ne_moj, alexmst, zewa, vadimako

paragate
Master
Master
Posts: 151
Joined: Nov 13th, '14, 13:04
Location: Denmark, Odense

Currency signs not showing up

Postby paragate » Jun 30th, '15, 08:45

Hi
Have this error!
Fatal error: Cannot use object of type Currencies as array in /…… on line 54
and the code is:
$currency = Currencies::model()->getDefaultCurrencyInfo();
$this->_view->currencySymbol = isset($currency['symbol']) ? $currency['symbol'] : '';
$this->_view->currencyPlace = isset($currency['symbol_place']) ? $currency['symbol_place'] : 'after';
$this->_view->numberFormat = Bootstrap::init()->getSettings('number_format');

but i think it must be:

$this->_view->currencySymbol = isset($currency->symbol) ? $currency->symbol : '';
$this->_view->currencyPlace = isset($currency->symbol_place) ? $currency->symbol_place : 'after';
$this->_view->numberFormat = Bootstrap::init()->getSettings('number_format');

But then again

if(isset($currency->symbol) ? $currency->symbol : '');
gives set currency signs
What do you suggest?

administrator
Site Admin
Site Admin
Posts: 5981
Joined: Jan 7th, '09, 23:18
Contact:

Re: Currency signs not showing up

Postby administrator » Jul 1st, '15, 16:37

Hi!

Yes, the latest version of Framework returns object and not array, so you may need to redo your code.
In the next versions we're planning to release following syntax:
$model->findByPk(1)->toArray();

paragate
Master
Master
Posts: 151
Joined: Nov 13th, '14, 13:04
Location: Denmark, Odense

Re: Currency signs not showing up

Postby paragate » Sep 9th, '16, 07:27

As of framework 2016 think it should be

$settings = Bootstrap::init()->getSettings();
$this->_view->numberFormat = $settings->number_format;
$this->_view->currencySymbol = A::app()->getCurrency('symbol');
$this->_view->currencyPlace = A::app()->getCurrency('symbol_place');


Return to “ApPHP Restaurant Site {developers/users}”