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

[BOOM-5223] Carriers list to enter a tracking number shows only those enabled for visitors #9687

Closed
prestonBot opened this issue Aug 22, 2018 · 13 comments · Fixed by #11256
Closed
Labels
1.7.3.0 Affects versions 1.7.4.2 Affects versions Bug Type: Bug Carriers Label: Which BO under menu is concerned Fixed Resolution: issue closed because fixed Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Order Component: Which BO section is concerned
Milestone

Comments

@prestonBot
Copy link
Collaborator

This issue has been migrated from the Forge. Read the original ticket here.

  • Reporter: Paolo
  • Created at: Fri, 30 Mar 2018 19:54:31 +0200

When modifying an order from backoffice to enter tracking information, the list of carriers shows only those enabled for visitors. Function getCarrierList() in AdminOrdersController should consider not only the country of the customer but its group too.

Configuration parameter PS_UNIDENTIFIED_GROUP can change this behavior, but what if we want to leave access to carriers only to guests and registered users?

  • How to reproduce the issue ?

Create a carrier with group access => Visitor


Create a carrier with group access => Guest / Customer


Go to FO => add products to the cart as a visitor => to complete the order => create a new customer => process checkout


Go to BO => edit the order created => edit the shipping details => the list of carriers show only carriers configured for visitor and not for Guest / Customer

@prestonBot prestonBot added 1.7.3.0 Affects versions 1.7.4.2 Affects versions Bug Type: Bug Carriers Label: Which BO under menu is concerned Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Order Component: Which BO section is concerned Ready Status: Issue is ready to be worked on labels Aug 22, 2018
@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: khouloud.belguith
  • Created at: Mon, 2 Apr 2018 11:56:22 +0200

Hi Paolo,

I did not manage to reproduce the issue with PS version 1.7.3.0.
I attached screenshots, thanks to check and feedback.

Best regards,
Khouloud

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: paolo
  • Created at: Wed, 4 Apr 2018 10:09:22 +0200

Hi Khouloud.

Here's my situation. Picture one shows the list of carriers we defined.

As we don't want visitors to have inaccurate information about shipping cost, we have a fake courier, "No shipping cost for visitors", enabled to visitors only, with free shipping (it will show "depending on destination" as shipping cost when filling the order).

Then we have "couriers" defining shipping costs for zones. These are enabled for guests and customers only.

With this situation, picture 2 shows the result: when we edit tracking information, the drop down list shows only the fake courier for visitor, while it should show a list of couriers for guests or customers (this test order was created with a registered user).

This comes from the use of function Carrier::getCarriersForOrder, that is called with group parameter null in function getCarrierList, module AdminOrdersController.php. As group parameter is null, getCarriersForOrder will use only PS_UNIDENTIFIED_GROUP as group, therefore visitor. I think it should use the group of the customer who placed the order, instead of being called with a null parameter.

We solved this by adding a real courier definition (DHL, for example, at the bottom of picture 1) to be used just to provide tracking information upon shipment. We also defined a new group ("couriers"), enabled for this new courier definition only.

Modifying getCarrierList function line from

return Carrier::getCarriersForOrder(Address::getZoneById((int) $address->id), null, $cart);

to

return Carrier::getCarriersForOrder(Address::getZoneById((int) $address->id), array(4), $cart);

(where '4' is the id of the new couriers group) it does what we need, as in picture 3.

Best regards,

 

Paolo

 

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: khouloud.belguith
  • Created at: Wed, 4 Apr 2018 13:43:48 +0200

Hi Paolo,

How could you create an order with a customer in a visitor group?

Best regards, Khouloud

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: paolo
  • Created at: Wed, 4 Apr 2018 14:41:48 +0200

Hi!

We can add products to the cart as visitors, but we need to checkout as guest or registered customer. No shipping cost is shown to visitors until they provide address information.

Paolo

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: khouloud.belguith
  • Created at: Wed, 4 Apr 2018 15:31:44 +0200

Hi Paolo,

I manage to reproduce the issue following this steps :
Create a free carrier with group access => Visitor
Create a carrier (not free) with group access => Guest / Customer
Go to FO => add products to the cart as a visitor => to complete the order => create a new customer => process checkout
Go to BO => edit the order created => edit the shipping details => the list of carriers is empty

PS: tested when Tracking URL for all the carriers empty or not.
We will see how to fix it.

Best regards, Khouloud

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: paolo
  • Created at: Wed, 4 Apr 2018 16:35:25 +0200

Thank you for your time in checking on this, Khouloud.

As I wrote above, the function getCarrierList may just consider in which group was the customer when he entered the order, and pass it to getCarriersForOrder instead of null (didn't test this myself...)

Have a great day,

Paolo

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: marion_francois
  • Created at: Thu, 5 Apr 2018 11:18:33 +0200

Salut Khouloud BELGUITH

Je n'arrive pas à reproduire le problème avec le scénario que tu décris
La liste des transporteurs est bien remplie
Peux-tu me dire si je n'ai pas loupé quelque chose: 

https://drive.google.com/open?id=12rudDc2OHD5VPgdSVini7ggGx9eIJMTA

Merci

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: khouloud.belguith
  • Created at: Thu, 5 Apr 2018 12:14:53 +0200

Salut Marion F,

Je n'ai pas utilisé les transporteurs par défaut de PrestaShop.
J'ai créé deux nouveaux transporteurs avec les caratéristiques spécifiés.
Apr 5 2018 11_09 AM.webm

Merci

@prestonBot
Copy link
Collaborator Author

This comment has been migrated from the Forge. Read the original comment here.

  • Author: marion_francois
  • Created at: Thu, 5 Apr 2018 13:51:06 +0200

I can reproduce the issue described by Paolo this way:

Create a carrier with group access => Visitor
Create a carrier with group access => Guest / Customer
Go to FO => add products to the cart as a visitor => to complete the order => create a new customer => process checkout
Go to BO => edit the order created => edit the shipping details => the list of carriers show only carriers configured for visitor and not for Guest / Customer

@manfield
Copy link
Contributor

manfield commented Nov 4, 2018

Hi, I'm experiencing the same exact issue.

@manfield
Copy link
Contributor

manfield commented Nov 4, 2018

Alright, this is the fix:

AdminOrderController.php line 3019

Method should retrieve customer's groups and passing them to the getCarriersForOrder static function:

    /**
     * Get available carrier list for an order
     * @param Object $order
     * @return array $delivery_option_list_formated
     */
    protected function getCarrierList($order)
    {
        $cart = $this->context->cart;
        $id_customer = $cart->id_customer;
        $groups = Customer::getGroupsStatic($id_customer);
        $address = new Address((int) $cart->id_address_delivery);
        return Carrier::getCarriersForOrder(Address::getZoneById((int) $address->id), $groups, $cart);
    }

I'm going to open a merge request on that.

@khouloudbelguith
Copy link
Contributor

Hi @manfield,

Thanks for your fix.

@manfield
Copy link
Contributor

Hi @khouloudbelguith, this merge request:
#11256

is not yet assigned. Just to make you know ;)

@ntiepresta ntiepresta added Fixed Resolution: issue closed because fixed and removed Ready Status: Issue is ready to be worked on labels Nov 22, 2018
@marionf marionf added this to To do in PrestaShop 1.7.6 via automation Nov 22, 2018
@marionf marionf moved this from To do to to be merged in PrestaShop 1.7.6 Nov 22, 2018
PrestaShop 1.7.6 automation moved this from to be merged to Done Nov 22, 2018
PierreRambaud added a commit that referenced this issue Nov 22, 2018
Fixes error reported in #9687, regarding carrier list in the modal to ...
@marionf marionf added this to the 1.7.6.0 milestone Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7.3.0 Affects versions 1.7.4.2 Affects versions Bug Type: Bug Carriers Label: Which BO under menu is concerned Fixed Resolution: issue closed because fixed Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Order Component: Which BO section is concerned
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants