187 $this->_scopeConfig = $scopeConfig;
189 $this->_attributeCollection = isset(
190 $data[
'attribute_collection']
191 ) ?
$data[
'attribute_collection'] : $collectionFactory->create(
192 static::ATTRIBUTE_COLLECTION_NAME
194 $this->_pageSize = isset(
196 ) ?
$data[
'page_size'] : (static::XML_PATH_PAGE_SIZE ? (int)$this->_scopeConfig->getValue(
197 static::XML_PATH_PAGE_SIZE,
198 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE
200 $this->_byPagesIterator = isset(
201 $data[
'collection_by_pages_iterator']
202 ) ?
$data[
'collection_by_pages_iterator'] : $resourceColFactory->create();
210 protected function _initStores()
213 foreach ($this->_storeManager->getStores(
true) as
$store) {
214 $this->_storeIdToCode[
$store->getId()] =
$store->getCode();
216 ksort($this->_storeIdToCode);
228 protected function _initWebsites($withDefault =
false)
231 foreach ($this->_storeManager->getWebsites($withDefault) as
$website) {
246 $errorCode = (string)$errorCode;
247 $this->_errors[$errorCode][] = $errorRowNum + 1;
249 $this->_invalidRows[$errorRowNum] =
true;
250 $this->_errorsCount++;
264 $this->_messageTemplates[$errorCode] =
$message;
277 if (isset($this->_messageTemplates[$errorCode])) {
278 return $this->_messageTemplates[$errorCode];
288 abstract public function export();
306 $this->_byPagesIterator->iterate(
$collection, $this->_pageSize, [[$this,
'exportItem']]);
314 protected function _getExportAttributeCodes()
316 if (
null === $this->_attributeCodes) {
320 $skippedAttributes = array_flip(
324 $skippedAttributes = [];
330 if (!isset($skippedAttributes[
$attribute->getAttributeId()])
399 foreach ($this->_errors as $errorCode => $errorRows) {
401 $this->_messageTemplates[$errorCode]
403 $this->_messageTemplates[$errorCode]
405 'Please correct the value for "%1" column.',
432 return count($this->_invalidRows);
463 if (!$this->_writer) {
464 throw new \Magento\Framework\Exception\LocalizedException(
__(
'Please specify the writer.'));
478 $this->_parameters = $parameters;
491 $this->_writer = $writer;
const FILTER_ELEMENT_SKIP
const ATTRIBUTE_COLLECTION_NAME
retrieveMessageTemplate($errorCode)
setWriter(AbstractAdapter $writer)
addMessageTemplate($errorCode, $message)
addRowError($errorCode, $errorRowNum)
setParameters(array $parameters)
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\ResourceModel\CollectionByPagesIteratorFactory $resourceColFactory, array $data=[])
filterAttributeCollection(\Magento\Framework\Data\Collection $collection)
_exportCollectionByPages(\Magento\Framework\Data\Collection\AbstractDb $collection)
getProcessedEntitiesCount()