Andrz2556 Posted April 16 Share Posted April 16 Hello, I tried to install some modules in my Prestashop, and still have this error. this is my module.php <?php header("Access-Control-Allow-Origin: *"); include_once(__DIR__ . '/Ps_IntroSlider.php'); if (!defined('_PS_VERSION_')) { exit; } $autoloadPath = __DIR__ . '/vendor/autoload.php'; if (file_exists($autoloadPath)) { require_once $autoloadPath; } use public_html\modules\introslider\controllers\admin\AdminIntrosliderController; class introslider extends Module { protected $_html = ''; protected $default_width = 779; protected $default_speed = 5000; protected $default_pause_on_hover = 1; protected $default_wrap = 1; protected $templateFile; public function __construct() { $this->name = 'introslider'; $this->tab = 'front_new_office_features'; $this->version = '1.0.0'; $this->author = 'HIC'; $this->need_instance = 0; $this->secure_key = Tools::encrypt($this->name); $this->bootstrap = true; $this->ps_versions_compliancy = [ 'min' => '1.6', 'max' => '1.7.99', ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->getTranslator()->trans('Intro slider', array(), 'Modules.Introslider.Admin'); $this->description = $this->l('Add new splash screen and product slides for mobile.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('introslider')) { $this->warning = $this->l('No name provided'); } } public function install() { /* Adds Module */ if (parent::install() && $this->registerHook('displayHeader') && $this->registerHook('displayHome') && $this->registerHook('actionShopDataDuplication')&& $this->manuallyInstallTab() ) { $shops = Shop::getContextListShopID(); $shop_groups_list = array(); /* Setup each shop */ foreach ($shops as $shop_id) { $shop_group_id = (int)Shop::getGroupFromShop($shop_id, true); if (!in_array($shop_group_id, $shop_groups_list)) { $shop_groups_list[] = $shop_group_id; } /* Sets up configuration */ $res = Configuration::updateValue('INTROSLIDER_SPEED', $this->default_speed, false, $shop_group_id, $shop_id); $res &= Configuration::updateValue('INTROSLIDER_PAUSE_ON_HOVER', $this->default_pause_on_hover, false, $shop_group_id, $shop_id); $res &= Configuration::updateValue('INTROSLIDER_WRAP', $this->default_wrap, false, $shop_group_id, $shop_id); } /* Sets up Shop Group configuration */ if (count($shop_groups_list)) { foreach ($shop_groups_list as $shop_group_id) { $res &= Configuration::updateValue('INTROSLIDER_SPEED', $this->default_speed, false, $shop_group_id); $res &= Configuration::updateValue('INTROSLIDER_PAUSE_ON_HOVER', $this->default_pause_on_hover, false, $shop_group_id); $res &= Configuration::updateValue('INTROSLIDER_WRAP', $this->default_wrap, false, $shop_group_id); } } /* Sets up Global configuration */ $res &= Configuration::updateValue('INTROSLIDER_SPEED', $this->default_speed); $res &= Configuration::updateValue('INTROSLIDER_PAUSE_ON_HOVER', $this->default_pause_on_hover); $res &= Configuration::updateValue('INTROSLIDER_WRAP', $this->default_wrap); /* Creates tables */ $res &= $this->createTables(); return (bool)$res; } return false; } public function uninstall() { return ( parent::uninstall() && Configuration::deleteByName('INTROSLIDER_SPEED') && Configuration::deleteByName('INTROSLIDER_PAUSE_ON_HOVER') && Configuration::deleteByName('INTROSLIDER_WRAP') && $this->uninstallTab() ); } private function manuallyInstallTab() { $tab = new Tab(); $tab->active = 1; $tab->class_name = AdminIntrosliderController::TAB_CLASS_NAME; // Only since 1.7.7, you can define a route name $tab->route_name = 'admin_introslider_manage'; $tab->name = []; foreach (Language::getLanguages() as $lang) { $tab->name[$lang['id_lang']] = $this->trans('Introslider Admin', [], 'Modules.Introslider.Admin', $lang['locale']); } $tab->icon = 'build'; $tab->id_parent = (int) Tab::getIdFromClassName('IMPROVE'); $tab->module = $this->name; return $tab->save(); } and this is route.yml admin_introslider_manage: path: introslider/demo methods: [GET] defaults: _controller: 'introslider\controllers\admin\AdminIntrosliderController::initContent' and yes I deleted previously var/cache before loading this page 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