// MERGE with 1.4 r7770

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7776 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-07-28 09:20:57 +00:00
parent df255f66c1
commit a875fecb20
968 changed files with 26082 additions and 3937 deletions
+20 -1
View File
@@ -37,7 +37,7 @@ class AttachmentCore extends ObjectModel
public $position;
protected $fieldsRequired = array('file', 'mime');
protected $fieldsSize = array('file' => 40, 'mime' => 64, 'file_name' => 128);
protected $fieldsSize = array('file' => 40, 'mime' => 128, 'file_name' => 128);
protected $fieldsValidate = array('file' => 'isGenericName', 'mime' => 'isCleanHtml', 'file_name' => 'isGenericName');
protected $fieldsRequiredLang = array('name');
@@ -102,5 +102,24 @@ class AttachmentCore extends ObjectModel
}
return $result1;
}
public static function getProductAttached($id_lang, $list)
{
$ids_attachements = array();
if (is_array($list))
{
foreach($list as $attachement)
$ids_attachements[] = $attachement['id_attachment'];
$tmp = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'product_attachment` pa
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pa.`id_product` = pl.`id_product`)
WHERE `id_attachment` IN ('.implode(',', array_map('intval', $ids_attachements)).') AND pl.`id_lang` = '.(int)$id_lang.';');
$productAttachements = array();
foreach($tmp as $t)
$productAttachements[$t['id_attachment']][] = $t['name'];
return $productAttachements;
}
else
return false;
}
}