0

I'm trying to add a bit of code after the checkout->confirm function. I'm trying to add it to all the payment gateways. The Regex is:

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

And in the VqMod file:

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

However, it doesn't work and just leaves

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

In the vqmod.log file.

What have I missed?

Matthew
  • 65
  • 1
  • 10

1 Answers1

3

Regex values also need you to provide the delimiter of the regex, such as a ~

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

you can optionally add the flags at the end for case insensitivity etc

EDIT

You can actually just do the same thing in your code without regex

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>
Jay Gilford
  • 15,141
  • 5
  • 37
  • 56
  • Thanks but it still didn't work - SEARCH NOT FOUND (ABORTING MOD): ~\$this->model_checkout_order->confirm.*\);$~ and then with flags ~\$this->model_checkout_order->confirm.*\);$/igm~ – Matthew Dec 09 '14 at 09:53
  • As the error suggests your text you've used there doesn't exist. Also, why do you even need to use a regex for this? Just use the code I've added above – Jay Gilford Dec 09 '14 at 13:48