soee Posted March 3, 2017 Share Posted March 3, 2017 Hi, i have fresh PrestaShop 1.7.0.5 installation. It is configured to use Polish language as default one and English was configured as the second available. When browsing shop with default language all works fine but as soon as i try to switch to English i have this error: SmartyException in smarty_internal_templatebase.php line 129: Unable to load template file '/cms/page.tpl' in smarty_internal_templatebase.php line 129 at Smarty_Internal_TemplateBase->fetch('/cms/page.tpl', null, 'layouts/layout-full-width.tpl', object(SmartyDev), false, true, false) in SmartyDev.php line 41 at SmartyDev->fetch('/cms/page.tpl', null, 'layouts/layout-full-width.tpl') in FrontController.php line 655 at FrontControllerCore->smartyOutputContent('/cms/page.tpl') in FrontController.php line 639 at FrontControllerCore->display() in Controller.php line 221 at ControllerCore->run() in Dispatcher.php line 366 at DispatcherCore->dispatch() in index.php line 28 One thing that i have observed while debugging it is that when using default language inside display() function of FrontendController.php value of $this->template passed to $this->smartyOutputContent($this->template) is set to index.tpl and after switching language it is set to /index.tpl. If i manually set $this->smartyOutputContent('index.tpl') page works for both languages. So it seems that the problem is leading slash added to template name after language is switched to English. The problem exists for any template that Smarty tries to load when shop is switched to non default language: Unable to load template file '/cms/page.tpl' Unable to load template file '/customer/authentication.tpl' etc. Any idea why this problem might exist here? PrestaShop 1.7.0.5 PHP 7.1 or 7.0 Nginx Link to comment Share on other sites More sharing options...
rocky Posted March 4, 2017 Share Posted March 4, 2017 It might be because you're using Nginx. You can try setting up a local installation using XAMPP to see if you have the same problem there. Link to comment Share on other sites More sharing options...
Yann Carpentier Posted March 7, 2017 Share Posted March 7, 2017 I have strictly same issue with a fresh install, french default language , english for secondary language. When I switch to "en" , same smarty error append. I run prestahop on Apache 2 , php 5.6 Link to comment Share on other sites More sharing options...
rocky Posted March 7, 2017 Share Posted March 7, 2017 Weird. It works fine on my XAMPP installation with PHP 7.0.13. I have 12 languages installed and no problems when switching between them. I installed PrestaShop with English though and then installed the other languages. Maybe you can reinstall in English and then add Polish? You can post a bug report on the Forge. Link to comment Share on other sites More sharing options...
soee Posted April 5, 2017 Author Share Posted April 5, 2017 We have switched to Apache and all seems to work fine. I think the problem was Nginx config. Link to comment Share on other sites More sharing options...
dorstcom Posted June 15, 2017 Share Posted June 15, 2017 Hi, We had the same problem and fixed it in Prestashop 1.7 It's in the file: /classes/Smarty/TemplateFinder.php if (is_file($dir.$locale.DIRECTORY_SEPARATOR.$tpl.$this->extension)) { // return $locale.DIRECTORY_SEPARATOR.$tpl.$this->extension; return $locale.$tpl.$this->extension; } By changing the language PS is adding a extra slash.In that case the theme-files cannot find. Kind regards, Team DORST communicatie 2 Link to comment Share on other sites More sharing options...
azmaer Posted July 25, 2017 Share Posted July 25, 2017 (edited) In 1.7.1 this problem still exist, also in newest version 1.7.2 Fresh install on XAMPP and debian apache and $dir.$locale.DIRECTORY_SEPARATOR.$tpl this outputs: string(73) "C:\xampp\htdocs\prestashop_171\PrestaShop/themes/classic/templates\\index" double slashes before index spcifically: $locale is empty and $dir outputs: "C:\xampp\htdocs\prestashop_171\PrestaShop/themes/classic/templates\" and then again is DIRECTORY_SEPERATOR it works correctly when return looks like this: return $dir.$locale.DIRECTORY_SEPARATOR.$tpl.$this->extension; OR return $tpl.$this->extension; OR return $dir.$tpl.$this->extension; OR return $locale.$tpl.$this->extension; any help how to correct this without editing core files? or maybe it's bug and there is just missing $dir in return in front of line 57 return $locale.DIRECTORY_SEPARATOR.$tpl.$this->extension; Edited July 25, 2017 by azmaer (see edit history) Link to comment Share on other sites More sharing options...
azmaer Posted October 8, 2017 Share Posted October 8, 2017 (edited) new version will cover this issue https://github.com/PrestaShop/PrestaShop/commit/120138548800cebb4ee16a38d831733c8d4285b1 Edited February 6, 2018 by azmaer (see edit history) Link to comment Share on other sites More sharing options...
Walidou123 Posted February 19, 2018 Share Posted February 19, 2018 On 15/06/2017 at 3:05 PM, dorstcom said: Hi, We had the same problem and fixed it in Prestashop 1.7 It's in the file: /classes/Smarty/TemplateFinder.php if (is_file($dir.$locale.DIRECTORY_SEPARATOR.$tpl.$this->extension)) { // return $locale.DIRECTORY_SEPARATOR.$tpl.$this->extension; return $locale.$tpl.$this->extension; } By changing the language PS is adding a extra slash. In that case the theme-files cannot find. Kind regards, Team DORST communicatie it worked for me. thank you !!! Link to comment Share on other sites More sharing options...
redcloud Posted February 22, 2018 Share Posted February 22, 2018 I have version 1.7.2.5 and I still have the same problem. Does anyone have any ideas? 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