powerflash Posted September 6, 2016 Share Posted September 6, 2016 I use a easy module for add custom field tab in product, the problem is that field in mysql contain html but in theme file the html is stripped, this is code that get field value public function hookProductTabContent($params) { global $smarty; $id_product = (int)Tools::getValue('id_product'); $id_lang = Context::getContext()->language->id; //Transfer the new tab content into template via smatry //( it is optional as far as the content can be assigned directly in the template) $result = Db::getInstance()->ExecuteS('SELECT custom_field, id_lang FROM '._DB_PREFIX_.'product_lang WHERE id_lang= '.$id_lang.' AND id_product = ' . (int)$id_product); if(!$result) return array(); foreach ($result as $field) { $content = $field['custom_field']; break; } $smarty->assign('productcare', $content); // Call the template containing the HTML-code of our new tab content: //return $this->display(__FILE__ , 'tpl/productTabContent.tpl'); } Link to comment Share on other sites More sharing options...
NemoPS Posted September 7, 2016 Share Posted September 7, 2016 Prestashop version? The use of globals is deprecated.Also the foreach doesn't make much sense since it only gets the content of a single entry in the results array. I also never saw a break inside foreach, I admit, what's the purpose of it supposed to be?Are you 100% sure the value is not stripped in the database already? How are you outputting to the template? Link to comment Share on other sites More sharing options...
powerflash Posted September 7, 2016 Author Share Posted September 7, 2016 (edited) ver 1.6.1.1 in the theme is simple print the var without other actions <div id="idTab4_8" class="fmeTabsClass block_hidden_only_for_screen">{$productcare}<br /> you can see backend screenshot confirm code html Edited September 7, 2016 by powerflash (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