0

我试图在 checkout->confirm 函数之后添加一些代码。我正在尝试将其添加到所有支付网关。正则表达式是:

\$this->model_checkout_order->confirm.*\);$

在 VqMod 文件中:

<file name="catalog/controller/payment/*.php">
    <operation info="In ALL payment gateways, On order confirm, generate the file and upload it">
        <search position="after" error="log" regex="true"><![CDATA[\$this->model_checkout_order->confirm.*\);$]]></search>
        <add><![CDATA[
            //added code here...
        ]]></add>
    </operation>
</file>

但是,它不起作用,只是离开

INVALID REGEX ERROR - \$this->model_checkout_order->confirm.*\);$

在 vqmod.log 文件中。

我错过了什么?

4

1 回答 1

2

正则表达式值还需要您提供正则表达式的分隔符,例如~

~\$this->model_checkout_order->confirm.*\);$~

您可以选择在末尾添加标志以不区分大小写等

编辑

你实际上可以在你的代码中做同样的事情而不用正则表达式

file name="catalog/controller/payment/*.php">
    <operation info="In ALL payment gateways, On order confirm, generate the file and upload it">
        <search position="after" error="log"><![CDATA[$this->model_checkout_order->confirm(]]></search>
        <add><![CDATA[
            //added code here...
        ]]></add>
    </operation>
</file>
于 2014-12-08T17:20:31.853 回答