Getting an error: No such entity with cartId = 17090. How to resolve it Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to resolve unserialize issue'No such entity' error when saving category as anchorPHP message: PHP Fatal error: Uncaught MagentoFrameworkExceptionNoSuchEntityException: No such entityMagento 2 Install error: “There is no such engine:”Magento2 - when customer Sign Out then error occurred: “No such entity with id = 0”Magento 2.2 showing error on order place “no such entry for orderid=”How does magento2 associates an entity with it's table?Getting Decoding Error with Accented, Latin Characters Magento 2.2No such entity with customerIdHow to resolve wamp issue with Magento 2.2.7

Why is black pepper both grey and black?

I am not a queen, who am I?

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]

"Seemed to had" is it correct?

How to do this path/lattice with tikz

Can inflation occur in a positive-sum game currency system such as the Stack Exchange reputation system?

Bonus calculation: Am I making a mountain out of a molehill?

iPhone Wallpaper?

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

How can I make names more distinctive without making them longer?

If Jon Snow became King of the Seven Kingdoms what would his regnal number be?

Is 1 ppb equal to 1 μg/kg?

Single word antonym of "flightless"

How widely used is the term Treppenwitz? Is it something that most Germans know?

Storing hydrofluoric acid before the invention of plastics

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

Why did the IBM 650 use bi-quinary?

Do I really need recursive chmod to restrict access to a folder?

Is a manifold-with-boundary with given interior and non-empty boundary essentially unique?

Why is there no army of Iron-Mans in the MCU?

What do you call a phrase that's not an idiom yet?

Is there a concise way to say "all of the X, one of each"?

Did Xerox really develop the first LAN?



Getting an error: No such entity with cartId = 17090. How to resolve it



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to resolve unserialize issue'No such entity' error when saving category as anchorPHP message: PHP Fatal error: Uncaught MagentoFrameworkExceptionNoSuchEntityException: No such entityMagento 2 Install error: “There is no such engine:”Magento2 - when customer Sign Out then error occurred: “No such entity with id = 0”Magento 2.2 showing error on order place “no such entry for orderid=”How does magento2 associates an entity with it's table?Getting Decoding Error with Accented, Latin Characters Magento 2.2No such entity with customerIdHow to resolve wamp issue with Magento 2.2.7



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















This error is generated when I create order using the backend. When creting the order with frontend, it works fine. I am using multi-website functionality in my project.



I have creted custom quote and sales attributes and saved them in quote and sales_order table.



Vendor/OrderAttributes/Plugin/ShippingInformationManagementPlugin.php



<?php

namespace VendorOrderAttributesPlugin;

class ShippingInformationManagementPlugin




protected $_transportBuilder;

/**
* @var MagentoFrameworkTranslateInlineStateInterface
*/
protected $inlineTranslation;

/**
* @var MagentoFrameworkAppConfigScopeConfigInterface
*/
protected $scopeConfig;

/**
* @var MagentoStoreModelStoreManagerInterface
*/
protected $storeManager;

/**
* @var MagentoFrameworkEscaper
*/
protected $_escaper;
protected $quoteRepository;

public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoQuoteModelQuoteRepository $quoteRepository
)
$this->quoteRepository = $quoteRepository;


public function beforeSaveAddressInformation(
MagentoCheckoutModelShippingInformationManagement $subject,
$cartId,
MagentoCheckoutApiDataShippingInformationInterface $addressInformation
)

$request_body = file_get_contents('php://input');
$delivery_details = json_decode($request_body, true);
$quote = $this->quoteRepository->getActive($cartId);

$delivery_date = null;
$crew_members = null;
$travelling_days = null;
$port_id = null;
$port_name = null;
if (isset($delivery_details['delivery_details']['delivery_date']))
$delivery_date = $delivery_details['delivery_details']['delivery_date'];

if (isset($delivery_details['delivery_details']['crew_members']))
$crew_members = $delivery_details['delivery_details']['crew_members'];

if (isset($delivery_details['delivery_details']['travelling_days']))
$travelling_days = $delivery_details['delivery_details']['travelling_days'];

if (isset($delivery_details['delivery_details']['port_id']))
$port_id = $delivery_details['delivery_details']['port_id'];

if (isset($delivery_details['delivery_details']['port_name']))
$port_name = $delivery_details['delivery_details']['port_name'];

$quote->setDeliveryDate($delivery_date);
$quote->setCrewMembers($crew_members);
$quote->setTravellingDays($travelling_days);
$quote->setPortId($port_id);
$quote->setPortName($port_name);
$quote->save();




Vendor/OrderAttributes/Observer/SaveShippingDeliveryToOrderObserver.php



<?php
/**
* Created by PhpStorm.
* User: eugen
* Date: 27.11.2015
* Time: 17:53
*/

namespace VendorOrderAttributesObserver;

use MagentoFrameworkEventObserver as EventObserver;
use MagentoFrameworkEventObserverInterface;

class SaveShippingDeliveryToOrderObserver implements ObserverInterface

/**
* @var MagentoFrameworkObjectManagerInterface
*/
protected $_objectManager;

/**
* @param MagentoFrameworkObjectManagerInterface $objectmanager
*/
public function __construct(MagentoFrameworkObjectManagerInterface $objectmanager, MagentoQuoteModelQuoteRepository $quoteRepository, PsrLogLoggerInterface $logger)

$this->_objectManager = $objectmanager;
$this->quoteRepository = $quoteRepository;
$this->logger = $logger;


public function execute(EventObserver $observer)

$order = $observer->getOrder();

$quote = $this->quoteRepository->getActive($order->getQuoteId());
$level = 'DEBUG';
$this->logger->log($level, 'errorlog1234-delivery-details', [$quote->getDeliveryDate(),$quote->getCrewMembers(),$quote->getTravellingDays(),$quote->getPortId(),$quote->getPortName()]);

$order->setDeliveryDate($quote->getDeliveryDate());
$order->setCrewMembers($quote->getCrewMembers());
$order->setTravellingDays($quote->getTravellingDays());
$order->setPortId($quote->getPortId());
$order->setPortName($quote->getPortName());
$order->save();
return $this;




Vendor/OrderAttributes/Plugin/OrderRepositoryPlugin.php



<?php

namespace VendorOrderAttributesPlugin;

use MagentoSalesApiDataOrderExtensionFactory;
use MagentoSalesApiDataOrderExtensionInterface;
use MagentoSalesApiDataOrderInterface;
use MagentoSalesApiDataOrderSearchResultInterface;
use MagentoSalesApiOrderRepositoryInterface;

/**
* Class OrderRepositoryPlugin
*/
class OrderRepositoryPlugin

/**
* Order feedback field name
*/
const DELIVERY_DATE = 'delivery_date';
const CREW_MEMBERS = 'crew_members';
const TRAVELLING_DAYS = 'travelling_days';
const PORT_ID = 'port_id';
const PORT_NAME = 'port_name';

/**
* Order Extension Attributes Factory
*
* @var OrderExtensionFactory
*/
protected $extensionFactory;

/**
* OrderRepositoryPlugin constructor
*
* @param OrderExtensionFactory $extensionFactory
*/
public function __construct(OrderExtensionFactory $extensionFactory)

$this->extensionFactory = $extensionFactory;


/**
* Add "crew_members" extension attribute to order data object to make it accessible in API data
*
* @param OrderRepositoryInterface $subject
* @param OrderInterface $order
*
* @return OrderInterface
*/
public function afterGet(OrderRepositoryInterface $subject, OrderInterface $order)

$DeliveryDate = $order->getData(self::DELIVERY_DATE);
$CrewMembers = $order->getData(self::CREW_MEMBERS);
$TravellingDays = $order->getData(self::TRAVELLING_DAYS);
$PortId = $order->getData(self::PORT_ID);
$PortName = $order->getData(self::PORT_NAME);
$extensionAttributes = $order->getExtensionAttributes();
$extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
$extensionAttributes->setDeliveryDate($DeliveryDate);
$extensionAttributes->setCrewMembers($CrewMembers);
$extensionAttributes->setTravellingDays($TravellingDays);
$extensionAttributes->setPortId($PortId);
$extensionAttributes->setPortName($PortName);
$order->setExtensionAttributes($extensionAttributes);

return $order;


/**
* Add "crew_members" extension attribute to order data object to make it accessible in API data
*
* @param OrderRepositoryInterface $subject
* @param OrderSearchResultInterface $searchResult
*
* @return OrderSearchResultInterface
*/
public function afterGetList(OrderRepositoryInterface $subject, OrderSearchResultInterface $searchResult)

$orders = $searchResult->getItems();

foreach ($orders as &$order)
$DeliveryDate = $order->getData(self::DELIVERY_DATE);
$CrewMembers = $order->getData(self::CREW_MEMBERS);
$TravellingDays = $order->getData(self::TRAVELLING_DAYS);
$PortId = $order->getData(self::PORT_ID);
$PortName = $order->getData(self::PORT_NAME);
$extensionAttributes = $order->getExtensionAttributes();
$extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
$extensionAttributes->setDeliveryDate($DeliveryDate);
$extensionAttributes->setCrewMembers($CrewMembers);
$extensionAttributes->setTravellingDays($TravellingDays);
$extensionAttributes->setPortId($PortId);
$extensionAttributes->setPortName($PortName);
$order->setExtensionAttributes($extensionAttributes);


return $searchResult;




Vendor/OrderAttributes/etc/extension_attributes.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoSalesApiDataOrderInterface">
<attribute code="delivery_date" type="string" />
<attribute code="crew_members" type="integer" />
<attribute code="travelling_days" type="integer" />
<attribute code="port_id" type="integer" />
<attribute code="port_name" type="string" />
</extension_attributes>
</config>








share




























    1















    This error is generated when I create order using the backend. When creting the order with frontend, it works fine. I am using multi-website functionality in my project.



    I have creted custom quote and sales attributes and saved them in quote and sales_order table.



    Vendor/OrderAttributes/Plugin/ShippingInformationManagementPlugin.php



    <?php

    namespace VendorOrderAttributesPlugin;

    class ShippingInformationManagementPlugin




    protected $_transportBuilder;

    /**
    * @var MagentoFrameworkTranslateInlineStateInterface
    */
    protected $inlineTranslation;

    /**
    * @var MagentoFrameworkAppConfigScopeConfigInterface
    */
    protected $scopeConfig;

    /**
    * @var MagentoStoreModelStoreManagerInterface
    */
    protected $storeManager;

    /**
    * @var MagentoFrameworkEscaper
    */
    protected $_escaper;
    protected $quoteRepository;

    public function __construct(
    MagentoFrameworkAppActionContext $context,
    MagentoQuoteModelQuoteRepository $quoteRepository
    )
    $this->quoteRepository = $quoteRepository;


    public function beforeSaveAddressInformation(
    MagentoCheckoutModelShippingInformationManagement $subject,
    $cartId,
    MagentoCheckoutApiDataShippingInformationInterface $addressInformation
    )

    $request_body = file_get_contents('php://input');
    $delivery_details = json_decode($request_body, true);
    $quote = $this->quoteRepository->getActive($cartId);

    $delivery_date = null;
    $crew_members = null;
    $travelling_days = null;
    $port_id = null;
    $port_name = null;
    if (isset($delivery_details['delivery_details']['delivery_date']))
    $delivery_date = $delivery_details['delivery_details']['delivery_date'];

    if (isset($delivery_details['delivery_details']['crew_members']))
    $crew_members = $delivery_details['delivery_details']['crew_members'];

    if (isset($delivery_details['delivery_details']['travelling_days']))
    $travelling_days = $delivery_details['delivery_details']['travelling_days'];

    if (isset($delivery_details['delivery_details']['port_id']))
    $port_id = $delivery_details['delivery_details']['port_id'];

    if (isset($delivery_details['delivery_details']['port_name']))
    $port_name = $delivery_details['delivery_details']['port_name'];

    $quote->setDeliveryDate($delivery_date);
    $quote->setCrewMembers($crew_members);
    $quote->setTravellingDays($travelling_days);
    $quote->setPortId($port_id);
    $quote->setPortName($port_name);
    $quote->save();




    Vendor/OrderAttributes/Observer/SaveShippingDeliveryToOrderObserver.php



    <?php
    /**
    * Created by PhpStorm.
    * User: eugen
    * Date: 27.11.2015
    * Time: 17:53
    */

    namespace VendorOrderAttributesObserver;

    use MagentoFrameworkEventObserver as EventObserver;
    use MagentoFrameworkEventObserverInterface;

    class SaveShippingDeliveryToOrderObserver implements ObserverInterface

    /**
    * @var MagentoFrameworkObjectManagerInterface
    */
    protected $_objectManager;

    /**
    * @param MagentoFrameworkObjectManagerInterface $objectmanager
    */
    public function __construct(MagentoFrameworkObjectManagerInterface $objectmanager, MagentoQuoteModelQuoteRepository $quoteRepository, PsrLogLoggerInterface $logger)

    $this->_objectManager = $objectmanager;
    $this->quoteRepository = $quoteRepository;
    $this->logger = $logger;


    public function execute(EventObserver $observer)

    $order = $observer->getOrder();

    $quote = $this->quoteRepository->getActive($order->getQuoteId());
    $level = 'DEBUG';
    $this->logger->log($level, 'errorlog1234-delivery-details', [$quote->getDeliveryDate(),$quote->getCrewMembers(),$quote->getTravellingDays(),$quote->getPortId(),$quote->getPortName()]);

    $order->setDeliveryDate($quote->getDeliveryDate());
    $order->setCrewMembers($quote->getCrewMembers());
    $order->setTravellingDays($quote->getTravellingDays());
    $order->setPortId($quote->getPortId());
    $order->setPortName($quote->getPortName());
    $order->save();
    return $this;




    Vendor/OrderAttributes/Plugin/OrderRepositoryPlugin.php



    <?php

    namespace VendorOrderAttributesPlugin;

    use MagentoSalesApiDataOrderExtensionFactory;
    use MagentoSalesApiDataOrderExtensionInterface;
    use MagentoSalesApiDataOrderInterface;
    use MagentoSalesApiDataOrderSearchResultInterface;
    use MagentoSalesApiOrderRepositoryInterface;

    /**
    * Class OrderRepositoryPlugin
    */
    class OrderRepositoryPlugin

    /**
    * Order feedback field name
    */
    const DELIVERY_DATE = 'delivery_date';
    const CREW_MEMBERS = 'crew_members';
    const TRAVELLING_DAYS = 'travelling_days';
    const PORT_ID = 'port_id';
    const PORT_NAME = 'port_name';

    /**
    * Order Extension Attributes Factory
    *
    * @var OrderExtensionFactory
    */
    protected $extensionFactory;

    /**
    * OrderRepositoryPlugin constructor
    *
    * @param OrderExtensionFactory $extensionFactory
    */
    public function __construct(OrderExtensionFactory $extensionFactory)

    $this->extensionFactory = $extensionFactory;


    /**
    * Add "crew_members" extension attribute to order data object to make it accessible in API data
    *
    * @param OrderRepositoryInterface $subject
    * @param OrderInterface $order
    *
    * @return OrderInterface
    */
    public function afterGet(OrderRepositoryInterface $subject, OrderInterface $order)

    $DeliveryDate = $order->getData(self::DELIVERY_DATE);
    $CrewMembers = $order->getData(self::CREW_MEMBERS);
    $TravellingDays = $order->getData(self::TRAVELLING_DAYS);
    $PortId = $order->getData(self::PORT_ID);
    $PortName = $order->getData(self::PORT_NAME);
    $extensionAttributes = $order->getExtensionAttributes();
    $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
    $extensionAttributes->setDeliveryDate($DeliveryDate);
    $extensionAttributes->setCrewMembers($CrewMembers);
    $extensionAttributes->setTravellingDays($TravellingDays);
    $extensionAttributes->setPortId($PortId);
    $extensionAttributes->setPortName($PortName);
    $order->setExtensionAttributes($extensionAttributes);

    return $order;


    /**
    * Add "crew_members" extension attribute to order data object to make it accessible in API data
    *
    * @param OrderRepositoryInterface $subject
    * @param OrderSearchResultInterface $searchResult
    *
    * @return OrderSearchResultInterface
    */
    public function afterGetList(OrderRepositoryInterface $subject, OrderSearchResultInterface $searchResult)

    $orders = $searchResult->getItems();

    foreach ($orders as &$order)
    $DeliveryDate = $order->getData(self::DELIVERY_DATE);
    $CrewMembers = $order->getData(self::CREW_MEMBERS);
    $TravellingDays = $order->getData(self::TRAVELLING_DAYS);
    $PortId = $order->getData(self::PORT_ID);
    $PortName = $order->getData(self::PORT_NAME);
    $extensionAttributes = $order->getExtensionAttributes();
    $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
    $extensionAttributes->setDeliveryDate($DeliveryDate);
    $extensionAttributes->setCrewMembers($CrewMembers);
    $extensionAttributes->setTravellingDays($TravellingDays);
    $extensionAttributes->setPortId($PortId);
    $extensionAttributes->setPortName($PortName);
    $order->setExtensionAttributes($extensionAttributes);


    return $searchResult;




    Vendor/OrderAttributes/etc/extension_attributes.xml



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="MagentoSalesApiDataOrderInterface">
    <attribute code="delivery_date" type="string" />
    <attribute code="crew_members" type="integer" />
    <attribute code="travelling_days" type="integer" />
    <attribute code="port_id" type="integer" />
    <attribute code="port_name" type="string" />
    </extension_attributes>
    </config>








    share
























      1












      1








      1








      This error is generated when I create order using the backend. When creting the order with frontend, it works fine. I am using multi-website functionality in my project.



      I have creted custom quote and sales attributes and saved them in quote and sales_order table.



      Vendor/OrderAttributes/Plugin/ShippingInformationManagementPlugin.php



      <?php

      namespace VendorOrderAttributesPlugin;

      class ShippingInformationManagementPlugin




      protected $_transportBuilder;

      /**
      * @var MagentoFrameworkTranslateInlineStateInterface
      */
      protected $inlineTranslation;

      /**
      * @var MagentoFrameworkAppConfigScopeConfigInterface
      */
      protected $scopeConfig;

      /**
      * @var MagentoStoreModelStoreManagerInterface
      */
      protected $storeManager;

      /**
      * @var MagentoFrameworkEscaper
      */
      protected $_escaper;
      protected $quoteRepository;

      public function __construct(
      MagentoFrameworkAppActionContext $context,
      MagentoQuoteModelQuoteRepository $quoteRepository
      )
      $this->quoteRepository = $quoteRepository;


      public function beforeSaveAddressInformation(
      MagentoCheckoutModelShippingInformationManagement $subject,
      $cartId,
      MagentoCheckoutApiDataShippingInformationInterface $addressInformation
      )

      $request_body = file_get_contents('php://input');
      $delivery_details = json_decode($request_body, true);
      $quote = $this->quoteRepository->getActive($cartId);

      $delivery_date = null;
      $crew_members = null;
      $travelling_days = null;
      $port_id = null;
      $port_name = null;
      if (isset($delivery_details['delivery_details']['delivery_date']))
      $delivery_date = $delivery_details['delivery_details']['delivery_date'];

      if (isset($delivery_details['delivery_details']['crew_members']))
      $crew_members = $delivery_details['delivery_details']['crew_members'];

      if (isset($delivery_details['delivery_details']['travelling_days']))
      $travelling_days = $delivery_details['delivery_details']['travelling_days'];

      if (isset($delivery_details['delivery_details']['port_id']))
      $port_id = $delivery_details['delivery_details']['port_id'];

      if (isset($delivery_details['delivery_details']['port_name']))
      $port_name = $delivery_details['delivery_details']['port_name'];

      $quote->setDeliveryDate($delivery_date);
      $quote->setCrewMembers($crew_members);
      $quote->setTravellingDays($travelling_days);
      $quote->setPortId($port_id);
      $quote->setPortName($port_name);
      $quote->save();




      Vendor/OrderAttributes/Observer/SaveShippingDeliveryToOrderObserver.php



      <?php
      /**
      * Created by PhpStorm.
      * User: eugen
      * Date: 27.11.2015
      * Time: 17:53
      */

      namespace VendorOrderAttributesObserver;

      use MagentoFrameworkEventObserver as EventObserver;
      use MagentoFrameworkEventObserverInterface;

      class SaveShippingDeliveryToOrderObserver implements ObserverInterface

      /**
      * @var MagentoFrameworkObjectManagerInterface
      */
      protected $_objectManager;

      /**
      * @param MagentoFrameworkObjectManagerInterface $objectmanager
      */
      public function __construct(MagentoFrameworkObjectManagerInterface $objectmanager, MagentoQuoteModelQuoteRepository $quoteRepository, PsrLogLoggerInterface $logger)

      $this->_objectManager = $objectmanager;
      $this->quoteRepository = $quoteRepository;
      $this->logger = $logger;


      public function execute(EventObserver $observer)

      $order = $observer->getOrder();

      $quote = $this->quoteRepository->getActive($order->getQuoteId());
      $level = 'DEBUG';
      $this->logger->log($level, 'errorlog1234-delivery-details', [$quote->getDeliveryDate(),$quote->getCrewMembers(),$quote->getTravellingDays(),$quote->getPortId(),$quote->getPortName()]);

      $order->setDeliveryDate($quote->getDeliveryDate());
      $order->setCrewMembers($quote->getCrewMembers());
      $order->setTravellingDays($quote->getTravellingDays());
      $order->setPortId($quote->getPortId());
      $order->setPortName($quote->getPortName());
      $order->save();
      return $this;




      Vendor/OrderAttributes/Plugin/OrderRepositoryPlugin.php



      <?php

      namespace VendorOrderAttributesPlugin;

      use MagentoSalesApiDataOrderExtensionFactory;
      use MagentoSalesApiDataOrderExtensionInterface;
      use MagentoSalesApiDataOrderInterface;
      use MagentoSalesApiDataOrderSearchResultInterface;
      use MagentoSalesApiOrderRepositoryInterface;

      /**
      * Class OrderRepositoryPlugin
      */
      class OrderRepositoryPlugin

      /**
      * Order feedback field name
      */
      const DELIVERY_DATE = 'delivery_date';
      const CREW_MEMBERS = 'crew_members';
      const TRAVELLING_DAYS = 'travelling_days';
      const PORT_ID = 'port_id';
      const PORT_NAME = 'port_name';

      /**
      * Order Extension Attributes Factory
      *
      * @var OrderExtensionFactory
      */
      protected $extensionFactory;

      /**
      * OrderRepositoryPlugin constructor
      *
      * @param OrderExtensionFactory $extensionFactory
      */
      public function __construct(OrderExtensionFactory $extensionFactory)

      $this->extensionFactory = $extensionFactory;


      /**
      * Add "crew_members" extension attribute to order data object to make it accessible in API data
      *
      * @param OrderRepositoryInterface $subject
      * @param OrderInterface $order
      *
      * @return OrderInterface
      */
      public function afterGet(OrderRepositoryInterface $subject, OrderInterface $order)

      $DeliveryDate = $order->getData(self::DELIVERY_DATE);
      $CrewMembers = $order->getData(self::CREW_MEMBERS);
      $TravellingDays = $order->getData(self::TRAVELLING_DAYS);
      $PortId = $order->getData(self::PORT_ID);
      $PortName = $order->getData(self::PORT_NAME);
      $extensionAttributes = $order->getExtensionAttributes();
      $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
      $extensionAttributes->setDeliveryDate($DeliveryDate);
      $extensionAttributes->setCrewMembers($CrewMembers);
      $extensionAttributes->setTravellingDays($TravellingDays);
      $extensionAttributes->setPortId($PortId);
      $extensionAttributes->setPortName($PortName);
      $order->setExtensionAttributes($extensionAttributes);

      return $order;


      /**
      * Add "crew_members" extension attribute to order data object to make it accessible in API data
      *
      * @param OrderRepositoryInterface $subject
      * @param OrderSearchResultInterface $searchResult
      *
      * @return OrderSearchResultInterface
      */
      public function afterGetList(OrderRepositoryInterface $subject, OrderSearchResultInterface $searchResult)

      $orders = $searchResult->getItems();

      foreach ($orders as &$order)
      $DeliveryDate = $order->getData(self::DELIVERY_DATE);
      $CrewMembers = $order->getData(self::CREW_MEMBERS);
      $TravellingDays = $order->getData(self::TRAVELLING_DAYS);
      $PortId = $order->getData(self::PORT_ID);
      $PortName = $order->getData(self::PORT_NAME);
      $extensionAttributes = $order->getExtensionAttributes();
      $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
      $extensionAttributes->setDeliveryDate($DeliveryDate);
      $extensionAttributes->setCrewMembers($CrewMembers);
      $extensionAttributes->setTravellingDays($TravellingDays);
      $extensionAttributes->setPortId($PortId);
      $extensionAttributes->setPortName($PortName);
      $order->setExtensionAttributes($extensionAttributes);


      return $searchResult;




      Vendor/OrderAttributes/etc/extension_attributes.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
      <extension_attributes for="MagentoSalesApiDataOrderInterface">
      <attribute code="delivery_date" type="string" />
      <attribute code="crew_members" type="integer" />
      <attribute code="travelling_days" type="integer" />
      <attribute code="port_id" type="integer" />
      <attribute code="port_name" type="string" />
      </extension_attributes>
      </config>








      share














      This error is generated when I create order using the backend. When creting the order with frontend, it works fine. I am using multi-website functionality in my project.



      I have creted custom quote and sales attributes and saved them in quote and sales_order table.



      Vendor/OrderAttributes/Plugin/ShippingInformationManagementPlugin.php



      <?php

      namespace VendorOrderAttributesPlugin;

      class ShippingInformationManagementPlugin




      protected $_transportBuilder;

      /**
      * @var MagentoFrameworkTranslateInlineStateInterface
      */
      protected $inlineTranslation;

      /**
      * @var MagentoFrameworkAppConfigScopeConfigInterface
      */
      protected $scopeConfig;

      /**
      * @var MagentoStoreModelStoreManagerInterface
      */
      protected $storeManager;

      /**
      * @var MagentoFrameworkEscaper
      */
      protected $_escaper;
      protected $quoteRepository;

      public function __construct(
      MagentoFrameworkAppActionContext $context,
      MagentoQuoteModelQuoteRepository $quoteRepository
      )
      $this->quoteRepository = $quoteRepository;


      public function beforeSaveAddressInformation(
      MagentoCheckoutModelShippingInformationManagement $subject,
      $cartId,
      MagentoCheckoutApiDataShippingInformationInterface $addressInformation
      )

      $request_body = file_get_contents('php://input');
      $delivery_details = json_decode($request_body, true);
      $quote = $this->quoteRepository->getActive($cartId);

      $delivery_date = null;
      $crew_members = null;
      $travelling_days = null;
      $port_id = null;
      $port_name = null;
      if (isset($delivery_details['delivery_details']['delivery_date']))
      $delivery_date = $delivery_details['delivery_details']['delivery_date'];

      if (isset($delivery_details['delivery_details']['crew_members']))
      $crew_members = $delivery_details['delivery_details']['crew_members'];

      if (isset($delivery_details['delivery_details']['travelling_days']))
      $travelling_days = $delivery_details['delivery_details']['travelling_days'];

      if (isset($delivery_details['delivery_details']['port_id']))
      $port_id = $delivery_details['delivery_details']['port_id'];

      if (isset($delivery_details['delivery_details']['port_name']))
      $port_name = $delivery_details['delivery_details']['port_name'];

      $quote->setDeliveryDate($delivery_date);
      $quote->setCrewMembers($crew_members);
      $quote->setTravellingDays($travelling_days);
      $quote->setPortId($port_id);
      $quote->setPortName($port_name);
      $quote->save();




      Vendor/OrderAttributes/Observer/SaveShippingDeliveryToOrderObserver.php



      <?php
      /**
      * Created by PhpStorm.
      * User: eugen
      * Date: 27.11.2015
      * Time: 17:53
      */

      namespace VendorOrderAttributesObserver;

      use MagentoFrameworkEventObserver as EventObserver;
      use MagentoFrameworkEventObserverInterface;

      class SaveShippingDeliveryToOrderObserver implements ObserverInterface

      /**
      * @var MagentoFrameworkObjectManagerInterface
      */
      protected $_objectManager;

      /**
      * @param MagentoFrameworkObjectManagerInterface $objectmanager
      */
      public function __construct(MagentoFrameworkObjectManagerInterface $objectmanager, MagentoQuoteModelQuoteRepository $quoteRepository, PsrLogLoggerInterface $logger)

      $this->_objectManager = $objectmanager;
      $this->quoteRepository = $quoteRepository;
      $this->logger = $logger;


      public function execute(EventObserver $observer)

      $order = $observer->getOrder();

      $quote = $this->quoteRepository->getActive($order->getQuoteId());
      $level = 'DEBUG';
      $this->logger->log($level, 'errorlog1234-delivery-details', [$quote->getDeliveryDate(),$quote->getCrewMembers(),$quote->getTravellingDays(),$quote->getPortId(),$quote->getPortName()]);

      $order->setDeliveryDate($quote->getDeliveryDate());
      $order->setCrewMembers($quote->getCrewMembers());
      $order->setTravellingDays($quote->getTravellingDays());
      $order->setPortId($quote->getPortId());
      $order->setPortName($quote->getPortName());
      $order->save();
      return $this;




      Vendor/OrderAttributes/Plugin/OrderRepositoryPlugin.php



      <?php

      namespace VendorOrderAttributesPlugin;

      use MagentoSalesApiDataOrderExtensionFactory;
      use MagentoSalesApiDataOrderExtensionInterface;
      use MagentoSalesApiDataOrderInterface;
      use MagentoSalesApiDataOrderSearchResultInterface;
      use MagentoSalesApiOrderRepositoryInterface;

      /**
      * Class OrderRepositoryPlugin
      */
      class OrderRepositoryPlugin

      /**
      * Order feedback field name
      */
      const DELIVERY_DATE = 'delivery_date';
      const CREW_MEMBERS = 'crew_members';
      const TRAVELLING_DAYS = 'travelling_days';
      const PORT_ID = 'port_id';
      const PORT_NAME = 'port_name';

      /**
      * Order Extension Attributes Factory
      *
      * @var OrderExtensionFactory
      */
      protected $extensionFactory;

      /**
      * OrderRepositoryPlugin constructor
      *
      * @param OrderExtensionFactory $extensionFactory
      */
      public function __construct(OrderExtensionFactory $extensionFactory)

      $this->extensionFactory = $extensionFactory;


      /**
      * Add "crew_members" extension attribute to order data object to make it accessible in API data
      *
      * @param OrderRepositoryInterface $subject
      * @param OrderInterface $order
      *
      * @return OrderInterface
      */
      public function afterGet(OrderRepositoryInterface $subject, OrderInterface $order)

      $DeliveryDate = $order->getData(self::DELIVERY_DATE);
      $CrewMembers = $order->getData(self::CREW_MEMBERS);
      $TravellingDays = $order->getData(self::TRAVELLING_DAYS);
      $PortId = $order->getData(self::PORT_ID);
      $PortName = $order->getData(self::PORT_NAME);
      $extensionAttributes = $order->getExtensionAttributes();
      $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
      $extensionAttributes->setDeliveryDate($DeliveryDate);
      $extensionAttributes->setCrewMembers($CrewMembers);
      $extensionAttributes->setTravellingDays($TravellingDays);
      $extensionAttributes->setPortId($PortId);
      $extensionAttributes->setPortName($PortName);
      $order->setExtensionAttributes($extensionAttributes);

      return $order;


      /**
      * Add "crew_members" extension attribute to order data object to make it accessible in API data
      *
      * @param OrderRepositoryInterface $subject
      * @param OrderSearchResultInterface $searchResult
      *
      * @return OrderSearchResultInterface
      */
      public function afterGetList(OrderRepositoryInterface $subject, OrderSearchResultInterface $searchResult)

      $orders = $searchResult->getItems();

      foreach ($orders as &$order)
      $DeliveryDate = $order->getData(self::DELIVERY_DATE);
      $CrewMembers = $order->getData(self::CREW_MEMBERS);
      $TravellingDays = $order->getData(self::TRAVELLING_DAYS);
      $PortId = $order->getData(self::PORT_ID);
      $PortName = $order->getData(self::PORT_NAME);
      $extensionAttributes = $order->getExtensionAttributes();
      $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
      $extensionAttributes->setDeliveryDate($DeliveryDate);
      $extensionAttributes->setCrewMembers($CrewMembers);
      $extensionAttributes->setTravellingDays($TravellingDays);
      $extensionAttributes->setPortId($PortId);
      $extensionAttributes->setPortName($PortName);
      $order->setExtensionAttributes($extensionAttributes);


      return $searchResult;




      Vendor/OrderAttributes/etc/extension_attributes.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
      <extension_attributes for="MagentoSalesApiDataOrderInterface">
      <attribute code="delivery_date" type="string" />
      <attribute code="crew_members" type="integer" />
      <attribute code="travelling_days" type="integer" />
      <attribute code="port_id" type="integer" />
      <attribute code="port_name" type="string" />
      </extension_attributes>
      </config>






      magento2.2 sales-order





      share












      share










      share



      share










      asked 5 mins ago









      Meetali GuptaMeetali Gupta

      314




      314




















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270238%2fgetting-an-error-no-such-entity-with-cartid-17090-how-to-resolve-it%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270238%2fgetting-an-error-no-such-entity-with-cartid-17090-how-to-resolve-it%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Disable / Remove link to Product Items in Cart Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How can I limit products that can be bought / added to cart?Remove item from cartHide “Add to Cart” button if specific products are already in cart“Prettifying” the custom options in cart pageCreate link in cart sidebar to view all added items After limit reachedLink products together in checkout/cartHow to Get product from cart and add it againHide action-edit on cart page if simple productRemoving Cart items - ObserverRemove wishlist items when added to cart

          Helsingin valtaus Sisällysluettelo Taustaa | Yleistä sotatoimista | Osapuolet | Taistelut Helsingin ympäristössä | Punaisten antautumissuunnitelma | Taistelujen kulku Helsingissä | Valtauksen jälkeen | Tappiot | Muistaminen | Kirjallisuutta | Lähteet | Aiheesta muualla | NavigointivalikkoTeoksen verkkoversioTeoksen verkkoversioGoogle BooksSisällissota Helsingissä päättyi tasan 95 vuotta sittenSaksalaisten ylivoima jyräsi punaisen HelsinginSuomalaiset kuvaavat sotien jälkiä kaupungeissa – katso kuvat ja tarinat tutuilta kulmiltaHelsingin valtaus 90 vuotta sittenSaksalaiset valtasivat HelsinginHyökkäys HelsinkiinHelsingin valtaus 12.–13.4. 1918Saksalaiset käyttivät ihmiskilpiä Helsingin valtauksessa 1918Teoksen verkkoversioTeoksen verkkoversioSaksalaiset hyökkäävät Etelä-SuomeenTaistelut LeppävaarassaSotilaat ja taistelutLeppävaara 1918 huhtikuussa. KapinatarinaHelsingin taistelut 1918Saksalaisten voitonparaati HelsingissäHelsingin valtausta juhlittiinSaksalaisten Helsinki vuonna 1918Helsingin taistelussa kaatuneet valkokaartilaisetHelsinkiin haudatut taisteluissa kaatuneet punaiset12.4.1918 Helsingin valtauksessa saksalaiset apujoukot vapauttavat kaupunginVapaussodan muistomerkkejä Helsingissä ja pääkaupunkiseudullaCrescendo / Vuoden 1918 Kansalaissodan uhrien muistomerkkim

          Adjektiivitarina Tarinan tekeminen | Esimerkki: ennen | Esimerkki: jälkeen | Navigointivalikko