products(10) >>>Men(12) >>Sub category(13) >>>Sample item (27) >>Sub category(14) >>>Women >>Sub category(16) >>Sub category(17)
[+phx:if=`[!UltimateParent &top=`12`!]`:is=`13`:then=`Yes Go!`:else=`No Go!`+]
[*parent:is=`13`:then=`Yes Go!`:else=`No Go!`*]
[!UltimateParent &topLevel=`2`!]
Thanks that work perfect. this is awesome, just what I needed. great modx
you can try this:
[*parent:is=`13`:then=`Yes Go!`:else=`No Go!`*]
I think that your UP call would work if it was like this:
[!UltimateParent &topLevel=`2`!]
This will return the ID of the document 2 levels deep from the root, but you need to be below it for it to work, otherwise UP fails.
[+phx:if=`[*product-sizes-shirts-xs*]`:ne=``:then=`Yes Go!`: elseif:`[*product-sizes-shirts-sm*]`:ne=``:then=`Yes Go!`: elseif:`[*product-sizes-shirts-med*]`:ne=``:then=`Yes Go!`: elseif:`[*product-sizes-shirts-lg*]`:ne=``:then=`Yes Go!`: else=`No Go!`+]
how about elseif and OR is there a way to do it with phx?
ie something like this:
[+phx:if=`[*product-sizes-shirts-xs*]`:ne=``:then=`Yes Go!`: elseif:`[*product-sizes-shirts-sm*]`:ne=``:then=`Yes Go!`: elseif:`[*product-sizes-shirts-med*]`:ne=``:then=`Yes Go!`: elseif:`[*product-sizes-shirts-lg*]`:ne=``:then=`Yes Go!`: else=`No Go!`+]
[+phx:if=`[*product-sizes-shirts-xs*][*product-sizes-shirts-sm*][*product-sizes-shirts-med*][*product-sizes-shirts-lg*]`:is=``:then=`No Go!`: else=`Yes Go!`+]
[+phx:if=`[*product-sizes-shirts-xs*]`:ne=``:then=`Yes Go!`: else`[+phx:if=`[*product-sizes-shirts-sm*]`:ne=``:then=`Yes Go!`: else=`[+phx:if=`[*product-sizes-shirts-med*]`:ne=``:then=`Yes Go!`:else=`No Go!`+]`+]`+]
<?php $up = $modx->runSnippet('UltimateParent'); $parent = $modx->documentObject['parent']; $id = $modx->documentObject['id']; if(isset($topId)){$tid = $topId;}else{$tid = $up;} if( $up == $tid AND $parent != $tid){return $parent;} if( $up == $tid AND $parent == $tid){return $id;} if( $up != $tid){return $up;} ?>