예제 #1
0
파일: list.php 프로젝트: ewbcanada/ftfinder
            $msg = "location search. Geocode: " . $locGCode;
        } else {
            $pointsQuery = "SELECT * FROM locations WHERE MATCH (name) AGAINST ('" . $locSearch . "')";
            if ($prodCatId) {
                $pointsQuery .= "AND product_id=" . $prodCatId;
            }
            $points = mysqlResultAsArray($pointsQuery);
        }
        //temporary
        $_SESSION['msg'] = $msg;
    }
    $smarty->assign('points', $points);
    $mun = mysqlResultAsArray("SELECT * FROM municipalities");
    $smarty->assign('mun', $mun);
    $categories = mysqlResultAsArray("SELECT * FROM categories");
    $products[] = "All";
    foreach ($categories as $key => $headings) {
        $prodQuery = "SELECT name, id FROM products WHERE category_id='" . $headings['id'] . "' ORDER BY name";
        //var_dump($prodQuery);
        $prodCat = mysqlResultAsArray($prodQuery);
        //var_dump($prodCat);
        foreach ($prodCat as $subheadings) {
            $tempArray[$subheadings['id']] = $subheadings['name'];
        }
        $products[$headings['name']] = $tempArray;
        unset($tempArray);
    }
    $smarty->assign('prodCat', $products);
} else {
    echo '$filter failed validate.';
}
예제 #2
0
// Add pagination information (ie, if more results were available but the
// SQL LIMIT statement kicked in...)
if ($rnum[0]) {
    $node = $doc->createElement("results");
    $newnode = $parnode->appendChild($node);
    if ($limit < count($gArray)) {
        $newnode->setAttribute("displayed", $limit);
    } else {
        $newnode->setAttribute("displayed", count($gArray));
    }
    $newnode->setAttribute("available", "" . $rnum[0]);
}
// Take results and add into XML doc
foreach ($gArray as $row) {
    $query = "SELECT products.name FROM products, locprods \n\t\t\t\t\tWHERE locprods.location_id='" . $row['id'] . "' \n\t\t\t\t\tAND locprods.product_id=products.id ORDER BY products.name";
    $products = mysqlResultAsArray($query);
    // ADD TO XML DOCUMENT NODE
    $node = $doc->createElement("marker");
    $newnode = $parnode->appendChild($node);
    $newnode->setAttribute("name", htmlentities($row['name']));
    $newnode->setAttribute("address", htmlentities($row['address']));
    $newnode->setAttribute("lat", $row['latitude']);
    $newnode->setAttribute("lng", $row['longitude']);
    $newnode->setAttribute("id", $row['id']);
    $newnode->setAttribute("type", $row['locationType_id']);
    $newnode->setAttribute("distance", $row['distance']);
    $newnode->setAttribute("phone", $row['phone']);
    $newnode->setAttribute("website", $row['website']);
    $newnode->setAttribute("description", $row['description']);
    $newnode->setAttribute("productDescription", $row['productDescription']);
    foreach ($products as $product) {