andrzejdlugosz Posted May 22, 2017 Share Posted May 22, 2017 Hello, Everything working fine, there is no code issues in .tpl file. I have simple if statement with: {if ($product->name)=='product1' || ($product->name)=='product2' } <!-- some text here --> {/if} But for some reason when I add another option: {if ($product->name)=='product1' || ($product->name)=='product2' || ($product->name)=='product3' } <!-- some text here --> {/if} I get below error. There is nothing wrong with coding. Maybe with file encoding? Could not find solution online. Could anyone help? Thanks for reading. [22-May-2017 12:27:17 Europe/London] PHP Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/home/gbs2/public_html/themes/autumn/product.tpl" on line 1 "{* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/license in /home/gbs2/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667 Link to comment Share on other sites More sharing options...
andrzejdlugosz Posted May 22, 2017 Author Share Posted May 22, 2017 Thanks for reply, but did not help. Same error. Link to comment Share on other sites More sharing options...
andrzejdlugosz Posted May 22, 2017 Author Share Posted May 22, 2017 As mentioned above THERE IS NO ISSUE BEFORE I add extra option in if statement (simply copied and pasted another option there) I have tried several times. File is quite long so I hopefully there is no need to see it all. Link to comment Share on other sites More sharing options...
andrzejdlugosz Posted May 22, 2017 Author Share Posted May 22, 2017 Please note I only pasted this bit below in if statement and error is pointing to beginning of product.tpl file. $product->name=='product3' Link to comment Share on other sites More sharing options...
bellini13 Posted May 22, 2017 Share Posted May 22, 2017 maybe the file encoding messed you up, especially since it is complaining about the first line of the .tpl which would appear to be comments... Link to comment Share on other sites More sharing options...
andrzejdlugosz Posted May 22, 2017 Author Share Posted May 22, 2017 i think I have checked it all. File is encoded in UTF-8. It is simple as: FILE WITHOUT PART below in if statement - no error, page loads fine. With PART below php fatal error mentioned before -page broken. Very frustrating. || ($product->name)=='product3' Link to comment Share on other sites More sharing options...
andrzejdlugosz Posted May 22, 2017 Author Share Posted May 22, 2017 Sorry, actually i had more than 24 conditions in IF statement and that was the issue. Wow. Link to comment Share on other sites More sharing options...
ypc-jack Posted May 23, 2017 Share Posted May 23, 2017 (edited) I think you can delete all code after code back up and then type in them rather than paste. you can refactor the code like: <?php if (in_array($product->name,['product1', 'product2', 'product3' ,'product4'])) { ... } Edited May 23, 2017 by ypc-jack (see edit history) Link to comment Share on other sites More sharing options...
andrzejdlugosz Posted May 23, 2017 Author Share Posted May 23, 2017 Thanks ypc-jack 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