*

zuki305

  • *
  • 3 posts
How to call attributes value only ?
« 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

*

MB Themes

Re: How to call attributes value only ?
« Reply #1 on: September 17, 2021, 08:02:27 AM »
@zuki
Check this function, it can help a lot:
Code: [Select]
// 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
  );
}
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots