Hello Forum members.
in my opencart 3.0.2.0 i have a module now this module gives me an error see the code below
Uncaught Twig_Error_Syntax: Unknown "json_encode" function in "default/template/extension/module/notification.twig" at line 22. in /home/mk4design/public_html/system/library/template/Twig/ExpressionParser.php:574 Stack trace: #0 /home/public_html/system/library/template/Twig/ExpressionParser.php(351): Twig_ExpressionParser->getFunctionNodeClass('json_encode', 22)
if i check the file i see 3 lines that are not correct and they are
Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
Below the complete notification twig file, could any one help me with this error.
Thanks in advance.
<div id="fnotification-{{ module }}" class="f-notification animated">
<div class="notification-block">
{% if (notification['close_status']) %}<button class="fclose-notification">×</button>{% endif %}
<div class="notification-image">
{% if (custom_icons) %}
{% if (thumb) %}
<img src="{{ thumb }}" title="{{ title }}" alt="{{ title }}">
{% endif %}
{% else %}
<i class="fas fa {{ font_icon }}"></i>
{% endif %}
</div>
<div class="notification-text-block">
<div class="notification-title">{{ title }}</div>
<div class="notification-text"></div>
</div>
</div>
</div>
<script type="text/javascript">
$('#fnotification-{{ module }}').fNotification({
uId : {{ module }},
Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
Amount : [{{ min_amount }}, {{ max_amount }}],
Text : '{{ text }}',
// Time Duration
DelayFirstMin : '{{ delay_first }}',
DisplayTime : '{{ display_time }}',
DelayMin : '{{ delay_between }}',
AnimationEffectOpen : '{{ in_animation }}',
AnimationEffectClose : '{{ out_animation }}',
DisplayTimes : '{{ cutomer_session > 0 ? cutomer_session : 0 }}',
CloseLifetime : '{{ cookie_time }}',
// Position
position: '{{ position }}',
postionTop : {{ top != '' ? top : '' }},
postionBottom : '{{ bottom != '' ? bottom : '' }}',
postionLeft : '{{ left != '' ? left : '' }}',
postionRight : '{{ right != '' ? right : '' }}',
NotificationSound :'',
// Style
borderRadius : '{{ border_radius }}',
borderWidth : '{{ border_width }}',
borderColor : '{{ border_color }}',
backGround : '{{ bg_color }}',
TextColor : '{{ text_color }}',
LinkColor : '{{ link_color }}',
Width : '{{ popup_width }}',
Height : '{{ popup_height }}',
// Close Button Color
BtnCloseColor : '{{ close_color }}',
BtnCloseHoverColor : '{{ close_hover_color }}',
});
</script>
in my opencart 3.0.2.0 i have a module now this module gives me an error see the code below
Uncaught Twig_Error_Syntax: Unknown "json_encode" function in "default/template/extension/module/notification.twig" at line 22. in /home/mk4design/public_html/system/library/template/Twig/ExpressionParser.php:574 Stack trace: #0 /home/public_html/system/library/template/Twig/ExpressionParser.php(351): Twig_ExpressionParser->getFunctionNodeClass('json_encode', 22)
if i check the file i see 3 lines that are not correct and they are
Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
Below the complete notification twig file, could any one help me with this error.
Thanks in advance.
<div id="fnotification-{{ module }}" class="f-notification animated">
<div class="notification-block">
{% if (notification['close_status']) %}<button class="fclose-notification">×</button>{% endif %}
<div class="notification-image">
{% if (custom_icons) %}
{% if (thumb) %}
<img src="{{ thumb }}" title="{{ title }}" alt="{{ title }}">
{% endif %}
{% else %}
<i class="fas fa {{ font_icon }}"></i>
{% endif %}
</div>
<div class="notification-text-block">
<div class="notification-title">{{ title }}</div>
<div class="notification-text"></div>
</div>
</div>
</div>
<script type="text/javascript">
$('#fnotification-{{ module }}').fNotification({
uId : {{ module }},
Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
Amount : [{{ min_amount }}, {{ max_amount }}],
Text : '{{ text }}',
// Time Duration
DelayFirstMin : '{{ delay_first }}',
DisplayTime : '{{ display_time }}',
DelayMin : '{{ delay_between }}',
AnimationEffectOpen : '{{ in_animation }}',
AnimationEffectClose : '{{ out_animation }}',
DisplayTimes : '{{ cutomer_session > 0 ? cutomer_session : 0 }}',
CloseLifetime : '{{ cookie_time }}',
// Position
position: '{{ position }}',
postionTop : {{ top != '' ? top : '' }},
postionBottom : '{{ bottom != '' ? bottom : '' }}',
postionLeft : '{{ left != '' ? left : '' }}',
postionRight : '{{ right != '' ? right : '' }}',
NotificationSound :'',
// Style
borderRadius : '{{ border_radius }}',
borderWidth : '{{ border_width }}',
borderColor : '{{ border_color }}',
backGround : '{{ bg_color }}',
TextColor : '{{ text_color }}',
LinkColor : '{{ link_color }}',
Width : '{{ popup_width }}',
Height : '{{ popup_height }}',
// Close Button Color
BtnCloseColor : '{{ close_color }}',
BtnCloseHoverColor : '{{ close_hover_color }}',
});
</script>
Guess wrong usage, see https://twig.symfony.com/doc/2.x/filter ... ncode.html
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
That module is free?
You can try to contact developer.
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Attach .tpl file here. (or entire module on PM)
I will try to convert
LE. You can't download 3.x version? I see is a 3.x version
https://www.opencart.com/index.php?rout ... n_id=34464
I will try to convert
LE. You can't download 3.x version? I see is a 3.x version
https://www.opencart.com/index.php?rout ... n_id=34464
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Change
This:
To this:
This:
To this:
This:
Code: Select all
{% if (notification['close_status']) %}
{% if (custom_icons) %}
{% if (thumb) %}
Code: Select all
{% if notification.close_status %}
{% if custom_icons %}
{% if thumb %}
Code: Select all
Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
Code: Select all
Cities : {{ city|json_encode() }},
Names : {{ cname|json_encode() }},
Products : {{ products|json_encode() }},
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Who is online
Users browsing this forum: No registered users and 344 guests