kirubanidhi Posted January 9, 2017 Share Posted January 9, 2017 (edited) While installing in my custom module that time occur below this fatal error. How to resolve this error Anyone help me. Fatal error: Call to undefined method Language::updateModulesTranslations() in /var/www/html/sf_prestashop/shop/classes/module/Module.php on line 292 Edited January 12, 2017 by kirubanidhi (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted January 9, 2017 Share Posted January 9, 2017 what version of Prestashop are you installing this custom module on? Be specific about the version Link to comment Share on other sites More sharing options...
kirubanidhi Posted January 10, 2017 Author Share Posted January 10, 2017 Code: if (!defined('_PS_VERSION_')) exit; class addressReadonly extends Module { public function __construct() { $this->name = 'addressreadonly'; $this->tab = 'front_office_features'; $this->version = '0.1'; $this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6'); $this->author = 'Sodexis, Inc <[email protected]>'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Address Readonly module'); $this->description = $this->l('With this module, we can restrict the address update for specific customer groups'); $this->confirmUninstall = $this->l('Are you sure you want to delete this module?'); } public function install() { if (!parent::install()|| !$this->registerHook('displayOverrideTemplate') || !$this->alterTable('add')) return false; return true; } public function uninstall() { if (!parent::uninstall() OR !$this->alterTable('remove')) return false; return true; } } This is my code. Im working on prestashop 1.5.6 version. I developed custom module. This module is working in my local but when i go to install test server same module that time occured above error. Can you help me. Please Link to comment Share on other sites More sharing options...
bellini13 Posted January 10, 2017 Share Posted January 10, 2017 Language::updateModulesTranslations does not exist in PS v1.5 Link to comment Share on other sites More sharing options...
kirubanidhi Posted January 11, 2017 Author Share Posted January 11, 2017 I dont know how to resolved it. Can you help me bellini. When module is install that time this error occured. Link to comment Share on other sites More sharing options...
bellini13 Posted January 11, 2017 Share Posted January 11, 2017 the code you provided is not the complete code. i don't know how much help I can be if you are trying to use a function that does not exist Link to comment Share on other sites More sharing options...
eleazar Posted January 11, 2017 Share Posted January 11, 2017 Language::updateModulesTranslations does not exist in PS v1.5 Nope! Language.php, line 885 in PrestaShop 1.5.6.2 for example. Link to comment Share on other sites More sharing options...
kirubanidhi Posted January 12, 2017 Author Share Posted January 12, 2017 I resolved this error, Im added classes/language.php inside, public static function getLanguagePackListContent($iso, $tar) { if (!$tar instanceof Archive_Tar) return false; $key = 'Language::getLanguagePackListContent_'.$iso; if (!Cache::isStored($key)) Cache::store($key, $tar->listContent()); return Cache::retrieve($key); } public static function updateModulesTranslations(Array $modules_list) { require_once(_PS_TOOL_DIR_.'tar/Archive_Tar.php'); $languages = Language::getLanguages(false); foreach($languages as $lang) { $files_listing = array(); foreach ($modules_list as $module_name) { $iso = $lang['iso_code']; $filegz = _PS_TRANSLATIONS_DIR_.$iso.'.gzip'; clearstatcache(); if (@filemtime($filegz) < (time() - (24 * 3600))) Language::downloadAndInstallLanguagePack($iso, null, null, false); $gz = new Archive_Tar($filegz, true); $files_list = Language::getLanguagePackListContent($iso, $gz); foreach ($files_list as $i => $file) if (!preg_match('/^modules\/'.$module_name.'\/.*/', $file['filename'])) unset($files_list[$i]); foreach($files_list as $file) if (isset($file['filename']) && is_string($file['filename'])) $files_listing[] = $file['filename']; } $gz->extractList($files_listing, _PS_TRANSLATIONS_DIR_.'../', ''); } } Its worked for me. Link to comment Share on other sites More sharing options...
bellini13 Posted January 12, 2017 Share Posted January 12, 2017 Nope! Language.php, line 885 in PrestaShop 1.5.6.2 for example. But not in PS v1.5.6.1 Link to comment Share on other sites More sharing options...
eleazar Posted January 12, 2017 Share Posted January 12, 2017 @Bellini Correct, you are right! @kirubanidhi You should use the complete Language.php from 1.5.6.3 which fixes some bugs and makes function getLanguagePackListContent work. 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