Jump to content

Recommended Posts

Всем привет!Пытаюсь вывести картинки категорий так как на скине!Сделал вот такой ocmod для версии OpenCart 3.0.2
<?xml version="1.0" encoding="utf-8"?>
<modification>
<code>categoryimage</code>
<name>Category Image</name>
<version>1.0</version>
<author>Alien</author>
<link></link>
<file path="catalog/controller/common/menu.php">
<operation error="skip">
<search><![CDATA[
foreach ($categories as $category) {
if ($category['top']) {
// Level 2
$children_data = array();

$children = $this->model_catalog_category->getCategories($category['category_id']);

foreach ($children as $child) {
$filter_data = array(
'filter_category_id' => $child['category_id'],
'filter_sub_category' => true
)
]]></search>
<add position="after"><![CDATA[
if ($category['image']) {
$category_thumb = $this->model_tool_image->resize($category_info['image'], 300, 300);
} else {
$category_thumb = '';
}]]></add>
</operation>
<operation error="skip">
<search><![CDATA['name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),]]></search>
<add position="after"><![CDATA['thumb' => $category_thumb,]]></add>
</operation>
</file>
<file path="catalog/view/theme/beetrendy/template/common/menu.twig">
<operation error="skip">
<search><![CDATA[<a href="{{ category.href }}" class="see-all">{{ text_all }} {{ category.name }}</a> </div>]]></search>
<add position="after"><![CDATA[{% if category.thumb %}<img src="{{ category.thumb }}">]]></add>
</operation>
</file>
</modification>
Но после установки выбивает вот такую ошибку
Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30Notice: Undefined variable: category_thumb in C:\Users\Alien\Desktop\OSPanel\storage\modification\catalog\controller\common\menu.php on line 30
Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected "endfor" tag (expecting closing tag for the "if" tag defined near line 11) in "beetrendy/template/common/menu.twig" at line 26.' in C:\Users\Alien\Desktop\OSPanel\domains\beetrendy.loc\system\library\template\Twig\Parser.php:172 Stack trace: #0 C:\Users\Alien\Desktop\OSPanel\domains\beetrendy.loc\system\library\template\Twig\TokenParser\If.php(34): Twig_Parser->subparse(Array) #1 C:\Users\Alien\Desktop\OSPanel\domains\beetrendy.loc\system\library\template\Twig\Parser.php(187): Twig_TokenParser_If->parse(Object(Twig_Token)) #2 C:\Users\Alien\Desktop\OSPanel\domains\beetrendy.loc\system\library\template\Twig\TokenParser\For.php(40): Twig_Parser->subparse(Array) #3 C:\Users\Alien\Desktop\OSPanel\domains\beetrendy.loc\system\library\template\Twig\Parser.php(187): Twig_TokenParser_For->parse(Object(Twig_Token)) #4 C:\Users\Alien\Desktop\OSPanel\domains\beetrendy.loc\system\library\template\Twig\TokenParser\If.php(34): Twig_Parser->subparse(Array) #5 C in C:\Users\Alien\Desktop\OSPanel\domains\beetrendy.loc\system\library\template\Twig\Parser.php on line 172
Посогите плиз решить проблему.

Безымянный.png

Share this post


Link to post
Share on other sites
14 минут назад, MaxBeauty сказал:

<search><![CDATA[

разве не одной строчке поиск идёт? Измените для <file path="catalog/controller/common/menu.php"> значение для поиска на какую нибудь одну строчку, которая уникальна

Share this post


Link to post
Share on other sites

в menu.twig ошибка

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.