PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] how to show my admin tab in prestashop 1.7?

 June 30, 2022     prestashop     No comments   

Issue

i succeeded to show my admin tab in ps 1.6 bu it does not appear in 1.7, here is my code :

  public function installTab()  {
    $tab = new Tab();
    $tab->id_parent = 0;
    //$tab->id_parent = (int)Tab::getIdFromClassName('AdminCatalog');
    $tab->name = array();
    foreach (Language::getLanguages(true) as $lang) {
        $tab->name[$lang['id_lang']] = 'Scan des codes barre';
      }
    $tab->class_name = 'AdminBarCodeGenerator';
    $tab->module = $this->name;
    $tab->active = 1;
    return $tab->add();

}

and my controller's methods:

 public function __construct(){
    $this->bootstrap = true;
    $this->display='';
    $this->context = Context::getContext();
    return parent::__construct();

}

   public function renderList()

{

$scan_form=$this->renderForm2();
$this->context->smarty->assign('scan_form',$scan_form);
return $this->context->smarty->fetch(_PS_MODULE_DIR_.'barcode/views/templates/admin/tabs/scan.tpl');

}

is there a specific way to handle it in ps 1.7 please?


Solution

I think problem might be in setting parent id to 0. Try:

$tab->id_parent = (int)Tab::getIdFromClassName('DEFAULT');

Also your class name should start with Admin



Answered By - Boryss96
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing