davidvrodrigues / vqmod

Automatically exported from code.google.com/p/vqmod
0 stars 0 forks source link

Replacing two lines only! #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
NOTE THAT THIS IS FOR VQMOD ENGINE ERRORS ONLY. FOR GENERAL ERRORS FROM
MODIFICATIONS CONTACT YOUR DEVELOPER

What steps will reproduce the problem?
adding offset="1" to replace two lines, doesn't seem to work!
example:
<search position="replace" offset="1">

What is the expected output? What do you see instead?
Nothing being replaced!
Not the first line, nor the second.

vQmod Version: 2.4.1
Server Operating System: linux (from godaddy.com)

Please provide any additional information below.
What if I want to replace two lines only? I need offset to be 1, Right?
Well, this is not working. But I have no problems when offset > 1.

Original issue reported on code.google.com by doo...@gmail.com on 21 Oct 2013 at 10:13

GoogleCodeExporter commented 8 years ago
This works fine. Example

<?xml version="1.0" encoding="UTF-8"?>
    <modification>
        <id>Test</id>
        <version>1.0.0</version>
        <vqmver>2.1.6</vqmver>
        <author>vQmod</author>

        <file name="catalog/controller/common/header.php">
            <operation>
                <search position="replace" offset="4"><![CDATA[if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {]]></search>
                <add><![CDATA[$this->data['logo'] = '';]]></add>
            </operation>
        </file>

    </modification>

Original comment by DJG6...@gmail.com on 26 Oct 2013 at 9:51

GoogleCodeExporter commented 8 years ago
Ok, now try setting offset = 1, not 4

Original comment by doo...@gmail.com on 26 Oct 2013 at 11:43

GoogleCodeExporter commented 8 years ago
That produces a php error with the code above, but the vQmod itself is working 
just fine. For example, changing it to

        <file name="catalog/controller/common/header.php">
            <operation>
                <search position="replace" offset="1"><![CDATA[if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {]]></search>
                <add><![CDATA[if(false) {]]></add>
            </operation>
        </file>

Works as expected, changing
        if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
            $this->data['logo'] = $server . 'image/' . $this->config->get('config_logo');
        } else {
            $this->data['logo'] = '';
        }   

to

        if(false) {

        } else {
            $this->data['logo'] = '';
        }   

Original comment by DJG6...@gmail.com on 26 Oct 2013 at 12:59

GoogleCodeExporter commented 8 years ago
It seems that I made a mistake somewhere, because it's working now. I'm sure I 
was having this problem repeatedly before. This is strange.
Anyways, sorry for the troubles.

Thank you.

Original comment by doo...@gmail.com on 26 Oct 2013 at 4:29

GoogleCodeExporter commented 8 years ago
It could be you had two extensions affecting the same part of the code perhaps?

Original comment by DJG6...@gmail.com on 26 Oct 2013 at 4:32