0

I have a error when add this code and i dont what is the error please i need help this is the code

    public function hookActionDispatcher($params = []){
       $payments_controllers = [
        'ps_wirepaymentvalidationModuleFrontController',
        'ps_checkpaymentvalidationModuleFrontController',
       ];
       if($params['controller_type'] == Dispatcher::FC_FRONT &&
         in_array($params['controller_class'], $payments_controllers) &&
         $params['is_module']){
         $cart = new Cart($this->context->cookie->id_cart);
          if($cart->id_address_delivery == 0 || $cart->id_address_invoice){
          $cart->id_address_delivery = 6;
          $cart->id_address_invoice = 6;
          $cart->update();
          }
       }
    }
Anurag Srivastava
  • 14,077
  • 4
  • 33
  • 43
WAOL
  • 5
  • 3

1 Answers1

-1

You can't use the public modifier on a function that's outside of a class. Try removing it, and your problem should disappear.

Caleb Denio
  • 1,465
  • 8
  • 15
  • Dissapear but the code dont work – WAOL Apr 16 '20 at 22:11
  • Without more context, it's nearly impossible to help you fix this. What is this code doing, and what's not working? – Caleb Denio Apr 16 '20 at 22:14
  • i need remove the shipping method from prestashop i do the same steps of this link https://www.ner2.com/tutoriales/desactivar-metodo-de-envio-en-prestashop-1-7/ – WAOL Apr 16 '20 at 22:19