We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12678
    • 2 Posts
    I need all resources where TV access_front (type checkbox) is checked.

    $c = $modx->newQuery('modResource');
    $c->innerJoin('modTemplateVarResource','TemplateVarResources');
    $c->where(array(
    	'access_front' => true,
    ));
    $ress = $modx->getCollection('modResource',$c);


    I tried modTemplateVarResource.access_front, TemplateVarResources.access_front, modResource.access_front...

    Empty result.

    What am I missing?
    Thanks
      • 28215
      • 4,149 Posts
      $c = $modx->newQuery('modResource');
      $c->innerJoin('modTemplateVarResource','TemplateVarResources');
      $c->innerJoin('modTemplateVar','TemplateVar','TemplateVarResources.tmplvarid = TemplateVar.id');
      $c->where(array(
      	'TemplateVar.name' => 'access_front',
      	'TemplateVarResources.value' => true,
      ));
      $ress = $modx->getCollection('modResource',$c);
      
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 12678
        • 2 Posts
        That’s it, thank you
          • 37670
          • 2 Posts
          hi,
          cool solution!
          couldn´t find an Evolution equivalent, though... since newQuery is only for Revolution.
          really appreciate your help.
            • 37670
            • 2 Posts
            btw, i only need the IDs of the resources where the TV 'slider_toggle' is set to 'Yes'.

            so, i tried the following instead, but for some reason, nothing is returned:

            @SELECT page.id FROM modx_site_content as page JOIN modx_site_tmplvar_contentvalues as tv_val JOIN modx_site_tmplvars as tv_name ON page.id=tv_val.id WHERE tv_val.value='No' AND tv_name.name='slider_toggle'

            where would you think i goofed up?

            thanks!