Jump to content

nvsdesign

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by nvsdesign

  1. I'm having some problems with a piece of software I use on a clients website. There is a "related items" function module available, with this module you can filter to show items from the same category OR in the same city. But now my client want's the module to show only items that are located in the same category AND the same city. My PHP knowledge is just not good enough to solve this myself, that's why I ask for advice here. I already defined the lines of code that manage the filter, but I don't know how to make this from an "OR" filter to an "AND" filter. Can someone help me with this? // Join over prop mid table if getting related by category if($search_cat) { $cats = ipropertyHTML::getAvailableCats($property->id); if($cats) { $searchwhere[] = 'pm.cat_id IN ('.implode(',', $cats).')'; } } // Filter by city. if($property->city && $search_city) $searchwhere[] = 'p.city = '.$db->Quote($property->city); if( count($searchwhere)) $query->where('('.implode(' OR ', $searchwhere).')'); I have attached the complete file in case that gives a better insight in the filter function. Best regards, Niels helper.php
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.