JuanTomas Posted December 11, 2015 Share Posted December 11, 2015 (edited) Solution: To retrieve a template variable that has been assigned to smarty in the context, use smarty->getTemplateVars() get_template_vars() is deprecated and unknown. Original question follows: ========================================== (Using Prestashop 1.6) ProductControllerCore has this function I want to override: protected function assignAttributesGroups() { //...do lots and lots of processing, then assign the results to smarty... $this->context->smarty->assign(array( 'groups' => $groups, 'colors' => (count($colors)) ? $colors : false, 'combinations' => $combinations, 'combinationImages' => $combination_images )); } Now here's my override: protected function assignAttributesGroups() { parent::assignAttributesGroups() ; // this next line fails with "Call of unknown method" $combinations = $this->context->smarty->get_template_vars("combinations") ; // if I could get the $combinations array, I'd add some custom fields to it, and then... $this->context->smarty->assign(array( 'combinations' => $combinations )); } According to this, get_template_vars() is a legitimate smarty method: http://www.smarty.net/docsv2/en/api.get.template.vars.tpl But it's unknown here for some reason. My new assignment overrides the one in the parent class. But that just breaks stuff, because the original contents of the array are lost. Is there a way for me to get a copy of the $combinations array in this override? Edited December 11, 2015 by JuanTomas (see edit history) 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