Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backoffice order button "Proceed to checkout in the front office" doest log in front office as customer - Prestashop 1.7.8.8 #31489

Closed
2 tasks done
Tracked by #17598
Prestapepe opened this issue Feb 22, 2023 · 5 comments
Labels
1.7.8.8 Affects versions BO Category: Back Office Bug Type: Bug Checkout Duplicate Resolution: issue closed because already reported FO Category: Front Office Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Order Component: Which BO section is concerned Verified The issue has been reproduced

Comments

@Prestapepe
Copy link

Prestapepe commented Feb 22, 2023

Prerequisites

Describe the bug and add attachments

When creating a new order in the backoffice, the button "Proceed to checkout in the front office" doest log you in to finish the order with the customer credentials.

This is the standard way to pay a phone order.

Expected behavior

Frontoffice cart with the user logged in to select shipping and payment options.

Steps to reproduce

You can reproduce this BUG in the backoffice demo (with any existing customer and any product)

1.- Go to https://demo.prestashop.com/#/en/back
2.- Menu option "orders" -> "ordes"
3.- Select blue button "Add new order"
4.- Type "pub@prestashop.com"
5.- Press "choose"
6.- Search for "cushion"
7.- Press "Add to cart"
8.- Press the last dropdown button of the page "more options"
9.- Select "Proceed to checkout in the front office"
10.- A new tab is opened in your browser asking you create a new account (not logged as pub@prestashop.com)
11.- Cry

PrestaShop version(s) where the bug happened

1.7.8.8 - 8.0.1 - 8.1.0 - develop

PHP version(s) where the bug happened

all

If your bug is related to a module, specify its name and its version

No response

@Prestapepe Prestapepe added Bug Type: Bug New New issue not yet processed by QA labels Feb 22, 2023
@AureRita
Copy link
Contributor

Hi @Prestapepe ,

Thank you for your report and and this wonderful ending in the steps to reproduce. I reproduce the issue with PrestaShop version 1.7.8.8 as you can see :

Untitled_.Feb.22.2023.5_11.PM.webm

I'll add this to the backlog so it can be fixed.

Please be aware that some issues might take a very long time to be resolved. If this one is important to you and you cannot wait for it to be fixed on the project’s own time, we strongly suggest you consider contacting a professional to help you.

If you fix the issue on your end, please contribute it back to the project. Remember that the more people contribute, the better PrestaShop becomes for everyone.

the strange part of this issue is that we can finish the checkout

Thanks

@AureRita AureRita added Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification BO Category: Back Office FO Category: Front Office Order Component: Which BO section is concerned Ready Status: Issue is ready to be worked on Checkout 1.7.8.8 Affects versions Verified The issue has been reproduced and removed New New issue not yet processed by QA labels Feb 22, 2023
@Hlavtox
Copy link
Contributor

Hlavtox commented Feb 23, 2023

Duplicate of #30074 and #20977

@eurya
Copy link

eurya commented Mar 13, 2023

How to fix this issue:

  • create a FrontController.php file in /override/classes/controller/
  • rewrite the recovertCart() function to fix it:
<?php
class FrontController extends FrontControllerCore
{

    /**
     * Recovers cart information.
     *
     * @return int|false
     */
    protected function recoverCart()
    {
        if (($id_cart = (int) Tools::getValue('recover_cart')) && Tools::getValue('token_cart') == md5(_COOKIE_KEY_ . 'recover_cart_' . $id_cart)) {
            $cart = new Cart((int) $id_cart);
            if (Validate::isLoadedObject($cart)) {
                $customer = new Customer((int) $cart->id_customer);
                if (Validate::isLoadedObject($customer)) {
                    $customer->logged = 1;
                    $this->context->customer = $customer;
                    $this->context->cookie->id_customer = (int) $customer->id;
                    $this->context->cookie->customer_lastname = $customer->lastname;
                    $this->context->cookie->customer_firstname = $customer->firstname;
                    $this->context->cookie->logged = 1;
                    $this->context->cookie->check_cgv = 1;
                    $this->context->cookie->is_guest = $customer->isGuest();
                    $this->context->cookie->passwd = $customer->passwd;
                    $this->context->cookie->email = $customer->email;

                    // extra patch line 
                    $this->context->cookie->registerSession(new CustomerSession());
                    // end patch

                    return $id_cart;
                }
            }
        } else {
            return false;
        }
    }
}

@PresDiego
Copy link

Hi, i created the override file FrontController.php as @eurya wrote, but the problem is the link too:
I've prestashop 8.0.1, and the link created in the BO is http://www.******com/it/ordine?step=3&recover_cart=********&token_cart=********************
I find these errors:

  • http and not https.....
  • ?step=3 : this was right in older PS, but now I've to delete this parameter from the link to work right.
    So we have to correct the link generator, thanks.
    Regards,
    Diego

@Hlavtox
Copy link
Contributor

Hlavtox commented Jul 20, 2023

Duplicate of #20977

@Hlavtox Hlavtox marked this as a duplicate of #20977 Jul 20, 2023
@Hlavtox Hlavtox closed this as completed Jul 20, 2023
@prestashop-issue-bot prestashop-issue-bot bot removed the Ready Status: Issue is ready to be worked on label Jul 20, 2023
@Hlavtox Hlavtox added the Duplicate Resolution: issue closed because already reported label Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.8.8 Affects versions BO Category: Back Office Bug Type: Bug Checkout Duplicate Resolution: issue closed because already reported FO Category: Front Office Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Order Component: Which BO section is concerned Verified The issue has been reproduced
Projects
None yet
Development

No branches or pull requests

5 participants