Block/Basket.php
public function getBasketItems()
    {
        $params = $this->getRequest()->getParams();

        if (! isset($params['quote_id']) ||
            ! isset($params['code']) ||
            ! $this->helper->isCodeValid($params['code'])
        ) {
            $this->helper->log('Abandoned cart not found or invalid code');

            return false;
        }
        $quoteId = (int) $params['quote_id'];
        $quoteModel = $this->quoteFactory->create()
            ->loadByIdWithoutStore($quoteId);

        //check for any quote for this email, don't want to render further
        if (!$quoteModel->getId()) {
            $this->helper->log('no quote found for ' . $quoteId);

            return false;
        }
        if (!$quoteModel->getIsActive()) {
            $this->helper->log('Cart is not active : ' . $quoteId);

            return false;
        }

        $this->quote = $quoteModel;

        //Start environment emulation of the specified store
        $storeId = $quoteModel->getStoreId();

        $appEmulation = $this->emulationFactory->create();
        $appEmulation->startEnvironmentEmulation($storeId);

        $quoteItems = $quoteModel->getAllItems();

        $itemsData = [];

        /** @var \Magento\Quote\Model\Quote\Item $quoteItem */

        $parentProductIds = [];

        //Collect all parent ids to identify later which products to show in EDC
        foreach ($quoteItems as $quoteItem) {
            if ($quoteItem->getParentItemId() == null) {
                $parentProductIds[] = $quoteItem->getProduct()->getId();
            }
        }
        foreach ($quoteItems as $quoteItem) {
            if ($quoteItem->getParentItemId() != null) {
                //If a product is a bundle we don't need to show all parts of it.
                if ($quoteItem->getParentItem()->getProductType() == 'bundle') {
                    continue;
                }
                $itemsData[] =  $this->getItemDataForChildProducts($quoteItem);
                //Signal that we added a child product, so its parent must be ignored later.
                if (in_array($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds)) {
                    $key = array_search($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds);
                    unset($parentProductIds[$key]);
                }
            }
        }

        foreach ($quoteItems as $quoteItem) {
            //If a child product added already, we must not add it's parent.
            if ($quoteItem->getParentItemId() == null && in_array($quoteItem->getProduct()->getId(), $parentProductIds)) {
                $itemsData[] = $this->getItemDataForParentProducts($quoteItem);
            }
        }

        return $itemsData;
    }
public function getBasketItems()
    {
        $params = $this->getRequest()->getParams();

        if (! isset($params['quote_id']) ||
            ! isset($params['code']) ||
            ! $this->helper->isCodeValid($params['code'])
        ) {
            $this->helper->log('Abandoned cart not found or invalid code');

            return false;
        }
        $quoteId = (int) $params['quote_id'];
        $quoteModel = $this->quoteFactory->create()
            ->loadByIdWithoutStore($quoteId);

        //check for any quote for this email, don't want to render further
        if (!$quoteModel->getId()) {
            $this->helper->log('no quote found for ' . $quoteId);

            return false;
        }
        if (!$quoteModel->getIsActive()) {
            $this->helper->log('Cart is not active : ' . $quoteId);

            return false;
        }

        $this->quote = $quoteModel;

        //Start environment emulation of the specified store
        $storeId = $quoteModel->getStoreId();

        $appEmulation = $this->emulationFactory->create();
        $appEmulation->startEnvironmentEmulation($storeId);

        $quoteItems = $quoteModel->getAllItems();

        $itemsData = [];

        /** @var \Magento\Quote\Model\Quote\Item $quoteItem */

        $parentProductIds = [];

        //Collect all parent ids to identify later which products to show in EDC
        foreach ($quoteItems as $quoteItem) {
            if ($quoteItem->getParentItemId() == null) {
                $parentProductIds[] = $quoteItem->getProduct()->getId();
            }
        }
        foreach ($quoteItems as $quoteItem) {
            if ($quoteItem->getParentItemId() != null) {
                //If a product is a bundle we don't need to show all parts of it.
                if ($quoteItem->getParentItem()->getProductType() == 'bundle') {
                    continue;
                }
                $itemsData[] =  $this->getItemDataForChildProducts($quoteItem);
                //Signal that we added a child product, so its parent must be ignored later.
                if (in_array($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds)) {
                    $key = array_search($quoteItem->getParentItem()->getProduct()->getId(), $parentProductIds);
                    unset($parentProductIds[$key]);
                }
            }
        }

        foreach ($quoteItems as $quoteItem) {
            //If a child product added already, we must not add it's parent.
            if ($quoteItem->getParentItemId() == null && in_array($quoteItem->getProduct()->getId(), $parentProductIds)) {
                $itemsData[] = $this->getItemDataForParentProducts($quoteItem);
            }
        }

        return $itemsData;
    }
public function getBasketItems ( ) { $ params = $ this -> getRequest ( ) -> getParams ( ) ; if ( ! isset ( $ params [ 'quote_id' ] ) || ! isset ( $ params [ 'code' ] ) || ! $ this -> helper -> isCodeValid ( $ params [ 'code' ] ) ) { $ this -> helper -> log ( 'Abandoned cart not found or invalid code' ) ; return false ; } $ quoteId = ( int ) $ params [ 'quote_id' ] ; $ quoteModel = $ this -> quoteFactory -> create ( ) -> loadByIdWithoutStore ( $ quoteId ) ; //check for any quote for this email, don't want to render further if ( ! $ quoteModel -> getId ( ) ) { $ this -> helper -> log ( 'no quote found for ' . $ quoteId ) ; return false ; } if ( ! $ quoteModel -> getIsActive ( ) ) { $ this -> helper -> log ( 'Cart is not active : ' . $ quoteId ) ; return false ; } $ this -> quote = $ quoteModel ; //Start environment emulation of the specified store $ storeId = $ quoteModel -> getStoreId ( ) ; $ appEmulation = $ this -> emulationFactory -> create ( ) ; $ appEmulation -> startEnvironmentEmulation ( $ storeId ) ; $ quoteItems = $ quoteModel -> getAllItems ( ) ; $ itemsData = [ ] ; /** @var \Magento\Quote\Model\Quote\Item $quoteItem */ $ parentProductIds = [ ] ; //Collect all parent ids to identify later which products to show in EDC foreach ( $ quoteItems as $ quoteItem ) { if ( $ quoteItem -> getParentItemId ( ) == null ) { $ parentProductIds [ ] = $ quoteItem -> getProduct ( ) -> getId ( ) ; } } foreach ( $ quoteItems as $ quoteItem ) { if ( $ quoteItem -> getParentItemId ( ) != null ) { //If a product is a bundle we don't need to show all parts of it. if ( $ quoteItem -> getParentItem ( ) -> getProductType ( ) == 'bundle' ) { continue ; } $ itemsData [ ] = $ this -> getItemDataForChildProducts ( $ quoteItem ) ; //Signal that we added a child product, so its parent must be ignored later. if ( in_array ( $ quoteItem -> getParentItem ( ) -> getProduct ( ) -> getId ( ) , $ parentProductIds ) ) { $ key = array_search ( $ quoteItem -> getParentItem ( ) -> getProduct ( ) -> getId ( ) , $ parentProductIds ) ; unset ( $ parentProductIds [ $ key ] ) ; } } } foreach ( $ quoteItems as $ quoteItem ) { //If a child product added already, we must not add it's parent. if ( $ quoteItem -> getParentItemId ( ) == null && in_array ( $ quoteItem -> getProduct ( ) -> getId ( ) , $ parentProductIds ) ) { $ itemsData [ ] = $ this -> getItemDataForParentProducts ( $ quoteItem ) ; } } return $ itemsData ; }
Basket items.

@return array
Basket items .