contentengineer Posted June 18, 2014 Share Posted June 18, 2014 We are extending Prestashop 1.6 with a "Parent" AdminTab and multiple "child" AdminTabs referencing separate classes for adding specialist functionality. The tab navigation works successfully, but we have become a little unstuck in defining the images that appear in the menu on the left and the page toolbar title at the top of each page (in green banner). Where should the physical assets sit? Which property of the Tab or AdminController should we be checking/linking? Thanks Rob Link to comment Share on other sites More sharing options...
contentengineer Posted June 18, 2014 Author Share Posted June 18, 2014 (edited) We note that the "majority" of images for tabs USED to appear to be in /var/www/html/img/t/ as gif images; but since 1.6 are rendered using CSS3/Font Awesome, with entries such as: .icon-heart:before { content: "\f004"; } .icon-AdminXyz:before { content: "\f099"; } in css and in html: <i class="icon-AdminXyz"> ---- The problem we face in "tailoring" them is that: icon-Admin##### are HARD coded into admin-theme.css; and then added in function initBreadcrumbs (AdminController.php) at line 413/419 One option would be to override initBreadcrumbs() function An alternative option would be to modify $breadcrumbs2 which has been assigned to $this->context->smarty->assign('breadcrumbs2',$breadcrumbs) Edited June 18, 2014 by contentengineer (see edit history) Link to comment Share on other sites More sharing options...
contentengineer Posted June 18, 2014 Author Share Posted June 18, 2014 (edited) "Our" revised solution to tailoring the icon in the admin (back office) menu for a new AdminTab is to use the Back Office hook to supplement the admin-theme.css: <?php /* Skeleton module template * @version 0.8 * @author RMS */ if (!defined('_PS_VERSION_')) exit; class ModuleTemplate extends Module public function install() { ... $this->registerHook('displayBackOfficeHeader'); ... } public function uninstall() { ... $this->unregisterHook('displayBackOfficeHeader'); ... } public function hookDisplayBackOfficeHeader() { $this->context->controller->addCss($this->_path.'css/tab.css'); } ... And a file tab.css in <store root>/modules/moduletemplate/css/ .icon-AdminModuleTemplate:before, .icon-AdminParentModuleTemplate:before { content: "\f004"; } Edited June 19, 2014 by contentengineer (see edit history) 2 Link to comment Share on other sites More sharing options...
Rubens Cury Posted April 22, 2015 Share Posted April 22, 2015 Tested and recommended. I was putting my module tab icons css code in \admin\themes\default\css\overrides.css Works fine but you cannot ensure your module will be installed with the correspondent tab icons. Thank you Link to comment Share on other sites More sharing options...
Chrims Posted May 20, 2015 Share Posted May 20, 2015 (edited) <?php if (!defined('_PS_VERSION_')) exit; class MyCrazyModule extends Module { public $modulname; public function __construct() { $this->name = 'mycrazymodule '; $this->tab = 'quick_bulk_update'; $this->version = '1.0.0'; $this->author = 'Author'; $this->need_instance = 0; //$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('My Crazy Module'); $this->description = $this->l('Description of my Module'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); } public function install() { // PS_VERSION CHECK if (version_compare(_PS_VERSION_, '1.5.1.0') >= 0) { $this->registerHook('displayBackOfficeHeader'); if (!parent::install()) { return false; } return true; } else { $this->_errors[] = $this->l('The version of your module is not compliant with your PrestaShop version.'); return false; } } public function uninstall() { $this->unregisterHook('displayBackOfficeHeader'); if (!parent::uninstall()) { return false; } return true; } public function hookDisplayBackOfficeHeader() { $this->context->controller->addCss($this->_path.'css/tab.css'); } } css/tab.css .icon-AdminMyCrazyModule:before, .icon-AdminMyCrazyModule:before { content: "\f019"; } It doesn't work for me. Where is the error? The css file not even included in the header. Edited May 20, 2015 by Chrims (see edit history) Link to comment Share on other sites More sharing options...
Chrims Posted May 20, 2015 Share Posted May 20, 2015 (edited) Yeeeeesss, i got it! $this->registerHook('displayBackOfficeHeader'); has to be after: parent::install() Edited May 20, 2015 by Chrims (see edit history) Link to comment Share on other sites More sharing options...
Rubens Cury Posted May 20, 2015 Share Posted May 20, 2015 Hi Chrims, Yea, you must do a registerHook once the "module's install" is successfully completed. Do something like that public function install() { if (!parent::install() || !$this->installModuleTab() || !$this->installModuleDb() || !$this->registerHook('displayBackOfficeHeader') || !Configuration::updateValue('MYMODULE_NAME', 'CustomName') ) return false; return true; } Link to comment Share on other sites More sharing options...
Chrims Posted May 20, 2015 Share Posted May 20, 2015 yes, the hook need the module id. And the id is generated after its install ;-D 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now