1

我想使用 OCMOD 替换行

我正在使用下面的代码替换文件admin/model/sale/customer.php中的行

<file path="admin/model/sale/customer.php" error="log">
        <operation>
            <search><![CDATA[ $this->load->model('setting/store'); ]]></search>
            <add position="before"><![CDATA[ 
                if($this->isFront==true) {
                    $this->load->adminmodel('setting/store');
                } else {
                    $this->load->model('setting/store');
                }
            ]]></add>
        </operation>
    </file>

搜索行在$this->load->model('setting/store');文件中重复 3 次。

问题是当我使用上面的代码时,它会意外替换该行。它将代码添加到函数附近的某个位置,这会导致修改时出现语法错误。替换后的示例:

.....
.....
    public function addReward($customer_id,  
                if($this->isFront==true) {
                    $this->load->adminmodel('setting/store');
                } else {
                    $this->load->model('setting/store');
                }
            $this->load->model('setting/store');der_id = 0) {
        $customer_info = $this->getCustomer($customer_id);

        if ($customer_info) {
            $this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', points = '" . (int)$points . "', description = '" . $this->db->escape($description) . "', date_added = NOW()");

            $this->load->language('mail/customer');
.....
.....

正确更换它的解决方案是什么?我不介意解决方案是否仅在addReward函数中替换。此外,我对之前、之后、替换和正则表达式都很好。

我想这可能是OCMOD的问题。

4

1 回答 1

0

首先使用

<search index="0">

第一场比赛

<search index="1">

第二场比赛

<search index="2">

第三场比赛...

似乎您从其他修改中遇到冲突,因此您可以在以下步骤中调试 ocmod:

  • 转到修改>>点击:日志:然后点击清除按钮
  • 单击刷新并按代码和文件搜索您的修改
于 2020-07-16T12:53:03.737 回答