Post by mgfkoch » Sat Dec 15, 2018 12:43 am

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>

Newbie

Posts

Joined
Sat Dec 15, 2018 12:33 am

User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by xxvirusxx » Sat Dec 15, 2018 9:24 pm

mgfkoch wrote:
Sat Dec 15, 2018 12:43 am
in my opencart 3.0.2.0 i have a module
That module is free?
You can try to contact developer.

My Extensions | OC 3.0.3.1, 3.0.2.0, 2.3.0.2 with bugs fixed | 2.3.0.2 Custom version | Buy me a beer or coffee


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by mgfkoch » Tue Dec 18, 2018 7:12 pm

It's a paid extension and the developer doesn't reply on my mails to help me. There was another php file that wasn't correct i repaired it self but de json encode error in twigfile, i don't no much about the json encode functions.

Newbie

Posts

Joined
Sat Dec 15, 2018 12:33 am

Post by xxvirusxx » Tue Dec 18, 2018 7:22 pm

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

My Extensions | OC 3.0.3.1, 3.0.2.0, 2.3.0.2 with bugs fixed | 2.3.0.2 Custom version | Buy me a beer or coffee


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm

Post by xxvirusxx » Fri Jan 04, 2019 12:05 am

Change

This:

Code: Select all

{% if (notification['close_status']) %}
{% if (custom_icons) %} 
{% if (thumb) %} 
To this:

Code: Select all

{% if notification.close_status %}
{% if custom_icons %} 
{% if thumb %} 
This:

Code: Select all

Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
To this:

Code: Select all

Cities : {{ city|json_encode() }},
Names : {{ cname|json_encode() }},
Products : {{ products|json_encode() }},

My Extensions | OC 3.0.3.1, 3.0.2.0, 2.3.0.2 with bugs fixed | 2.3.0.2 Custom version | Buy me a beer or coffee


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Who is online

Users browsing this forum: No registered users and 8 guests