You will need to hire someone to custom code that for you. Even though it's not a lot of work at all....there is no extension for that. The code is already there for you on certain parts of the website you just need to translate it to the reviews form, add the appropriate field(s) to the review table, and adjust the INSERT query to insert the value.
Hi There,
I am also looking for a way doing that. I have a good understanding in PHP and familiar with OpenCart framework.
Any kind of help will be appreciated.
Thanks,
I am also looking for a way doing that. I have a good understanding in PHP and familiar with OpenCart framework.
Any kind of help will be appreciated.
Thanks,
Gal Opatovsky - Web Designer
http://www.vibesdesign.com.au
http://www.themineralmiracle.com.au
Open: /catalog/view/theme/your_theme/template/product/product.tpl and find this line:
Directly below that add this:
And now find this:
Replace it with this:
Now open catalog/model/catalog/reveiw.php and find this code:
Replace that with this:
Now open: catalog/controller/product/product.php and find this line:
Directly below that add this:
BACK UP YOUR DATABASE. Open up your database in phpmyadmin and click on the SQL tab. Paste this code and run the command by pressing GO.
So there you have it. You now need to take the country codes from that field and run the function that will display the country name as a part of the reviews in the admin. You will set it up like I did here: with the control, model, and view.
Code: Select all
<input type="text" name="name" value="" />
Code: Select all
<br />
<br />
<b>Country:</b> <br /><select name="country_id">
<option value="">Select</option>
<?php foreach ($countries as $country) { ?>
<option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
<?php } ?>
</select>
Code: Select all
data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
Code: Select all
data: 'country_id=' + encodeURIComponent($('select[name=\'country_id\']').val()) + '&name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
Now open catalog/model/catalog/reveiw.php and find this code:
Code: Select all
$this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int)$this->customer->getId() . "', product_id = '" . (int)$product_id . "', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int)$data['rating'] . "', date_added = NOW()");
Code: Select all
$this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int)$this->customer->getId() . "', product_id = '" . (int)$product_id . "', text = '" . $this->db->escape($data['text']) . "', country_id = '" . (int)$data['country_id'] . "', rating = '" . (int)$data['rating'] . "', date_added = NOW()");
Code: Select all
public function index() {
Code: Select all
$this->load->model('localisation/country');
$this->data['countries'] = $this->model_localisation_country->getCountries();
Code: Select all
ALTER TABLE `review` ADD `country_id` INT( 8 ) NOT NULL
Thanks avvici,
This is great, I am sure other users will also use that as a guide for adding different fields to the standard review form.
This is great, I am sure other users will also use that as a guide for adding different fields to the standard review form.
Gal Opatovsky - Web Designer
http://www.vibesdesign.com.au
http://www.themineralmiracle.com.au
Yes, the one in 'image\flags\'.avvici wrote:You mean the icon for the store country?
Can not find the way to make it. It would be great appreciated if you can help. Thanks!
I know nothing about PHP and SQL, but I still try my best to understand it.
avvici wrote:Uh, there are many flags. Do you want your home country flag in place of the text "Country: ?"
No, the country flag for customer.
Your code can show the country name in text, but if you can change it to country flag instead of country text would be great. Hope you can understand it.
I know nothing about PHP and SQL, but I still try my best to understand it.
Right.allenshea wrote:avvici wrote:Uh, there are many flags. Do you want your home country flag in place of the text "Country: ?"
No, the country flag for customer.
Your code can show the country name in text, but if you can change it to country flag instead of country text would be great. Hope you can understand it.
Who is online
Users browsing this forum: No registered users and 40 guests