HAProxy, Varnish 4, Nginx, PHP-FPM 7.0.10-1, MariaDB
Setup another website, store & store view
Submit the order
Order creation
Return with exception _No such entity with cartId = XX_
What I tested so far:
Regards
Jan
From firebug:
{"message":"An error occurred on the server. Please try to place the order again.","trace":"#0 \/var
\/www\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(146): Magento\\Checkout\\Model
\\PaymentInformationManagement->savePaymentInformationAndPlaceOrder(8, Object(Magento\\Quote\\Model\
\Quote\\Payment\\Interceptor), Object(Magento\\Quote\\Model\\Quote\\Address))\n#1 \/var\/www\/html\/var
\/generation\/Magento\/Checkout\/Model\/PaymentInformationManagement\/Interceptor.php(26): Magento\\Checkout
\\Model\\PaymentInformationManagement\\Interceptor->___callPlugins('savePaymentInfo...', Array, Array
)\n#2 [internal function]: Magento\\Checkout\\Model\\PaymentInformationManagement\\Interceptor->savePaymentInformationAndPlaceOrder
(8, Object(Magento\\Quote\\Model\\Quote\\Payment\\Interceptor), Object(Magento\\Quote\\Model\\Quote\
\Address))\n#3 \/var\/www\/html\/vendor\/magento\/module-webapi\/Controller\/Rest.php(307): call_user_func_array
(Array, Array)\n#4 \/var\/www\/html\/vendor\/magento\/module-webapi\/Controller\/Rest.php(216): Magento
\\Webapi\\Controller\\Rest->processApiRequest()\n#5 \/var\/www\/html\/var\/generation\/Magento\/Webapi
\/Controller\/Rest\/Interceptor.php(37): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\
\Framework\\App\\Request\\Http))\n#6 \/var\/www\/html\/vendor\/magento\/framework\/App\/Http.php(135
): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\
\Http))\n#7 \/var\/www\/html\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\\Framework
\\App\\Http->launch()\n#8 \/var\/www\/html\/pub\/index.php(51): Magento\\Framework\\App\\Bootstrap->run
(Object(Magento\\Framework\\App\\Http))\n#9 {main}"}
Same thing here, many stores. Default store orders from admin are OK, cannot create orders from other stores, I get a No such entity with cartId = XX error.
@Ubeo - did you try creating frontend orders? In one of our clients shop they seems to be blocked...
@gewaechshaus yes, it works on frontend.
Got the same issue with a multistore setup. Can only create backend orders for the default store. Choosing an other store results in this error message.
@PascalBrouwers - what's going on in your frontend? Our clients guest frontend orders are partially blocked 2, so be aware...
Frontend is ok. But we like to be able to make a backend order as well ;)
Any updates about it ?
I have the same issue on version 2.1.3 (multiwebsite)
For example, I need to retrieve a quote after the order is placed from the admin panel
checkout_submit_all_after
event in my custom observer to retrieve the order which was placed from the admin panel and NOT from the default store.quote_id
from the order object and try to retrieve the quote using the \Magento\Quote\Model\QuoteRepository::get()
method.\Magento\Quote\Model\QuoteRepository::loadQuote()
method which sets the current store ID before the quote execution.As a workaround, I always have to set the current store using StoreManager
before quote execution in the admin scope, but I think this is not acceptable.
@magento-team, please fix this issue asap. Thanks.
Experiencing the same issue on CE 2.1.3.
Same here...
Same here. having issue in CE 2.1.2
I'm having this issue on and off for the last couple of days.
After downloading an updated database from our staging server, when I try to checkout I was getting error message "No such entity with cartId = 0".
However, if I switch to a new incognito browser I was able to checkout, while still getting the error in my regular browser.
The issue seems to have something to do with the wrong ID getting posting to estimate-shipping-methods rest api.
Error in regular browser posting
/rest/default/V1/guest-carts/582/estimate-shipping-methods
Incognito browser posting
rest/default/V1/guest-carts/8c5a23bf5bfb3040cce9c340af04b973/estimate-shipping-methods
Which causes the function below to return zero because 582 is not a valid mask_id.
Magento version 2.1.3
vendor/magento/module-quote/Model/GuestCart/GuestShippingMethodManagement.php
public function estimateByExtendedAddress($cartId, AddressInterface $address)
{
/** @var $quoteIdMask QuoteIdMask */
$quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
return $this->getShipmentEstimationManagement()
->estimateByExtendedAddress((int) $quoteIdMask->getQuoteId(), $address);
}
I'm getting this same issue on 2.1.4
I'm also having the problem in 2.1.5 and it's causing lots of problems. Please fix asap.
Hi, @gewaechshaus. We need more information about your configuration to reproduce this issue. Please, specify payment and shipping methods you use and your second website's settings.
Hi, @asrar7787. Tried to reproduce it as you told but still can't get this error message.
Can you provide the detailed steps we must follow to reproduce this issue?
Here is my steps:
What i missed? What i must to do to reproduce it?
Hi @IlnitskiyArtem, have you tried following the steps given by @alexpoletaev ?
https://github.com/magento/magento2/issues/6522#issuecomment-276027109
Those seem to be detailed enough.
@korostii
The issue still persists in EE 2.1.6.
I will not be verbose again as other members already did earlier, it's a waste of time, if you do not really appreciate others time!
Anyway, debug this class in multi-store installation for admin orders
vendor/magento/module-quote/Model/QuoteRepository.php
on line 192 and you will see that $shardeStoreIds
at one point will be having no array element, means default store view. This in turn causes the error.
Why core team not taking it seriously given that merchants spend money for Enterprise edition?!
I would suggest a member of advisory board team should take a look into it.
And do not just tag can not reproduce
please.
This is misleading, an Enterprise Level misleading, as I spent few hours considering the issue does not exist. So I had to debug all other modules and stuff. But eventually, it's the core code!
I would not mind screen cast with you tbh!
M2 guys, please acknowledge this issue and fix that asap.
I think I am receiving this error.
I get this error whenever I try to edit an order in the backend that is not part of the default shop. (by edit I mean the cancel/reorder edit where you add extra products change shipping methods etc.)
As a further test I added code to the root index.php to change website run code param to my second store effectively making that my default store. When I did this I could edit orders for my second store without errors but I would get errors whenever I tried to edit an order from the default store.
@alexpoletaev
Hi mate, would you mind sharing/explaining your code where and how you were able to implement your workaround please?
Thanks
Asrar
Hi @asrar7787, we had this issue with the 3rd party module, but the problem is that magento always retrieves a quote (if the QuoteRepository was used) from the admin area for the default store, so you need to find the place where you catch this exception and provide a store id like this:
$quote = $this->quoteRepository->get($quoteId, [$order->getStoreId()]);
or, at least, like this:
$this->storeManager->setCurrentStore($order->getStoreId());
$quote = $this->quoteRepository->get($quoteId);
it's better to use the first example. So using this way you telling Magento for which store you want to retrieve the quote.
I was having trouble finding the correct place to place the code mentioned above. I was eventually able to work out a slightly hacky way of doing this (do it at the start of all order saves in admin). I'm still testing this for any possible issues it might cause so use at your own risk
/vendor/magento/module-sales/Controller/Adminhtml/Order/Create/Save.php
try {
// hack to let it save in multistores
$om = \Magento\Framework\App\ObjectManager::getInstance();
$manager = $om->get('Magento\Store\ModelStoreManagerInterface');
$manager->setCurrentStore($this->_getSession()->getQuote()->getStoreId());
// end hack
@alexpoletaev probably fixed in https://github.com/magento/magento2/commit/e93c44e66d256836c18e6a5e7e9f24623f05e25b (2.2.x
branch only).
I had to create a 'before' plugin for order Magento\Sales\Controller\Adminhtml\Order\Create\Save
so no core hack necessary, a Magento 2 way fix ;-), cheers @nick-iFactory
see below:
the etc/adminhtml/di.xml for declaring the plugin:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Controller\Adminhtml\Order\Create\Save">
<plugin name="namespace_modulename_adminhtml_order_create_save_before_execute"
type="Namespace\Modulename\Plugin\Sales\Controller\Adminhtml\Order\Create\Save"
sortOrder="1"
disabled="false"
/>
</type>
</config>
and the plugin for controller
<?php
namespace Namespace\Modulename\Plugin\Sales\Controller\Adminhtml\Order\Create;
use Magento\Backend\Model\Session\Quote as BackendSessionQuote;
use Magento\Store\Model\StoreManagerInterface;
class Save
{
protected $backendSessionQuote;
protected $storeManagerInterface;
public function __construct(
BackendSessionQuote $backendSessionQuote,
StoreManagerInterface $storeManagerInterface
) {
$this->backendSessionQuote = $backendSessionQuote;
$this->storeManagerInterface = $storeManagerInterface;
}
public function beforeExecute(
\Magento\Sales\Controller\Adminhtml\Order\Create\Save $subject
) {
$this->storeManagerInterface->setCurrentStore($this->backendSessionQuote->getQuote()->getStoreId());
return;
}
}
That should work.
@orlangur Thanks for the update, I will give that a go.
Seeing this issue on 2.1.9, except I'm not running multistore, we only have one storefront. Also I'm not seeing it on the back end, we are getting this problem during regular checkout.
@asrar7787 - I was going to try your solution, but then I realized that this is a fix for the admin, so not applicable to people buying via the regular cart.
Would setting the site to single store mode (assuming there is no need for multistore) resolve this issue?
@aeu please keep in mind that single-store mode has its own issues, most notably #7392
We are experiencing this issue quite a lot as well on Magento 2.1.6.
Here are my thoughts:
What I found is that every time the order is created it throws that "No such entity" exception. When the quote is converted to order, it sets is_active to 0. Later on, on success page, it tries to get the quote and because it has is_active as 0, it throws that exception.
But, in the code it doesn't render that error, it just sets quote id to 0 if that error is caught. Most likely it is done to remove that quote from the customer's session after placing order successfully.
So, taken above into account, it seems that most likely the bug is not in the error itself, but in the rendering - this error simply shouldn't be seen, but somehow it gets visible for the customer in some rear cases. Probably because of some ajax requests triggered too fast / too slow, but not sure exactly, these are just guesses.
Any comments from the devs about this? Are my observations correct?
Thanks.
Most helpful comment
I have the same issue on version 2.1.3 (multiwebsite)
For example, I need to retrieve a quote after the order is placed from the admin panel
checkout_submit_all_after
event in my custom observer to retrieve the order which was placed from the admin panel and NOT from the default store.quote_id
from the order object and try to retrieve the quote using the\Magento\Quote\Model\QuoteRepository::get()
method.\Magento\Quote\Model\QuoteRepository::loadQuote()
method which sets the current store ID before the quote execution.As a workaround, I always have to set the current store using
StoreManager
before quote execution in the admin scope, but I think this is not acceptable.@magento-team, please fix this issue asap. Thanks.