Uncaught Twig_Error_Syntax: Неизвестная функция "json_encode" opencart - PullRequest
0 голосов
/ 15 декабря 2018

У меня проблема с файлом ветки в моем интернет-магазине opencart 3.0.2.0.Ошибка, которую я получил:

Uncaught Twig_Error_Syntax: неизвестная функция "json_encode" в "default / template / extension / module / messages.twig" в строке 22. в / home / mk4design / public_html /system / library / template / Twig / ExpressionParser.php: 574 Трассировка стека: # 0

Полный файл ветки находится ниже, и есть 3 строки с json_encode, которые не являются правильными.

Может ли кто-нибудь помочь мне помочь мне решить эту проблему?

<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>

1 Ответ

0 голосов
/ 21 декабря 2018

Синтаксис Twig для json - это данные | json_encode ()

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

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