Jump to content

[Solved] Prestashop : Call to undefined method Language::updateModulesTranslations()


kirubanidhi

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...