// Fix download products

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8080 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-16 16:22:13 +00:00
parent 28025e0ff6
commit e86d668a49
4 changed files with 14 additions and 5 deletions
+2 -3
View File
@@ -26,6 +26,5 @@
*/ */
define('PS_ADMIN_DIR', getcwd()); define('PS_ADMIN_DIR', getcwd());
require(dirname(dirname(__FILE__)).'/config/config.inc.php');
include(PS_ADMIN_DIR.'/../get-file.php'); ControllerFactory::getController('getFileController')->run();
+1 -1
View File
@@ -1335,7 +1335,7 @@ class AdminProducts extends AdminTab
$download->display_filename = Tools::getValue('virtual_product_name'); $download->display_filename = Tools::getValue('virtual_product_name');
$download->physically_filename = Tools::getValue('virtual_product_filename') ? Tools::getValue('virtual_product_filename') : ProductDownload::getNewFilename(); $download->physically_filename = Tools::getValue('virtual_product_filename') ? Tools::getValue('virtual_product_filename') : ProductDownload::getNewFilename();
$download->date_deposit = date('Y-m-d H:i:s'); $download->date_deposit = date('Y-m-d H:i:s');
$download->date_expiration = Tools::getValue('virtual_product_expiration_date') ? Tools::getValue('virtual_product_expiration_date').' 23:59:59' : '0000-00-00 00:00:00'; $download->date_expiration = Tools::getValue('virtual_product_expiration_date') ? Tools::getValue('virtual_product_expiration_date').' 23:59:59' : '';
$download->nb_days_accessible = Tools::getValue('virtual_product_nb_days'); $download->nb_days_accessible = Tools::getValue('virtual_product_nb_days');
$download->nb_downloadable = Tools::getValue('virtual_product_nb_downloable'); $download->nb_downloadable = Tools::getValue('virtual_product_nb_downloable');
$download->active = 1; $download->active = 1;
+4 -1
View File
@@ -101,6 +101,9 @@ class ProductDownloadCore extends ObjectModel
{ {
$this->validateFields(); $this->validateFields();
if (!$this->date_expiration)
$this->date_expiration = '0000-00-00 00:00:00';
$fields['id_product'] = (int)($this->id_product); $fields['id_product'] = (int)($this->id_product);
$fields['display_filename'] = pSQL($this->display_filename); $fields['display_filename'] = pSQL($this->display_filename);
$fields['physically_filename'] = pSQL($this->physically_filename); $fields['physically_filename'] = pSQL($this->physically_filename);
@@ -205,7 +208,7 @@ class ProductDownloadCore extends ObjectModel
public function getTextLink($admin=true, $hash=false) public function getTextLink($admin=true, $hash=false)
{ {
$key = $this->physically_filename . '-' . ($hash ? $hash : 'orderdetail'); $key = $this->physically_filename . '-' . ($hash ? $hash : 'orderdetail');
$link = ($admin) ? './index.php?controller=get-file-admin' : Tools::getHttpHost(true, true).'index.php?controller=get-file'; $link = ($admin) ? 'get-file-admin.php?' : Tools::getHttpHost(true, true).'index.php?controller=get-file&';
$link .= ($admin) ? 'file='.$this->physically_filename : 'key='.$key; $link .= ($admin) ? 'file='.$this->physically_filename : 'key='.$key;
return $link; return $link;
} }
+7
View File
@@ -27,6 +27,13 @@
class getFileControllerCore extends FrontController class getFileControllerCore extends FrontController
{ {
public function run()
{
$this->init();
$this->preProcess();
$this->process();
}
public function process() public function process()
{ {
$cookie = $this->context->cookie; $cookie = $this->context->cookie;