/** * Returns all calculated values of inherited properties * for iblock. * * @return array[string]string */ public function queryValues() { $result = array(); if ($this->hasTemplates()) { $connection = \Bitrix\Main\Application::getConnection(); $query = $connection->query("\n\t\t\t\tSELECT\n\t\t\t\t\tP.ID\n\t\t\t\t\t,P.CODE\n\t\t\t\t\t,P.TEMPLATE\n\t\t\t\t\t,P.ENTITY_TYPE\n\t\t\t\t\t,P.ENTITY_ID\n\t\t\t\t\t,IP.VALUE\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock_iblock_iprop IP\n\t\t\t\t\tINNER JOIN b_iblock_iproperty P ON P.ID = IP.IPROP_ID\n\t\t\t\tWHERE\n\t\t\t\t\tIP.IBLOCK_ID = " . $this->iblockId . "\n\t\t\t"); while ($row = $query->fetch()) { $result[$row["CODE"]] = $row; } if (empty($result)) { $result = parent::queryValues(); foreach ($result as $row) { $connection->add("b_iblock_iblock_iprop", array("IBLOCK_ID" => $this->iblockId, "IPROP_ID" => $row["ID"], "VALUE" => $row["VALUE"]), null); } } } return $result; }
public function queryValues() { $result = array(); if ($this->hasTemplates()) { $connection = \Freetrix\Main\Application::getConnection(); $query = $connection->query("\n\t\t\t\tSELECT\n\t\t\t\t\tP.ID\n\t\t\t\t\t,P.CODE\n\t\t\t\t\t,P.TEMPLATE\n\t\t\t\t\t,P.ENTITY_TYPE\n\t\t\t\t\t,P.ENTITY_ID\n\t\t\t\t\t,IP.VALUE\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock_element_iprop IP\n\t\t\t\t\tINNER JOIN b_iblock_iproperty P ON P.ID = IP.IPROP_ID\n\t\t\t\tWHERE\n\t\t\t\t\tIP.IBLOCK_ID = " . $this->iblock_id . "\n\t\t\t\t\tAND IP.ELEMENT_ID = " . $this->element_id . "\n\t\t\t"); while ($row = $query->fetch()) { $result[$row["CODE"]] = $row; } if (empty($result)) { $result = parent::queryValues(); if (!empty($result)) { $elementList = \Freetrix\Iblock\ElementTable::getList(array("select" => array("IBLOCK_SECTION_ID"), "filter" => array("=ID" => $this->element_id))); $element = $elementList->fetch(); foreach ($result as $CODE => $row) { $connection->add("b_iblock_element_iprop", array("IBLOCK_ID" => $this->iblock_id, "SECTION_ID" => intval($element["IBLOCK_SECTION_ID"]), "ELEMENT_ID" => $this->element_id, "IPROP_ID" => $row["ID"], "VALUE" => $row["VALUE"])); } } } } return $result; }