I need a snippet where the TVs ’Longitude’ AND ’Latitude’ are empty in the Database.
Therefore i wrote the following snippet:
$c = $modx->newQuery('modResource');
$c->innerJoin('modTemplateVarResource','TemplateVarResources');
$c->innerJoin('modTemplateVar','TemplateVar','TemplateVarResources.tmplvarid = TemplateVar.id');
$c->where(array(
'TemplateVar.name' => 'Longitude',
'TemplateVarResources.value' => '0',
//array(
// 'OR:TemplateVar.name:=' => 'Latitude',
// 'AND:TemplateVarResources.value:=' => '0',
// ),
));
$ress = $modx->getCollection('modResource',$c);
//$c->prepare();
//$modx->log(xPDO::LOG_LEVEL_ERROR, $c->toSql());
foreach($ress as $result){
echo $result->get('id').'<br />';
echo $result->get('pagetitle').'<br />';
echo 'Longitude: '.$result->getTVValue('Longitude').'<br />';
echo 'Latitude: '.$result->getTVValue('Latitude').'<br />';
}
How do I write the correct AND condition so that ’Longitude’ AND ’Latitude’ are empty (not zero)?
The above query works if i have a value for example of 1 and change the line
'TemplateVarResources.value' => '0',
to
'TemplateVarResources.value' => '1',
I hope somebody can help