Ejemplo n.º 1
0
 /**
  * Returns list of properties IDs marked as indexed to the section according their "TYPE".
  * - N - maps to Indexer::NUMERIC
  * - S - to Indexer::STRING
  * - F, E, G, L - to Indexer::DICTIONARY
  *
  * @param integer $propertyType Property classification for the index.
  *
  * @return integer[]
  */
 protected function getFilterProperty($propertyType)
 {
     if (!isset($this->propertyFilter)) {
         $this->propertyFilter = array(Storage::DICTIONARY => array(), Storage::STRING => array(), Storage::NUMERIC => array(), Storage::DATETIME => array());
         $propertyList = \Bitrix\Iblock\SectionPropertyTable::getList(array("select" => array("PROPERTY_ID", "PROPERTY.PROPERTY_TYPE", "PROPERTY.USER_TYPE"), "filter" => array("=IBLOCK_ID" => array($this->iblockId, $this->skuIblockId), "=SMART_FILTER" => "Y")));
         while ($link = $propertyList->fetch()) {
             if ($link["IBLOCK_SECTION_PROPERTY_PROPERTY_PROPERTY_TYPE"] === "N") {
                 $this->propertyFilter[Storage::NUMERIC][] = $link["PROPERTY_ID"];
             } elseif ($link["IBLOCK_SECTION_PROPERTY_PROPERTY_USER_TYPE"] === "DateTime") {
                 $this->propertyFilter[Storage::DATETIME][] = $link["PROPERTY_ID"];
             } elseif ($link["IBLOCK_SECTION_PROPERTY_PROPERTY_PROPERTY_TYPE"] === "S") {
                 $this->propertyFilter[Storage::STRING][] = $link["PROPERTY_ID"];
             } else {
                 $this->propertyFilter[Storage::DICTIONARY][] = $link["PROPERTY_ID"];
             }
         }
     }
     return $this->propertyFilter[$propertyType];
 }
Ejemplo n.º 2
0
 /**
  * Returns map of properties to their types.
  * Properties of iblock and its sku returned
  * which marked as for smart filter.
  *
  * @return integer[]
  */
 private function getFilterProperty()
 {
     if (!isset($this->propertyFilter)) {
         $this->propertyFilter = array();
         $propertyList = \Bitrix\Iblock\SectionPropertyTable::getList(array("select" => array("PROPERTY_ID", "PROPERTY.PROPERTY_TYPE"), "filter" => array("=IBLOCK_ID" => array($this->iblockId, $this->skuIblockId), "=SMART_FILTER" => "Y")));
         while ($link = $propertyList->fetch()) {
             if ($link["IBLOCK_SECTION_PROPERTY_PROPERTY_PROPERTY_TYPE"] === "N") {
                 $this->propertyFilter[$link["PROPERTY_ID"]] = Storage::NUMERIC;
             } elseif ($link["IBLOCK_SECTION_PROPERTY_PROPERTY_PROPERTY_TYPE"] === "S") {
                 $this->propertyFilter[$link["PROPERTY_ID"]] = Storage::STRING;
             } else {
                 $this->propertyFilter[$link["PROPERTY_ID"]] = Storage::DICTIONARY;
             }
         }
     }
     return $this->propertyFilter;
 }