Jump to content
BWT

[Solved] Module Configure link as New Tab

Recommended Posts

Hello,

I need a little help setting up a new back office tab. I wanted to add a new tab to the back office so that I can quickly go to the settings of my blog module. I have found a few other posts about this however when I tried to do it the first time I totally broke the site, after fixing everything I tried again with undesirable results again. So I am reaching out to the community for a better understanding of how to do this, I know from my searches that I am not the only one who wishes to understand this in a detailed way so I figured I would try and post about this process. Please break down the steps to make this happen I appreciate your time many thanks ahead of time.

 

How to create a new BO TAB with a modules configure settings in the tab??

Edited by tjg (see edit history)

Share this post


Link to post
Share on other sites

I want to do this too, having a difficult time doing it. can you help?? Please send me a private message thanks.

Share this post


Link to post
Share on other sites

Hello, I want to do this too. Be so good and write your solution! Thx a lot!

Share this post


Link to post
Share on other sites

In the back office go to Employees> tabs>new tab> Then you need to fill out the fields, if your connecting the tab to a already installed module you will need to add the correct names, if you connecting to a new page one will need to be created such as admin>tabs>AdminMyTabPage.php and configured accordingly on he new tab fields.

post-149621-0-21030700-1344265954_thumb.png

Share this post


Link to post
Share on other sites

I connected module EDITORIAL, the tab was created, but it is not working.

V_st_i_ek.jpg

 

 

V_st_i_ek2.jpg

Share this post


Link to post
Share on other sites

@ovom:

 

If you go to your module's configuration page, you will see in the address bar the details required for the input fields (see attached image below). The 'controller' will be the CLASS and the 'configure' will be the MODULE.

 

33m279g.jpg

 

However, I'm currently using Prestashop 1.5.1 and there seems to be a bug, in that the MODULE field doesn't seem to work. So my workaround is to fill the CLASS field with both the controller and the module like so: AdminModules&configure=slideric

 

PS: The settings for Prestashop 1.5.1 is under Administration > Menus

  • Like 1

Share this post


Link to post
Share on other sites

@kelvs

 

Yes, the same thing happens if you create a 'Quick Access' link from the 'Administration' menu for back office shortcuts. In the "Quick Access > Add Menu" page, there's even an instruction as follows:

 

"If it's an URL that comes from your Back Office, you must NOT put a security token."

 

Meaning, I assume, that if you were to create a back office shortcut, you were not supposed to include the security token in the URL, thus the security warning. So I guess since we created the links ourselves and we know what we were doing, it should be save. Just click on the "I understand the risks and I really want to display this page" and you should be good to go.

  • Like 2

Share this post


Link to post
Share on other sites

I was searching the solution to security token warning and kinda found something. It is not "professional", but I got rid of this horrible "invalid token" warning in BO tabs I created myself (thanks to @Aldi M's instructions above).

Now the button "I understand the risk..." clicks itself ;)

 

So, what I did was:

1. in admin/themes/default/template/invalid_token.tpl just after <head> I added:

 

 

<script type="text/javascript">

 

function init(){

 

var linkPage = document.getElementById('dynLink').href;

window.location.href = linkPage;

}

 

onload=init;

 

</script>

 

2. In the same file I added the

 

id="dynLink"

 

to <a href="{$url}" method="get" style="float:left;background: #E3E3E3;border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 20px 10px;padding:10px;text-align:center;vertical-align:middle;">

 

so it looks like this now:

 

<a href="{$url}" id="dynLink" method="get" style="float:left;background: #E3E3E3;border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 20px 10px;padding:10px;text-align:center;vertical-align:middle;">

 

The solution is based on this thread: http://www.webdeveloper.com/forum/showthread.php?97081-Auto-click-a-link-Please-help!

  • Like 3

Share this post


Link to post
Share on other sites

hey. same issue. trying to get configure links for modules on other pages with correct token. i see all the config links have same token. how would i call that?

 

Ive found.

if (Tools::getValue('redirect') == 'config' && Tools::getValue('module_name') != '' && $return == '12' && Module::isInstalled(pSQL(Tools::getValue('module_name'))))
			Tools::redirectAdmin('index.php?controller=adminmodules&configure='.Tools::getValue('module_name').'&token='.Tools::getValue('token').'&module_name='.Tools::getValue('module_name').$params);
		Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);

<a href="{$url}" method="get" style="float:left;background: #E3E3E3;border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 20px 10px;padding:10px;text-align:center;vertical-align:middle;">
		{l s='I understand the risks and I really want to display this page'}
</a>

<div class="row-actions-module">
  {if !isset($module->not_on_disk)}{$module->optionsHtml}{else} {/if}
</div>
is the code for the modules links, ie config delete reset...

Share this post


Link to post
Share on other sites

@ovom:

 

If you go to your module's configuration page, you will see in the address bar the details required for the input fields (see attached image below). The 'controller' will be the CLASS and the 'configure' will be the MODULE.

 

33m279g.jpg

 

However, I'm currently using Prestashop 1.5.1 and there seems to be a bug, in that the MODULE field doesn't seem to work. So my workaround is to fill the CLASS field with both the controller and the module like so: AdminModules&configure=slideric

 

PS: The settings for Prestashop 1.5.1 is under Administration > Menus

 

how do you get the token part right?

i noticed all the modules' delete configure delete.. have the same token... so to make a link right to the configure of the module.

how do i call that correct token?

Share this post


Link to post
Share on other sites

how do you get the token part right?

i noticed all the modules' delete configure delete.. have the same token... so to make a link right to the configure of the module.

how do i call that correct token?

 

you can get token from $_GET[''] variable - both for controller (php script) and for template (smarty code $smarty.get)

Share this post


Link to post
Share on other sites

I was searching the solution to security token warning and kinda found something. It is not "professional", but I got rid of this horrible "invalid token" warning in BO tabs I created myself (thanks to @Aldi M's instructions above).

Now the button "I understand the risk..." clicks itself ;)

 

So, what I did was:

1. in admin/themes/default/template/invalid_token.tpl just after <head> I added:

 

 

<script type="text/javascript">

 

function init(){

 

var linkPage = document.getElementById('dynLink').href;

window.location.href = linkPage;

}

 

onload=init;

 

</script>

 

2. In the same file I added the

 

id="dynLink"

 

to <a href="{$url}" method="get" style="float:left;background: #E3E3E3;border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 20px 10px;padding:10px;text-align:center;vertical-align:middle;">

 

so it looks like this now:

 

<a href="{$url}" id="dynLink" method="get" style="float:left;background: #E3E3E3;border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 20px 10px;padding:10px;text-align:center;vertical-align:middle;">

 

The solution is based on this thread: http://www.webdeveloper.com/forum/showthread.php?97081-Auto-click-a-link-Please-help!

 

 

This solution is good but not permanent solution...would be better if we will get permanent solution...

Share this post


Link to post
Share on other sites

This solution is good but not permanent solution...would be better if we will get permanent solution...

Works great!

Share this post


Link to post
Share on other sites

The Quick Access link to the module config works great ! It's a good solution.

Also, i didn't have any Token error notification.

I'm on Prestashop 1.4.10.

 

Cheers,

Ray

Share this post


Link to post
Share on other sites

Casually landed in this topic, and have a couple of minutes to explain my solution.

 

  1. Create a new tab that links to one of your module's admin controllers (for example MyModulePreferencesController).
  2. In the Preferences admin controller's class, just define the init() class, call parent::init() and do a redirect: 
    Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules') . '&configure=' . Tools::safeOutput($this->module->name));
    

Share this post


Link to post
Share on other sites

 

Casually landed in this topic, and have a couple of minutes to explain my solution.

 

  1. Create a new tab that links to one of your module's admin controllers (for example MyModulePreferencesController).
  2. In the Preferences admin controller's class, just define the init() class, call parent::init() and do a redirect: 
    Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules') . '&configure=' . Tools::safeOutput($this->module->name));
    

 

Hello,

 

Can you give a complete code of controller's class please?

 

Thanks :)

Share this post


Link to post
Share on other sites

Hello,

 

Can you give a complete code of controller's class please?

 

Thanks :)

 

Can't you read?

class AdminPreferencesController extends ModuleAdminController
{

    /**
     * @see AdminController->init();
     */
    public function init()
    {

        parent::init();

        // Just redirect to the module configuration page
        Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules') . '&configure=' . Tools::safeOutput($this->module->name));

    }

}
  • Like 2

Share this post


Link to post
Share on other sites

 

Can't you read?

class AdminPreferencesController extends ModuleAdminController
{

    /**
     * @see AdminController->init();
     */
    public function init()
    {

        parent::init();

        // Just redirect to the module configuration page
        Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules') . '&configure=' . Tools::safeOutput($this->module->name));

    }

}

Thanks :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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