Question

I'm writing my first xml file for Opencart with VQmod. See the lines:

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>Exibe porcento de desconto</id>
    <version>1.0</version>
    <vqmver>2.1.5</vqmver>
    <author>Oldman</author>

    <file name="catalog/view/theme/my_theme/template/product/product.tpl">
        <operation>

      <search position="after"><![CDATA[<?php if ($price) { ?>
      <div class="price">
        <span class="txt_price"><?php echo $text_price; ?></span>
        <?php if (!$special) { ?>
        <?php echo $price; ?>
        <?php } else { ?>
        <span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
        <?php } ?>]]></search>
            <add><![CDATA[ <?php echo 'Works fine!';?>]]></add>
        </operation>
    </file>
</modification>

But when I put the xml file into the vqmod/xml folder It doesn't work. What am I doing wrong?

Était-ce utile?

La solution

Because You are trying to do a multiline search. This is not possible with current vQmod. Do only a one line search...

Like:

<modification>

    <id>Exibe porcento de desconto</id>
    <version>1.0</version>
    <vqmver>2.1.5</vqmver>
    <author>Oldman</author>

    <file name="catalog/view/theme/my_theme/template/product/product.tpl">
        <operation>
            <search position="before"><![CDATA[<?php if ($price) { ?>]]></search>
            <add><![CDATA[ <?php echo 'Before the price if statement!';?>]]></add>
        </operation>
    </file>
</modification>

Autres conseils

VQMod will not allow the multiple line search, so if you want to search multiple line you can use "offset" property, offset="(no. of next line)"

<id>Exibe porcento de desconto</id>
<version>1.0</version>
<vqmver>2.1.5</vqmver>
<author>Oldman</author>

<file name="catalog/view/theme/my_theme/template/product/product.tpl">
    <operation>
        <search position="before" offset="7"><![CDATA[<?php if ($price) { ?>]]></search>
        <add><![CDATA[ <?php echo 'Works fine!';?>]]></add>
    </operation>
</file>

VQMod doesn't support multiple line search. To know about vqmod options check this link: Opencart: Vqmod tutorial.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top