Post
by smarg » Wed Apr 13, 2016 2:36 pm
Hello to all,
I use version 1.5.6.4,with a theme installed and this code works for me. Also, after fixing the search problem, I had a problem with the product count and shown at the end of the page: "Showing 0 to 0 of 0 (0 Pages)". If anyone else have the same problem, I show you what I did to fix it.
First I show you what I changed to fix the product search:
The only I did was to add % in the line 345: "AND pd.name LIKE '%" and in line 349 " AND p.model LIKE '%". All the code in lines 344-350 is:
if (!empty($data['filter_name'])) {
$sql .= " AND pd.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
}
if (!empty($data['filter_model'])) {
$sql .= " AND p.model LIKE '%" . $this->db->escape($data['filter_model']) . "%'";
}
Second, I show you what I did to fix the procuct count at the end of admin page:
I changed the code in function:"public function getProfiles($product_id)" in the lines 600 to 607. Add % in line 602(" AND pd.name LIKE '%") and in line 606(" AND p.model LIKE '%"). The hole code is:
public function getProfiles($product_id) {
return $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_profile` WHERE product_id = " . (int)$product_id)->rows;
}
public function getTotalProducts($data = array()) {
$sql = "SELECT COUNT(DISTINCT p.product_id) AS total FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)";
if (!empty($data['filter_category_id'])) {
$sql .= " LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id)";
}
$sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
if (!empty($data['filter_name'])) {
$sql .= " AND pd.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
}
if (!empty($data['filter_model'])) {
$sql .= " AND p.model LIKE '%" . $this->db->escape($data['filter_model']) . "%'";
}
I hope to help anyone has the same problem.