Salut la communauté, Moi aussi ce détail m'a posé pas mal de soucis. Comme il faut passer beaucoup de temps à configurer les transporteurs, leurs zones et leurs tranches, je me retrouvais avec un nouvel ID de transporteur généré à chaque modif, et du coup certaines fonctionnalités sautaient, notamment au niveau de l'automatisation des envois par La Poste, parce qu'associées à cet ID. En regardant dans le code, on voit que c'est un comportement qui a été généré spécifiquement pour cette rubrique des transporteurs... Voici le code à changer dans admin/tabs/AdminCarriers.php (ligne 162 environ) pour pouvoir effectuer des modifications du transporteur sans en créer un nouveau à la place à chaque mise à jour : /* Object update */
if (isset($id) AND !empty($id))
{
if ($this->tabAccess['edit'] === '1')
{
$object = new $this->className($id);
if (Validate::isLoadedObject($object))
{
$object->deleted = 1;
$object->update();
$objectNew = new $this->className();
$this->copyFromPost($objectNew, $this->table);
$result = $objectNew->add();
if (Validate::isLoadedObject($objectNew))
{
$this->afterDelete($objectNew, $object->id);
Hook::updateCarrier(intval($object->id), $objectNew);
}
if (!$result)
$this->_errors[] = Tools::displayError('an error occurred while updating object').' '.$this->table.'';
elseif ($this->postImage($objectNew->id))
{
$this->changeZones($objectNew->id);
Tools::redirectAdmin($currentIndex.'&id;_'.$this->table.'='.$object->id.'&conf=4'.'&token;='.$this->token);
}
}
else
$this->_errors[] = Tools::displayError('an error occurred while updating object').' '.$this->table.' '.Tools::displayError('(cannot load object)');
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
}
A remplacer par :
/* Object update */
if (isset($id) AND !empty($id))
{
if ($this->tabAccess['edit'] === '1')
{
$object = new $this->className($id);
if (Validate::isLoadedObject($object))
{
$this->copyFromPost($object, $this->table);
if ($this->postImage($object->id))
$this->changeZones($object->id);
$result = $object->update();
if (!$result)
$this->_errors[] = Tools::displayError('an error occurred while updating object').' '.$this->table.'';
else
Tools::redirectAdmin($currentIndex.'&id;_'.$this->table.'='.$object->id.'&conf=4'.'&token;='.$this->token);
}
else
$this->_errors[] = Tools::displayError('an error occurred while updating object').' '.$this->table.' '.Tools::displayError('(cannot load object)');
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
}
Pensez quand même à faire une copie de sauvegarde du fichier avant de le modifier, mais chez moi ça marche nickel, je n'ai plus de problèmes depuis.