Jump to content

Skip address page for registered customers PS1.6


Recommended Posts

Dear Prestashop gurus, I come to you for guidance.

 

I stumbled upon a simple but yet so frustrating problem which I can’t solve and would truly appreciate the help from you!

Problem: When guests click on the “go to checkout” button, they are forwarded directly to the checkout page (perfect). However, logged in customers are instead forwarded to the “address page”, which is an unnecessary step for my shop since I do not require customers to register their address (third party solution for shipping and payment).

Solution: Skip the “address page” for registered customers and instead forwarded directly to checkout.

 

I believe that this happening because there is a function in ParentOrderController.php and OrderOpcController.php which will redirecting the logged in user to the address page if s/he doesn't have an address yet. However, I don’t know how to edit it.

 protected function _assignAddress()
    {
        //if guest checkout disabled and flag is_guest  in cookies is actived
        if (Configuration::get('PS_GUEST_CHECKOUT_ENABLED') == 0 && ((int)$this->context->customer->is_guest != Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))) {
            $this->context->customer->logout();
            Tools::redirect('');
        } elseif (!Customer::getAddressesTotalById($this->context->customer->id)) {
            $multi = (int)Tools::getValue('multi-shipping');
            Tools::redirect('index.php?controller=address&back='.urlencode('order.php?step=1'.($multi ? '&multi-shipping='.$multi : '')));
        }
case 'getAddressBlockAndCarriersAndPayments':
                            if ($this->context->customer->isLogged() || $this->context->customer->isGuest()) {
                                // check if customer have addresses
                                if (!Customer::getAddressesTotalById($this->context->customer->id)) {
                                    $this->ajaxDie(Tools::jsonEncode(array('no_address' => 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...