Page 1 of 1

filter ads by area

Posted: Thu Mar 07, 2013 9:50 am
by nickD
Hi,

It would be perfect for my scenario to filter the ads by area before I show them in the MarketPlace.
What i have done until now is to create a custom field (enumerated) called area for the ads and trying to take it into consideration when i get the ads from the mod_cyclosad module ..
I noticed that there is an element called adFields which is fieldValue type ..
trying the following did not give me the result i wanted to..

what i am doing wrong here ?

thanks
Nick

Code: Select all

...
//fullads
$myParams - > pageSize = empty($_REQUEST['page_size']) ? $params - > get('pageSize') : trim($_REQUEST['page_size']);
$myParams - > tradeType = empty($_REQUEST['trade_type']) ? $params - > get('tradeType') : trim($_REQUEST['trade_type']);
$myParams - > currentPage = empty($_REQUEST['curp']) ? 0 : (int) trim($_REQUEST['curp']);;
$myParams - > categoryId = $_REQUEST['caid'];
$myParams - > keywords = $_REQUEST['keywords'];

//this is what i added
if (!empty($_REQUEST['area'])) {
    $params - > adFields = array();
    for ($i = 0; $i < 1; $i++) {
        $field_value = new stdclass();
        $field_value - > internalName = "area";
        $field_value - > value = $_REQUEST['area'];
        $params - > adFields[$i] = $field_value;
    }
    //$myParams - > showAdFields = true;
}

...