iT邦幫忙

0

Opencart3自定義套件config更新

  • 分享至 

  • xImage

我在開發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>
archer9080 iT邦研究生 4 級 ‧ 2021-12-28 11:49:13 檢舉
Extensions的Modification應該有refresh?
Log檔沒有顯示error?
breakgod iT邦新手 2 級 ‧ 2021-12-28 11:51:39 檢舉
我主要是新增參數與程式碼上去
success.php可以work,理論上config.php應該也可以work吧
log沒有看到error喔~謝謝
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答