Answer the question
In order to leave comments, you need to log in
How to set a css class for a certain property of a product?
There is a product property with the symbolic code "PROP_INCOME" and it is necessary to set a certain css-style for it, for example - font-weight: 600;
How to do it?
Answer the question
In order to leave comments, you need to log in
`$value = value.style.font-weight == '600';` - what programming language?! :) Is it some mix of php+javascript (although the spelling is not correct then)? ... it won't work.
You need to find a piece of code in the component template code where the product properties are displayed. And there already check / search for the desired property, and when you find it, then substitute either the inline font-weight style or even better the style class. do not forget to add the style class itself to style.css
For example, if the code you provided is cut from the correct place from the component template, then in the end it will turn out something like this:
<?php
foreach ($arResult['PROPERTIES'] as $code => $value) {
if (in_array ($code, ELEMENT_PROPERTIES_SKIP) || empty($value['VALUE']))
{
continue;
}
$class = $style = '';
if ($code == 'PROP_INCOME') {
$class = 'fb-600';
$style = 'style="font-weight: 600;"';
}
?>
<div class="catalog-property <?=$class?>">
<?=$value?>
</div>
or
<div <?=($style??'')?>>
<?=$value?>
</div>
<?php
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question