1

I am trying to use VQMOD for the first time and when I added the code below to my page nothing changed.

I tried to change the home link on top right of home page (open cart) to my home, but the text did not change. Unfortunately, there was no error on the VQMOD manager.

My XML code is Below. Do I need to add something to my TPL or make any other changes?

<modification>
    <file name="catalog/view/theme/*/template/common/header.tpl">
        <operation>
            <search position="replace"><![CDATA[<?php echo $text_home; ?>]]></search>         
            <add><![CDATA[my home]]></add>   
        </operation>    
    </file>       
</modification>
4

3 回答 3

3

您无法像代码中那样替换 header.tpl。VQMOD“只能搜索单行”不是特定变量。

试试这个代码:

<file name="catalog/view/theme/*/template/common/header.tpl">
    <operation>
        <search position="replace"><![CDATA[
          <div class="links"><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist-total"><?php echo $text_wishlist; ?></a><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a><a href="<?php echo $shopping_cart; ?>"><?php echo $text_shopping_cart; ?></a><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
        ]]>
        </search>
        <add><![CDATA[
          <div class="links"><a href="<?php echo $home; ?>">your own link</a><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist-total"><?php echo $text_wishlist; ?></a><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a><a href="<?php echo $shopping_cart; ?>"><?php echo $text_shopping_cart; ?></a><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
        ]]>
        </add>
    </operation>
</file>
于 2012-08-02T10:57:00.080 回答
1

我立即发现缺少的一件事是缺少顶部的修改细节

<id>Mod Name</id>
<version>1.0.0</version>
<vqmver>2.X</vqmver>
<author>Your name</author>

你真的应该在 xml 文件的顶部也有这段代码

<?xml version="1.0" encoding="UTF-8"?>
于 2012-11-25T17:25:23.253 回答
0

您在 *.tpl 文件中有 include() 或 require() 或 require_once()

require ('catalog/view/theme/*/template/product/*.tpl');

修改为

require($vqmod->modCheck('catalog/view/theme/*/template/product/*.tpl'));

或者

<?php
global $vqmod;
require($vqmod->modCheck('file/path/here'));
?>

或修改 vqmod_opencart.xml

<file name="path/ *.tpl">
        <operation>
            <search position="replace" regex="true"><![CDATA[~require\(([^)]+)~]]></search>
            <add><![CDATA[require($vqmod->modCheck($1)]]></add>
       </operation>
</file>
于 2015-10-20T14:42:44.887 回答