1

I am a newbie to opencart. I want to create an extra field in catalog section of admin panel. I have made an ocmod file which will find a div with specific id and after that adds a span for now. Actually I wanted an file upload button.

Below is my install.xml code

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Catalogupload</name>
    <version>1.0</version>
    <author>Rishi</author>
    <link>https://www.sarvadaa.com</link>
    <code>Upload catalog file</code>
    <file path="admin/view/template/catalog/information_form.twig">
        <operation>
            <search><![CDATA[
            <div class="tab-pane" id="tab-seo">
            ]]></search>
            <add position="before"><![CDATA[<span id="rishi">Hello</span>]]></add>
        </operation>
    </file>
</modification>

The zip file name is catalogupload.ocmod.zip.

It isn't showing any effect on admin panel.

When I look at the ocmod.log file from storage the below shows up which I dont have any idea of.

2021-06-02 6:16:25 - MOD: Modification Default

FILE: system/engine/action.php
REGEX: ~(require|include)(_once)?\(([^)]+)~
LINE: 69

FILE: system/engine/loader.php
REGEX: ~(require|include)(_once)?\(([^)]+)~
LINE: 77
LINE: 151
LINE: 168

FILE: system/library/config.php
REGEX: ~(require|include)(_once)?\(([^)]+)~
LINE: 59

FILE: system/library/language.php
REGEX: ~(require|include)(_once)?\(([^)]+)~
LINE: 67
LINE: 73

FILE: system/library/template/template.php
REGEX: ~(require|include)(_once)?\(([^)]+)~
LINE: 18

FILE: system/library/template/twig.php
CODE: $loader = new \Twig_Loader_Filesystem(DIR_TEMPLATE);
NOT FOUND - OPERATIONS ABORTED!
----------------------------------------------------------------
MOD: Catalogupload

FILE: admin/view/template/catalog/information_form.twig
CODE: <div class="tab-pane" id="tab-seo">
LINE: 132
----------------------------------------------------------------
MOD: OCMOD Downloader

FILE: admin/controller/marketplace/modification.php
CODE: n enable(
LINE: 550
CODE: 'modification_id' => $result['modification_id'],
LINE: 715

FILE: admin/view/template/marketplace/modification.twig
CODE: if not modification.enabled
LINE: 96
----------------------------------------------------------------

Please help me with this. What i am doing wrong here?

  • 1
    Here is an article about adding an extra field on porduct page. With category everything is same. https://stackoverflow.com/a/61368875/3187127 – focus.style Jun 02 '21 at 08:03
  • 1
    If you use OC3.0.3.6 version there can be a bug. You can try to install this free module to fix this bug... https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=40216&filter_search=twig%20fix – K. B. Jun 09 '21 at 14:39
  • You need to update the modification cache and update the cache of twig templates on Dashboard. Please see the following to understand how OpenCart allows you to modify core code without modifying the core files themselves: http://docs.opencart.com/en-gb/extension/modifications/ – opencartbot Jun 09 '21 at 13:49

1 Answers1

0

If you use the OpenCart 3.0.3.6 there is a bug to the modification.xml file.

You can install the free extension to fix this bug as well https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=40216

This will solve the problem.

Mujahid Bhoraniya
  • 1,518
  • 10
  • 22