Skip to content

Commit 6aadedf

Browse files
committed
MAGETWO-80643: Cannot create orders in the admin for stores other than the default when using Paypal Payflow Pro
1 parent 373f320 commit 6aadedf

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

app/code/Magento/Quote/Model/ResourceModel/Quote.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ protected function _construct()
6262
protected function _getLoadSelect($field, $value, $object)
6363
{
6464
$select = parent::_getLoadSelect($field, $value, $object);
65+
if ($this->getIdFieldName() === $field) {
66+
return $select;
67+
}
68+
6569
$storeIds = $object->getSharedStoreIds();
6670
if ($storeIds) {
6771
if ($storeIds != ['*']) {

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteRepositoryTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Quote\Api\Data\CartSearchResultsInterface;
1616
use Magento\Quote\Model\Quote\Address as QuoteAddress;
1717
use Magento\Quote\Api\Data\CartExtension;
18+
use Magento\Store\Model\Website;
1819

1920
/**
2021
* QuoteRepository test.
@@ -51,6 +52,24 @@ protected function setUp()
5152
$this->filterBuilder = $this->objectManager->create(FilterBuilder::class);
5253
}
5354

55+
/**
56+
* Tests getting quote.
57+
* @magentoDataFixture Magento/Quote/_files/quote_on_second_website.php
58+
*/
59+
public function testGet()
60+
{
61+
/** @var Website $website */
62+
$website = $this->objectManager->create(Website::class);
63+
$website->load('test', 'code');
64+
65+
/** @var Quote $quote */
66+
$quote = $this->objectManager->create(Quote::class);
67+
$quote->setSharedStoreIds($website->getStoreIds());
68+
$quote->load('test01', 'reserved_order_id');
69+
70+
$this->quoteRepository->get($quote->getId());
71+
}
72+
5473
/**
5574
* Tests getting list of quotes according to search criteria.
5675
* @magentoDataFixture Magento/Sales/_files/quote.php
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
require __DIR__ . '/../../Catalog/_files/products_with_websites_and_stores.php';
8+
9+
\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(Magento\Framework\App\Area::AREA_FRONTEND);
10+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
11+
12+
$addressData = include __DIR__ . '/../../Sales/_files/address_data.php';
13+
$billingAddress = $objectManager->create(\Magento\Quote\Model\Quote\Address::class, ['data' => $addressData]);
14+
$billingAddress->setAddressType('billing');
15+
$shippingAddress = clone $billingAddress;
16+
$shippingAddress->setId(null)->setAddressType('shipping');
17+
18+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
19+
$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
20+
$product2 = $productRepository->get('simple-2');
21+
22+
/** @var \Magento\Store\Model\Store $store */
23+
$store = $objectManager->create(\Magento\Store\Model\Store::class);
24+
$store->load('fixture_second_store', 'code');
25+
26+
/** @var \Magento\Quote\Model\Quote $quote */
27+
$quote = $objectManager->create(\Magento\Quote\Model\Quote::class);
28+
$quote->setCustomerIsGuest(true)
29+
->setStoreId($store->getId())
30+
->setReservedOrderId('test01')
31+
->setBillingAddress($billingAddress)
32+
->setShippingAddress($shippingAddress)
33+
->addProduct($product2);
34+
$quote->getPayment()->setMethod('checkmo');
35+
$quote->setIsMultiShipping('1');
36+
$quote->collectTotals();
37+
$quote->save();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
8+
9+
/** @var \Magento\Framework\Registry $registry */
10+
$registry = $objectManager->get(\Magento\Framework\Registry::class);
11+
$registry->unregister('isSecureArea');
12+
$registry->register('isSecureArea', true);
13+
14+
/** @var \Magento\Store\Model\Website $website */
15+
$website = $objectManager->create(\Magento\Store\Model\Website::class);
16+
$website->load('test', 'code');
17+
18+
/** @var $quote \Magento\Quote\Model\Quote */
19+
$quote = $objectManager->create(\Magento\Quote\Model\Quote::class);
20+
$quote->setSharedStoreIds($website->getStoreIds());
21+
$quote->load('test01', 'reserved_order_id');
22+
if ($quote->getId()) {
23+
$quote->delete();
24+
}
25+
26+
$registry->unregister('isSecureArea');
27+
$registry->register('isSecureArea', false);
28+
29+
require __DIR__ . '/../../Catalog/_files/products_with_websites_and_stores_rollback.php';

0 commit comments

Comments
 (0)