Created
November 16, 2019 11:29
-
-
Save OlegShchavelev/63f4623b74c877ae3ce9d677fd801e5d to your computer and use it in GitHub Desktop.
Вывод мультикатегорий в MS2
This file contains hidden or 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
$id = $modx->resource->id; | |
$tpl = '@INLINE <a href="[[~[[+id]]]]">[[+pagetitle]]</a>'; | |
$pdo = $modx->getService('pdoFetch'); | |
$options = array( | |
'innerJoin' => array( | |
'msCategory' => array('on' => 'msCategoryMember.category_id = msCategory.id') | |
), | |
'select' => array('msCategory' => 'all'), | |
'sortby' => 'msCategory.id' | |
); | |
$conditions = array('product_id' => $id); | |
$rows = $pdo->getCollection('msCategoryMember', $conditions, $options); | |
$output = ''; | |
foreach ($rows as $row) { | |
$output .= $pdo->getChunk($tpl, $row); | |
} | |
return $output; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment