Poppy381 Posted January 7, 2015 Share Posted January 7, 2015 Hi all I am new to the forum, For several weeks I play a little on Presta and I want to make a small personal Module. So I use the online documentation. I am training on the small module proposed "mymodule." I wonder how do you retrieve smarty variables to display in my back office. Here so I have a .php page that works very well. When picking the currency (in red in my example), the currency is not displayed. I tried different syntaxes, and then try to add the start of the global $ smarty function; The idea is not to write "€ or $ ', but to recover the variable to be adapted according to the currency of the obviously shop. If anyone can help me how one recovers these variables it would tip top because my Google search are not helpfull or must doing something wrong. Thank you Quote public function displayForm() { global $smarty; $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // Init Fields form array $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs', ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Configuration value'), 'name' => 'MYMODULE_NAME', 'size' => 20, 'prefix' => Tools::getValue($id_currency), 'required' => true ) ), Link to comment Share on other sites More sharing options...
Poppy381 Posted January 9, 2015 Author Share Posted January 9, 2015 Ok here is the answer : use a Context Object (see the Prestashop documentation) Instead of 'prefix' => Tools::getValue($id_currency), Use : 'prefix' => $this->context->currency->sign, It works. $smarty variable can't be called in a .php file, only in template (.tpl). Use context object in .php. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now