Example #1
0
 /**
  * Get export data for collection
  *
  * @return array
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function getExportData()
 {
     $exportData = [];
     try {
         $rawData = $this->collectRawData();
         $multirawData = $this->collectMultirawData();
         $productIds = array_keys($rawData);
         $stockItemRows = $this->prepareCatalogInventory($productIds);
         $this->rowCustomizer->prepareData($this->_getEntityCollection(), $productIds);
         $this->setHeaderColumns($multirawData['customOptionsData'], $stockItemRows);
         $this->_headerColumns = $this->rowCustomizer->addHeaderColumns($this->_headerColumns);
         foreach ($rawData as $productId => $productData) {
             foreach ($productData as $storeId => $dataRow) {
                 if ($storeId == Store::DEFAULT_STORE_ID && isset($stockItemRows[$productId])) {
                     $dataRow = array_merge($dataRow, $stockItemRows[$productId]);
                 }
                 $exportData = array_merge($exportData, $this->addMultirowData($dataRow, $multirawData));
             }
         }
     } catch (\Exception $e) {
         $this->_logger->logException($e);
     }
     return $exportData;
 }