public static function getOptionsById($attributeId, $return = 0)
{
$db = Factory::getDBO();
$query = 'SELECT a.id, a.title, a.alias, a.amount, a.operator, a.stock, a.operator_weight, a.weight, a.image, a.image_medium, a.image_small, a.download_folder, a.download_file, a.download_token, a.color, a.default_value, a.required, a.type';
$query .= ' FROM #__phocacart_attribute_values AS a' . ' WHERE a.attribute_id = ' . (int) $attributeId . ' ORDER BY a.ordering';
$db->setQuery($query);
if ($return == 0) {
return $db->loadObjectList();
} else {
if ($return == 1) {
return $db->loadAssocList();
} else {
$options = $db->loadAssocList();
$optionsSubform = array();
$i = 0;
if (!empty($options)) {
foreach ($options as $k => $v) {
$optionsSubform['options' . $i]['id'] = (int) $v['id'];
$optionsSubform['options' . $i]['title'] = (string) $v['title'];
$optionsSubform['options' . $i]['alias'] = (string) $v['alias'];
$optionsSubform['options' . $i]['operator'] = (string) $v['operator'];
$optionsSubform['options' . $i]['amount'] = PhocacartPrice::cleanPrice($v['amount']);
$optionsSubform['options' . $i]['stock'] = (string) $v['stock'];
$optionsSubform['options' . $i]['operator_weight'] = (string) $v['operator_weight'];
$optionsSubform['options' . $i]['weight'] = PhocacartPrice::cleanPrice($v['weight']);
$optionsSubform['options' . $i]['image'] = (string) $v['image'];
$optionsSubform['options' . $i]['image_medium'] = (string) $v['image_medium'];
$optionsSubform['options' . $i]['image_small'] = (string) $v['image_small'];
$optionsSubform['options' . $i]['download_folder'] = (string) $v['download_folder'];
$optionsSubform['options' . $i]['download_file'] = (string) $v['download_file'];
$optionsSubform['options' . $i]['download_token'] = (string) $v['download_token'];
$optionsSubform['options' . $i]['color'] = (string) $v['color'];
$optionsSubform['options' . $i]['default_value'] = (int) $v['default_value'];
$optionsSubform['options' . $i]['required'] = (int) $v['required'];
$optionsSubform['options' . $i]['type'] = (int) $v['type'];
$i++;
}
}
return $optionsSubform;
}
}
return false;
}