@zuki
Check this function, it can help a lot:
// GET SINGLE ATTRIBUTE VALUE ENTERED BY USER (NOT PREDEFINED)
function atr_item_attribute_value_by_user($attribute_id, $item_id = '') {
if($item_id <= 0) {
$item_id = osc_item_id();
}
$attribute = ModelATR::newInstance()->getAttributeDetail($attribute_id);
$value = ModelATR::newInstance()->getItemAttributeValues($item_id, $attribute_id);
if($value['fk_i_attribute_value_id'] > 0) {
$val_row = ModelATR::newInstance()->getAttributeValue($value['fk_i_attribute_value_id']);
$val = atr_name($val_row['locales']);
} else {
$val = $value['s_value'];
}
return array(
'id' => $attribute['pk_i_id'],
'name' => $attribute['s_name'],
'value' => $val
);
}