Post by Marinelife » Fri Dec 13, 2019 3:49 am

Hello Team,

Kindly need your urgent support to fix this issue i'm getting on my store when a customer trying to register it's showing Error 500 page with this error in "error_log"

Code: Select all

[12-Dec-2019 22:44:12 Asia/Riyadh] PHP Fatal error:  Uncaught Twig_Error_Syntax: Unexpected character "$" in "default/template/account/register.twig" at line 438. in /home/SITE/public_html/system/library/template/Twig/Lexer.php:284
Stack trace:
#0 /home/SITE/public_html/system/library/template/Twig/Lexer.php(205): Twig_Lexer->lexExpression()
#1 /home/SITE/public_html/system/library/template/Twig/Lexer.php(111): Twig_Lexer->lexBlock()
#2 /home/SITE/public_html/system/library/template/Twig/Environment.php(581): Twig_Lexer->tokenize('{{ header }}\n{%...', 'default/templat...')
#3 /home/SITE/public_html/system/library/template/Twig/Environment.php(671): Twig_Environment->tokenize('{{ header }}\n{%...', 'default/templat...')
#4 /home/SITE/public_html/system/library/template/Twig/Environment.php(396): Twig_Environment->compileSource('{{ header }}\n{%...', 'default/templat...')
#5 /home/SITE/storage/modification/system/library/template/twig.php(59): Twig_Environment->loadTemplate('default/templat...')
#6 /home/SITE/storage/modific in /home/SITE/public_html/system/library/template/Twig/Lexer.php on line 284
OC v3.0.2.0
Your help would be much appreciated.

User avatar
New member

Posts

Joined
Fri Aug 25, 2017 7:13 am
Location - Jeddah

Post by by mona » Fri Dec 13, 2019 4:19 am

There is no line 438 on default/template/account/register.twig ..
So - you have added some hard code, I suspect you have added php instead of twig and the error is on line 438

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by xxvirusxx » Fri Dec 13, 2019 4:59 am

Marinelife wrote:
Fri Dec 13, 2019 3:49 am
Unexpected character "$" in "default/template/account/register.twig" at line 438.
Check what ocmod extension made changes in that files

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Marinelife » Fri Dec 13, 2019 5:27 am

xxvirusxx wrote:
Fri Dec 13, 2019 4:59 am
Marinelife wrote:
Fri Dec 13, 2019 3:49 am
Unexpected character "$" in "default/template/account/register.twig" at line 438.
Check what ocmod extension made changes in that files
Thank you so much xxvirusxx for your suggestion. I was searching in the ocmod modification files and found the error caused from the newsletter ocmod i well inform the developer to fix the issue.

Now the store working properly.

User avatar
New member

Posts

Joined
Fri Aug 25, 2017 7:13 am
Location - Jeddah

Post by xxvirusxx » Fri Dec 13, 2019 5:34 am

You can try to search in newsletter ocmod file the sign $ and remove.
Possible he forgot to remove when converted to 3.x

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Marinelife » Fri Dec 13, 2019 5:54 am

xxvirusxx wrote:
Fri Dec 13, 2019 5:34 am
You can try to search in newsletter ocmod file the sign $ and remove.
Possible he forgot to remove when converted to 3.x
This is the code for it in the ocmod file:

Code: Select all

<file path="catalog/view/theme/*/template/checkout/register.twig">
<operation>
<search index="0"><![CDATA[name="newsletter"]]></search>
<add position="after" offset="1"><![CDATA[{% if mail_template_newsletter_status %}<div id="emailtemplate-preference">
<div class="help-block"><button type="button" class="btn btn-link btn-collapse collapsed" data-toggle="collapse" data-target="#collapse-preference" style="padding:0;"><i class="fa fa-fw"></i> {{ text_preference }}</button></div>
<div id="collapse-preference" class="collapse">
<div class="form-group row">
<div class="col-xs-12">
<div class="checkbox disabled text-muted">
<label>
<input type="checkbox" name="preference_essential" id="input_preference_essential" value="1" checked="checked" disabled="disabled" />
{{ entry_preference_essential }}</label>
</div>
{% if mail_template_newsletter_notification %}<div class="checkbox">
<label>
<input type="checkbox" name="preference_notification" id="input_preference_notification" value="1"{% if preference_notification %} checked="checked"{% endif $} />
{{ entry_preference_notification }}</label>
</div>{% endif $}
{% if mail_template_newsletter_showcase %}<div class="checkbox">
<label>
<input type="checkbox" name="preference_showcase" id="input_preference_showcase" value="1"{% if preference_showcase %} checked="checked"{% endif $} />
{{ entry_preference_showcase }}</label>
</div>{% endif $}
</div>
</div>
</div>
</div>
<style type="text/css">
.btn-collapse .fa:before {content:"\f103";}
.btn-collapse.collapsed .fa:before {content:"\f101";}
</style>
<script type="text/javascript"><!--
$('#emailtemplate-preference').each(function() {
var $emailtemplate_preference = $(this);
var $input_newsletter = $('input[name=newsletter]');
if ($emailtemplate_preference.length && $input_newsletter.length) {
$emailtemplate_preference.insertAfter($input_newsletter.parents('.checkbox'));
}
});
//--></script>{% endif $}]]></add>
</operation>
</file>

User avatar
New member

Posts

Joined
Fri Aug 25, 2017 7:13 am
Location - Jeddah

Post by xxvirusxx » Fri Dec 13, 2019 5:56 am

Change {% endif $} with {% endif %}

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Marinelife » Fri Dec 13, 2019 6:03 am

xxvirusxx wrote:
Fri Dec 13, 2019 5:56 am
Change {% endif $} with {% endif %}
Prefect,

I have changed it and enabled the ocmod file it's working properly now.
Thank you so much xxvirusxx for your assist.
I really appreciated.

User avatar
New member

Posts

Joined
Fri Aug 25, 2017 7:13 am
Location - Jeddah
Who is online

Users browsing this forum: No registered users and 370 guests