<? function get_OrdCount($PrId) { $product = new TProduct($PrId); $OrdCount = $product->GetOrdCount(); unset($product); return $OrdCount; }; function get_Parameters($PrId) { $Result = ""; $product = new TProduct($PrId); $product->RetriveAllFromDB(); if (!empty($product->parameters)) { foreach ($product->parameters as $parameter) { $Result .= $parameter["name"] . ": " . $parameter["value"] . "<br />"; }; }; unset($product); return $Result; }; function products_show_at_face($FDId, $par0, $par1, $par2, $par3) { include_once("admin/classes/tree.class.php"); include_once("admin/classes/tree_category.class.php"); include_once("admin/modules/products/products_conf.php"); include_once("admin/modules/products/products_class.php"); include_once("admin/modules/filter/filter_show.php"); $tplCommon = new XTemplate($conf_tpl_path); $tplCommon->assign("JS_PATH", $conf_js_path); $tplCommon->assign("CSS_PATH", $conf_css_path); $tplCommon->parse("css"); $Result = ""; $Result .= $tplCommon->text("css"); $ver_id = (int) DefineVariable("ver_id", -1); $is_filter = DefineVariable("isfilter"); $h_CId = (int)$par3["h_CId"]; //-------------Описание родительской категории----------------------- //if ($is_filter!=1) $CId = (int) $par3["CId"]; if ($h_CId>0) $CId = $h_CId; $res = my_query("SELECT Ph.PhSmall, C.CName, C.CShortDescr, C.CDescr, C.CSeoTitle, C.CSeoKeyWords, C.CSeoDescr FROM adm_categories C LEFT JOIN adm_photos Ph ON C.PhId=Ph.PhId WHERE CId='$CId'"); $data = my_get($res); if ($ver_id <= 0) { $history = ShowTreeHistoryAtFace($FDId - 1, $CId, true); } else { $history = "<a href='/'>Главная</a> / Подбор по автомобилю"; } $tplCommon->assign("HISTORY", $history); if ((int) $CId > 0) $tplCommon->assign("FILTER", $filter = show_filter_at_face($CId, false, $ver_id)); /* if (SetPhoto($data["PhSmall"], "") != "") { $tplCommon->assign("CAT_IMAGE", SetPhoto($data["PhSmall"], "images/def.png")); $tplCommon->parse("category.descr.image"); }; //if ($data["CShortDescr"] != "") { $tplCommon->assign("CNAME", $data["CName"]); $tplCommon->assign("SHORT_DESCR", $data["CShortDescr"]); $tplCommon->assign("DESCR", $data["CDescr"]); $tplCommon->parse("category.descr"); //}; */ $seo_title = $data["CSeoTitle"]; $seo_keywords = $data["CSeoKeyWords"]; $seo_descr = $data["CSeoDescr"]; $parent_category_descr = $data["CDescr"]; $parent_category_name = $data["CName"]; $parent_CId = my_val("SELECT CParent_Id FROM adm_categories WHERE CId=$CId", 0, "CParent_Id"); $tplCommon->assign("BACK_HREF", "index.php?FDId=11&par3[CId]=$parent_CId"); $tplCommon->parse("category"); $Result .= $tplCommon->text("category"); //-------------------Вывод товаров------------------------ $get_func_name = "products_get1"; if ($is_filter==1) $get_func_name = "products_filter1"; //PrintArray($par3); $full_data = call_user_func($get_func_name, $FDId, $par0, $par1, $par2, $par3); //Вызываем ту функцию, которая нам требуется $data = $full_data["data"]; $rows = array_keys($data); $main_href = GetCurrentURL(); if (empty($rows)) { $tplCommon->assign("BACK_HREF", $_SERVER["HTTP_REFERER"]); $tplCommon->parse("back_href"); $tplCommon->parse("no_products"); $Result .= $tplCommon->text("no_products"); //$Result .= $tplCommon->text("back_href"); //return $Result; return array("content" => $Result, "title" => ""); //ShowTreeHistoryAtFace($FDId - 1, $CId, false) } else { $i = 1; foreach ($rows as $row) { $href = ReplaceVariableValueInUrl($main_href, "par1", 4); $href = ReplaceVariableValueInUrl($href, "par2", $data[$row]["PrId"]); $href.="&par3[PrStId]=".$data[$row]["PrStId"]; $photo_small = SetPhoto($data[$row]["PhSmall"], $conf_def_photo); //"images/def.jpg" $photo_big = SetPhoto($data[$row]["PhBig"], ""); //"images/def.jpg" $tplCommon->assign("HREF", htmlspecialchars($href)); $tplCommon->assign("PHOTO_SMALL", $photo_small); $tplCommon->assign("PHOTO_BIG", $photo_big); if ($photo_big == "") { $tplCommon->parse("products.mode_2.tr.td.small"); } else { $tplCommon->parse("products.mode_2.tr.td.big_and_small"); } //$tplCommon->parse("products.mode_2.tr.td.big_and_small"); /* if ($photo_small != "") { $tplCommon->parse("products.mode_1.tr.image"); }; */ $tplCommon->assign("CID",$CId); $tplCommon->assign("PRNAME", $data[$row]["PrName"]); $tplCommon->assign("PRID", $data[$row]["PrId"]); $tplCommon->assign("PRPRICE", sprintf("%01.0f", $data[$row]["PrStPrice"])); //костыль /*if (GetCurrentCustomer() == -1) { $tplCommon->assign("PRPRICE", sprintf("%01.0f", $data[$row]["PrPrice"])); } else { $tplCommon->assign("PRPRICE", sprintf("%01.0f", $data[$row]["PrPrice2"])); }*/ $tplCommon->assign("STORE_COUNT", $data[$row]["PrStCount"]); $tplCommon->assign("PRCOUNT1", $data[$row]["PrCount1"]); $tplCommon->assign("PRSHORTDESCR", $data[$row]["PrShortDescr"]); $tplCommon->assign("ORDCOUNT", get_OrdCount($data[$row]["PrId"])); $tplCommon->assign("PRCODE", $data[$row]["PrCode"]); $tplCommon->assign("COLSPAN", $conf_show_at_row_count + 1); $tplCommon->assign("PARAMS", $params); $tplCommon->assign("PRSTMODEL", $data1["PrStModel"]); $tplCommon->assign("PRSTID", $data1["PrStId"]); $tplCommon->assign("PRSTPRICE", sprintf("%01.0f",$data1["PrStPrice"])); $tplCommon->assign("PRSTOLDPRICE", sprintf("%01.0f",$data1["PrStOldPrice"])); $tplCommon->assign("ORDCOUNT", get_OrdCount($data1["PrStId"])); $tplCommon->assign("STORE_COUNT", $store_count); //$tplCommon->assign("PHSMALL", $photo_small); //$tplCommon->assign("PHBIG", $photo_big); //print $data[$row]["PrId"] . "!"; if ($conf_display_mode == 2) {//Вывод по столбцам (режим 2) $tplCommon->assign("I", $i % $conf_show_at_row_count); $tplCommon->assign("TD_WIDTH", round(100 / $conf_show_at_row_count)); /* //Параметры $product = new TProduct($data[$row]["PrId"]); $product->RetriveAllFromDB(); //PrintArray($product->parameters); if (!empty($product->parameters)) { foreach ($product->parameters as $parameter) { $tplCommon->assign("PARAM_NAME", $parameter["name"]); $tplCommon->assign("PARAM_VALUE", $parameter["value"]); $tplCommon->parse("products.mode_2.tr.td.params"); }; }; unset($product); //------------------------------------------- */ if ($i % $conf_show_at_row_count != 1) { $tplCommon->parse("products.mode_2.tr.td.hr"); } $tplCommon->parse("products.mode_2.tr.td"); if ($i==count($rows)) { $delta = $conf_show_at_row_count-$i%$conf_show_at_row_count; for($j=0;$j<$delta;$j++){ $tplCommon->parse("products.mode_2.tr.empty"); } } if ($i % $conf_show_at_row_count == 0) { $tplCommon->parse("products.mode_2.tr"); } elseif ($i == count($rows)) { $tplCommon->parse("products.mode_2.tr"); } } else {//Вывод списком (режим1) /* //Параметры $product = new TProduct($data[$row]["PrId"]); $product->cat_id = $CId; $product->RetriveParamsFromDB(); if (!empty($product->parameters)) { foreach ($product->parameters as $parameter) { $tplCommon->assign("PARAM_NAME", $parameter["name"]); $tplCommon->assign("PARAM_VALUE", $parameter["value"]); $tplCommon->parse("products.mode_1.tr.params"); } } unset($product); */ //Конец.Параметры $tplCommon->parse("products.mode_1.tr"); } $i++; }; if ($par3["hide_rewinds"] == true) { } else { $tplCommon->assign("REWINDS", PrintRewinds1(GetCurrentURL(), $full_data["service"]["from"], $full_data["service"]["max_count"], "", "", $full_data["service"]["display_count"])); }; }; if ($conf_display_mode == 2) { $tplCommon->parse("products.mode_2"); } else { $tplCommon->parse("products.mode_1"); } if (SetPhoto($data["PhSmall"], "") != "") { $tplCommon->assign("CAT_IMAGE", SetPhoto($data["PhSmall"], "images/def.png")); $tplCommon->parse("products.descr.image"); }; //if ($data["CShortDescr"] != "") { $tplCommon->assign("CNAME", $parent_category_name); //$tplCommon->assign("SHORT_DESCR", $data["CShortDescr"]); $tplCommon->assign("DESCR", $parent_category_descr);//$data["CDescr"]); $tplCommon->parse("products.descr"); //}; $tplCommon->parse("products"); $Result .= $tplCommon->text("products"); $basket = new TBasket(); $basket->RetriveFromSession(); $basket_pr_count = $basket->GetPrCount(); if ($basket_pr_count > 0) { $tplCommon->parse("arrow2"); $Result .= $tplCommon->text("arrow2"); } else { $tplCommon->parse("arrow1"); $Result .= $tplCommon->text("arrow1"); } if ($is_filter) return $Result; return array("content" => $Result, "title" => "", "pathway" => $history, "seo_title" => $seo_title, "seo_keywords" => $seo_keywords, "seo_descr" => $seo_descr); //ShowTreeHistoryAtFace($FDId - 1, $CId, false) }; --- Добавлено --- Весь код