0

После установки специального модуля prestashop Получение фатальной ошибки: вызов неопределенного метода при нажатии на меню, которое создается модулем Неустранимая ошибка: вызов не определен метод querydr :: viewAccess() в D: \ XAMPP \ HTDOCS \ raffleV1.3 \ oknr9hexztcseff5 \ functions.php на линии 279После установки ошибки получения ошибочного модуля prestashop Fatal error: вызов неопределенного метода при нажатии на меню

<?php 
if (!defined('_PS_VERSION_')) exit; 
class querydr extends Module 
{ 

protected $config_form = false; 
public $html; 
public $tabName = 'renderForm'; 
public function __construct() 
{ 

    $this->name = 'querydr'; 
    $this->tab = 'others'; 
    $this->version = '1.0.0'; 
    $this->author = 'xyz'; 
    $this->need_instance = 1; 
    $this->module_key = 'f35950b303e7cbcda7fd8e56bb100d77121'; 
    /** 
    * Set $this->bootstrap to true if your module is compliant with bootstrap (PrestaShop 1.6) 
    */ 
    $this->bootstrap = true; 
    parent::__construct(); 
    $this->displayName = $this->l('Query DR'); 
    $this->description = $this->l('Allow your Back Office to Query the transactions '); 
    $this->confirmUninstall = $this->l('You want to Uninstall Query DR ?.'); 
    $this->_tabsArray = array(
    'Querydr' => 'Query DR', 
    ); 

    if (!Configuration::get('QUERYDR')) 
     $this->warning = $this->l('No name provided'); 
} 





/** 
* Don't forget to create update methods if needed: 
* http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update 
*/ 
public function install() 
{ 
    include(dirname(__FILE__).'/sql/install.php'); 

    return parent::install() && 
     Configuration::updateValue('QUERYDR','Query Dr') 
     && $this->_installTabs(); 
} 

private function _installTabs() 
{ 
    $parentTab = new Tab(); 
    foreach (Language::getLanguages() as $language) $parentTab->name[$language['id_lang']] = 'Query Dr'; 
    $parentTab->class_name = 'Querydr'; 
    $parentTab->module = $this->name; 
    $parentTab->id_parent = 0; 
    if (!$parentTab->save()) return false; 
    else { 
     $idTab = $parentTab->id; 
     //$idEn = Language::getIdByIso('en'); 
     foreach ($this->_tabsArray as $tabKey => $name) { 
      $childTab = new Tab(); 
      foreach (Language::getLanguages() as $language) $childTab->name[$language['id_lang']] = $name; 

      $childTab->class_name = $tabKey; 
      $childTab->module = $this->name; 
      $childTab->id_parent = $idTab; 

      if (!$childTab->save()) return false; 
     } 
    } 
    return true; 
} 



public function uninstall() 
{ 
    include(dirname(__FILE__).'/sql/uninstall.php'); 
    Configuration::deleteByName('QUERYDR'); 
    Configuration::deleteByName('QUERYDR_MERCHANT_ID'); 
    Configuration::deleteByName('QUERYDR_SECRET_KEY'); 
    $this->_uninstallTabs(); 
    if (!parent::uninstall()) 
    return false; 
    return true; 

} 


private function _uninstallTabs() 
{ 
    foreach ($this->_tabsArray as $tabKey => $name) { 
     $idTab = Tab::getIdFromClassName($tabKey); 
     if ($idTab != 0) { 
      $tab = new Tab($idTab); 
      $tab->delete(); 
     } 
    } 

    $idTab = Tab::getIdFromClassName('QueryDr'); 
    if ($idTab != 0) { 
     $tab = new Tab($idTab); 
     $tab->delete(); 
    } 
    return true; 
} 


    public function getContent() 
{ 
    if (Tools::isSubmit('submitQueryDrModule')) { 
     Configuration::updateValue('QUERYDR_MERCHANT_ID', Tools::getValue('QUERYDR_MERCHANT_ID')); 
     Configuration::updateValue('QUERYDR_SECRET_KEY', Tools::getValue('QUERYDR_SECRET_KEY')); 
     $this->html .= $this->displayConfirmation($this->l('Settings Updated')); 
     $this->tabName = 'renderForm'; 
    } 

    if ($this->tabName) { 
     $this->html .= '<script>$(document).ready(function(){$("#'.$this->tabName.'").addClass("active");$(".'.$this->tabName.'").parents(".nav-tabs > li").addClass("active");});</script>'; 
    } else { 
     $this->html .= '<script>$(document).ready(function(){$("#renderForm").addClass("active");     $(this).attr("href").indexOf("#renderForm").addClass("active");});</script>'; 
    } 
    $this->html .= '<ul class="nav nav-tabs" role="tablist"><li ><a class="renderForm" href="#renderForm" role="tab" data-toggle="tab">SETTINGS</a></li></ul>'; 

    $this->html .= '<div class="tab-content"><div class="tab-pane " id="renderForm">'.$this->renderForm_1_6().'</div></div>'; 
    $this->html .='<style>div.flash.fail {color: #cd0a0a;background-color: #fef1ec;border: #cd0a0a 1px solid;       padding: 0.5em;margin: 0 3px;margin-top: 22px;margin-bottom: 12px;text-align: center;border-radius: 2px 2px 2px 2px;}</style>'; 

    return $this->html; 
} 

    protected function renderForm_1_6() 
{ 
    $fields_form = array(
         'form' => array(
          'legend' => array(
              'title' => $this->l('Settings'), 
              'icon' => 'icon-cogs', 
             ), 
          'input' => array(
                array(
            'col' => 3, 
            'type' => 'text', 
            'desc' => $this->l('Your merchant ID ex: 201408191000001'), 
            'name' => 'QUERYDR_MERCHANT_ID', 
            'label' => $this->l('MERCHANT ID'), 
           ),      array(
            'col' => 3, 
            'type' => 'text', 
            'desc' => $this->l('Your key provided by network international'), 
            'name' => 'QUERYDR_SECRET_KEY', 
            'label' => $this->l('SECRET KEY'), 
           ) 
             ), 
             'submit' => array(
                 'title' => $this->l('Save'), 
                ), 
            ) 
         ); 

    $helper = new HelperForm(); 
    $helper->show_toolbar = false; 
    $helper->table = $this->table; 
    $helper->module = $this; 
    $helper->default_form_language = $this->context->language->id; 
    $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); 
    $helper->identifier = $this->identifier; 
    $helper->submit_action = 'submitQueryDrModule'; 
    $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) 
    .'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; 
    $helper->token = Tools::getAdminTokenLite('AdminModules'); 

    $helper->tpl_vars = array(
    'fields_value' => $this->getConfigFormValues(), /* Add values for your inputs */ 
    'languages' => $this->context->controller->getLanguages(), 
    'id_language' => $this->context->language->id, 
    ); 

    return $helper->generateForm(array(
    $fields_form)); 
} 

    protected function getConfigFormValues() 
{ 
    return array(
     'QUERYDR_MERCHANT_ID' => Configuration::get('QUERYDR_MERCHANT_ID'), 
     'QUERYDR_SECRET_KEY' => Configuration::get('QUERYDR_SECRET_KEY'), 
    ); 
} 

}

Мой модуль ссылку здесь -

https://www.dropbox.com/s/juyhcu5zub8p9fi/querydr.zip?dl=0

ответ

0

Я не уверен, если он собирается помочь вам, но ... попробуйте префикс вашего администратора имя контроллера с «Admin», как «AdminQuerydrController» и изменить его также в установке вкладки

tab->class_name = 'AdminQuerydrController'; 

убедитесь изменить также контроллер имя файла PHP

"AdminQuerydrController.php"