0 Пользователей и 1 Гость просматривают эту тему.
  • 2 Ответов
  • 2238 Просмотров
*

Sottel

  • Осваиваюсь на форуме
  • 16
  • 0 / 0
Как вывести товары из подкатегорий в категории для VM 1.1.4?
Весь форму прочитал не нашёл!
помогите!
*

DrMartens

  • Захожу иногда
  • 99
  • 0 / 0
+1 тоже мнтересует!
*

DrMartens

  • Захожу иногда
  • 99
  • 0 / 0
В файле /administrator/components/com_virtuemart/html/shop.browse.php ищем строку $dbp = new ps_DB;
Под ней добавляем:

function getCatergoryChildsList( $clist, $catid ){
   $res_list = array( $catid );
   $search_childs = true;
   while( $search_childs ){
      $search_childs = false;
      foreach( $clist as $c_catid => $val ){
         if( in_array( $val['category_parent_id'], $res_list ) ){
            $res_list[] = $c_catid;
            unset( $clist[ $c_catid ] );
            $search_childs = true;
         }
      }
   }
   return $res_list;
}
$category_childs = '';
if ( $category_id && $ps_product_category->has_childs($category_id) ){
   $category_childs = getCatergoryChildsList( $ps_product_category->getCategoryTreeArray(), $category_id );
}

Далее открываем /administrator/components/com_virtuemart/html/shop_browse_queries.php, находим код:

   } elseif( empty( $keyword ) && empty( $manufacturer_id )) {
      $where_clause[] = "`#__{vm}_product_category_xref`.`category_id`=".$category_id;
   }

меняем на немного подправленный нами:

   } elseif( empty( $keyword ) && empty( $manufacturer_id )) {
      if(!empty( $category_childs ))
         $where_clause[] = "`#__{vm}_product_category_xref`.`category_id` IN (".$category_id.",".implode(',',$category_childs).")";
      else
         $where_clause[] = "`#__{vm}_product_category_xref`.`category_id`=".$category_id;
   }

Сохраняем, проверяем...
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться