Search code examples
opencartvqmod

Vqmod - writing a first file for Opencart


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?


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>