нужно что бы товары у которых стоит определенный stock_status_id не отображались на сайте.
Думал сделать просто: в файле catalog/model/catalog/product.php в public function getProductsByCategoryId в запрос добавить условие типа WHERE p.stock_status_id !=11
Когда запрос выполняю в phpmyadmin работает, но на сайте нет изминений. Может кто делал подобное или может посоветовать...
osStore 0.1.6, есть модуль фильтров.
Код public function getProductsByCategoryId
public function getProductsByCategoryId($category_id, $values, $sort = 'p.sort_order', $order = 'ASC', $start = 0, $limit = 20) {
$sql = "SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id)";
if($category_id != 0) {
$sql .= "LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id)";
}
$sql .= " WHERE p.stock_status_id !=11 AND p.stock_status_id !=9 AND p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "'";
if($category_id != 0) {
$sql .= " AND p2c.category_id = '" . (int)$category_id . "'";
}
if (isset($values) && $values != '') {
$values_without_underline = "";
$values_for_IN = "";
$values_arr = explode('_', $values);
asort($values_arr);
reset($values_arr);
foreach ($values_arr as $value_id) {
if (empty($values_for_IN)) {
$values_for_IN = "'" . $value_id . "'";
} else {
$values_for_IN .= ", '" . $value_id . "'";
}
$values_without_underline .= $value_id;
}
$sql .= " AND (SELECT GROUP_CONCAT(DISTINCT value_id ORDER BY value_id ASC SEPARATOR '') FROM " . DB_PREFIX . "product_to_value WHERE product_id = p.product_id AND
p.stock_status_id !=11 AND p.stock_status_id !=9 AND value_id IN (" . $values_for_IN . ")) = '" . $values_without_underline . "'";
}
$sort_data = array(
'pd.name',
'p.sort_order',
'special',
'rating',
'p.price',
'p.model'
);
if (in_array($sort, $sort_data)) {
if ($sort == 'pd.name' || $sort == 'p.model') {
$sql .= " ORDER BY LCASE(" . $sort . ")";
} else {
$sql .= " ORDER BY " . $sort;
}
} else {
$sql .= " ORDER BY p.sort_order";
}
if ($order == 'DESC') {
$sql .= " DESC";
} else {
$sql .= " ASC";
}
if ($start < 0) {
$start = 0;
}
$sql .= " LIMIT " . (int)$start . "," . (int)$limit;
$query = $this->db->query($sql);
return $query->rows;
}