Добавлю свою наработку:
$feature_id = '151'; //id характеристики "Бренд/Производитель" $prod_id = '23';$feature_value = fn_bc_custom_changes_get_product_features($prod_id, $feature_id);
function fn_bc_custom_changes_get_product_features($product_id, $feature_id = '', $lang_code = CART_LANGUAGE)
{
/*На всякий случай сделать проверку на существование значения $feature_id*/
if ($feature_id == '') {return '';}
$features = '';
if (!isset($features[$lang_code])) {
list($features[$lang_code]) = fn_get_product_features(array('plain' => true), 0, $lang_code);
}
//params
$main_category = db_get_field('SELECT category_id FROM ?:products_categories WHERE product_id = ?i AND link_type = ?s', $product_id, 'M');
$product = array(
'product_id' => $product_id,
'main_category' => $main_category
);
$product_features = fn_get_product_features_list($product, 'CP', $lang_code);
$result = array();
if (!empty($product_features)) {
foreach ($product_features as $f) {
if ($f['feature_id'] == $feature_id) {
if ($f['feature_type'] == "C") {
$result = ($f['value'] == "Y") ? __("yes") : __ ("no");
} elseif ($f['feature_type'] == "S" && !empty($f['variant'])) {
$result = fn_bc_custom_changes_get_product_info($f['variant']);
} elseif ($f['feature_type'] == "T" && !empty($f['value'])) {
$result = fn_bc_custom_changes_get_product_info($f['value']);
} elseif ($f['feature_type'] == "M") {
if (!empty($f['variants'])) {
$_value = '';
$counter = count($f['variants']);
foreach ($f['variants'] as $_variant) {
if ($counter > 1) {
$_value .= $_variant['variant'] . ', ';
} else {
$_value = $_variant['variant'];
}
}
$_value = ($counter > 1) ? substr($_value, 0, -2) : $_value;
$result = fn_bc_custom_changes_get_product_info($_value);
}
} elseif ($f['feature_type'] == "N") {
$result = fn_bc_custom_changes_get_product_info($f['variant']);
} elseif ($f['feature_type'] == "O") {
$result = fn_bc_custom_changes_get_product_info($f['value_int']);
}
elseif ($f['feature_type'] == "E") {
$result = fn_bc_custom_changes_get_product_info($f['variant']);
}
break;
}
}
}
return !empty($result) ? $result : '';
}
function fn_bc_custom_changes_get_product_info($data)
{
return htmlspecialchars(strip_tags($data), ENT_QUOTES, 'UTF-8');
}