Osclass Support Forums
Osclass plugin support => Attributes Plugins => Topic started by: zuki305 on September 16, 2021, 05:19:46 PM
-
I need help plz.
1 - How to call attributes value? .. no the attribute name.
second option is how call the value before attribute name.
Right now this " echo atr_show_attribute(68 )" , return
Name + value (Bed 7) instead of Value + Name (7 Bed)
Best regards
-
@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
);
}