Jump to content

Stuck at add new address page


koala_dev

Recommended Posts

I'm experiencing a strange behavior in my prestashop installation, I have enabled "One-page" checkout but whenever I try to access the shopping cart (quick order) page I get redirected to the add new address page.

 

So when clicking a link that points to http://mystore.com/quick-order I get redirected to http://mystore.com/address?back=order.php%3Fstep%3D1%26multi-shipping%3D0.

 

Does anyone know how to correct this?

Edited by koala_dev (see edit history)
Link to comment
Share on other sites

Try to turn off all Caching, all ccc's to "original", force reload of smarty templates (Advanced Parameters)

Then try to toggle Friendly URL's, and reload the front page (Ctrl-F5) , and see if going to order page works.

Then try to toggle Friendly URL's back to original state.

Then return caching, ccc, force reload template etc to original state.

 

 

Hope this helps,

pascal

Link to comment
Share on other sites

  • 2 weeks later...

I have the same issue and I tried that and it didn't help. This issue only occur if you are logged in. So if you are logged in and go to checkout it forces you to the page for adding another address. I am on prestashop 1.5.4.1.

 

Please help, this sucks for all registered customers.

Link to comment
Share on other sites

Pacquaio,

Do you use a custom Theme, or just default one? If custom theme, please temporarily change to the default theme, and see if it still happens. (also, re-apply caching suggestions as given after changing the theme)

 

Let us know the result,

pascal

Link to comment
Share on other sites

@Pascal

 

I still experience the same behavior after reverting to the default theme and disabling caching and friendly URL's. It appears this only happens when the user has not yet added any addresses. The links that point to http://mystore.com/index.php?controller=order-opc are redirected to http://mystore.com/index.php?controller=address&back=order%3Fstep%3D1%26multi-shipping%3D0 and the only way to get the order page is by adding a new address.

Link to comment
Share on other sites

This happening because there is a function in ParentOrderController.php which will redirecting the logged in user to the address page if s/he doesn't have an addres yet.

protected function _assignAddress()
{
      /* ... code ...*/ 
      elseif (!Customer::getAddressesTotalById((int)(self::$cookie->id_customer)))
            Tools::redirect('address.php?back=order.php?step=1');
      /* ... code ...*/ 
}

This function was used in OrderOpcController.php inside public function preProcess()

public function preProcess()
{
     /* ... code ...*/ 
                        case 'getAddressBlockAndCarriersAndPayments':
                            if (self::$cookie->isLogged())
                            {
                                // check if customer have addresses
                                if (!Customer::getAddressesTotalById((int)(self::$cookie->id_customer)))
                                    die(Tools::jsonEncode(array('no_address' => 1)));
      /* ... code ...*/  
                                $this->_assignAddress();
      /* ... code ...*/
}
Link to comment
Share on other sites

This is not a Prestashop Bug's, this is the SOP Prestashop :)

 

But i think you can do something like this to replace Tools::redirect()

But then you should modify the next step, to make sure customer add an addressBut then you should modify the next step

        else if (!Customer::getAddressesTotalById($this->context->customer->id)) {
            $this->context->cart->id_address_delivery = 1;
            $this->context->cart->id_address_invoice = 1;
        }
Link to comment
Share on other sites

  • 3 weeks later...

Thanks for the info, that certainly seems to be the issue, is there anyway to correct it? If I simply remove the redirect line the page lands in an infinite redirect loop

Because there is another redirection a little lower. To be exact there are two parts of code in ParentOrderController.php, which need to be removed to solve the problem.

 

protected function _assignAddress()
{
    /* ... */
    else if (!Customer::getAddressesTotalById($this->context->customer->id))
        Tools::redirect('index.php?controller=address&back='.urlencode('order.php?step=1&multi-shipping='.(int)Tools::getValue('multi-shipping')));
    /* ... */
    if (!count($customerAddresses))
    {
        $bad_delivery = false;
        if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || (!Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)))
        {
            $back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int)Tools::getValue('multi-shipping')));
            $params = array('multi-shipping' => (int)Tools::getValue('multi-shipping'), 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice), 'back' => $back_url);
            Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params));
        }
    }
    /* ... */
}

 

P.S. I hope that address requirement will be optional in future versions as nowadays many shops don't need it in a way it is. Virtual products is a good way to get rid of an address, but it lacks some features (such as combinations) and not applicable to any shop.

Edited by Godangel (see edit history)
Link to comment
Share on other sites

  • 4 months later...

hi , i used prestashop 1.5.6.0 with the default template , sorry i don't have the link because the site in maitenance for the moment

but i think that  I can explain the problem: 

when the customer connect with google, facebook, tweeter account and place an order he must add a new address each time when it connect though he has already addresses that are registered with this site. 

Link to comment
Share on other sites

hmm, I don't know that module, but it seems they don't create a PrestaShop user correctly that is linked to the social login user. If you then login again, it probably just makes a new PS user (or it cannot correctly find the old one or so), so that a new address is needed every time.

 

Where did you get thst module? Is it compatible with PS 1.5.6.0, according to the developer?

Link to comment
Share on other sites

  • 3 weeks later...

Hi there.

 

Impossible for a customer to add or modify a new postal address when he is log in.

Blank page as result.

I use Prestashop 1.4.6.2 and I have the same problem using any theme.

If you have any clue...

Thank you !

Link to comment
Share on other sites

Hi Pat,

White screens normally indicate some error on a page.

Please turn on debug mode to get more info on the error. Then, if you're still stuck, copy and paste the error Message here.

 

(Search google on 'prestashop debug mode' on how to turn on debug mode)

 

Pascal

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

Hi, I have the same problem with being redirect to addresses instead to quick-order.

I am using the "One page checkout" module.

The problem only occurs if I enable the codr klarna checkout module.

I have deleted the lines from parentordercontroller.php and then the redirect works properly however when I choose a payment method and I press "back" my original customer email adress gets automatically changed for a preset email from codr klarna checkout.. and I dont know why this happens.

can somebody assist.

I have disable the klarna check out..so please let me know if somebody can help so i can activate it again for testing.

 

website: www.markone-fashion.com

thanks

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