Changes for module upgrade and suggession
This commit is contained in:
@@ -60,7 +60,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
protected $iso_default_country;
|
||||
protected $filter_configuration = array();
|
||||
|
||||
protected $xml_modules_list = _PS_API_MODULES_LIST_16_;
|
||||
protected $xml_modules_list = _QLO_NATIVE_MODULES_LIST_;
|
||||
|
||||
/**
|
||||
* Admin Modules Controller Constructor
|
||||
@@ -768,8 +768,8 @@ class AdminModulesControllerCore extends AdminController
|
||||
if (!file_exists(_PS_MODULE_DIR_.$name.'/'.$name.'.php') || $key == 'update' || $key == 'updateAll') {
|
||||
$files_list = array(
|
||||
array('type' => 'addonsNative', 'file' => Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
array('type' => 'addonsBought', 'file' => Module::CACHE_FILE_CUSTOMER_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
array('type' => 'addonsMustHave', 'file' => Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
// array('type' => 'addonsBought', 'file' => Module::CACHE_FILE_CUSTOMER_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
// array('type' => 'addonsMustHave', 'file' => Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
);
|
||||
|
||||
foreach ($files_list as $f) {
|
||||
@@ -779,7 +779,8 @@ class AdminModulesControllerCore extends AdminController
|
||||
if ($xml = @simplexml_load_string($content, null, LIBXML_NOCDATA)) {
|
||||
foreach ($xml->module as $modaddons) {
|
||||
if (Tools::strtolower($name) == Tools::strtolower($modaddons->name)) {
|
||||
$module_to_update[$name]['id'] = $modaddons->id;
|
||||
// $module_to_update[$name]['id'] = $modaddons->id;
|
||||
$module_to_update[$name]['name'] = $modaddons->name;
|
||||
$module_to_update[$name]['displayName'] = $modaddons->displayName;
|
||||
$module_to_update[$name]['need_loggedOnAddons'] = $f['loggedOnAddons'];
|
||||
}
|
||||
@@ -791,11 +792,11 @@ class AdminModulesControllerCore extends AdminController
|
||||
foreach ($module_to_update as $name => $attr) {
|
||||
if ((is_null($attr) && $this->logged_on_addons == 0) || ($attr['need_loggedOnAddons'] == 1 && $this->logged_on_addons == 0)) {
|
||||
$this->errors[] = sprintf(Tools::displayError('You need to be logged in to your PrestaShop Addons account in order to update the %s module. %s'), '<strong>'.$name.'</strong>', '<a href="#" class="addons_connect" data-toggle="modal" data-target="#modal_addons_connect" title="Addons">'.$this->l('Click here to log in.').'</a>');
|
||||
} elseif (!is_null($attr['id'])) {
|
||||
} elseif (!is_null($attr['name'])) {
|
||||
$download_ok = false;
|
||||
if ($attr['need_loggedOnAddons'] == 0 && file_put_contents(_PS_MODULE_DIR_.$name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($attr['id']))))) {
|
||||
if ($attr['need_loggedOnAddons'] == 0 && file_put_contents(_PS_MODULE_DIR_.$name.'.zip', Tools::addonsRequest('module', array('module_name' => pSQL($attr['name']))))) {
|
||||
$download_ok = true;
|
||||
} elseif ($attr['need_loggedOnAddons'] == 1 && $this->logged_on_addons && file_put_contents(_PS_MODULE_DIR_.$name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($attr['id']), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons)))))) {
|
||||
} elseif ($attr['need_loggedOnAddons'] == 1 && $this->logged_on_addons && file_put_contents(_PS_MODULE_DIR_.$name.'.zip', Tools::addonsRequest('module', array('module_name' => pSQL($attr['name']), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons)))))) {
|
||||
$download_ok = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user