1

I have an instance of OpenCart which I am trying to modify with vQmod. Specifically I am trying to disable the Add to Cart button if a product's price is zero. However, the vQmod operation is failing with a SEARCH NOT FOUND (ABORTING MOD) error. Why is it failing?

catalog/view/theme/simplegreat/product/category.tpl:

<div class="box-product-buttons clearfix">
    <a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="buttons-cart"><?php echo $button_cart; ?></a>
    <a onclick="addToWishList('<?php echo $product['product_id']; ?>');" class="buttons-wish" title="<?php echo $button_wishlist; ?>"></a>
    <a onclick="addToCompare('<?php echo $product['product_id']; ?>');" class="buttons-compare" title="<?php echo $button_compare; ?>"></a>
</div>

vQmod file:

<operation>
            <search position="replace"><![CDATA[<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="buttons-cart"><?php echo $button_cart; ?></a>]]></search>
            <add><![CDATA[
                  // ...
            ]]></add>
</operation>

There are other vQmod files that modify category.tpl, but they modify other parts of the file (not the line that is being searched for here).

user2181948
  • 1,646
  • 3
  • 33
  • 60
  • are you sure you are editing correct file in correct folder? make sure other vqmods are not altering that line, also check if there is not OCmod that is altering file – Ripper Jan 23 '17 at 23:09
  • @Ripper OCMod is not in use, and there are other vQmod files altering that file, but not that specific line – user2181948 Jan 24 '17 at 02:17

1 Answers1

0

If you sure about other scripts not replacing that line maybe try just partial match, but you need to replace one more line, because otherwise you would replace just that string...

Example:

    <operation>
        <search position="replace" offset="1"><![CDATA[addToCart('<?php echo $product['product_id']; ?>');"]]></search>
        <add><![CDATA[
              // ...
              // also add next line here
        ]]></add>
    </operation>
Ripper
  • 1,132
  • 13
  • 26