Skip to content

Commit

Permalink
Merge pull request #539 from magento-nord/merchant_beta
Browse files Browse the repository at this point in the history
[Nord] Merchant Beta Fixes
  • Loading branch information
Bomko, Alex(abomko) committed Aug 19, 2015
2 parents 30b2e3b + 57c8fec commit 85ab7c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
18 changes: 10 additions & 8 deletions app/code/Magento/CatalogImportExport/Model/Import/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1466,13 +1466,15 @@ protected function _saveProducts()
if (!empty($rowData[self::COL_MEDIA_IMAGE]) && is_array($rowData[self::COL_MEDIA_IMAGE])) {
$position = array_search($mediaImage, $mediaGalleryImages);
foreach ($rowData[self::COL_MEDIA_IMAGE] as $mediaImage) {
$mediaGallery[$rowSku][] = [
'attribute_id' => $this->getMediaGalleryAttributeId(),
'label' => isset($mediaGalleryLabels[$position]) ? $mediaGalleryLabels[$position] : '',
'position' => $position,
'disabled' => '',
'value' => $mediaImage,
];
if (!empty($mediaImage)) {
$mediaGallery[$rowSku][] = [
'attribute_id' => $this->getMediaGalleryAttributeId(),
'label' => isset($mediaGalleryLabels[$position]) ? $mediaGalleryLabels[$position] : '',
'position' => $position,
'disabled' => '',
'value' => $mediaImage,
];
}
}
}
}
Expand Down Expand Up @@ -1750,7 +1752,7 @@ protected function _getUploader()
$destinationDir = "catalog/product";
$destinationPath = $dirAddon . $DS . $this->_mediaDirectory->getRelativePath($destinationDir);

$this->_mediaDirectory->create($destinationDir);
$this->_mediaDirectory->create($destinationPath);
if (!$this->_fileUploader->setDestDir($destinationPath)) {
throw new \Magento\Framework\Exception\LocalizedException(
__('File directory \'%1\' is not writable.', $destinationPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,14 @@ public function setDestDir($path)
protected function _moveFile($tmpPath, $destPath)
{
if ($this->_directory->isFile($tmpPath)) {
return $this->_directory->copyFile($tmpPath, $destPath);
$tmpRealPath = $this->_directory->getDriver()->getRealPath(
$this->_directory->getAbsolutePath($tmpPath)
);
$destinationRealPath = $this->_directory->getDriver()->getRealPath(
$this->_directory->getAbsolutePath($destPath)
);
$isSameFile = $tmpRealPath === $destinationRealPath;
return $isSameFile ?: $this->_directory->copyFile($tmpPath, $destPath);
} else {
return false;
}
Expand Down

0 comments on commit 85ab7c3

Please sign in to comment.