Welcome, Guest ( Customer Panel | Login )

 All Forums
 VPCart Forum
 Search returns nothing for the second language
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

4 Posts

Posted - April 01 2009 :  05:49:58  Show Profile  Reply with Quote
Hi All,

Wish I can find a solution to the following problem.
I run a bilingual website using VPASP v 6.5. Products are in English with French translation.

the problem is that the search result only gives results when the English term is searched for and for French it returns nothing and no error but returns nothing, while the products are display in French in the French interface.

Please note that in the French interface, in the advanced search the categories dropdownlist is always populated in English the original language not in French

Please also note that
"xselectproductsbylanguage"="Yes" "xsearchdisplaycategories"="Yes"

Can anyone please help.

VP-CART New User

121 Posts

Posted - November 05 2012 :  10:19:53  Show Profile  Visit manilow's Homepage  Reply with Quote
Hi nesrine1972 (and maybe many others),

To make the search module second (or more) language compatible, I added the following lines in the SearchGenerateSQLv2 routine in shopproductcreatesql.asp (vpasp v7.0) :

After the existing lines at the start of the routine :
'sql = " where cc.intCatalogId=p.CatalogId and cc.intcategoryid=c.categoryid AND sc.intCatalogId=p.CatalogId"
sql = " where cc.intCatalogId=p.CatalogId and cc.intcategoryid=c.categoryid "


'Search according to selected language
if lcase(getSess("language")) <> lcase(getconfig("xlanguage")) then
tmpstr = tmpstr & ", translateproducts t"
sql = sql & " and t.lang='" & getSess("language") & "' and cc.intCatalogId=t.CatalogId "
end if

Then, at the end of the subroutine :

sql = tmpStr & sql

'Replace searchfields by translated fields
if lcase(getSess("language")) <> lcase(getconfig("xlanguage")) then
SQL = replace(SQL,lcase("p.cname"),"t.cname")
SQL = replace(SQL,lcase("p.cdescription"),"t.cdescription")
SQL = replace(SQL,lcase("p.productmetakeyword"),"t.productmetakeyword")
end if

SetSess "SQL", SQL

(in green existing lines, in red new lines)

Kind regards,

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)