Jump to content

Como eliminar el checkout de dirección y envió de producto


Recommended Posts

Buenas,

Esto te pasa porque te redirige al checkout?setp=1 ya que ps_wirepayment realiza una verificación cart->id_address en la validación:

modules/ps_wirepayment/controllers/front/validation.php

 

 if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active){
      Tools::redirect('index.php?controller=order&step=1');
 }

 

Si quiere hacer efectivo el saltarte los pasos en el checkout tienes que hacer lo siguiente:

 

1- Crea una dirección en el el Back-Office, por ejemplo la id_address = 4

2- El Hook "actionDispatcher" actualiza nuestro carrito en la Base de Datos, conecta un módulo a actionDispatcher:

   <?php
    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 = 4;
          $cart->id_address_invoice = 4;
          $cart->update();
        }
      }
    }

3- Realiza un Override de Address con el id_address: 

    class Address extends AddressCore {
      public static function getFirstCustomerAddressId($id_customer, $active = true){
        return 4;
      }
    }

4- Realiza un Override en Cart para tener una dirección siempre válida:

    class Cart extends CartCore {
      public function checkAndUpdateAddresses(){
        return true; // always valid
      }
    }

5- Realiza un Override en OrderController para eliminar el paso de Dirección del checkout:

    class OrderController extends OrderControllerCore {
      protected function bootstrap(){
        // ->addStep(new CheckoutAddressesStep(
        //     $this->context,
        //     $translator,
        //     $this->makeAddressForm()
        // ))
      }
    }

 

Espero que te sirva de ayuda,

Saludos,

 

  • Like 1
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...