Model/Sync/Wishlist.php
public function exportWishlistForWebsiteInSingle(\Magento\Store\Api\Data\WebsiteInterface $website)
    {
        //transactional data limit
        $limit             = $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT,
            $website
        );
        $collection        = $this->getModifiedWishlistToImport(
            $website,
            $limit
        );
        $this->wishlistIds = [];
        //email_wishlist wishlist ids
        $wishlistIds = $collection->getColumnValues('wishlist_id');

        $wishlistCollection = $this->wishlist->create()
                                             ->getWishlistByIds($wishlistIds);

        foreach ($wishlistCollection as $wishlist) {
            $wishlistId    = $wishlist->getid();
            $wishlistItems = $this->itemCollection->create()
                                                  ->addWishlistFilter($wishlist);

            $connectorWishlist = $this->wishlistFactory->create();
            $connectorWishlist->setId($wishlistId)
                              ->setUpdatedAt($wishlist->getUpdatedAt())
                              ->setCustomerId($wishlist->getCustomerId())
                              ->setEmail($wishlist->getEmail());

            if ($wishlistItems->getSize()) {
                /** @var \Magento\Wishlist\Model\Item $item */
                foreach ($wishlistItems as $item) {
                    try {
                        $product = $item->getProduct();
                        $connectorWishlistItem = $this->createConnectorWishlistItem($product, $item);
                        if ($connectorWishlistItem) {
                            $connectorWishlist->setItem($connectorWishlistItem);
                        }
                        $this->countWishlists++;
                    } catch (\Exception $e) {
                        //Product does not exist. Continue to next item
                        continue;
                    }
                }
                //send wishlist as transactional data
                $this->start = microtime(true);
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   $connectorWishlist->expose(),
                                                   Importer::MODE_SINGLE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            } else {
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   [$wishlist->getId()],
                                                   Importer::MODE_SINGLE_DELETE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            }
        }
        if (! empty($this->wishlistIds)) {
            $this->setImported($this->wishlistIds, true);
        }
    }
public function exportWishlistForWebsiteInSingle(\Magento\Store\Api\Data\WebsiteInterface $website)
    {
        //transactional data limit
        $limit             = $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT,
            $website
        );
        $collection        = $this->getModifiedWishlistToImport(
            $website,
            $limit
        );
        $this->wishlistIds = [];
        //email_wishlist wishlist ids
        $wishlistIds = $collection->getColumnValues('wishlist_id');

        $wishlistCollection = $this->wishlist->create()
                                             ->getWishlistByIds($wishlistIds);

        foreach ($wishlistCollection as $wishlist) {
            $wishlistId    = $wishlist->getid();
            $wishlistItems = $this->itemCollection->create()
                                                  ->addWishlistFilter($wishlist);

            $connectorWishlist = $this->wishlistFactory->create();
            $connectorWishlist->setId($wishlistId)
                              ->setUpdatedAt($wishlist->getUpdatedAt())
                              ->setCustomerId($wishlist->getCustomerId())
                              ->setEmail($wishlist->getEmail());

            if ($wishlistItems->getSize()) {
                /** @var \Magento\Wishlist\Model\Item $item */
                foreach ($wishlistItems as $item) {
                    try {
                        $product = $item->getProduct();
                        $connectorWishlistItem = $this->createConnectorWishlistItem($product, $item);
                        if ($connectorWishlistItem) {
                            $connectorWishlist->setItem($connectorWishlistItem);
                        }
                        $this->countWishlists++;
                    } catch (\Exception $e) {
                        //Product does not exist. Continue to next item
                        continue;
                    }
                }
                //send wishlist as transactional data
                $this->start = microtime(true);
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   $connectorWishlist->expose(),
                                                   Importer::MODE_SINGLE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            } else {
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   [$wishlist->getId()],
                                                   Importer::MODE_SINGLE_DELETE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            }
        }
        if (! empty($this->wishlistIds)) {
            $this->setImported($this->wishlistIds, true);
        }
    }
public function exportWishlistForWebsiteInSingle ( \ Magento \ Store \ Api \ Data \ WebsiteInterface $ website ) { //transactional data limit $ limit = $ this -> helper -> getWebsiteConfig ( \ Dotdigitalgroup \ Email \ Helper \ Config :: XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT , $ website ) ; $ collection = $ this -> getModifiedWishlistToImport ( $ website , $ limit ) ; $ this -> wishlistIds = [ ] ; //email_wishlist wishlist ids $ wishlistIds = $ collection -> getColumnValues ( 'wishlist_id' ) ; $ wishlistCollection = $ this -> wishlist -> create ( ) -> getWishlistByIds ( $ wishlistIds ) ; foreach ( $ wishlistCollection as $ wishlist ) { $ wishlistId = $ wishlist -> getid ( ) ; $ wishlistItems = $ this -> itemCollection -> create ( ) -> addWishlistFilter ( $ wishlist ) ; $ connectorWishlist = $ this -> wishlistFactory -> create ( ) ; $ connectorWishlist -> setId ( $ wishlistId ) -> setUpdatedAt ( $ wishlist -> getUpdatedAt ( ) ) -> setCustomerId ( $ wishlist -> getCustomerId ( ) ) -> setEmail ( $ wishlist -> getEmail ( ) ) ; if ( $ wishlistItems -> getSize ( ) ) { /** @var \Magento\Wishlist\Model\Item $item */ foreach ( $ wishlistItems as $ item ) { try { $ product = $ item -> getProduct ( ) ; $ connectorWishlistItem = $ this -> createConnectorWishlistItem ( $ product , $ item ) ; if ( $ connectorWishlistItem ) { $ connectorWishlist -> setItem ( $ connectorWishlistItem ) ; } $ this -> countWishlists ++ ; } catch ( \ Exception $ e ) { //Product does not exist. Continue to next item continue ; } } //send wishlist as transactional data $ this -> start = microtime ( true ) ; //register in queue with importer $ check = $ this -> importerFactory -> create ( ) -> registerQueue ( Importer :: IMPORT_TYPE_WISHLIST , $ connectorWishlist -> expose ( ) , Importer :: MODE_SINGLE , $ website -> getId ( ) ) ; if ( $ check ) { $ this -> wishlistIds [ ] = $ wishlistId ; } } else { //register in queue with importer $ check = $ this -> importerFactory -> create ( ) -> registerQueue ( Importer :: IMPORT_TYPE_WISHLIST , [ $ wishlist -> getId ( ) ] , Importer :: MODE_SINGLE_DELETE , $ website -> getId ( ) ) ; if ( $ check ) { $ this -> wishlistIds [ ] = $ wishlistId ; } } } if ( ! empty ( $ this -> wishlistIds ) ) { $ this -> setImported ( $ this -> wishlistIds , true ) ; } }
Export single wishlist for website.

@param \Magento\Store\Api\Data\WebsiteInterface $website

@return null
Export single wishlist for website .