2015-08-07 1 views
0

J'ai configuré ce module pour une passerelle de paiement sur opencart mais j'ai eu cette erreur que j'ai changée $this->data à $data, j'ai une page blanche. Si je change de nouveau à $ this-> data i obtenir ce errorhttp://prntscr.com/832nd2error Appel à la méthode non définie ControllerPaymentStanbic :: render() dans le plugin de paiement

est ici le code

     <?php 
      class ControllerPaymentCipgSim extends Controller { 
       private $error = array(); 
       public function index() { 
       $this->load->language('payment/cipg_sim'); 
       $this->data['heading_title'] = $this->language->get('heading_title'); 
       $this->load->model('setting/setting'); 
       if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validate())) { 
        $this->load->model('setting/setting'); 
        $this->model_setting_setting->editSetting('cipg_sim', $this->request->post); 
        $this->session->data['success'] = $this->language->get('text_success'); 
        $this->redirect(HTTPS_SERVER .'index.php?route=extension/payment&token=' . $this->session->data['token']); 
       } 
       $this->data['heading_title']  = $this->language->get('heading_title'); 
       $this->data['text_enabled']  = $this->language->get('text_enabled'); 
       $this->data['text_disabled']  = $this->language->get('text_disabled'); 
       $this->data['text_all_zones']  = $this->language->get('text_all_zones'); 
       $this->data['text_yes']  = $this->language->get('text_yes'); 
       $this->data['text_no']   = $this->language->get('text_no'); 
       $this->data['text_test']  = $this->language->get('text_test'); 
       $this->data['text_live']  = $this->language->get('text_live'); 
       $this->data['button_save']  = $this->language->get('button_save'); 
       $this->data['button_cancel']  = $this->language->get('button_cancel'); 
       $this->data['tab_general']  = $this->language->get('tab_general'); 
       $this->data['get_from_aznet']  = $this->language->get('text_get_from_aznet'); 
       $this->data['set_at_aznet']  = $this->language->get('text_set_at_aznet'); 
       $this->data['optional_aznet']  = $this->language->get('text_optional_aznet'); 
       $this->data['text_min_amount'] = $this->language->get('text_min_amount'); 
       $this->data['text_order_status'] = $this->language->get('text_order_status'); 
       $this->data['text_custom_html'] = $this->language->get('text_custom_html'); 
       $this->data['text_custom_html_help']= $this->language->get('text_custom_html_help'); 
       $this->data['entry_status']  = $this->language->get('entry_status'); 
       $this->data['entry_login_id']  = $this->language->get('entry_login_id'); 
       $this->data['entry_transaction_key']= $this->language->get('entry_transaction_key'); 
       $this->data['entry_response_key'] = $this->language->get('entry_response_key'); 
       $this->data['entry_minimum_amt'] = $this->language->get('entry_minimum_amt'); 
       $this->data['entry_server']  = $this->language->get('entry_server'); 
       $this->data['entry_test']  = $this->language->get('entry_test'); 
       $this->data['entry_geo_zone']  = $this->language->get('entry_geo_zone'); 
       $this->data['entry_order_status'] = $this->language->get('entry_order_status'); 
       $this->data['entry_sort_order'] = $this->language->get('entry_sort_order'); 
       $this->data['entry_custom_header'] = $this->language->get('entry_custom_header'); 
       $this->data['entry_custom_footer'] = $this->language->get('entry_custom_footer'); 
       $this->load->model('localisation/order_status'); 
       $this->data['order_statuses']  = $this->model_localisation_order_status->getOrderStatuses(); 
       $this->load->model('localisation/geo_zone'); 
       $this->data['geo_zones']  = $this->model_localisation_geo_zone->getGeoZones(); 

       if (isset($this->request->post['cipg_sim_login_id'])) { 
        $this->data['cipg_sim_login_id'] = $this->request->post['cipg_sim_login_id']; 
       } else { 
        $this->data['cipg_sim_login_id'] = $this->config->get('cipg_sim_login_id'); 
       } 

       if (isset($this->request->post['cipg_sim_transaction_key'])) { 
        $this->data['cipg_sim_transaction_key'] = $this->request->post['cipg_sim_transaction_key']; 
       } else { 
        $this->data['cipg_sim_transaction_key'] = $this->config->get('cipg_sim_transaction_key'); 
       } 

       if (isset($this->request->post['cipg_sim_response_key'])) { 
        $this->data['cipg_sim_response_key'] = $this->request->post['cipg_sim_response_key']; 
       } else { 
        $this->data['cipg_sim_response_key'] = $this->config->get('cipg_sim_response_key'); 
       } 

       if (isset($this->request->post['cipg_sim_total'])) { 
        $this->data['cipg_sim_total'] = $this->request->post['cipg_sim_total']; 
       } else { 
        $this->data['cipg_sim_total'] = $this->config->get('cipg_sim_total'); 
       } 

       if (isset($this->request->post['cipg_sim_server'])) { 
        $this->data['cipg_sim_server'] = $this->request->post['cipg_sim_server']; 
       } else { 
        $this->data['cipg_sim_server'] = $this->config->get('cipg_sim_server'); 
       } 

       if (isset($this->request->post['cipg_sim_test'])) { 
        $this->data['cipg_sim_test'] = $this->request->post['cipg_sim_test']; 
       } else { 
        $this->data['cipg_sim_test'] = $this->config->get('cipg_sim_test'); 
       } 

       if (isset($this->request->post['cipg_sim_status'])) { 
        $this->data['cipg_sim_status'] = $this->request->post['cipg_sim_status']; 
       } else { 
        $this->data['cipg_sim_status'] = $this->config->get('cipg_sim_status'); 
       } 

       if (isset($this->request->post['cipg_sim_geo_zone_id'])) { 
        $this->data['cipg_sim_geo_zone_id'] = $this->request->post['cipg_sim_geo_zone_id']; 
       } else { 
        $this->data['cipg_sim_geo_zone_id'] = $this->config->get('cipg_sim_geo_zone_id'); 
       } 

       if (isset($this->request->post['cipg_sim_sort_order'])) { 
        $this->data['cipg_sim_sort_order'] = $this->request->post['cipg_sim_sort_order']; 
       } else { 
        $this->data['cipg_sim_sort_order'] = $this->config->get('cipg_sim_sort_order'); 
       } 

       if (isset($this->request->post['cipg_sim_order_status_id'])) { 
        $this->data['cipg_sim_order_status_id'] = $this->request->post['cipg_sim_order_status_id']; 
       } else { 
        $this->data['cipg_sim_order_status_id'] = $this->config->get('cipg_sim_order_status_id'); 
       } 

       if (isset($this->request->post['cipg_sim_custom_header'])) { 
        $this->data['cipg_sim_custom_header'] = $this->request->post['cipg_sim_custom_header']; 
       } else { 
        $this->data['cipg_sim_custom_header'] = $this->config->get('cipg_sim_custom_header'); 
       } 

       if (isset($this->request->post['cipg_sim_custom_footer'])) { 
        $this->data['cipg_sim_custom_footer'] = $this->request->post['cipg_sim_custom_footer']; 
       } else { 
        $this->data['cipg_sim_custom_footer'] = $this->config->get('cipg_sim_custom_footer'); 
       } 

       if (isset($this->error['warning'])) { 
        $this->data['error_warning'] = $this->error['warning']; 
       } else { 
        $this->data['error_warning'] = ''; 
       } 

        if (isset($this->error['login_id'])) { 
        $this->data['error_login_id'] = $this->error['login_id']; 
       } else { 
        $this->data['error_login_id'] = ''; 
       } 

       if (isset($this->error['transaction_key'])) { 
        $this->data['error_transaction_key'] = $this->error['transaction_key']; 
       } else { 
        $this->data['error_transaction_key'] = ''; 
       } 

       if (isset($this->error['response_key'])) { 
        $this->data['error_response_key'] = $this->error['response_key']; 
       } else { 
        $this->data['error_response_key'] = ''; 
       } 

        $this->data['breadcrumbs'] = array(); 
        $this->data['breadcrumbs'][] = array(
         'text'  => $this->language->get('text_home'), 
        'href'  => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 
         'separator' => false 
        ); 
        $this->data['breadcrumbs'][] = array(
         'text'  => $this->language->get('text_payment'), 
        'href'  => $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'), 
         'separator' => ' :: ' 
        ); 
        $this->data['breadcrumbs'][] = array(
         'text'  => $this->language->get('heading_title'), 
        'href'  => $this->url->link('payment/cipg_sim', 'token=' . $this->session->data['token'], 'SSL'), 
         'separator' => ' :: ' 
        ); 
       $this->data['action'] = HTTPS_SERVER .'index.php?route=payment/cipg_sim&token=' . $this->session->data['token']; 
       $this->data['cancel'] = HTTPS_SERVER .'index.php?route=extension/payment&token=' . $this->session->data['token']; 
       $this->template = 'payment/cipg_sim.tpl'; 
       $this->children = array(
        'common/header', 
        'common/footer' 
       ); 
       $this->response->setOutput($this->render()); 
       } 

       private function validate() { 
       /*if (!$this->user->hasPermission('modify', 'payment/cipg_sim')){ 
        $this->error['warning'] = $this->language->get('error_permission'); 
       } 
       if (!$this->request->post['cipg_sim_login_id']) { 
        $this->error['login_id'] = $this->language->get('error_login_id'); 
       } 
       if (!$this->request->post['cipg_sim_transaction_key']) { 
        $this->error['transaction_key'] = $this->language->get('error_transaction_key'); 
       } 
       if (!$this->request->post['cipg_sim_response_key']) { 
        $this->error['response_key'] = $this->language->get('error_response_key'); 
       } elseif(isset($this->request->post['cipg_sim_response_key']) && (strlen(preg_replace('/\s+/', ' ', $this->request->post['cipg_sim_response_key'])) > 20)) { 
        $this->error['response_key'] = $this->language->get('error_response_key'); 
       }*/ 
       if (!$this->error) { 
        return TRUE; 
       } else { 
        return FALSE; 
       } 
       } 
      } 
      ?> 

Quelqu'un peut-il aider s'il vous plaît?

+0

'ControllerPaymentStanbic' n'apparaît pas du tout dans ce code. Le message d'erreur indique que l'erreur est dans stanbic.php, êtes-vous sûr que c'est le contenu du bon fichier? – Xebax

+0

Mes excuses, c'est censé être ControllerPaymentAzNetSim pas ControllerPaymentstanbic. J'ai créé un autre fichier et changé le nom de la classe pour voir. Mais apparemment, j'ai eu la même erreur pour les deux. – Jahswey

+0

Vous devriez alors éditer votre question. Actuellement, il est difficile de vous aider car le message d'erreur dans le titre et dans le texte n'est pas le bon. Et nous ne savons rien de la classe 'Controller'. Le message d'erreur indique que la méthode 'render()' est indéfinie, où est-elle censée être définie? Dans votre classe? Dans 'Controller'? – Xebax

Répondre

1

Il semble que vous utilisiez une version très récente d'OpenCart. L'attribut de données n'est plus un membre de la classe Controller, comme vous pouvez le voir dans le version history.

Je suppose également que vous utilisez une extension tierce de la boutique. La recherche de "stanbic" fait apparaître one result, ce qui n'est compatible avec aucune version OpenCart récente. Essayez la même extension sur une version OpenCart plus ancienne. Ou vous pouvez essayer de fixer la mise en œuvre vous-même:

  • Créer une variable locale $data = array(); droite au début de la fonction d'index
  • Remplacer toutes les références à « $this->data » avec « $data »
  • passer le local $ données à la fonction setOutput: $this->response->setOutput($this->load->view('foldername/filename.tpl', $data));

Ceci n'est pas testé et il est probable que vous devrez modifier davantage de code, car il semble que le code OpenCart 2.x soit assez différent de la base de code 1.5.x. Utilisez un recent controller comme référence.

+0

merci !!! fonctionne parfaitement .. testé dans opencart 2 – Cocuba