We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53460
    • 69 Posts
    Ok there's a lot to unpack here so I'll do my best to explain. The example page is located here: https://nogreaterpartnership.bipc.com/opportunity-zones

    I initially had a listing of people in a grid display that pulls from various resources. That is displayed through pdoResources like this:
    [[pdoResources?
        &parents=`186,187,188`
        &depth=`1`
        &resources=`[[*ServicesLandingTeam:getInsightEmployeesIDs]]`
        &tpl =`personTpl`
        &sortby=`{"AttorneyLastName":"ASC"}`
        &includeTVs=`AttorneyPhoto,AttorneyTitle,AttorneyLastName,AttorneyBusinessEmail,AttorneyBusinessPhone`
        &prepareTVs=`1`
        &tvPrefix=``
        &limit=`1000`
        &select = `{"modResource":"id,pagetitle,uri"}`
        &where=`{"template:IN":[39,16,40,49]}`
        &totalVar=`totalPeoples`
    ]]
    


    Now, the client wants to show multiple instances of this for various locations. I know that I could manually show this with multiple TVs, but this is already inside an existing template and I don't want to mess up the other instances using this template.

    So this is what I did using MIGX.
    Template Variable: RelatedTeams
    FormTabs:
    [
    {"caption":"team members", "fields": [
    {"field":"teamLocation","caption":"Location","inputTVtype":"text"},
    {"field":"teamList","caption":"List","inputTVtype":"listbox-multiple","inputOptionValues":"@SELECT `pagetitle`, `longtitle` FROM `[[+PREFIX]]site_content` WHERE `published` = 1 AND `deleted` = 0 AND (`template` = 16 OR `template` = 49) ORDER BY `pagetitle` ASC"}
    ]}]
    

    GridColumns:
    [
    {"header": "Location", "width": "200", "sortable": "true", "dataIndex": "teamLocation"},
    {"header": "List", "width": "100", "sortable": "false", "dataIndex": "teamList"}
    ]


    This gave me a nice list of all the people that I could select just like normal and add the header of the team's location to each grouping. So I added the loop using getImageList like so:
    [[!getImageList?
        &tvname=`RelatedTeams`
        &tpl=`RelatedTeamsPersonTpl`
    ]]
    


    And my template chunk like this:
    <div class="row">
        <h4 class="gridTitle">[[+teamLocation]]</h4>
        <div class="people-grid">
            
            [[pdoResources?
                &parents=`186,187,188`
                &depth=`1`
                &resources=`[[+teamList:getInsightEmployeesIDs]]`
                &sortby=`{"AttorneyLastName":"ASC"}`
                &includeTVs=`AttorneyPhoto,AttorneyTitle,AttorneyLastName,AttorneyBusinessEmail,AttorneyBusinessPhone`
                &prepareTVs=`1`
                &tvPrefix=``
                &limit=`8`
                &select = `{"modResource":"id,pagetitle,uri"}`
                &where=`{"template:IN":[39,16,40,49]}`
                &totalVar=`totalPeoples`
                &tpl =`@INLINE 
                <div class="vcard" style="display:block;">
    				<a href="[[+uri]]">
    				    <div class="col-photo" style="background-image: url('[[+AttorneyPhoto:default=`/assets/images/people/default2.jpg`]]');">
                            <img src='[[+AttorneyPhoto:default=`/assets/images/people/default2.jpg`]]' alt="[[+pagetitle]]'s Photo">
                        </div>
    				</a>
    				<div class="col-info">
    					<div class="wrap-info">
    						<div class="name"><a href="[[+uri]]">[[+pagetitle]]</a></div>
    						<div class="title">[[+AttorneyTitle]]</div>
    						[[+AttorneyServicesAndIndustries:notempty=`
    						    [[+AttorneyServicesAndIndustries:getFirstServiceId:notempty=`<div class="industry"><a href="[[#[[+AttorneyServicesAndIndustries:getFirstServiceId]].uri]]">[[#[[+AttorneyServicesAndIndustries:getFirstServiceId]].pagetitle]]</a></div>`]]
    						`]]    
    						<div class="email">
    							<a href="mailto:[[+AttorneyBusinessEmail]]">[[+AttorneyBusinessEmail]]</a>
    						</div>
    						<div class="phone">
    							<a href="tel:[[+AttorneyBusinessPhone]]">P: [[+AttorneyBusinessPhone]]</a>
    						</div>
    						<a href="[[~715]]?id=[[+id]]" class="vcard-link">vCARD</a>
    					</div>
    				</div>
    			</div>`
            ]]
    	</div>
    </div>


    This appears to be working...sort of. The "cards" are being generated and adding in the names. However, it's loading EVERYONE in the database rather than the selections I've made in the list(s). For example, in the "National" section, there should only be 2 people and in "Pennsylvania" there should only be 3 people.

    I know there's a ton of content here. So if there's anything else I can provide, please let me know.

    Thank you in advance.
      • 53460
      • 69 Posts
      Ok for some reason when I try replying here with attachments, the post gets all messed up.

      But it looks like this IS working fine. But only when selecting one person per section. The problem seems to sit with the listbox items. When using multiple people, there IS a delimiter of a comma showing up in the back end of MODX when viewing my template variables. But when I view the raw data on the actual page, it is just a string of text with no delimiter.

      How can I force that comma to show up between items?

      thanks