public function setFields(array $fields) { parent::setFields($fields); if (is_array($this->fields) && $this->fields["MEASURE"] > 0) { $this->fields["MEASURE"] = new ElementCatalogMeasure($this->fields["MEASURE"]); } }
public function setFields(array $fields) { parent::setFields($fields); if (is_array($this->fields)) { //$this->fields["MEASURE"] = new ElementCatalogMeasure($this->fields["MEASURE"]); //TODO } }
/** * Used to initialize entity fields from some external source. * * @param array $fields Entity fields. * * @return void */ public function setFields(array $fields) { parent::setFields($fields); if (is_array($this->fields) && $this->iblockId > 0) { foreach ($this->fields as $id => $value) { if (substr($id, 0, 3) === "UF_") { $propertyCode = $id; $fieldCode = strtolower(substr($id, 3)); $this->fieldMap[$fieldCode] = $propertyCode; } } } }
public function setFields(array $fields) { parent::setFields($fields); if (is_array($this->fields) && $this->fields["IBLOCK_ID"] > 0) { if (isset($fields["PROPERTY_VALUES"]) && is_array($fields["PROPERTY_VALUES"])) { $this->property = new ElementProperty($this->id); $this->property->setIblockId($this->fields["IBLOCK_ID"]); $this->property->setFields($fields["PROPERTY_VALUES"]); } $this->iblock = new Iblock($fields["IBLOCK_ID"]); if (isset($fields["IBLOCK_SECTION_ID"]) && $fields["IBLOCK_SECTION_ID"] > 0) { $this->parent = new Section($fields["IBLOCK_SECTION_ID"]); $this->sections = new SectionPath($fields["IBLOCK_SECTION_ID"]); } if (\Freetrix\Main\Loader::includeModule('catalog')) { $this->catalog = new ElementCatalog($this->id); } } }
public function setFields(array $fields) { parent::setFields($fields); if (is_array($this->fields) && $this->fields["IBLOCK_ID"] > 0) { $properties = array(); foreach ($this->fields as $id => $value) { if (substr($id, 0, 3) === "UF_") { $properties[$id] = $value; } } $this->property = new SectionProperty($this->id); $this->property->setIblockId($this->fields["IBLOCK_ID"]); $this->property->setFields($properties); $this->iblock = new Iblock($fields["IBLOCK_ID"]); if (isset($fields["IBLOCK_SECTION_ID"]) && $fields["IBLOCK_SECTION_ID"] > 0) { $this->parent = new Section($fields["IBLOCK_SECTION_ID"]); $this->sections = new SectionPath($fields["IBLOCK_SECTION_ID"]); } if (\Bitrix\Main\Loader::includeModule('catalog')) { $this->catalog = new ElementCatalog($this->id); } } }
public function setFields(array $fields) { parent::setFields($fields); if (is_array($this->fields) && $this->iblock_id > 0) { $properties = array(); $propertyList = \Bitrix\Iblock\PropertyTable::getList(array("select" => array("*"), "filter" => array("=IBLOCK_ID" => $this->iblock_id))); while ($row = $propertyList->fetch()) { if ($row["USER_TYPE_SETTINGS"]) { $row["USER_TYPE_SETTINGS"] = unserialize($row["USER_TYPE_SETTINGS"]); } $properties[$row["ID"]] = $row; if ($row["CODE"] != "") { $properties[$row["CODE"]] =& $properties[$row["ID"]]; } } foreach ($fields as $propertyCode => $propertyValues) { if (is_array($propertyValues)) { foreach ($propertyValues as $i => $propertyValue) { if (is_array($propertyValue) && array_key_exists("VALUE", $propertyValue)) { if ($propertyValue["VALUE"] != "") { $propertyValues[$i] = $propertyValue["VALUE"]; } else { unset($propertyValues[$i]); } } } } if (isset($properties[$propertyCode])) { $property = $properties[$propertyCode]; $fieldCode = strtolower($propertyCode); if ($property["PROPERTY_TYPE"] === "L") { if (is_numeric($propertyValues)) { $value = new ElementPropertyEnum($propertyValues); } elseif (is_array($propertyValues)) { $value = array(); foreach ($propertyValues as $propertyValue) { if (is_numeric($propertyValue)) { $value[] = new ElementPropertyEnum($propertyValue); } } } else { $value = $propertyValues; } } elseif ($property["PROPERTY_TYPE"] === "E") { if ($propertyValues instanceof Element) { $this->element_link_properties[$fieldCode] = $propertyValues; $value = $propertyValues->getField("name"); } elseif (is_numeric($propertyValues)) { $this->element_link_properties[$fieldCode] = $propertyValues; $value = new ElementPropertyElement($propertyValues); } else { $value = $propertyValues; } } elseif ($property["PROPERTY_TYPE"] === "G") { if ($propertyValues instanceof Section) { $this->section_link_properties[$fieldCode] = $propertyValues; $value = $propertyValues->getField("name"); } elseif (is_numeric($propertyValues)) { $this->section_link_properties[$fieldCode] = $propertyValues; $value = new ElementPropertySection($propertyValues); } else { $value = $propertyValues; } } else { if (strlen($property["USER_TYPE"])) { $value = new ElementPropertyUserField($propertyValues, $property); } else { $value = $propertyValues; } } $this->fieldMap[$fieldCode] = $property["ID"]; $this->fieldMap[$property["ID"]] = $property["ID"]; if ($property["CODE"] != "") { $this->fieldMap[strtolower($property["CODE"])] = $property["ID"]; } $this->fields[$property["ID"]] = $value; } } } }