missill Posted April 22, 2016 Share Posted April 22, 2016 Hello everybody, I'd like to put custom fields of customer with custom fields plugin in the index.tpl. Do i override IndexController or Customer class and how to affect value ? Thanks for helping me. Link to comment Share on other sites More sharing options...
shokinro Posted April 25, 2016 Share Posted April 25, 2016 I think you will need to override Customer class so that you will be able to handle the new custom fields. then use the customer object to load data and then display in your index.tpl via Smarty variable or $this->context->customer in IndexController.php 1 Link to comment Share on other sites More sharing options...
missill Posted April 25, 2016 Author Share Posted April 25, 2016 Hi shokinro and thanks to answer me ! I tried to do what you recommend me and it works fine !!! I overrided Customer class and added a new function to get my new custom field value from the database. In my index.tpl, i do this : {assign var='myvariable' value=Context::getContext()->customer->getMyvariable()} I could assign my variable directly from my class Customer in a smarty variable. I don't know what the best solution but it works Thanks. Link to comment Share on other sites More sharing options...
shokinro Posted April 25, 2016 Share Posted April 25, 2016 I am glad the problem is resolved. thanks for update yes you are right you can also assign variables via theme file, it does not matter. It is just personal preference to do that in PHP or theme file. 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