From 3dc31447272c1e339ae8fdbde80b9a7e63acbc6c Mon Sep 17 00:00:00 2001 From: lBrieu Date: Wed, 5 Oct 2011 13:54:56 +0000 Subject: [PATCH] [*] FO : change the download link for files associated to product attributes git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9057 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/ProductDownload.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/classes/ProductDownload.php b/classes/ProductDownload.php index 4d799babc..f95da7a2b 100644 --- a/classes/ProductDownload.php +++ b/classes/ProductDownload.php @@ -208,7 +208,7 @@ class ProductDownloadCore extends ObjectModel * @param int $id_product Product the id * @return integer Product the id for this virtual product */ - public static function getIdFromIdAttibute($id_product_attribute) + public static function getIdFromIdAttibute($id_product, $id_product_attribute) { if (!self::isFeatureActive()) return false; @@ -217,7 +217,8 @@ class ProductDownloadCore extends ObjectModel self::$_productIds[$id_product_attribute] = (int)Db::getInstance()->getValue(' SELECT `id_product_download` FROM `'._DB_PREFIX_.'product_download` - WHERE `id_product_attribute` = '.(int)$id_product_attribute.' AND `active` = 1'); + WHERE `id_product` = '.(int)$id_product.' + AND `id_product_attribute` = '.(int)$id_product_attribute.' AND `active` = 1'); return self::$_productIds[$id_product_attribute]; } @@ -312,7 +313,7 @@ class ProductDownloadCore extends ObjectModel public function getTextLink($admin = true, $hash = false) { $key = $this->filename . '-' . ($hash ? $hash : 'orderdetail'); - $link = ($admin) ? 'get-file-admin.php?' : Tools::getHttpHost(true, true).'index.php?controller=get-file&'; + $link = ($admin) ? 'get-file-admin.php?' : _PS_BASE_URL_.__PS_BASE_URI__.'index.php?controller=get-file&'; $link .= ($admin) ? 'file='.$this->filename : 'key='.$key; return $link; }