本文整理汇总了PHP中ProductDownload::deleteFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductDownload::deleteFile方法的具体用法?PHP ProductDownload::deleteFile怎么用?PHP ProductDownload::deleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductDownload
的用法示例。
在下文中一共展示了ProductDownload::deleteFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteVirtualProduct
public function deleteVirtualProduct()
{
if (!($id_product_download = ProductDownload::getIdFromIdProduct(Tools::getValue('id_product')))) {
return false;
}
$productDownload = new ProductDownload(intval($id_product_download));
return $productDownload->deleteFile();
}
示例2: ajaxProcessDeleteVirtualProduct
public function ajaxProcessDeleteVirtualProduct()
{
if (!($id_product_download = ProductDownload::getIdFromIdProduct((int) Tools::getValue('id_product')))) {
$this->jsonError($this->l('Cannot retrieve file'));
} else {
$product_download = new ProductDownload((int) $id_product_download);
if (!$product_download->deleteFile((int) $id_product_download)) {
$this->jsonError($this->l('Cannot delete file'));
} else {
$this->jsonConfirmation($this->_conf[1]);
}
}
}
示例3: initProcess
public function initProcess()
{
if (Tools::isSubmit('submitAddproductAndStay') || Tools::isSubmit('submitAddproduct')) {
$this->id_object = (int) Tools::getValue('id_product');
$this->object = new Product($this->id_object);
if ($this->isTabSubmitted('Informations') && $this->object->is_virtual && (int) Tools::getValue('type_product') != 2) {
if ($id_product_download = (int) ProductDownload::getIdFromIdProduct($this->id_object)) {
$product_download = new ProductDownload($id_product_download);
if (!$product_download->deleteFile($id_product_download)) {
$this->errors[] = Tools::displayError('Cannot delete file');
}
}
}
}
// Delete a product in the download folder
if (Tools::getValue('deleteVirtualProduct')) {
if ($this->tabAccess['delete'] === '1') {
$this->action = 'deleteVirtualProduct';
} else {
$this->errors[] = Tools::displayError('You do not have permission to delete this.');
}
} elseif (Tools::isSubmit('submitAddProductAndPreview')) {
$this->display = 'edit';
$this->action = 'save';
if (Tools::getValue('id_product')) {
$this->id_object = Tools::getValue('id_product');
$this->object = new Product((int) Tools::getValue('id_product'));
}
} elseif (Tools::isSubmit('submitAttachments')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'attachments';
$this->tab_display = 'attachments';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif (Tools::getIsset('duplicate' . $this->table)) {
if ($this->tabAccess['add'] === '1') {
$this->action = 'duplicate';
} else {
$this->errors[] = Tools::displayError('You do not have permission to add this.');
}
} elseif (Tools::getValue('id_image') && Tools::getValue('ajax')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'image';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif (Tools::isSubmit('submitProductAttribute')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'productAttribute';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif (Tools::isSubmit('submitFeatures') || Tools::isSubmit('submitFeaturesAndStay')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'features';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif (Tools::isSubmit('submitPricesModification')) {
if ($this->tabAccess['add'] === '1') {
$this->action = 'pricesModification';
} else {
$this->errors[] = Tools::displayError('You do not have permission to add this.');
}
} elseif (Tools::isSubmit('deleteSpecificPrice')) {
if ($this->tabAccess['delete'] === '1') {
$this->action = 'deleteSpecificPrice';
} else {
$this->errors[] = Tools::displayError('You do not have permission to delete this.');
}
} elseif (Tools::isSubmit('submitSpecificPricePriorities')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'specificPricePriorities';
$this->tab_display = 'prices';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif (Tools::isSubmit('submitCustomizationConfiguration')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'customizationConfiguration';
$this->tab_display = 'customization';
$this->display = 'edit';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif (Tools::isSubmit('submitProductCustomization')) {
if ($this->tabAccess['edit'] === '1') {
$this->action = 'productCustomization';
$this->tab_display = 'customization';
$this->display = 'edit';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
} elseif (Tools::isSubmit('id_product')) {
$post_max_size = Tools::getMaxUploadSize(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1024 * 1024);
if ($post_max_size && isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] && $_SERVER['CONTENT_LENGTH'] > $post_max_size) {
$this->errors[] = sprintf(Tools::displayError('The uploaded file exceeds the "Maximum size for a downloadable product" set in preferences (%1$dMB) or the post_max_size/ directive in php.ini (%2$dMB).'), number_format(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE')), $post_max_size / 1024 / 1024);
}
}
//.........这里部分代码省略.........
示例4: processDeleteVirtualProduct
public function processDeleteVirtualProduct()
{
if (!($id_product_download = ProductDownload::getIdFromIdProduct((int) Tools::getValue('id_product')))) {
$this->errors[] = Tools::displayError('Cannot retrieve file');
} else {
$product_download = new ProductDownload((int) $id_product_download);
if (!$product_download->deleteFile((int) $id_product_download)) {
$this->errors[] = Tools::displayError('Cannot delete file');
} else {
$this->redirect_after = self::$currentIndex . '&id_product=' . (int) Tools::getValue('id_product') . '&updateproduct&key_tab=VirtualProduct&conf=1&token=' . $this->token;
}
}
$this->display = 'edit';
$this->tab_display = 'VirtualProduct';
}
示例5: deleteVirtualProduct
public function deleteVirtualProduct()
{
if (!($id_product_download = ProductDownload::getIdFromIdProduct((int) Tools::getValue('id_product'))) && !Tools::getValue('file')) {
return false;
}
$file = Tools::getValue('file');
$productDownload = new ProductDownload((int) $id_product_download);
$return = $productDownload->deleteFile();
if (!$return && file_exists(_PS_DOWNLOAD_DIR_ . $file)) {
$return = unlink(_PS_DOWNLOAD_DIR_ . $file);
}
return $return;
}