Skip to content

Fix #271 #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
const ERROR_GROUP_PRICE_DATA_INCOMPLETE = 'groupPriceDataIsIncomplete';
const ERROR_SKU_NOT_FOUND_FOR_DELETE = 'skuNotFoundToDelete';
const ERROR_SUPER_PRODUCTS_SKU_NOT_FOUND = 'superProductsSkuNotFound';
const ERROR_MEDIA_DATA_INCOMPLETE = 'mediaDataIsIncomplete';

/**
* Pairs of attribute set ID-to-name.
Expand Down Expand Up @@ -182,7 +183,8 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
self::ERROR_INVALID_TIER_PRICE_GROUP => 'Tier Price customer group ID is invalid',
self::ERROR_TIER_DATA_INCOMPLETE => 'Tier Price data is incomplete',
self::ERROR_SKU_NOT_FOUND_FOR_DELETE => 'Product with specified SKU not found',
self::ERROR_SUPER_PRODUCTS_SKU_NOT_FOUND => 'Product with specified super products SKU not found'
self::ERROR_SUPER_PRODUCTS_SKU_NOT_FOUND => 'Product with specified super products SKU not found',
self::ERROR_MEDIA_DATA_INCOMPLETE => 'Media data is incomplete'
);

/**
Expand Down Expand Up @@ -693,6 +695,23 @@ protected function _isSuperProductsSkuValid($rowData, $rowNum)
return true;
}

/**
* Check media information
*
* @param array $rowData
* @param int $rowNum
* @return bool
*/
protected function _isMediaValid($rowData, $rowNum)
{
if (!empty($rowData['_media_image']) && empty($rowData['_media_attribute_id'])) {
$this->addRowError(self::ERROR_MEDIA_DATA_INCOMPLETE, $rowNum);
return false;
}

return true;
}

/**
* Gather and save information about product links.
* Must be called after ALL products saving done.
Expand Down Expand Up @@ -1567,6 +1586,7 @@ public function validateRow(array $rowData, $rowNum)
$this->_isTierPriceValid($rowData, $rowNum);
$this->_isGroupPriceValid($rowData, $rowNum);
$this->_isSuperProductsSkuValid($rowData, $rowNum);
$this->_isMediaValid($rowData, $rowNum);

if (self::SCOPE_DEFAULT == $rowScope) { // SKU is specified, row is SCOPE_DEFAULT, new product block begins
$this->_processedEntitiesCount ++;
Expand Down