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
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.
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?
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...
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.
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.
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...
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.
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])."' ";
?>
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.
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
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.
Hold on, do i have to modify the merchants.php also ?
renaming "merchant" to "shop" ?
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.
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
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.
Hi David,
I followed the above steps and received "no results found" message.
Thanks,
Syed
Hi Syed,
If you could email me your modified search.php and merchants.php i'll check them out for you...
Cheers,
David.
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
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.
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
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.
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!