付款方式中未显示 opencart 自定义付款扩展

opencart custom payment extension is not showing in the payment method

我正在 opencart 3 中编写自定义支付扩展程序。我已经设置了必要的方法,但插件未启用。我正在尝试在安装后自动启用该插件,但它确实可以正常工作。 这些是我的代码。 目录> upload/admin/controller/extension/mycustom.php

private $info_status = true;

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
        $this->model_setting_setting->editSetting('gtpayment', $this->request->post);
        $this->session->data['success'] = $this->language->get('text_success');
        $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true));
    }
if (isset($this->request->post['gtpayment_status'])) {          
        $data['gtpayment_status'] = $this->request->post['gtpayment_status'];   
    }else{  
        $data['gtpayment_status'] = $this->config->get('gtpayment_status');
    }

如果这些代码不正确,是否有可能使插件在安装后自动启用。

1 - 您错过了扩展文件夹下的付款文件夹。

2 - 如果您的实际模块是 gtpayment,您的模块文件名和类名必须是 gtpayment:

admin/controller/extension/payment/gtpayment.php

class ControllerExtensionPaymentGtpayment extends Controller {

3 - 您必须使用 $data['payment_gtpayment_status'] 而不是 $data['gtpayment_status']

Extensions are now prefixed by their category. so paypal_status would become payment_papal_status

Source of quote