On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi,

    i use migxloopcollection to get a list of resources. i would like to use different templates for each item.
    getImageList has the option &tpl=`@Field:…`

    I tried to use it for migxloopcollection, but it doesn't work. Now i am not sure if it is not supported or if i am doing something wrong (i tried it first with one item):

    The Snippet Call
    [[!migxLoopCollection?
    		&classname=`modResource`
    		&joins=`[
    {"alias":"presentationStyle","classname":"modTemplateVarResource","on":"presentationStyle.contentid=modResource.id AND presentationStyle.tmplvarid=46"}
    		]`
    		&selectfields=`id,pagetitle,introtext`
    			
    		[[- <!-- search -->]]
    		&where=`[
    			{"published":"1"},
    			{"parent":"[[*id]]"},
    			{"template:=":"10","OR:template:=":"12","OR:template:=":"11"}
    		]`
    			
    		[[- <!-- sort -->]]
    		&sortConfig=`[{"sortby":"menuindex","sortdir":"ASC"}]`
    		
    		&tpl=`@Field:presentationStyle.value`
    	]]


    The Result for presentationStyle.value
    product-listing-default

    The name of the chunk
    product-listing-default

    tried it with this &where to check presentationStyle.value (delivers the right result)
    [[- <!-- search -->]]
    		&where=`[
    			{"published":"1"},
    			{"parent":"[[*id]]"},
    			{"template:=":"10","OR:template:=":"12","OR:template:=":"11"},
    			{"presentationStyle.value:=":"product-listing-default"}
    		]`

    This question has been answered by Bruno17. See the first response.

    • the output-rendering - loop is the same of getImageList and migxLoopCollection.

      try :
      @FIELD:
      not
      @Field:
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • discuss.answer
        try also:

        @FIELD:presentationStyle_value
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
        • also instead of this

          {"template:=":"10","OR:template:=":"12","OR:template:=":"11"}


          use this:

          {"template:IN":[ 10,11,12 ]}
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
          • Urgs. Looked to long at the code and was blind wink

            Thanks!!!