<div id="catalog"> <?
if($section_id == 0)
{
$i = 0;
echo '<p>текст</p>';
echo '<div class="title">Категории</div>';
echo '<table class="section">';
$sql = CIBlockSection::GetList(Array('SORT'=>'ASC'), Array('IBLOCK_ID'=>1, 'ACTIVE'=>'Y', 'DEPTH_LEVEL'=>1));
while($result = $sql->GetNext())
{
$i++;
if($i == 1) echo '<tr valign="top">';
echo '<td valign="top">';
echo '<a id="bxid_876076" href="'.$result['SECTION_PAGE_URL'].'" ><img id="bxid_245686" src="'.CFile::GetPath($result['PICTURE']).'" alt="'.$result['NAME'].'" /></a><br /><a id="bxid_802386" href="'.$result['SECTION_PAGE_URL'].'" >'.$result['NAME'].'</a>';
echo '</td>';
if($i == 4)
{
echo '</tr>';
$i = 0;
}
}
echo '</table>';
}
else
{
/* breadcrumb */
$arSectionFilter["ID"] = $section_id;
$rsSection = CIBlockSection::GetList(Array(), $arSectionFilter);
if($arSection = $rsSection->GetNext())
{
$rsPath = GetIBlockSectionPath($arSection["IBLOCK_ID"], $arSection["ID"]);
while($arPath = $rsPath->GetNext())
{
$APPLICATION->AddChainItem($arPath["NAME"], $arPath["SECTION_PAGE_URL"]);
}
}
/* -- */
$sorted = $_GET['sorted'];
if(!empty($sorted)) $FIELD = $sorted;
else $FIELD = 'SORT';
$sql = CIBlockElement::GetList(Array($FIELD =>'ASC'), Array('IBLOCK_ID'=>1, 'ACTIVE'=>'Y', 'SECTION_ID'=>$section_id)); //получаем список
$sql->NavStart(5); //разбиваем на страницы по 20 элементов
if($sql->SelectedRowsCount() > 0)
{
while($sql->NavNext(true, "f_")):
$sql_section = CIBlockSection::GetByID($section_id);
if($result_section = $sql_section->GetNext())
{
$APPLICATION->SetTitle($result_section['NAME']);
if(!empty($result_section['DESCRIPTION'])) echo '<p>'.$result_section['DESCRIPTION'].'</p><br /><br />';
echo '<div style="float:left; margin-right: 3px;">Сортировать по: </div>';
?> <form method="get" action=""> <select name="sorted"> <option value="NAME">Названию товара</option> <option value="catalog_PRICE_2">Цене</option> </select> <input type="image" src="/bitrix/templates/work/images/sort.png" /> </form>
<br />
<br />
<?
echo $sql->NavPrint("Товары"); //постраничная навигация
echo '<br /><br />';
echo '<table border="0" style="width: 100%;">';
while($query = $sql->GetNextElement())
{
$result = $query->GetFields();
$sqlPrice = CPrice::GetList(array(), array("PRODUCT_ID"=>$result['ID'], "CATALOG_GROUP_ID"=>2));
$resPrice = $sqlPrice->Fetch();
echo '<tr>';
echo '<td style="font-size: 1.6em; padding-bottom: 3px;" colspan="2"><a id="bxid_746318" href="'.$result['DETAIL_PAGE_URL'].'" style="color: #C52E3D;" >'.$result['NAME'].'</a></td>';
echo '</tr>';
echo '<tr>';
echo '<td style="width: 140px;" valign="top"><a id="bxid_228604" href="'.$result['DETAIL_PAGE_URL'].'" ><img id="bxid_320564" src="'.CFile::GetPath($result['PREVIEW_PICTURE']).'" style="width: 120px;" /></a></td>';
echo '<td valign="top">';
echo $result['PREVIEW_TEXT'];
  |