0

请查看 vqmod 文件夹中的以下 xml 文件。

<?xml version="1.0" encoding="UTF-8"?>
    <modification>
        <id>Drop Shipping</id>
        <version>2.0.0</version>
        <vqmver required="true">2.4.0</vqmver>
        <author>South Coast Hosting Services (Pty) Ltd</author>
        <file name="admin/language/*/common/menu.php">
            <operation error="log">
                <search><![CDATA[// Text]]></search>
                <add position="after"><![CDATA[
                $_['text_gdropship_menu'] = 'Drop Shipping';
                $_['text_gdropship_setup'] = 'Drop Shipping Setup';
                ]]></add>
            </operation>
        </file>
        <file name="admin/controller/common/menu.php">
            <operation error="log">
                <search ><![CDATA[$this->load->language('common/menu');]]></search>
                <add position="after"><![CDATA[
                $data['text_gdropship_setup'] = $this->language->get('text_gdropship_setup');
                $data['text_gdropship_menu'] = $this->language->get('text_gdropship_menu'); 
                ]]></add>
            </operation>
            <operation error="log">
                <search><![CDATA[$data['home'] = $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL');]]></search>
                <add position="before"><![CDATA[
                    $data['gdropshipmenu'] = $this->url->link('custom/gdropship', 'token=' . $this->session->data['token'], 'SSL');
                    $data['home'] = $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL');
                ]]></add>
            </operation>
        </file>
        <file name="admin/view/template/common/menu.tpl">
            <operation error="log">
                <search><![CDATA[<li id="system"><a class="parent"><i class="fa fa-cog fa-fw"></i> <span><?php echo $text_system; ?></span></a>]]></search>
                <add position="before"><![CDATA[<li><a class="parent"><i class="fa fa-share-alt fa-fw"></i><span><?php echo $text_gdropship_menu; ?><span></a>
        <ul>
            <li><a href="<?php echo $gdropshipmenu; ?>"><?php echo $text_gdropship_setup; ?></a></li>
        </ul><li id="system"><a class="parent"><i class="fa fa-cog fa-fw"></i> <span><?php echo $text_system; ?></span></a>]]></add>
            </operation>
        </file>
    </modification>

这运行完美,链接到在这个问题中创建的管理页面。您将看到位置标签包含“之后”和“之前”选项。我的问题是(除了花一整天时间来解决这个问题并做这几行)是这两个标签似乎都被替换了,而不是在之前或之后进行。将它们更改为替换无效。因此,我只包含了我“After-ing”的代码。

所以我的问题是我对上面的代码做错了吗?我只想在继续开发之前澄清一下,这样它就不会让我失望。它可能只是另一个 OC2 新手。

谢谢你。

PS Maybee 考虑到 Opencart2 的新标签是有保证的?

4

1 回答 1

2

您的 vQmod 搜索或替换没有任何问题。问题是您已将搜索和替换参数格式化为 OCMod 的参数,使用标签position="XXX"中的<add>而不是<search>vQmod 格式的标签。交换那些应该可以解决问题

于 2014-10-24T20:46:11.467 回答