[*] BO : you can know download the previous file near the upload file input
This commit is contained in:
@@ -509,7 +509,7 @@
|
||||
{elseif $input.type == 'categories_select'}
|
||||
{$input.category_tree}
|
||||
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
|
||||
{$asso_shop}
|
||||
{$asso_shop}
|
||||
{elseif $input.type == 'color'}
|
||||
<div class="col-lg-2">
|
||||
<div class="row">
|
||||
|
||||
@@ -56,6 +56,14 @@
|
||||
<button id="{$id}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if}
|
||||
</button>
|
||||
{if isset($file)}
|
||||
<a href="{$file}">
|
||||
<button type="button" class="btn btn-default">
|
||||
<i class="icon-download"></i>
|
||||
{if isset($size)}{l s='Download current file (%skb)' sprintf=$size}{else}{l s='Download current file'}{/if}
|
||||
</button>
|
||||
</a>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -106,8 +106,8 @@ class AttachmentCore extends ObjectModel
|
||||
public static function deleteProductAttachments($id_product)
|
||||
{
|
||||
$res = Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'product_attachment
|
||||
WHERE id_product = '.(int)$id_product);
|
||||
DELETE FROM '._DB_PREFIX_.'product_attachment
|
||||
WHERE id_product = '.(int)$id_product);
|
||||
|
||||
Product::updateCacheAttachment((int)$id_product);
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ class HelperFormCore extends Helper
|
||||
$uploader->setImage(isset($params['image'])?$params['image']:null);
|
||||
$uploader->setThumb(isset($params['thumb'])?$params['thumb']:null);
|
||||
$uploader->setSize(isset($params['size'])?$params['size']:null);
|
||||
$uploader->setFile(isset($params['file'])?$params['file']:null);
|
||||
$uploader->setTitle(isset($params['title'])?$params['title']:null);
|
||||
$uploader->setDeleteUrl(isset($params['delete_url'])?$params['delete_url']:null);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ class HelperUploaderCore extends Uploader
|
||||
private $_name;
|
||||
private $_multiple;
|
||||
private $_size;
|
||||
private $_file;
|
||||
protected $_template;
|
||||
private $_template_directory;
|
||||
private $_title;
|
||||
@@ -195,6 +196,17 @@ class HelperUploaderCore extends Uploader
|
||||
return $this->getTemplateDirectory().$template;
|
||||
}
|
||||
|
||||
public function setFile($value)
|
||||
{
|
||||
$this->_file = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFile()
|
||||
{
|
||||
return $this->_file;
|
||||
}
|
||||
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->_title = $value;
|
||||
@@ -303,6 +315,7 @@ class HelperUploaderCore extends Uploader
|
||||
'display_image' => $this->displayImage(),
|
||||
'image' => $this->getImage(),
|
||||
'thumb' => $this->getThumb(),
|
||||
'file' => $this->getFile(),
|
||||
'size' => $this->getSize(),
|
||||
'delete_url' => $this->getDeleteUrl(),
|
||||
'title' => $this->getTitle()
|
||||
|
||||
@@ -78,6 +78,12 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj))
|
||||
{
|
||||
$link = $this->context->link->getPageLink('attachment', true, NULL, 'id_attachment='.$obj->id);
|
||||
$size = round(filesize(_PS_DOWNLOAD_DIR_.$obj->file) / 1024);
|
||||
}
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Attachment'),
|
||||
@@ -90,22 +96,26 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'lang' => true,
|
||||
'col' => 4
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description:'),
|
||||
'name' => 'description',
|
||||
'lang' => true,
|
||||
'col' => 6
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'file' => isset($link) ? $link : null,
|
||||
'size' => isset($size) ? $size : null,
|
||||
'label' => $this->l('File:'),
|
||||
'name' => 'file',
|
||||
'hint' => $this->l('Upload a file from your computer.')
|
||||
'col' => 6
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save '),
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user