public static function getAttributesById($productId, $return = 0)
{
$db = Factory::getDBO();
$query = 'SELECT a.id, a.title, a.alias, a.required, a.type' . ' FROM #__phocacart_attributes 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 {
$attributes = $db->loadAssocList();
$attributesSubform = array();
$i = 0;
if (!empty($attributes)) {
foreach ($attributes as $k => $v) {
$attributesSubform['attributes' . $i]['id'] = (int) $v['id'];
$attributesSubform['attributes' . $i]['title'] = (string) $v['title'];
$attributesSubform['attributes' . $i]['alias'] = (string) $v['alias'];
$attributesSubform['attributes' . $i]['required'] = (int) $v['required'];
$attributesSubform['attributes' . $i]['type'] = (int) $v['type'];
$i++;
}
}
return $attributesSubform;
}
}
return false;
}