Good day! Tell me, how can I add a quick link on the home page of the administrator to configure my module?
Adding quick link on admin home page (Prestashop 1.5.4)
Follow the following steps:
1) In admin section to go Administration at top menu and then click on Quick Access.
2) IN next page click on Add new and you will see a form
3) Now open admin panel in another tab and to the module page or section, of which you want to place a link in quick access.
4) Copy that complete link in note pad and remove the token section of the link. It is required to remove the token section according to Prestashop.
5) Now come back to the add new form for quick access, give your link a name and then copy that modified link to the Url field.
6) Save it and you will have that link in quick access.
The above is method is used to add it at admin. Now if you want to add it pro-grammatically you can follow the following steps.
1) In your module in the install function, user a code like below
Db::getInstance()->insert('quick_access', array('new_window' => 0, 'link' => 'link_to_your_module_page')); //an entry is made in quick_access table, get the quick_access id to insert lang data $id = Db::getInstance()->Insert_ID(); //this will give you last inserted ID from quick_access table which is your current quick_access id. //now make insertions in quick_access_lang table for multi language data. //get all your site languages, and place a foreach loop and in that loop insert //data into the quick_access_lang table using below code Db::getInstance()->insert('quick_access_lang', array('id_quick_access' => $id, 'id_lang' => 'lang_id', 'name' => 'name of your link')); //Now for uninstalling module, you want to delete the link, so you need to store the quick access link id in configuration table so you can use it later. Configuration::updateValue('MY_QUICK_ACCESS_LINK_ID', $id);
2) Now in your uninstall function in your module class, place the below code
$id = Configuration::get('MY_QUICK_ACCESS_LINK_ID'); //get id of your quick access link Db::getInstance()->delete('quick_access', 'where id_quick_access = '.$id); Db::getInstance()->delete('quick_access_lang', 'where id_quick_access = '.$id); //now delete the id from config table Configuration::deleteByName('MY_QUICK_ACCESS_LINK_ID');
Note : The above code is not tested, it may / may not need some adjustments.
In Prestashop 1.6.1 (maybe earlier too) in Admin view, at the top of the page, Quick Access has the option to "Add current page to QuickAccess". So just navigate to the Configuration page you need and use it.