Перейти к содержанию
Форум поддержки пользователей VamShop

Задвоение фильтра по производителю


Рекомендуемые сообщения

Саш, в  includes\modules\default.php

поменяй 

  if (isset ($_GET['manufacturers_id'])) {
    $filterlist_sql = "select distinct p.manufacturers_id, p.label_id, c.categories_id as id, cd.categories_name as name from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c, ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd where p.products_status = '1' and c.categories_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '".(int) $_SESSION['languages_id']."' and p.manufacturers_id = '".(int) $_GET['manufacturers_id']."' group by p.manufacturers_id";
  } else {
    if (PRODUCT_LIST_RECURSIVE == 'true') {
    $filterlist_sql = "select distinct p.manufacturers_id, p.label_id, m.manufacturers_id as id, m.manufacturers_name as name from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c, ".TABLE_CATEGORIES." c,".TABLE_MANUFACTURERS." m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and (p2c.categories_id = '".$current_category_id."' AND p2c.categories_id = c.categories_id OR p2c.categories_id = c.categories_id AND c.parent_id = '".$current_category_id."') group by p.manufacturers_id";
    } else {
    $filterlist_sql = "select distinct m.manufacturers_id as id, p.label_id, m.manufacturers_name as name from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c, ".TABLE_MANUFACTURERS." m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '".$current_category_id."' group by p.manufacturers_id";
    }
  }

на

  if (isset ($_GET['manufacturers_id'])) {
    $filterlist_sql = "select distinct p.manufacturers_id,  c.categories_id as id, cd.categories_name as name from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c, ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd where p.products_status = '1' and c.categories_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '".(int) $_SESSION['languages_id']."' and p.manufacturers_id = '".(int) $_GET['manufacturers_id']."' group by p.manufacturers_id";
  } else {
    if (PRODUCT_LIST_RECURSIVE == 'true') {
    $filterlist_sql = "select distinct p.manufacturers_id,  m.manufacturers_id as id, m.manufacturers_name as name from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c, ".TABLE_CATEGORIES." c,".TABLE_MANUFACTURERS." m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and (p2c.categories_id = '".$current_category_id."' AND p2c.categories_id = c.categories_id OR p2c.categories_id = c.categories_id AND c.parent_id = '".$current_category_id."') group by p.manufacturers_id";
    } else {
    $filterlist_sql = "select distinct m.manufacturers_id as id,  m.manufacturers_name as name from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_TO_CATEGORIES." p2c, ".TABLE_MANUFACTURERS." m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '".$current_category_id."' group by p.manufacturers_id";
    }
  }

 

из за p.label_id

distinct

не срабатывал корректно SQL запрос (выдавало дубли)

 

Ссылка на сообщение
Поделиться на другие сайты
×
×
  • Создать...