Hello David,
How can i removed the title in search results for example brand:abc: to abc, merchant:xyz: to xyz and category:123: to 123 instead.
I try to read on node 291 but couldn't understand it.
thanks
jack
Hello David,
I have made the changes as above but it still the same.
The below script is from the searchform.php.
<input type='text' name='q' size='80' value='<?php print (isset($q)?$q:""); ?>' />
Do i need to mod the above.
thanks
jack
Hello Jack,
My apologies - the code above is only regarding the page title, it does not affect the query as displayed in the search box. Now, you can change this also, but remember that the code in the search box will no longer reflect the actual search. Let me know if you want to do this still..
Cheers,
David.
Hello David,
You mentioned that it will not reflect the actual search. Can you pls explain further. By doing this, will it affect the seo or anything else etc..
Otherwise would it be possible to hide the brand: category: merchant: when do query.
Also this thing appeared on the latest searches mod i made for example it captured brand:xyz
thanks
jack
Hello Jack,
The situation is that brand: merchant: etc. are an important part of the query - they determine what SQL search.php uses to generate the search results. So, if you change the value of the text displayed in the search box, and the user then clicks "Search" again, the results would be completely different - which is why I don't recommend changing the value displayed there as it could confuse your users.
It should be easy to prevent these queries being logged in the querylog (this indicates that someone did click Search with brand:xyz in the search box!). In that modification, you will have added this code to search.php:
if ($_GET["log"])
{
...to limit these queries being logged simply add the following code on the next line (inside the IF structure):
if (strpos($q,":")) continue;
Cheers,
David.
Hello David,
thank you. I got it.
Btw, regarding the above topic, I was trying to change to other language. The problem is with the search results appearing brand:abc merchant:xyz category:123. How can i change the word brand merchant and category to other language. I did changes on the script which has print translate function but for this one couldn't figure out how to change it. Wonder if it can be mod.
thanks
jack
Hello Jack,
This is a bit more complicated because the words merchant, category and brand exactly match the database field names and are used to construct the SQL. If you do change them, where the links are generated in merchants.php, categories.php and brands.php, then you would also need to make changes in search.php where you will find this code beginning at line 36:
<?php
case "merchant":
// pass through to category
case "category":
// pass through to brand
case "brand":
?>
What this does is looks for the merchant:, category: or brand: part of the query, so these need to be changed to your new words, and then renamed afterwards, like this:
<?php
case "newmerchant":
// pass through to category
case "newcategory":
// pass through to brand
case "newbrand":
if ($parts[0] == "newmerchant") $parts[0] = "merchant";
if ($parts[0] == "newcategory") $parts[0] = "category";
if ($parts[0] == "newbrand") $parts[0] = "brand";
?>
That should do the trick...
Cheers,
David.
Hello David,
Are you saying that i change the newmerchant newcategory and newbrand into my own language in search.php? Also u mentioned about merchants.php, categories.php and brands.php. Do i need to do any changes inside these 3 files.
thanks
jack
Hello Jack,
Yes - to do this, you need to make changes in merchants.php, categories.php and brands.php and then make corresponding changes in search.php as described above.
Taking merchants.php as an example, you will see where the word "merchant" is used on line 22:
$item["href"] = "search.php?q=merchant:".urlencode($feed["merchant"]).":";
Now, let's say you wanted to use the word "shop" instead of "merchant", you would change this to:
$item["href"] = "search.php?q=shop:".urlencode($feed["merchant"]).":";
For the equivalent change in search.php based on the code above where I have used "newmerchant" you would use "shop" - which is then translated back to "merchant" for use in the database code.
Cheers,
David.
Hello David,
I have changed as per the above but still the same. Couldn't get it work. i noticed that the banner output 'produce search results for brand:abc (showing 1 to 10 of 299 products) also required changes.
Else can we just empty the search box however the url remain in full.
thanks
jack
Hello Jack,
As a single modification, look for this code on line 13 of html/header.php:
<title><?php print (isset($header["title"])?$header["title"]:$config_title); ?></title>
...and REPLACE this with:
<?php
$header["title"] = str_replace("merchant:","",$header["title"]);
$header["title"] = str_replace("category:","",$header["title"]);
$header["title"] = str_replace("brand:","",$header["title"]);
$header["title"] = str_replace(":"," ",$header["title"]);
?>
<title><?php print (isset($header["title"])?$header["title"]:$config_title); ?></title>
That should do the trick!
Cheers,
David.