You are here:  » Replace "merchant": in search function field with another word

Support Forum



Replace "merchant": in search function field with another word

Submitted by IG on Tue, 2006-02-07 18:49 in

Hi David

When I search the products of a specific merchant, it shows "merchant:merchantname:productxyz" in the search function field. As merchant is not really a common word in my country I would like to replace "merchant:" with something more understandable like "shop:". Is this possible without changing all the code? It would be great to change the word just before it is shown in the search function, but I have no clue if this is possible.

Cheers,
IG

Submitted by support on Tue, 2006-02-07 18:55

Hi Ivo,

Sure it is possible to do this. You will need to make changes to 3 files:

merchants.php and product.php:

Search and replace "merchant:" with "shop:"

search.php:

Change the line that says:
case "merchant":
To:
case "shop":

...that should do the trick!

Submitted by IG on Tue, 2006-02-07 19:45

It did the trick....almost.

I also had to change "merchant" to "shop" in .htaccess as I am using mod_rewrite and in index.php I had to change $merchant_href from "merchant" to "shop".

Now everything seems to work smoothly. (Please shout if I did something!)

Thanks for your outstanding support, David.

Submitted by IG on Tue, 2006-02-28 06:38

Yesterday, I downloaded the latest version of Price Tapestry. I tried to replace "merchant:" in the search function field with a more meaningful word in my language.

I did the same changes as when I installed Price Tapestry for the first time:
- replaced case "merchant": with case "shop": in search.php
- replaced "merchant" with "shop" in .htaccess
- replaced "merchant" with "shop" in products.php and merchants.php

Having done these changes, when I click on a registered merchant, I get the following error message:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/produktsuchmaschine.ch/httpdocs/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/produktsuchmaschine.ch/httpdocs/includes/database.php on line 26

Can anybody let me know what this error message means and how I can make it work?

Submitted by support on Tue, 2006-02-28 07:55

Hello Ivo,

It would help to see the SQL that is being generated to tell what is wrong. The best way to do this is to add a print statement inside the query function in includes/database.php:

<?php
  
function database_querySelect($sql,&$rows)
  {
    print 
"[".$sql."]";
    
// ... rest of function ...//
?>

If you post the SQL, we should be able to see what is wrong...

Submitted by IG on Tue, 2006-02-28 08:35

Hi David

The SQL is as following

[SELECT COUNT(*) as resultcount FROM `products` WHERE shop='MyToys' ]

I believe that I have to replace "merchant" with "shop" in the products table of the database, but I am afraid that this would have also other consequences...

As always, your advise is highly appreciated.

Submitted by support on Tue, 2006-02-28 08:43

I would simply leave it as "merchant" within the SQL, there's no problem with it appearing as "shop" on the website; just change shop back to merchant within the SQL in search.php.

That should get you back in business.

Cheers,
David.

Submitted by IG on Tue, 2006-02-28 09:00

I changed case "shop": back to case "merchant": as this is the only place where "merchant" appears in search.php.

Now, when I click on any registered merchant, I get the following SQL:
[SELECT COUNT(*) as resultcount FROM `products` WHERE MATCH name AGAINST ('shop')]

Strange...

Submitted by support on Tue, 2006-02-28 09:05

Ah - I know what's happened, Ivo.

In the latest distribution; I made a change that saves on the repeated code and uses the value from the query as the field name used in the SQL. Here's what you need to do (see the "add the following line" comment)...

<?php
    
switch($parts[0])
    {
      case 
"shop":
        
// pass through to category
      
case "category":
        
// pass through to brand
      
case "brand":
        
// add the following line:
        
if ($parts[0] == "shop"$parts[0] = "merchant";
?>

Basically; you've got to change "shop" back to "merchant" so that the correct field is used when constructing the SQL on the next few lines.

Submitted by IG on Tue, 2006-02-28 09:28

Bingo! Thanks a lot, David.

Submitted by MikeyC on Sun, 2009-01-04 11:05

Hi David,

Tried the mods in this thread, but it don't seem to work for me.
Do have have to blank out the part:

<?php
 $where 
" ".$parts[0]."='".database_safe($parts[1])."' ";
?>

in

<?php
      
case "merchant":
        
// pass through to category
      
case "category":
        
// pass through to brand
      
case "brand":
        if (
$parts[0] == "shop"$parts[0] = "merchant";
        
$where " ".$parts[0]."='".database_safe($parts[1])."' ";
?>

Submitted by support on Mon, 2009-01-05 09:27

Hi Mikey,

That line is still needed. At what stage does it not work - do you just get "No results" for a merchant search?

Cheers,
David.

Submitted by MikeyC on Mon, 2009-01-05 11:39

No, it just doesn't do anything.
When i change the words, then i get "No results".

I take it i don't have to change the merchants.php and the product.php ?? (as this was old code)

Mike

Submitted by support on Mon, 2009-01-05 11:43

Hi Mike,

Could you email me a link to the installation; along with your modified search.php and merchants.php and i'll take a look for you...

Cheers,
David.

Submitted by MikeyC on Mon, 2009-01-05 11:45

Hold on, do i have to modify the merchants.php also ?
renaming "merchant" to "shop" ?

Submitted by support on Mon, 2009-01-05 11:49

Hi Mike,

That's correct - the modification in search.php only applies when the incoming search string is different - so merchants.php must have the corresponding change made...

Cheers,
David.

Submitted by MikeyC on Mon, 2009-01-05 11:54

and in products.php i need to change this also ? (thought it was html/product.php)
I'll try it later on and i'll let you know tonight if i got it fixed for my site.

Thanks David,

Mikey

Submitted by support on Mon, 2009-01-05 11:59

Hi Mikey,

The only merchant links on the product page are in the prices table, so in html/prices.php you would need to replace merchant: with shop: also...

Cheers,
David.

Submitted by Syed on Sat, 2010-02-27 05:31

Hi David,

I followed the above steps and received "no results found" message.

Thanks,
Syed

Submitted by support on Sat, 2010-02-27 08:37

Hi Syed,

If you could email me your modified search.php and merchants.php i'll check them out for you...

Cheers,
David.

Submitted by Syed on Sun, 2010-02-28 12:42

Hi David,

Its working now...Is it possible to replace the word "Product" as well from the URL and menu crumb?

Also i want to remove the review feature from all pages. Please tell me how to do this?

Cheers,
Syed

Submitted by support on Sun, 2010-02-28 20:11

Hi Syed,

To disable the reviews feature, edit your config.php and change line 16 as follows:

  $config_useInteraction = FALSE;

To remove /product/ that can be done - could you email me a link to a page on your site showing the breadcrumb, together with the following files:

.htaccess
search.php
sitemap.php
html/menu.php

...and I'll work out the changes for you...

Cheers,
David.

Submitted by Syed on Mon, 2010-03-01 13:38

Hi David,

1. To diable the review - I set the useinteraction to False in config.php but still not working.

2. I do not need to remove but need to rename "product" to "produk" for all the product pages.

Please tell me how to fix this?

Thanks,
Syed

Submitted by support on Mon, 2010-03-01 13:48

Hello Syed,

Could you send me an email with;

1) An example URL where there is still a "Review" link showing

2) These files so I can change product/ to produk/ for you...

.htaccess
sitemap.php
search.php
products.php

Cheers,
David.