Jump to content

Create New Menu similar to Order Menu in Back Office


shahil512
 Share

Recommended Posts

We need to create new menu similar to order menu in back office. Please explain in detail or with video how to do it.

 

We already created new menu, but after creating it - it says -

 

" The controller admin not found is missing or in valid "

Share this post


Link to post
Share on other sites

... now everyhing is clear for me. You have to create own module, with own files. you need to be familiar in php / smarty

all informations related to this case are in the urls that i pasted above

Share this post


Link to post
Share on other sites

Thanks, actually we build controller and it is showing blank page with message as :

 

" The controller admin not found is missing or in valid "

 

So do you mean we have to do remaining job. Our team knows php and smarty so it is not an issue.

Share this post


Link to post
Share on other sites

let's start from the beginning

 

you created new position in the menu, right?

now you have to create controller for this.

 

you need to create controller file and move it to the controllers/admin directory.

make sure that controller name (also file) is exactly the same as you defined in the menu

Share this post


Link to post
Share on other sites

Thanks Vekia, we did everything as per the details you have provided. We almost completed 95% job. Now we have the following queries:

 

1) In list view - if we put custom button - and how to apply custom function to it?

 

We need to click on button and there we need to write function which will update database. After database is updated, it should be redirect to list view.

Share this post


Link to post
Share on other sites

so, you've got now module / own controller

 

in this case, you can create button in your .tpl file

 

then in php files (for example in the init function) you can check if the button was send:

 

if (tools::getValue('yourbuttonname')){

YOUR_ACTION_HERE

}

Share this post


Link to post
Share on other sites

so, in your controller file you've got function:

 

public function display(){
}

 

 

you can put there something like:

 

 if (isset($_POST['your_button'])){
       $this->dosomething();
 } 

Share this post


Link to post
Share on other sites

Hi, here i my file.

 

-------------------

 

<?php

include_once( PS_ADMIN_DIR.'/../classes/AdminTab.php');

 

class AdminInPost extends AdminTab

{

public function __construct()

{

$this->table = 'restapi';

$this->className = 'InPost';

$this->lang = false;

//$this->addRowAction('view');

$this->edit = false;

$this->delete = false;

//$this->addRowAction('delete');

 

 

$this->fieldsDisplay = array(

'sr_num' => array(

'title' => $this->l('Serial No'),

'align' => 'center',

'width' => 25),

'parcel_id' => array(

'title' => $this->l('Carrier PID'),

'width' => 200),

'payment_status' => array(

'title' => $this->l('Payment Status'),

'align' => 'center',

'width' => 25),

'dest_city' => array(

'title' => $this->l('Destination'),

'width' => 200),

'machine' => array(

'title' => $this->l('Machine'),

'width' => 200),

'email' => array(

'title' => $this->l('Email'),

'width' => 200),

'mobile' => array(

'title' => $this->l('Mobile'),

'width' => 100),

'parcel_size' => array(

'title' => $this->l('Parcel Size'),

'align' => 'center',

'width' => 100),

'id_img' => array(

'title' => $this->l('Action'),

'prefix' => '<a href="index.php?controller=AdminInPost&token=a85e8ea89d91ff0e2840f02aaaa75c9d&diaplay">',

'suffix' => '<img src="../img/admin/note.png" name="imgclick"></a>', // replace with Constant from config

'align' => 'center',

'width' => 100)

);

 

$this->identifier = 'sr_num';

 

parent::__construct();

}

 

 

public function diaplay(){

if (tools::getValue('imgclick')){

echo "rachit";

die('called');

}

}

 

public function displayForm()

{

global $currentIndex;

 

$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));

$languages = Language::getLanguages();

$obj = $this->loadObject(true);

 

echo '

<script type="text/javascript">

id_language = Number('.$defaultLanguage.');

</script>';

}

 

 

}

?>

Share this post


Link to post
Share on other sites

  • 2 weeks 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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More