我在開發opencart套件時,想更新config.php,但卻沒有更新成功
我的環境是WIN10 + appserv + php7.4.27 + opencart3.0.3.7
我的檔案是install.php,會打包成install.ocmod.zip
程式碼中有更新兩隻程式,config.php與success.php
其中success.php的兩個更新都有成功
但config.php的資料卻沒有更新進去
想請教一下各位前輩有關於config.php的更新是有什麼限制嗎?
或者我這寫法哪裡有錯了?網路上找不到有什麼資源是說更新config.php的(苦腦…
還請各位前輩幫忙解惑一下,謝謝
程式碼如下:
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>模組</name>
<code>my_module</code>
<version>1.0</version>
<author><![CDATA[Break]]></author>
<link>http://www.opencart.com</link>
<file path="config.php">
<operation>
<search>
<![CDATA[
define('DB_PREFIX', '');
]]>
</search>
<add position="after">
<![CDATA[
define('OC_SHOP_NAME', 'test_oc');
]]>
</add>
</operation>
</file>
<file path="catalog/controller/checkout/success.php">
<operation>
<search>
<![CDATA[
if (isset($this->session->data['order_id'])) {
]]>
</search>
<add position="before">
<![CDATA[
$paymentInfo = "";
$this->load->model('checkout/order');
$order = $this->model_checkout_order->getOrder($this->session->data['order_id']);
]]>
</add>
</operation>
<operation>
<search>
<![CDATA[
$data['text_message'] = sprintf($this->language->get('text_customer'), $this->url->link('account/account', '', true), $this->url->link('account/order', '', true), $this->url->link('account/download', '', true), $this->url->link('information/contact'));
]]>
</search>
<add position="before">
<![CDATA[
$data['text_message'] = sprintf($this->language->get('text_customer'), $this->url->link('account/account', '', true), $this->url->link('account/order', '', true), $this->url->link('account/download', '', true), $this->url->link('information/contact')) . '<br/>' . $paymentInfo;
]]>
</add>
</operation>
</file>
</modification>