userlond
userlond

Reputation: 3826

Opencart OCMod how to apply modifications to all .php files in all directories

When I need to apply modifications to one file, I use the code below:

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Modification name</name>
    <file path="system/library/cart/cart.php">
        <operation>
            <search><![CDATA[<some code to apply>]]></search>
            <add position="after"><![CDATA[// <some code to apply>]]></add>
        </operation>
    </file>
<modification>

Target file is set via path attribute of file tag.

How to apply modifications to all .php files? I've tried with no luck the code below:

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Modification name</name>
    <file path="**/*.php">
        <operation>
            <search><![CDATA[<some code to apply>]]></search>
            <add position="after"><![CDATA[// <some code to apply>]]></add>
        </operation>
    </file>
<modification>

Upvotes: 0

Views: 563

Answers (2)

NYC
NYC

Reputation: 21

According to https://github.com/opencart/opencart/wiki/Modification-System

Please note that all file paths must start with either admin, catalog or system

Maybe give this a try

<file path="system/*/*/*.php">

where /*/*/ is the path to where all the php files that you wish to include

Upvotes: 0

K. B.
K. B.

Reputation: 1430

To apply for all themes (directory) and one file example:

<file path="catalog/view/theme/*/template/extension/payment/cod.twig>

To apply for all themes (directory) and several files example:

<file path="catalog/view/theme/*/template/extension/payment/{cod,bank_transfer,cheque}.twig>

I do not think that you need to apply for all files the same things in OCMOD

Upvotes: 0

Related Questions