Jump to content

Override CartController n'affiche pas d'erreur


sbou

Recommended Posts

Bonjour,

 

J'ai fait un override de la méthode processChangeProductInCart

suivant certaine règle je dois remonter une erreur 

$this->errors[] = $this->trans('Error to display', array(), 'Shop.Notifications.Error');

Dans controllers/front/CartController.php

public function displayAjaxUpdate()

J'ai bien le die hasError qui est exécuté

 

$this->ajaxDie(Tools::jsonEncode([
    'hasError' => true,
    'errors' => $this->errors,
    'quantity' => $productQuantity,
]));

dans modules/ps_shoppingcart/controllers/front/ajax.php

initcontent la action 'add-to-cart' , je n'ai plus cette info pour afficher un meeage spécifique 

if (Tools::getValue('action') === 'add-to-cart') {
    $modal = $this->module->renderModal(
        $this->context->cart,
        Tools::getValue('id_product'),
        Tools::getValue('id_product_attribute')
    );
}

 

Faut-il remonter l'erreur autrement ?

 

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...