ajax-live-search icon indicating copy to clipboard operation
ajax-live-search copied to clipboard

Template setting

Open milivojsa opened this issue 8 years ago • 2 comments

Hi,

I cannot figure out how to do these two things:

  1. remove footer from search. I found in .js file function and tried to use it but it doesnt work. Can you provide some example how to use these functions?

  2. set output like this [ IMAGE ] [ NAME ] [ ... ]. Output is done within foreach loop if I understand correctly. I was planning to implement that with IF statement so if ($columnName === 'image') then insert <img src="databaseOutput"> inside <td>. Is this good?

Thank you for this great plugin!

Cheers! Aleksandar

milivojsa avatar Dec 23 '16 11:12 milivojsa

Hi,

second thing is done but couldnt figure out how to remove footer from search. Currently not so good solution is to limit search output to 5 items so footer cannot show.

Thanks again for this great plugin!

Cheers! Aleksandar

milivojsa avatar Feb 19 '17 12:02 milivojsa

Hi its kinda easy, the only file you nede to edit is default.php

*/ if (!empty($rows)) {

foreach ($rows as $row) { 
	
    $html .= '<tr>';
    foreach ($row as $columnName => $column) {
		
		 if($columnName == 'id') {
			 $columnId= $column;
		}
					
		 if($columnName == 'name') {
			 $columnProductname= $column;
		}
		
		if($columnName == 'productimage') {
			 $columnProductimage= $column;
		} 
		 if($columnName == 'producturl') {
			  $columnProducturl= $column;
			 

		 $html .= "<td><img src='https://pathtoimage.com/$columnProductimage' class='imagevsearchi' style='width: 50px;height: auto;margin-right: 10px;'><a href='../produkt/{$columnProducturl}&id={$columnId}'>{$columnProductname}</a></td>";
	}
		 
		
    }
    $html .= '</tr>';
}

} else { // No result

// To prevent XSS prevention convert user input to HTML entities
$query = htmlentities($query, ENT_NOQUOTES, 'UTF-8');

// there is no result - return an appropriate message.
$html .= "<tr><td>Nenašli jsme žádné výsledky</td></tr>";

}

return $html;

NeXxik91 avatar Jul 01 '20 13:07 NeXxik91