1

I need to override the get orders list API call, and set a join with my custom table, but without loose the SearchCriteria terms, is this possible?

Current Code: (I've created a plugin in Magento\Sales\Api\OrderRepositoryInterface inside webapi_rest folder.)

public function aroundGetList
(
    \Magento\Sales\Api\OrderRepositoryInterface $subject,
    callable $proceed,
    \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
){
    $searchResult = $this->searchResultFactory->create();
    $this->collectionProcessor->process($searchCriteria, $searchResult);
    $searchResult->setSearchCriteria($searchCriteria);
    foreach ($searchResult->getItems() as $order) {
        $this->setShippingAssignments($order);
    }
    return $searchResult;

}
-3

I solve this situation as following:

$searchResult->getSelect()->joinLeft(
        array('my_table'=>'myAlias'),
        'main_table.entity_id = myAlias.id',
        []
    );
1
  • their is no getSelect() method in SearchResult
    – Hiren
    Mar 19 '19 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.