getCustomers example

->limit(100);

            $customers = $this->numberSearch->search($criteria);
            $helper->start($customers->getTotal(), 'Start indexing customers');

            $this->clearStreamIndex($streamId);

            $insert = $this->connection->prepare(
                'INSERT INTO s_customer_streams_mapping (stream_id, customer_id) VALUES (:streamId, :customerId)'
            );

            while ($customers->getCustomers()) {
                foreach ($customers->getIds() as $customerId) {
                    $insert->execute([
                        ':streamId' => $streamId,
                        ':customerId' => $customerId,
                    ]);
                }

                $helper->advance((int) $criteria->getLimit());
                $criteria->offset($criteria->getOffset() + $criteria->getLimit());
                $customers = $this->numberSearch->search($criteria);
            }

            
if ($streamId !== null) {
            $streamId = (int) $streamId;
        }
        $customerNumberSearchResult = $this->resource->getOne(
            $streamId,
            (int) $request->getParam('offset', 0),
            (int) $request->getParam('limit', 50),
            $request->getParam('conditions', ''),
            $request->getParam('sortings', '')
        );

        $this->View()->assign('data', $customerNumberSearchResult->getCustomers());
        $this->View()->assign('total', $customerNumberSearchResult->getTotal());
        $this->View()->assign('success', true);
    }

    /** * POST /api/customer_streams * POST /api/customer_streams?buildSearchIndex=1 */
    public function postAction(): void
    {
        $request = $this->Request();

        


    /** * @param string $term * * @return array */
    public function search($term)
    {
        return [
            'articles' => $this->getArticles($term),
            'customers' => $this->getCustomers($term),
            'orders' => $this->getOrders($term),
        ];
    }

    /** * @param string $term * * @return array */
    private function getArticles($term)
    {
        
if (empty(Shopware()->Config()->get('voteSendCalling'))) {
            return;
        }

        $sendTime = Shopware()->Config()->get('voteCallingTime', 10);
        $orders = $this->getOrders($sendTime);
        if (empty($orders)) {
            return 'No orders for rating mail found.';
        }

        $orderIds = array_keys($orders);
        $customers = $this->getCustomers($orderIds);
        $orderPositions = $this->getPositions($orderIds);

        $shopPositionBaseProducts = $this->structurePositionsArray($orderPositions);

        $shopPositionImages = $this->getPositionImages($shopPositionBaseProducts);

        $count = 0;
        foreach ($orders as $orderId => $order) {
            if (empty($customers[$orderId]['email']) || empty($orderPositions[$orderId])) {
                continue;
            }

            
Home | Imprint | This part of the site doesn't use cookies.