Model/Sales/Order.php
public function searchOrdersForReview()
    {
        $websites = $this->helper->getwebsites(true);

        foreach ($websites as $website) {
            $apiEnabled = $this->helper->isEnabled($website);
            if ($apiEnabled
                && $this->helper->getWebsiteConfig(
                    \Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEWS_ENABLED,
                    $website
                )
                && $this->helper->getOrderStatus($website)
                && $this->helper->getDelay($website)
            ) {
                $storeIds = $website->getStoreIds();
                if (empty($storeIds)) {
                    continue;
                }

                $orderStatusFromConfig = $this->helper->getOrderStatus(
                    $website
                );
                $delayInDays = $this->helper->getDelay(
                    $website
                );

                $campaignCollection = $this->campaignCollection->create()
                    ->getCollectionByEvent('Order Review');

                $campaignOrderIds = $campaignCollection->getColumnValues(
                    'order_increment_id'
                );
                $fromTime = new \DateTime('now', new \DateTimezone('UTC'));
                $interval = $this->dateIntervalFactory->create(
                    ['interval_spec' => sprintf('P%sD', $delayInDays)]
                );
                $fromTime->sub($interval);
                $toTime = clone $fromTime;
                $fromTime->sub($this->dateIntervalFactory->create(['interval_spec' => 'PT2H']));
                $fromDate = $fromTime->format('Y-m-d H:i:s');
                $toDate = $toTime->format('Y-m-d H:i:s');

                $created = ['from' => $fromDate, 'to' => $toDate, 'date' => true];

                $collection = $this->orderCollection->create()
                    ->getSalesCollectionForReviews(
                        $orderStatusFromConfig,
                        $created,
                        $website,
                        $campaignOrderIds
                    );

                //process rules on collection
                $collection = $this->rulesFactory->create()
                    ->process(
                        $collection,
                        \Dotdigitalgroup\Email\Model\Rules::REVIEW,
                        $website->getId()
                    );

                if ($collection->getSize()) {
                    $this->reviewCollection[$website->getId()] = $collection;
                }
            }
        }
    }
public function searchOrdersForReview()
    {
        $websites = $this->helper->getwebsites(true);

        foreach ($websites as $website) {
            $apiEnabled = $this->helper->isEnabled($website);
            if ($apiEnabled
                && $this->helper->getWebsiteConfig(
                    \Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEWS_ENABLED,
                    $website
                )
                && $this->helper->getOrderStatus($website)
                && $this->helper->getDelay($website)
            ) {
                $storeIds = $website->getStoreIds();
                if (empty($storeIds)) {
                    continue;
                }

                $orderStatusFromConfig = $this->helper->getOrderStatus(
                    $website
                );
                $delayInDays = $this->helper->getDelay(
                    $website
                );

                $campaignCollection = $this->campaignCollection->create()
                    ->getCollectionByEvent('Order Review');

                $campaignOrderIds = $campaignCollection->getColumnValues(
                    'order_increment_id'
                );
                $fromTime = new \DateTime('now', new \DateTimezone('UTC'));
                $interval = $this->dateIntervalFactory->create(
                    ['interval_spec' => sprintf('P%sD', $delayInDays)]
                );
                $fromTime->sub($interval);
                $toTime = clone $fromTime;
                $fromTime->sub($this->dateIntervalFactory->create(['interval_spec' => 'PT2H']));
                $fromDate = $fromTime->format('Y-m-d H:i:s');
                $toDate = $toTime->format('Y-m-d H:i:s');

                $created = ['from' => $fromDate, 'to' => $toDate, 'date' => true];

                $collection = $this->orderCollection->create()
                    ->getSalesCollectionForReviews(
                        $orderStatusFromConfig,
                        $created,
                        $website,
                        $campaignOrderIds
                    );

                //process rules on collection
                $collection = $this->rulesFactory->create()
                    ->process(
                        $collection,
                        \Dotdigitalgroup\Email\Model\Rules::REVIEW,
                        $website->getId()
                    );

                if ($collection->getSize()) {
                    $this->reviewCollection[$website->getId()] = $collection;
                }
            }
        }
    }
public function searchOrdersForReview ( ) { $ websites = $ this -> helper -> getwebsites ( true ) ; foreach ( $ websites as $ website ) { $ apiEnabled = $ this -> helper -> isEnabled ( $ website ) ; if ( $ apiEnabled && $ this -> helper -> getWebsiteConfig ( \ Dotdigitalgroup \ Email \ Helper \ Config :: XML_PATH_REVIEWS_ENABLED , $ website ) && $ this -> helper -> getOrderStatus ( $ website ) && $ this -> helper -> getDelay ( $ website ) ) { $ storeIds = $ website -> getStoreIds ( ) ; if ( empty ( $ storeIds ) ) { continue ; } $ orderStatusFromConfig = $ this -> helper -> getOrderStatus ( $ website ) ; $ delayInDays = $ this -> helper -> getDelay ( $ website ) ; $ campaignCollection = $ this -> campaignCollection -> create ( ) -> getCollectionByEvent ( 'Order Review' ) ; $ campaignOrderIds = $ campaignCollection -> getColumnValues ( 'order_increment_id' ) ; $ fromTime = new \ DateTime ( 'now' , new \ DateTimezone ( 'UTC' ) ) ; $ interval = $ this -> dateIntervalFactory -> create ( [ 'interval_spec' => sprintf ( 'P%sD' , $ delayInDays ) ] ) ; $ fromTime -> sub ( $ interval ) ; $ toTime = clone $ fromTime ; $ fromTime -> sub ( $ this -> dateIntervalFactory -> create ( [ 'interval_spec' => 'PT2H' ] ) ) ; $ fromDate = $ fromTime -> format ( 'Y-m-d H:i:s' ) ; $ toDate = $ toTime -> format ( 'Y-m-d H:i:s' ) ; $ created = [ 'from' => $ fromDate , 'to' => $ toDate , 'date' => true ] ; $ collection = $ this -> orderCollection -> create ( ) -> getSalesCollectionForReviews ( $ orderStatusFromConfig , $ created , $ website , $ campaignOrderIds ) ; //process rules on collection $ collection = $ this -> rulesFactory -> create ( ) -> process ( $ collection , \ Dotdigitalgroup \ Email \ Model \ Rules :: REVIEW , $ website -> getId ( ) ) ; if ( $ collection -> getSize ( ) ) { $ this -> reviewCollection [ $ website -> getId ( ) ] = $ collection ; } } } }
Search for orders to review per website.

@return null
Search for orders to review per website .