当前位置: 首页>>代码示例>>PHP>>正文


PHP ProductDownload::deleteFile方法代码示例

本文整理汇总了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();
 }
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:8,代码来源:AdminProducts.php

示例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]);
         }
     }
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:13,代码来源:AdminProductsController.php

示例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);
         }
     }
//.........这里部分代码省略.........
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:101,代码来源:AdminProductsController.php

示例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';
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:15,代码来源:AdminProductsController.php

示例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;
 }
开发者ID:greench,项目名称:prestashop,代码行数:13,代码来源:AdminProducts.php


注:本文中的ProductDownload::deleteFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。