Skip to content

Commit

Permalink
Fixed passing null for str_replace is deprecated in Mage_Downloadable…
Browse files Browse the repository at this point in the history
…_Block_Adminhtml_Catalog_Product_Edit_Tab_Downloadable_Links (#3330)
  • Loading branch information
kyrena authored Jun 19, 2023
1 parent 2dad20c commit 15f7623
Showing 1 changed file with 38 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,41 +164,46 @@ public function getLinkData()
'sample_type' => $item->getSampleType(),
'sort_order' => $item->getSortOrder(),
];
$file = Mage::helper('downloadable/file')->getFilePath(
Mage_Downloadable_Model_Link::getBasePath(),
$item->getLinkFile()
);

if ($item->getLinkFile() && !is_file($file)) {
Mage::helper('core/file_storage_database')->saveFileToFilesystem($file);
}

if ($item->getLinkFile() && is_file($file)) {
$name = '<a href="'
. $this->getUrl('*/downloadable_product_edit/link', [
'id' => $item->getId(),
'_secure' => true
]) . '">' . Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()) . '</a>';
$tmpLinkItem['file_save'] = [
[
'file' => $item->getLinkFile(),
'name' => $name,
'size' => filesize($file),
'status' => 'old'
]];
if ($item->getLinkFile()) {
$file = Mage::helper('downloadable/file')->getFilePath(
Mage_Downloadable_Model_Link::getBasePath(),
$item->getLinkFile()
);
if (!is_file($file)) {
Mage::helper('core/file_storage_database')->saveFileToFilesystem($file);
}
if (is_file($file)) {
$name = '<a href="'
. $this->getUrl('*/downloadable_product_edit/link', [
'id' => $item->getId(),
'_secure' => true
]) . '">' . Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()) . '</a>';
$tmpLinkItem['file_save'] = [
[
'file' => $item->getLinkFile(),
'name' => $name,
'size' => filesize($file),
'status' => 'old'
]
];
}
}
$sampleFile = Mage::helper('downloadable/file')->getFilePath(
Mage_Downloadable_Model_Link::getBaseSamplePath(),
$item->getSampleFile()
);
if ($item->getSampleFile() && is_file($sampleFile)) {
$tmpLinkItem['sample_file_save'] = [
[
'file' => $item->getSampleFile(),
'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
'size' => filesize($sampleFile),
'status' => 'old'
]];
if ($item->getSampleFile()) {
$sampleFile = Mage::helper('downloadable/file')->getFilePath(
Mage_Downloadable_Model_Link::getBaseSamplePath(),
$item->getSampleFile()
);
if (is_file($sampleFile)) {
$tmpLinkItem['sample_file_save'] = [
[
'file' => $item->getSampleFile(),
'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
'size' => filesize($sampleFile),
'status' => 'old'
]
];
}
}
if ($item->getNumberOfDownloads() == '0') {
$tmpLinkItem['is_unlimited'] = ' checked="checked"';
Expand Down

0 comments on commit 15f7623

Please sign in to comment.