Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getProductTypes()
 {
     $productTypes = array();
     foreach ($this->productTypeConfig->getAll() as $productTypeData) {
         $productTypes[] = $this->productTypeBuilder->setName($productTypeData['name'])->setLabel($productTypeData['label'])->create();
     }
     return $productTypes;
 }
 /**
  * {@inheritdoc}
  */
 public function getProductTypes()
 {
     if ($this->productTypes === null) {
         $productTypes = [];
         foreach ($this->productTypeConfig->getAll() as $productTypeData) {
             /** @var \Magento\Catalog\Api\Data\ProductTypeInterface $productType */
             $productType = $this->productTypeFactory->create();
             $productType->setName($productTypeData['name'])->setLabel($productTypeData['label']);
             $productTypes[] = $productType;
         }
         $this->productTypes = $productTypes;
     }
     return $this->productTypes;
 }
Example #3
0
 /**
  * Get product types
  *
  * @return array
  */
 public function getTypes()
 {
     if (is_null($this->_types)) {
         $productTypes = $this->_config->getAll();
         foreach ($productTypes as $productTypeKey => $productTypeConfig) {
             $productTypes[$productTypeKey]['label'] = __($productTypeConfig['label']);
         }
         $this->_types = $productTypes;
     }
     return $this->_types;
 }
 /**
  * @param int|null $filter
  * @return array
  */
 public function getIsQtyTypeIds($filter = null)
 {
     if (null === $this->isQtyTypeIds) {
         $this->isQtyTypeIds = [];
         foreach ($this->config->getAll() as $typeId => $typeConfig) {
             $this->isQtyTypeIds[$typeId] = isset($typeConfig['is_qty']) ? $typeConfig['is_qty'] : false;
         }
     }
     $result = $this->isQtyTypeIds;
     if ($filter !== null) {
         foreach ($result as $key => $value) {
             if ($value !== $filter) {
                 unset($result[$key]);
             }
         }
     }
     return $result;
 }