예제 #1
0
 /**
  * @return $this|\Magento\Catalog\Model\Layer\Filter\AbstractFilter
  */
 public function _initItems()
 {
     try {
         if ($this->bxDataHelper->isFilterLayoutEnabled($this->_layer)) {
             $this->is_bx_attribute = $this->bxDataHelper->isBxAttribute($this->fieldName);
             $data = $this->_getItemsData();
             $items = [];
             foreach ($data as $itemData) {
                 $selected = isset($itemData['selected']) ? $itemData['selected'] : null;
                 $type = isset($itemData['type']) ? $itemData['type'] : null;
                 $items[] = $this->_createItem($itemData['label'], $itemData['value'], $itemData['count'], $selected, $type);
             }
             $this->_items = $items;
             return $this;
         }
         return parent::_initItems();
     } catch (\Exception $e) {
         $this->bxDataHelper->setFallback(true);
         $this->_logger->critical($e);
         return parent::_initItems();
     }
 }