Product listing: check two category fields

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 9, 2013   (RSS)

By gregThomas - July 8, 2013

Hi Jeremy,

So the item needs to be displayed if it appears in the categorie OR categorie2?

What about doing adding an or statement to your if statement to check if the item appears in category2 as well:

<?php foreach ($oeuvresRecords as $record): ?>
  <?php if ($record['categorie'] == '12' || $record['categorie2'] == '12'): ?>
    <h4><?php echo $record['titre'] ?></h4>
    <p><?php echo $record['formation'] ?></p>
    <p><a href="<?php echo $record['_link'] ?>">Détails</a></p>
  <?php endif ?>
<?php endforeach; ?>

So if the item has a category of 12 or a category2 of 12, then the item will be displayed.

Let me know if you have any questions.

Thanks

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By jjem - July 9, 2013

That's it... thanks a lot.

Jeremy