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

Payment methods in payments title in wrong language #7582

Closed
Bartlomiejsz opened this issue Nov 28, 2016 · 8 comments

Comments

@Bartlomiejsz
Copy link
Contributor

commented Nov 28, 2016

Preconditions

  1. Magento 2.1.2
  2. Having at least two store views (e.g. EN and FR)
  3. Payment method configured with different title for each store view (e.g. Invoice - EN, Facture - FR)

Steps to reproduce

  1. Add some product to cart in EN store view.
  2. Go to checkout second step (Payment method title is correct - Invoice).
  3. Switch to FR store view.
  4. Go to second checkout step.

Expected result

  1. Payment method title should now be 'Facture'

Actual result

  1. The title is still 'Invoice', because of those code lines:
public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null)
{
    $store = $quote ? $quote->getStoreId() : null;
    $methods = [];
    foreach ($this->paymentHelper->getStoreMethods($store, $quote) as $method) {
@vityakopin

This comment has been minimized.

Copy link

commented Jun 19, 2017

Thanks for reporting this issue. I cannot reproduce this. Try to delete cookies after switching between store views. Could you confirm that this issue is still actual?

@Bartlomiejsz

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2017

@vityakopin @veloraven issue still persists on 2.1.7

@vityakopin

This comment has been minimized.

Copy link

commented Jun 21, 2017

Internal ticket MAGETWO-70060 was created.

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Sep 22, 2017

@Bartlomiejsz, thank you for your report.
We've created internal ticket(s) MAGETWO-70060, MAGETWO-73214 to track progress on the issue.

@bka

This comment has been minimized.

Copy link
Contributor

commented Oct 1, 2017

Issue is still present on 2.2-develop. What you can observe is, that the store view from which you put product into the quote matters. If I put a product from other store view e.g. FR into cart and go to checkout the translation will be correct.

It's because the available payment methods and their titles are fetched via API call to /rest/de/V1/carts/mine/payment-information. This API call can only indirectly determine which store view to use. In app/code/Magento/Payment/Model/MethodList.php the storeId to use is coming from the quote.

public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null)
{
    $store = $quote ? $quote->getStoreId() : null;

This quote object gets initialized in and overwritten by Magento/Quote/Model/Quote::loadByCustomer. StoreId is coming from quote in this case.

protected function loadQuote($loadMethod, $loadField, $identifier, array $sharedStoreIds = [])
{
    /** @var Quote $quote */
    $quote = $this->quoteFactory->create();
    if ($sharedStoreIds) {
        $quote->setSharedStoreIds($sharedStoreIds);
    }
    $quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier);
    if (!$quote->getId()) {
        throw NoSuchEntityException::singleField($loadField, $identifier);
    }
    return $quote;
}
bka pushed a commit to bka/magento2 that referenced this issue Oct 1, 2017
Bernhard Leers
magento#7582: use setStoreId after custom load method to given storeI…
…d determination precedence to fix payment title translation error in checkout
okorshenko added a commit that referenced this issue Oct 11, 2017
MAGETWO-80894: #7582: use setStoreId after custom load method to give…
… storeId precedence #11165

 - Merge Pull Request #11165 from bka/magento2:issue-7582
 - Merged commits:
   1. 33dcc36
okorshenko added a commit that referenced this issue Oct 11, 2017
@okorshenko

This comment has been minimized.

Copy link
Contributor

commented Oct 11, 2017

Hi @Bartlomiejsz the issue has been fixed in 2.2-develop branch and will be available in 2.2.1 release soon

@okorshenko okorshenko closed this Oct 11, 2017

@magento-team

This comment has been minimized.

Copy link
Contributor

commented Oct 11, 2017

Internal ticket to track issue progress: MAGETWO-80894

@magento-team

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2018

Hi @Bartlomiejsz. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

magento-engcom-team pushed a commit that referenced this issue Aug 3, 2018
MAGETWO-91330: [B2B] The product total price value on the second webs…
…ite is as on the default website

- reverted fix from community PR #11165
- issue #7582 is fixed via plugin on store view switching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.