public static
getProductFilesByProductId
(mixed $productId, mixed $return = 0)
public static function getProductFilesByProductId($productId, $return = 0)
{
$db = Factory::getDBO();
$query = 'SELECT a.id, a.download_file, a.download_token, a.download_days';
$query .= ' FROM #__phocacart_product_files AS a' . ' WHERE a.product_id = ' . (int) $productId . ' ORDER BY a.ordering';
$db->setQuery($query);
if ($return == 0) {
return $db->loadObjectList();
} else {
if ($return == 1) {
return $db->loadAssocList();
} else {
$files = $db->loadAssocList();
$filesSubform = array();
$i = 0;
if (!empty($files)) {
foreach ($files as $k => $v) {
$filesSubform['additional_download_files' . $i]['id'] = (string) $v['id'];
$filesSubform['additional_download_files' . $i]['download_file'] = (string) $v['download_file'];
$filesSubform['additional_download_files' . $i]['download_token'] = (string) $v['download_token'];
$filesSubform['additional_download_files' . $i]['download_days'] = (string) $v['download_days'];
$i++;
}
}
return $filesSubform;
}
}
return false;
}