php meta_filter.php

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php meta_filter.php相关的知识,希望对你有一定的参考价值。

<?
if(preg_match('/\/filter\//', $APPLICATION->GetCurPage())) {
	$TITLE = "";
  $DESC  = "";

	$arSelect = Array("ID", "NAME");
  $arFilter = Array("IBLOCK_ID"=>$arParams["IBLOCK_ID"], "ID" => $arResult['VARIABLES']['SECTION_ID'], "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y");
  $res = CIBlockSection::GetList(Array(), $arFilter, false, $arSelect);
  if($ar_result = $res->GetNext()) {
   	if($ar_result['NAME'] != ''){
				$TITLE = 'Купить '.$ar_result['NAME'];
				$DESC = $ar_result['NAME'];
		}
  }

	if($TITLE != '' && $arResult['VARIABLES']['SMART_FILTER_PATH'] != '') {
		$filters = explode('/', $arResult['VARIABLES']['SMART_FILTER_PATH']);
		foreach ($filters as $filter) {
			$filter_data = explode('-is-', $filter);

			$filter_data_coll = explode('-or-', $filter_data[1]);
			if(count($filter_data_coll) > 1) {
					$res = CIBlockProperty::GetByID($filter_data[0], $arParams["IBLOCK_ID"]);
					if($ar_res = $res->GetNext()) {
						$TITLE .= ' '.strtolower($ar_res['NAME']);
						$DESC .= ' '.strtolower($ar_res['NAME']);

						$prop_res = CIBlockPropertyEnum::GetList(Array(), Array("IBLOCK_ID"=>$arParams["IBLOCK_ID"], "CODE"=>$filter_data[0]));
						while($ar_res = $prop_res->GetNext()) {
							foreach ($filter_data_coll as $key => $code) {
								if($ar_res['XML_ID'] == $code) {
									if($key)  {
										$TITLE .= ',';
										$DESCR .= ',';
									}
									$TITLE .= ' '.$ar_res["VALUE"];
									$DESC  .= ' '.$ar_res["VALUE"];
									break;
								}	
							}
						}
					}
				//}
			}
			// для одиночного фильтра
			else {
				$res = CIBlockProperty::GetByID($filter_data[0], $arParams["IBLOCK_ID"]);
				if($ar_res = $res->GetNext()) {
				  $TITLE .= ' '.strtolower($ar_res['NAME']);
					$DESC .= ' '.strtolower($ar_res['NAME']);

					$prop_res = CIBlockPropertyEnum::GetList(Array(), Array("IBLOCK_ID"=>$arParams["IBLOCK_ID"], "CODE"=>$filter_data[0]));
					while($ar_res = $prop_res->GetNext()) {

						if($ar_res['XML_ID'] == $filter_data[1]) {
							$TITLE .= ' '.$ar_res["VALUE"];
							$DESC  .= ' '.$ar_res["VALUE"];
							break;
						}
					}
				}
			}


		}
	}
	if($TITLE != '') $TITLE .= ' в Самаре';
	if($DESC  != '') $DESC  .= ': каталог, цены в Интернет-магазине «Чистмарт»';

  $APPLICATION->SetPageProperty('title', $TITLE);
  $APPLICATION->SetPageProperty('description', $DESC);
}

以上是关于php meta_filter.php的主要内容,如果未能解决你的问题,请参考以下文章

php [guzzle php] guzzle php #php

php send.php php邮件模板#php

IntelliJ IDEA 11编辑php是,支持php文件名为.php5和.php4,如何设置能让其也支持.php呢?

如何从php5升级到php7

请问php中如何调用php文件中的内容?

php [php:PHPMailer示例] php库“PHPMailer”示例。 #PHP