Created
September 19, 2023 18:13
-
-
Save sashabeep/4e757ca10770352018ff74ffe2afd2bf to your computer and use it in GitHub Desktop.
Evo cms пример вывода свойств продукта из всех заполненных TV используя названия TV как в админке
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if(!empty($productOptions)) | |
<ul> | |
@foreach ($productOptions as $item) | |
<li><b>{{ $item['caption'] }}:</b> {{ str_replace("||",", ",$item['value']) }}</li> {{--не помню зачем, вроде, для множественных значений--}} | |
@endforeach | |
</ul> | |
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$val = $modx->getTemplateVars('*', '*', $documentObject['id'],1,'category'); | |
$tvcategories = [10]; //id категории свойств товаров | |
$tvexclude = [16,17,43,45]; //TV которые не хочу выводить | |
$productOptions = []; //массив свойств | |
if(!empty($val)){ | |
foreach ($val as $key=>$val){ | |
if( in_array($val['category'],$tvcategories) && !(in_array($val['id'],$tvexclude)) && $val['value']!=''){ | |
$productOptions[]=$val; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment