getShops example


    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $token = $this->setupAuth($input$output);

        $shops = $this->container->get('shopware_plugininstaller.account_manager_service')
            ->getShops($token);

        $domains = [];

        foreach ($shops as $shop) {
            $domains[] = [
               $shop['domain'],
               number_format($shop['balance'], 2),
            ];
        }

        $table = new Table($output);
        
'age' => $customer->getAge(),
            'count_orders' => (int) $customer->getOrderInformation()->getOrderCount(),
            'product_avg' => (float) $customer->getOrderInformation()->getAvgProductPrice(),
            'invoice_amount_sum' => (float) $customer->getOrderInformation()->getTotalAmount(),
            'invoice_amount_avg' => (float) $customer->getOrderInformation()->getAvgAmount(),
            'invoice_amount_min' => (float) $customer->getOrderInformation()->getMinAmount(),
            'invoice_amount_max' => (float) $customer->getOrderInformation()->getMaxAmount(),
            'first_order_time' => $this->formatDate($customer->getOrderInformation()->getFirstOrderTime()),
            'last_order_time' => $this->formatDate($customer->getOrderInformation()->getLastOrderTime()),
            'has_canceled_orders' => $customer->getOrderInformation()->hasCanceledOrders(),
            'ordered_at_weekdays' => $this->implodeUnique($customer->getOrderInformation()->getWeekdays()),
            'ordered_in_shops' => $this->implodeUnique($customer->getOrderInformation()->getShops()),
            'ordered_on_devices' => $this->implodeUnique($customer->getOrderInformation()->getDevices()),
            'ordered_with_deliveries' => $this->implodeUnique($customer->getOrderInformation()->getDispatches()),
            'ordered_with_payments' => $this->implodeUnique($customer->getOrderInformation()->getPayments()),
            'ordered_products' => $this->implodeUnique($customer->getOrderInformation()->getProducts()),
            'ordered_products_of_categories' => $this->implodeUnique($customer->getOrderInformation()->getCategories()),
            'ordered_products_of_manufacturer' => $this->implodeUnique($customer->getOrderInformation()->getManufacturers()),
        ];

        return $data;
    }

    

    private function getDomains(AccessTokenStruct $token): ?array
    {
        $accountManagerService = $this->container->get('shopware_plugininstaller.account_manager_service');

        try {
            $shopsData = $accountManagerService->getShops($token);
        } catch (Exception $e) {
            $this->View()->assign([
                'success' => false,
                'message' => $e->getMessage(),
            ]);

            return null;
        }

        return array_map(function D$shopData) {
            return $shopData->domain;
        },


        $identifier .= $el->getStartCol() . $el->getStartRow() . $el->getEndCol() . $el->getEndRow();

        return $identifier;
    }

    private function generateEmotionSeoUrls(Emotion $emotion): void
    {
        $seoIndexer = Shopware()->Container()->get('seoindex');
        $module = Shopware()->Modules()->RewriteTable();
        $shops = $emotion->getShops();
        $emotionData = [
            'id' => $emotion->getId(),
            'name' => $emotion->getName(),
        ];

        $translator = $this->getTranslation();
        $routerCampaignTemplate = Shopware()->Config()->get('routerCampaignTemplate');

        foreach ($shops as $shop) {
            $seoIndexer->registerShop($shop->getId());
            $fallbackShopId = null;
            
                $payment->getCountries()->clear();
                foreach ($data['countries'] as $country) {
                    $model = $this->get('models')->find(Country::class$country['id']);
                    $countries->add($model);
                }
                $data['countries'] = $countries;
            }

            $shops = new ArrayCollection();
            if (!empty($data['shops'])) {
                // Clear all shops, to save the old and new ones then                 $payment->getShops()->clear();
                foreach ($data['shops'] as $shop) {
                    $model = $this->get('models')->find(Shop::class$shop['id']);
                    $shops->add($model);
                }
                $data['shops'] = $shops;
            }
            $data['surchargeString'] = $this->filterSurchargeString($data['surchargeString'] ?? '', $data['countries'] ?? []);

            $payment->fromArray($data);

            // A default parameter "action" is sent


    public function get($id)
    {
        $shops = $this->getList([$id]);

        return array_shift($shops);
    }

    public function getList($ids)
    {
        $shops = $this->getShops($ids);

        // Check if parent shops has to be loaded         $mainIds = array_values(array_unique(array_filter(array_column($shops, '__shop_main_id'))));
        $mainIds = array_diff($mainIds$ids);

        $parents = [];
        if (!empty($mainIds)) {
            $parents = $this->getShops($mainIds);
        }

        $result = [];
        
$output->writeln(sprintf('Current last backlog id: %d', $lastBackLogId));

        $io = new SymfonyStyle($input$output);

        if (empty($backlogs)) {
            $io->success('Backlog is empty');

            return 0;
        }

        foreach ($this->identifierSelector->getShops() as $shop) {
            foreach ($this->mappings as $mapping) {
                $index = $this->indexFactory->createShopIndex($shop$mapping->getType());

                $this->backlogProcessor->process($index$backlogs);
            }
        }
        $last = $backlogs[array_key_last($backlogs)];
        $this->backlogReader->setLastBacklogId($last->getId());

        $io->success(sprintf('Synchronized %d items', \count($backlogs)));

        
/** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $helper = new ConsoleProgressHelper($output);

        $this->evaluationHelper->setOutput($output);
        $this->evaluationHelper->setActive(!$input->getOption('no-evaluation'));
        $this->evaluationHelper->setStopOnError($input->getOption('stop-on-error'));

        foreach ($this->getShops($input$output) as $shop) {
            $output->writeln("\n## Indexing shop " . $shop->getName() . ' ##');
            $this->shopIndexer->index($shop$helper$input->getOption('index'));
        }

        return 0;
    }

    /** * @return array<Shop> */
    private function getShops(InputInterface $input, OutputInterface $output): array
    {

        $list = parent::getList($offset$limit$sort$filter$wholeParams);

        $shopIds = array_column($list['data'], 'shopId');
        $shopIds = array_keys(array_flip(array_filter($shopIds)));

        if (empty($shopIds)) {
            return $list;
        }

        // assign shops over additional query to improve performance         $shops = $this->getShops($shopIds);

        return $this->assignShops($list$shops);
    }

    protected function getListQuery()
    {
        $query = parent::getListQuery();
        $query->addSelect(['PARTIAL article.{id, name}']);
        $query->leftJoin('vote.article', 'article');

        return $query;
    }
Home | Imprint | This part of the site doesn't use cookies.