0

I am writing a custom payment extension in opencart 3. I have setup necessary method and the plugin is not enabling. I am trying to enable the plugin automatically after installation it does work yet. These are my code. directory> 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');
    }

If these code is not correct is there a possible way to make a plugin automatically enable after installation.

DigitCart
  • 2,980
  • 2
  • 18
  • 28
Kabiru Wahab
  • 77
  • 1
  • 13

1 Answers1

0

1 - You missed payment folder under extension folder.

2 - If your actual module is gtpayment, your module filename and your classname must be gtpayment:

admin/controller/extension/payment/gtpayment.php

And

class ControllerExtensionPaymentGtpayment extends Controller {

3 - You must use $data['payment_gtpayment_status'] instead $data['gtpayment_status']

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

Source of quote

DigitCart
  • 2,980
  • 2
  • 18
  • 28
  • Directory name and class name is a spelling errors. I got that well in the plugin, i will check the prefises and i will get back to you. Thank you @DigitCart – Kabiru Wahab Jan 10 '18 at 12:54
  • Thanks very much. It works it is enabled but only display error in the payment method as Warning: Invalid argument supplied for foreach() in C:\xampp4\htdocs\storage\modification\system\engine\loader.php on line 83Notice: Undefined property: Proxy::getMethod in C:\xampp4\htdocs\opencart\upload\catalog\controller\checkout\payment_method.php on line 53 – Kabiru Wahab Jan 10 '18 at 23:27
  • I think you need to compare your extension with an existing payment extension in OpenCart 3. – DigitCart Jan 11 '18 at 07:05