dmartin_webimpacto Posted March 18, 2014 Share Posted March 18, 2014 Yesterday was launched the new awesome Prestashop version, and the first "bug" we found is that the Smarty Console (used to debug all the templates) was removed intentionally. /controllers/admin/AdminPerformanceController.php On the initFieldsetSmarty() function we must add to the "fields_forms" variable the next code: array( 'type' => 'radio', 'label' => $this->l('Smarty Console'), 'name' => 'smarty_console', 'values' => array( array( 'id' => 'smarty_console_2', 'value' => 2, 'label' => $this->l('Always display'), 'hint' => $this->l('This option should be used in a production environment.') ), array( 'id' => 'smarty_console_1', 'value' => 1, 'label' => $this->l('Display through URL'), 'hint' => $this->l('It should be used in a production environment when you need debug.') ), array( 'id' => 'smarty_console_0', 'value' => 0, 'label' => $this->l('Never display'), 'hint' => $this->l('Not display.') ) ) ), array( 'type' => 'text', 'label' => $this->l('Smarty Console Key'), 'name' => 'smarty_console_key' ) On the same file, search for postProcess() function and near the line 650 aprox. that start with if ($this->tabAccess['edit'] === '1'). We can see how the function update two "config" variables, SMARTY_FORCE_COMPILE y el SMARTY_CACHE, but the two for the Smarty console are missing. On the next you can find the complete code block: if ($this->tabAccess['edit'] === '1') { Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_)); Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0)); Configuration::updateValue('PS_SMARTY_CONSOLE_KEY',Tools::getValue('smarty_console_key','SMARTY_DEBUG')); Configuration::updateValue('PS_SMARTY_CONSOLE', Tools::getValue('smarty_console', 0)); $redirectAdmin = true; } /config/smarty.config.inc.php On this file we need to paste the next code block above the comment that says /* Use this constant if you want to load smarty without all PrestaShop functions */ near the 40th line. // Production mode $smarty->debugging = false; $smarty->debugging_ctrl = 'NONE'; if (Configuration::get('PS_SMARTY_CONSOLE') == _PS_SMARTY_CONSOLE_OPEN_BY_URL_) { $smarty->debugging_ctrl = 'URL'; $smarty->smarty_debug_id = Configuration::get('PS_SMARTY_CONSOLE_KEY'); } else if (Configuration::get('PS_SMARTY_CONSOLE') == _PS_SMARTY_CONSOLE_OPEN_) $smarty->debugging = true; /tools/smarty/sysplugins/smarty_internal_templatebase.php Search for the commentary // display or fetch that is near over 350 line, and change the conditional if($display), to the next code: // display or fetch if ($display || strpos($template->template_resource,'global.tpl')!==false) { If we go back to the backoffice, we can see that the options are recovered. One more thing. If we go throug "URL", once we put SMARTY_DEBUG (or what you decide), the system make a "cookie" that always open the Smarty Console. You can erase the cookie or put the next parameter on the URL: http://ourshop.com/?SMARTY_DEBUG=off 8 Link to comment Share on other sites More sharing options...
sadlyblue Posted May 5, 2014 Share Posted May 5, 2014 Thanks for the guide. Do you know why they removed smarty_debug? Link to comment Share on other sites More sharing options...
vekia Posted May 5, 2014 Share Posted May 5, 2014 ... other way to active console just use {debug} code for example in header.tpl file located in your theme 4 Link to comment Share on other sites More sharing options...
sadlyblue Posted May 5, 2014 Share Posted May 5, 2014 ... other way to active console just use {debug} code for example in header.tpl file located in your theme Sometimes i use that one, on a test shop and inside the tpl to check which variables are availble. If on the real shop, i prefer the SMARTY_DEBUG option, this way won't show for all users, and it's easier. Link to comment Share on other sites More sharing options...
sadlyblue Posted July 17, 2014 Share Posted July 17, 2014 Thanks for the guide. I still have one problem. Smarty_debug doesn't open a new window, only writes the variables at the bottom of the page. Link to comment Share on other sites More sharing options...
Hitmark7 Posted July 31, 2014 Share Posted July 31, 2014 ... other way to active console just use {debug} code for example in header.tpl file located in your theme This method doesn't show a pop up window like it used to do on previous PrestaShop versions; it just writes some difficult to read code into the HTML. I do the maintenance for several stores, and the dmartin_webimpacto system is too laborious for me. Any idea for recovering the pop up window more easily? Link to comment Share on other sites More sharing options...
libel Posted August 7, 2014 Share Posted August 7, 2014 Thanks for the guide. I still have one problem. Smarty_debug doesn't open a new window, only writes the variables at the bottom of the page. same problem with {debug} in the template... anyone have an idea ? Link to comment Share on other sites More sharing options...
phili_b Posted August 7, 2014 Share Posted August 7, 2014 (edited) same problem with {debug} in the template... anyone have an idea ? From http://forge.prestashop.com: Issue PS1.6 PSCSX-2651,30/7/2014, debug console writes directly in page Mainly : The popup window started working as expected when I toggled "Move Javascript to the end" to ON in BO > Advanced Parameters > Performance. and 3 others minors changes written in the issue. Edited August 7, 2014 by phili_b (see edit history) 1 Link to comment Share on other sites More sharing options...
PuntoSex Posted August 22, 2014 Share Posted August 22, 2014 my theme doesn't work well with js at the end. will try the commit to see if it works any way... Link to comment Share on other sites More sharing options...
ircykk Posted January 29, 2015 Share Posted January 29, 2015 (edited) Sometimes i use that one, on a test shop and inside the tpl to check which variables are availble. If on the real shop, i prefer the SMARTY_DEBUG option, this way won't show for all users, and it's easier. You can just {if isset($smarty.get.debug)}{debug}{/if} and in url add domain.com?debug Edited January 29, 2015 by ircykk (see edit history) Link to comment Share on other sites More sharing options...
Enrique Gómez Posted February 6, 2015 Share Posted February 6, 2015 (edited) my theme doesn't work well with js at the end. will try the commit to see if it works any way... For me worked taking into account another tpl so the script for the popup works fine instead of if ($display || strpos($template->template_resource,'global.tpl')!==false) { For example if ($display || strpos($template->template_resource,'blockmyaccountfooter.tpl')!==false) { Edited February 6, 2015 by Enrique Gómez (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts