26 if (!isset(
$params[
'options'])) {
31 $filter = new \Zend_Filter_LocalizedToNormalized(
32 [
'locale' => $this->_objectManager->get(
33 \
Magento\Framework\Locale\ResolverInterface::class
41 throw new \Magento\Framework\Exception\LocalizedException(
42 __(
"The quote item isn't found. Verify the item and try again.")
47 if (is_string(
$item)) {
48 throw new \Magento\Framework\Exception\LocalizedException(
__(
$item));
50 if (
$item->getHasError()) {
51 throw new \Magento\Framework\Exception\LocalizedException(
__(
$item->getMessage()));
54 $related = $this->
getRequest()->getParam(
'related_product');
55 if (!empty($related)) {
56 $this->cart->addProductsByIds(explode(
',', $related));
61 $this->_eventManager->dispatch(
62 'checkout_cart_update_item_complete',
65 if (!$this->_checkoutSession->getNoCartRedirect(
true)) {
66 if (!$this->cart->getQuote()->getHasError()) {
68 '%1 was updated in your shopping cart.',
69 $this->_objectManager->get(\
Magento\Framework\Escaper::class)
70 ->escapeHtml(
$item->getProduct()->getName())
72 $this->messageManager->addSuccessMessage(
$message);
74 return $this->
_goBack($this->_url->getUrl(
'checkout/cart'));
77 if ($this->_checkoutSession->getUseNotice(
true)) {
78 $this->messageManager->addNoticeMessage($e->getMessage());
80 $messages = array_unique(explode(
"\n", $e->getMessage()));
82 $this->messageManager->addErrorMessage(
$message);
86 $url = $this->_checkoutSession->getRedirectUrl(
true);
88 return $this->resultRedirectFactory->create()->setUrl(
$url);
90 $cartUrl = $this->_objectManager->get(\
Magento\Checkout\Helper\Cart::class)->getCartUrl();
91 return $this->resultRedirectFactory->create()->setUrl($this->
_redirect->getRedirectUrl($cartUrl));
94 $this->messageManager->addExceptionMessage($e,
__(
'We can\'t update the item right now.'));
95 $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
98 return $this->resultRedirectFactory->create()->setPath(
'*/*');
_redirect($path, $arguments=[])
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]