Reputation: 15
I need the visitor only see the reviews in current Language!
I'm new to Opencart, if a visitor chooses a language like English to navigate on the site, how to don't show up the comments in other languages as Portuguese, Spanish, Italian etc.
Why? It doens't make sense to see the comments in a language that the visitor does not understand!
I think in create a dropdown available languages in the reviews tab, and the user "Must" choose his language , and then store in database, and show up only the reviews in the selected language with a php if ... anyone could help me, how can I do it in Opencart?
Upvotes: 1
Views: 681
Reputation: 16065
You would have to follow these steps:
language_id
column into review
tablecatalog/model/catalog/review.php
model edit the addReview()
method - after date_added = NOW()
in the SQL query add this: , language_id =
and after the last "
before )
add this: . (int)$this->config->get('config_language_id')
catalog/model/catalog/review.php
now and will do the same change in both methods getReviewsByProductId
and getTotalReviewsByProductId
and to make this simple, add the new where condition directly after WHERE
in the SQL queries: r.language_id = " . (int)$this->config->get('config_language_id') . " AND
This should be it.
Upvotes: 1
Reputation: 1244
maybe this could help in quick:
http://www.gmodules.com/ig/creator?synd=open&url=http://www.google.com/ig/modules/translatemypage.xml&lang=en
otherwise modification to the opencart code are required,
1) determine the comment's language
2) session identify the user's language
3) compare if match or not
4) if match, show the comment
Upvotes: 0