0

我正在 opencart 3 中编写自定义支付扩展。我已经设置了必要的方法并且插件未启用。我正在尝试在安装后自动启用该插件,但它确实可以工作。这些是我的代码。目录>上传/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');
    }

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

4

1 回答 1

0

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

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

admin/controller/extension/payment/gtpayment.php

class ControllerExtensionPaymentGtpayment extends Controller {

3 - 您必须$data['payment_gtpayment_status']改用$data['gtpayment_status']

扩展现在以它们的类别为前缀。所以 paypal_status 会变成 payment_papal_status

报价来源

于 2018-01-10T12:23:50.967 回答