Author Topic: Searching in multiple languages  (Read 67944 times)

alephlin

  • Beginner
  • *
  • Posts: 2
Re: Searching in multiple languages
« Reply #60 on: January 15, 2010, 18:49:59 pm »
Hello everyone,

I have implemented this piece of code, as you were so kind to provide, into shop_browse_queries.php

Quote
    // hack joomfish
      $jf .= "LEFT JOIN ( SELECT `reference_field` , `reference_id` , `value` FROM `#__jf_content`";
      $jf .= " WHERE `reference_table` = 'vm_product' AND `published` = 1 " ;
      $t = array();
      if (!empty($keyword))  $t[] = " `value` LIKE '%$keyword%'";
      if (!empty($keyword1)) $t[] = " `value` LIKE '%$keyword1%'";
      if (!empty($keyword2)) $t[] = " `value` LIKE '%$keyword2%'";
      if (count($t)) $jf .= " AND ( " . implode(" OR ", $t) . " ) ";
      $jf .= ") AS trad ON `#__{vm}_product`.`product_id` = `trad`.`reference_id`";
      $join_array[] = $jf;
    // end hack

and the virtuemart search is much faster now. I have two languages on my site and can search in both of them. (I cannot switch between languages within the search however. When I try that, the search results are gone and it takes a long time to come up with all of the products: about 14.000. But then, who would want to switch languages once shopping?)

What I would really like, up to the point of really need, is the search for product_type_values to be multilinguistic (or is it multilingual?) Anyway, that one can filter product_type_values in several languages. E.g. product_type 'Television'; values: EN: 'New','Secondhand', NL: 'Nieuw', 'Tweedehands'. I have succeeded using Joomfish to translate the search values already, but the search is restricted to vm_product_type_# (I guess from looking at shop_browse_queries) and in that table are no translations.

Does anyone know a solution or has experience with this? Any help would be greatly appreciated.

Thanks very much and greetings from the Netherlands.

tsili

  • Beginner
  • *
  • Posts: 28
Re: Searching in multiple languages
« Reply #61 on: August 31, 2010, 16:10:14 pm »
Hi all,

this can't be faster since you will also need the reference id in the MySQL WHERE clause as it is part of the jos_jf_content table's combo index (I am talking about this line: $jf .= " WHERE `reference_table` = 'vm_product' AND `published` = 1 AND `reference_field` = 'product_name'" ;).
To make your search faster and also be able to search in joomfish translated products you can replace the above part:
    // hack joomfish
      $jf .= "LEFT JOIN ( SELECT `reference_field` , `reference_id` , `value` FROM `#__jf_content`";
      $jf .= " WHERE `reference_table` = 'vm_product' AND `published` = 1 AND `reference_field` = 'product_name'" ;
      $t = array();
      if (!empty($keyword))  $t[] = " `value` LIKE '%$keyword%'";
      if (!empty($keyword1)) $t[] = " `value` LIKE '%$keyword1%'";
      if (!empty($keyword2)) $t[] = " `value` LIKE '%$keyword2%'";
      if (count($t)) $jf .= " AND ( " . implode(" OR ", $t) . " ) ";
      $jf .= ") AS trad ON `#__{vm}_product`.`product_id` = `trad`.`reference_id`";
      $join_array[] = $jf;
    // end hack

with this one:

// hack joomfish
  $jf .= "LEFT JOIN `#__jf_content` AS trad ON `#__{vm}_product`.`product_id` = `trad`.`reference_id`";
  $join_array[] = $jf;
// end hack

Don't forget that there are some other places as well in shop_browse_queries.php where you will have to make some additions/modifications.
For those interested I am attaching my version of shop_browse_queries.php.

Hope this helps!

Take care,
Yiannis

[attachment cleanup by admin]

dianbg

  • Beginner
  • *
  • Posts: 1
Re: Searching in multiple languages
« Reply #62 on: November 30, 2010, 20:08:54 pm »
I am using Joomla 1.5.15, Joom!Fish Version V2.1.5 and VirtueMart 1.1.6 .

The hack
// hack joomfish
  $jf .= "LEFT JOIN `#__jf_content` AS trad ON `#__{vm}_product`.`product_id` = `trad`.`reference_id`";
  $join_array[] = $jf;
// end hack

is not working for me.

I made the my file according tsili's file.

tsili

  • Beginner
  • *
  • Posts: 28
Re: Searching in multiple languages
« Reply #63 on: December 01, 2010, 11:12:43 am »
Hi dianbg,

Did you apply all the changes marked with 'hack' in shop_browse_queries.php?
Apart from the code you are attaching you will have to modify other lines as well. Please search the file I am attaching for the word 'hack' and apply accordingly.

Thanx!

8tarkhan

  • Beginner
  • *
  • Posts: 5
Re: Searching in multiple languages
« Reply #64 on: February 12, 2011, 19:56:18 pm »
Hi all,

I really confused what I have to do could you please tell me what I have to do now and where should I start?

my Joomla is 1.5.22
my Joomfish is 2.1.5
and also my vM is 1.1.7

Pleasssssss help me !!:D
Regards,

tsili

  • Beginner
  • *
  • Posts: 28
Re: Searching in multiple languages
« Reply #65 on: February 13, 2011, 08:11:34 am »
Hi 8tarkhan,

Just follow my post above (the one I am attaching the file). If you have problems let me know.

Cheers!

8tarkhan

  • Beginner
  • *
  • Posts: 5
Re: Searching in multiple languages
« Reply #66 on: February 14, 2011, 02:09:16 am »
Hi,

First of all thank you for your fast replay, secondly could you please tell me to which folder should I upload this file?

Thank you again,

tsili

  • Beginner
  • *
  • Posts: 28
Re: Searching in multiple languages
« Reply #67 on: February 14, 2011, 08:48:45 am »
Hi 8tarkhan,

You will find the file in: administrator\components\com_virtuemart\html

Cheers

8tarkhan

  • Beginner
  • *
  • Posts: 5
Re: Searching in multiple languages
« Reply #68 on: February 14, 2011, 21:21:38 pm »
Hi I get "error 500" could you please tell me what i have to do?
I have done whatever you said and I think I did correctly but still I can not fix this problem.

Jordi

  • Beginner
  • *
  • Posts: 13
Re: Searching in multiple languages
« Reply #69 on: February 22, 2011, 11:26:42 am »
No search in second language in VM 1.1.7   ::)

Thanks

dagmarpvie

  • Beginner
  • *
  • Posts: 1
Re: Searching in multiple languages
« Reply #70 on: February 22, 2011, 18:54:33 pm »
Sorry I'm a newbie - which languages pack I can use for 1.1.7. to change from english to german? or do I have to install an other version first and then make an update?

bruha

  • Beginner
  • *
  • Posts: 1
Re: Searching in multiple languages
« Reply #71 on: July 18, 2011, 18:27:21 pm »
doesn't work not 1st, not 2nd hack  :-\
joomla 1.5.23
vm 1.1.9
jf 2.0.4

calluska

  • Beginner
  • *
  • Posts: 1
Re: Searching in multiple languages
« Reply #72 on: July 14, 2012, 16:03:26 pm »
Great hack! Works wonders! Should be as standard..

Joomla 1.5.26
Virtuemart 1.1.8
Joom!Fish Version V2.2.3

Hi all,

this can't be faster since you will also need the reference id in the MySQL WHERE clause as it is part of the jos_jf_content table's combo index (I am talking about this line: $jf .= " WHERE `reference_table` = 'vm_product' AND `published` = 1 AND `reference_field` = 'product_name'" ;).
To make your search faster and also be able to search in joomfish translated products you can replace the above part:
    // hack joomfish
      $jf .= "LEFT JOIN ( SELECT `reference_field` , `reference_id` , `value` FROM `#__jf_content`";
      $jf .= " WHERE `reference_table` = 'vm_product' AND `published` = 1 AND `reference_field` = 'product_name'" ;
      $t = array();
      if (!empty($keyword))  $t[] = " `value` LIKE '%$keyword%'";
      if (!empty($keyword1)) $t[] = " `value` LIKE '%$keyword1%'";
      if (!empty($keyword2)) $t[] = " `value` LIKE '%$keyword2%'";
      if (count($t)) $jf .= " AND ( " . implode(" OR ", $t) . " ) ";
      $jf .= ") AS trad ON `#__{vm}_product`.`product_id` = `trad`.`reference_id`";
      $join_array[] = $jf;
    // end hack

with this one:

// hack joomfish
  $jf .= "LEFT JOIN `#__jf_content` AS trad ON `#__{vm}_product`.`product_id` = `trad`.`reference_id`";
  $join_array[] = $jf;
// end hack

Don't forget that there are some other places as well in shop_browse_queries.php where you will have to make some additions/modifications.
For those interested I am attaching my version of shop_browse_queries.php.

Hope this helps!

Take care,
Yiannis

triphp

  • Beginner
  • *
  • Posts: 3
Re: Searching in multiple languages
« Reply #73 on: December 25, 2012, 05:24:06 am »
 ;)