Example #1
0
 /**
  * Function gets order properties from database
  * @param mixed[] $cached Cached data taken from obtainDataCachedStructure()
  * @return void
  */
 protected function obtainProps(&$cached)
 {
     if (empty($this->dbResult["ID"])) {
         return;
     }
     $props = array();
     $dbOrderProps = CSaleOrderPropsValue::GetOrderProps($this->dbResult["ID"]);
     $iGroup = -1;
     while ($arOrderProps = $dbOrderProps->Fetch()) {
         if (empty($this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]]) || !in_array($arOrderProps["ORDER_PROPS_ID"], $this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]])) {
             if ($arOrderProps["ACTIVE"] == "Y" && $arOrderProps["UTIL"] == "N") {
                 $arOrderPropsTmp = $arOrderProps;
                 if ($iGroup != intval($arOrderProps["PROPS_GROUP_ID"])) {
                     $arOrderPropsTmp["SHOW_GROUP_NAME"] = "Y";
                     $iGroup = intval($arOrderProps["PROPS_GROUP_ID"]);
                 }
                 if ($arOrderProps["TYPE"] == "SELECT" || $arOrderProps["TYPE"] == "RADIO") {
                     $arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $arOrderProps["VALUE"]);
                     $arOrderPropsTmp["VALUE"] = htmlspecialcharsEx($arVal["NAME"]);
                 } elseif ($arOrderProps["TYPE"] == "MULTISELECT") {
                     $arOrderPropsTmp["VALUE"] = "";
                     $curVal = explode(",", $arOrderProps["VALUE"]);
                     for ($i = 0, $intCount = count($curVal); $i < $intCount; $i++) {
                         $arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
                         if ($i > 0) {
                             $arOrderPropsTmp["VALUE"] .= ", ";
                         }
                         $arOrderPropsTmp["VALUE"] .= htmlspecialcharsEx($arVal["NAME"]);
                     }
                 } elseif ($arOrderProps["TYPE"] == "LOCATION") {
                     $locationName = "";
                     if (CSaleLocation::isLocationProEnabled()) {
                         $locationName = Location\Admin\LocationHelper::getLocationPathDisplay($arOrderProps["VALUE"]);
                     } else {
                         if (CSaleLocation::isLocationProMigrated()) {
                             $arOrderProps["VALUE"] = CSaleLocation::getLocationIDbyCODE($arOrderProps["VALUE"]);
                         }
                         $arVal = CSaleLocation::GetByID($arOrderProps["VALUE"], LANGUAGE_ID);
                         $locationName .= !strlen($arVal["COUNTRY_NAME"]) ? "" : $arVal["COUNTRY_NAME"];
                         if (strlen($arVal["COUNTRY_NAME"]) && strlen($arVal["REGION_NAME"])) {
                             $locationName .= " - " . $arVal["REGION_NAME"];
                         } elseif (strlen($arVal["REGION_NAME"])) {
                             $locationName .= $arVal["REGION_NAME"];
                         }
                         if (strlen($arVal["COUNTRY_NAME"]) || strlen($arVal["REGION_NAME"])) {
                             $locationName .= " - " . $arVal["CITY_NAME"];
                         } elseif (strlen($arVal["CITY_NAME"])) {
                             $locationName .= $arVal["CITY_NAME"];
                         }
                     }
                     $arOrderPropsTmp["VALUE"] = $locationName;
                 } elseif ($arOrderProps["TYPE"] == "FILE") {
                     if (strpos($arOrderProps["VALUE"], ",") !== false) {
                         $fileValue = "";
                         $values = explode(",", $arOrderProps["VALUE"]);
                         if (self::isNonemptyArray($values)) {
                             foreach ($values as $fileId) {
                                 $fileValue .= CFile::ShowFile(trim($fileId), 0, 90, 90, true) . "<br/>";
                             }
                         }
                         $arOrderPropsTmp["VALUE"] = $fileValue;
                     } else {
                         $arOrderPropsTmp["VALUE"] = CFile::ShowFile($arOrderProps["VALUE"], 0, 90, 90, true);
                     }
                 }
                 $props[] = $arOrderPropsTmp;
             }
         }
     }
     $cached["ORDER_PROPS"] = $props;
 }
								$countCurVal = count($curVal);
								for ($i = 0; $i < $countCurVal; $i++)
								{
									$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
									if ($i > 0)
										echo ", ";
									echo htmlspecialcharsEx($arVal["NAME"]);
								}
							}
							elseif ($arOrderProps["TYPE"] == "LOCATION")
							{
								$arOrder["LOCATION_TO"] = $arOrderProps["VALUE"];

								if(CSaleLocation::isLocationProEnabled())
								{
									print(Location\Admin\LocationHelper::getLocationPathDisplay($arOrderProps['VALUE']));
								}
								else
								{
									if(CSaleLocation::isLocationProMigrated())
										$arOrderProps["VALUE"] = CSaleLocation::getLocationIDbyCODE($arOrderProps["VALUE"]);

									$arVal = CSaleLocation::GetByID($arOrderProps["VALUE"], LANG);
									$locationString = $arVal["COUNTRY_NAME"];

									if (strlen($arVal["REGION_NAME"]) > 0 && strlen($locationString) > 0)
										$locationString .= " - ".$arVal["REGION_NAME"];
									elseif (strlen($locationString) <= 0 && strlen($arVal["REGION_NAME"]) > 0)
										$locationString = $arVal["REGION_NAME"];

									if (strlen($locationString) > 0 && strlen($arVal["CITY_NAME"]) > 0)
Example #3
0
				}
				elseif($arProps["TYPE"] == "CHECKBOX")
				{
					if($arProps["VALUE"] == "Y")
					{
						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], GetMessage("SALE_YES"));
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], GetMessage("SALE_YES"));
					}
				}
				elseif($arProps["TYPE"] == "LOCATION")
				{
					if(CSaleLocation::isLocationProEnabled())
					{
						$path = htmlspecialcharsEx(Helper::getLocationPathDisplay($arProps["VALUE"]));

						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], $path);
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], $path);
					}
					else
					{
						$arVal = CSaleLocation::GetByID($arProps["VALUE"], LANG);
						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], htmlspecialcharsEx($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]));
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], htmlspecialcharsEx($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]));
					}
				}