[Install.xml文件在opencart 3中将其作为扩展安装时不会更新php文件

问题描述 投票:0回答:1

我正在从事一个opencart项目。在另一个开发人员实施的项目中,有一个新的模块调用折扣。我已将相关文件和相关方法复制到一个新项目中,并且效果很好。我已经创建了一个带有与Discount模块相关的新文件的discount.ocmod.zip文件,并且已经创建了install.xml文件来更新默认的php文件(我正在更新product.php),但是安装扩展程序后,文件将复制到正确的位置,但是product.php不会使用新功能进行更新。我在这里做错什么了?

这是修改日志。

enter image description here

这是我的xml文件:

<?xml version="1.0" encoding="UTF-8"?>

-<modification>

<generator>Created with OpenIX - https://openix.io/en/tool/opencart/ocmod</generator>

<name>installment plan</name>

<version>0.1</version>

<code>20778</code>

<author>Thilina</author>

<link>www.test.com</link>


-<file path="admin/controller/catalog/product.php">


-<operation>


-<search>

-<![CDATA[// Image]]>
</search>


-<add position="before">

-<![CDATA[//Credit Cards
		if (isset($this->request->post['credit_cards'])) {
			$credit_cards = $this->request->post['credit_cards'];
		} elseif (isset($this->request->get['product_id'])) {
			$credit_cards = $this->model_catalog_product->getCreditCards();
		} else {
			$data['credit_cards'] = array();
		}

		$data['credit_cards'] = array();

		foreach ($credit_cards as $credit_card) {
			$data['credit_cards'][] = array(
					'credit_card_id' => $credit_card['credit_card_id'],
					'credit_card_name'=> $credit_card['credit_card_name']);
		}

		//Installment Plan Product Ids
		if(!isset($this->request->get['product_id'])){
			$data['installment_plans'] = array();
		}else{
			$data['installment_plans']	= $this->model_catalog_product->getInstallmentPlansOfProduct($this->request->get['product_id']);
		}
]]>
</add>

</operation>

</file>

</modification>
php xml opencart-3 ocmod
1个回答
0
投票

也许您可以尝试从XML文件中删除“-”:

<?xml version="1.0" encoding="UTF-8"?>

<modification>

<generator>Created with OpenIX - https://openix.io/en/tool/opencart/ocmod</generator>

<name>installment plan</name>

<version>0.1</version>

<code>20778</code>

<author>Thilina</author>

<link>www.test.com</link>


<file path="admin/controller/catalog/product.php">


<operation>


<search>
<![CDATA[// Image]]>
</search>

<add position="before">

    <![CDATA[//Credit Cards
        if (isset($this->request->post['credit_cards'])) {
            $credit_cards = $this->request->post['credit_cards'];
        } elseif (isset($this->request->get['product_id'])) {
            $credit_cards = $this->model_catalog_product->getCreditCards();
        } else {
            $data['credit_cards'] = array();
        }

        $data['credit_cards'] = array();

        foreach ($credit_cards as $credit_card) {
            $data['credit_cards'][] = array(
                    'credit_card_id' => $credit_card['credit_card_id'],
                    'credit_card_name'=> $credit_card['credit_card_name']);
        }

        //Installment Plan Product Ids
        if(!isset($this->request->get['product_id'])){
            $data['installment_plans'] = array();
        }else{
            $data['installment_plans']  = $this->model_catalog_product->getInstallmentPlansOfProduct($this->request->get['product_id']);
        }
    ]]>
</add>

</operation>

</file>

</modification>
© www.soinside.com 2019 - 2024. All rights reserved.