Jump to content

Custom Back Office Tab Doesn't Visible


Recommended Posts

Hello everyone, I'm new on developing module of Prestashop and I use version of 1.7.4.2. I'm trying to develeping a module and I have to create a custom tab in left menu in back office. I tried this way which in the Prestashop official documentation(https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/tabs/). But custom tab doesn't visible in the back office. Here I add my code and my file names. Can anyone help me about where is my mistake? Thank you so much.

 

My Files

driveorder

-driveorder.php

-logo.png

-controllers

--admin

---AdminDriveOrder.php

 

And there is driveorder.php file which is I created custom tab.

<?php
if (!defined('_PS_VERSION_'))
    exit;

class driveorder extends Module
{
    public function __construct()
    {
        $this->name = 'driveorder'; /* This is the 'technic' name, this should equal to filename (mycustommodule.php) and the folder name */
        $this->tab = 'administration'; /* administration, front_office_features, etc */
        $this->version = '1.0.0'; /* Your module version */
        $this->author = 'Sertac Bazancir'; /* I guess it was clear */
        $this->need_instance = 0; /* If your module need an instance without installation */
        $this->controllers = array('driveProducts');
        $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); /* Your compatibility with prestashop(s) version */
        $this->bootstrap = true; /* Since 1.6 the backoffice implements the twitter bootstrap */

        parent::__construct(); /* I need to explain that? */

        $this->displayName = $this->l('Drive Order'); /* This is the name that merchant see */
        $this->description = $this->l('Google Drive integration for virtual products.'); /* A short description of functionality of this module */

        $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); /* This is a popup message before the uninstall */

        $this->tabs = array(
	        array(
	            'name' => 'Drive Order', // One name for all langs
		        'class_name' => 'AdminDriveOrder',
		        'visible' => true,
		        'parent_class_name' => 'AdminCatalog',
			    )
    	);
    	
    }

    public function install(){
    	if (Shop::isFeatureActive()){
     		Shop::setContext(Shop::CONTEXT_ALL);
    	}
	  	$sql = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."drive_product`(
	  	`id_product` INT(10) NOT NULL PRIMARY KEY,
	  	`id_drive` VARCHAR(255) NOT NULL )";
	  	$result = Db::getInstance()->Execute($sql);
	  	if (!parent::install() OR !$result OR !$this->registerHook('actionPaymentConfirmation')){
	    	return false;
	  	}
	  	return true;
	}

	public function uninstall(){
		$sql = "DROP TABLE `"._DB_PREFIX_."drive_product`";
		$result = Db::getInstance()->Execute($sql);
		if (!parent::uninstall() OR !$result OR !Configuration::deleteByName('driveorder')){
			return false;
		}
	  	return true;
	}

	public function hookActionPaymentConfirmation($params){
		global $smarty;
	}
}
?>

 

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...