// Bug fix when deleting a file associated to a virtual product
This commit is contained in:
@@ -152,14 +152,18 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the file
|
* Delete the file
|
||||||
|
* @param int $id_product_download : if we need to delete a specific product attribute file
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function deleteFile()
|
public function deleteFile($id_product_download = NULL)
|
||||||
{
|
{
|
||||||
if (!$this->checkFile())
|
if (!$this->checkFile())
|
||||||
return false;
|
return false;
|
||||||
return unlink(_PS_DOWNLOAD_DIR_.$this->filename);
|
|
||||||
|
return unlink(_PS_DOWNLOAD_DIR_.$this->filename) && Db::getInstance()->Execute('DELETE
|
||||||
|
FROM `'._DB_PREFIX_.'product_download`
|
||||||
|
WHERE `id_product_download` = '.(int)$id_product_download);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,7 +220,7 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
if (!self::isFeatureActive())
|
if (!self::isFeatureActive())
|
||||||
return false;
|
return false;
|
||||||
if (array_key_exists($id_product_attribute, self::$_productIds))
|
if (array_key_exists($id_product_attribute, self::$_productIds))
|
||||||
return self::$_productIds[$id_product];
|
return self::$_productIds[$id_product];
|
||||||
self::$_productIds[$id_product_attribute] = (int)Db::getInstance()->getValue('
|
self::$_productIds[$id_product_attribute] = (int)Db::getInstance()->getValue('
|
||||||
SELECT `id_product_download`
|
SELECT `id_product_download`
|
||||||
FROM `'._DB_PREFIX_.'product_download`
|
FROM `'._DB_PREFIX_.'product_download`
|
||||||
|
|||||||
Reference in New Issue
Block a user