Algolia_Algoliasearch_Helper_Entity_Producthelper::getAllAttributes PHP Метод

getAllAttributes() публичный Метод

public getAllAttributes ( $add_empty_row = false )
    public function getAllAttributes($add_empty_row = false)
    {
        if (is_null(self::$_productAttributes)) {
            self::$_productAttributes = array();
            /** @var $config Mage_Eav_Model_Config */
            $config = Mage::getSingleton('eav/config');
            $allAttributes = $config->getEntityAttributeCodes('catalog_product');
            $productAttributes = array_merge(array('name', 'path', 'categories', 'categories.level0', 'categories.level1', 'categories.level2', 'categories.level3', 'categories.level4', 'categories_without_path', 'main_categories', 'main_categories.level0', 'main_categories.level1', 'main_categories.level2', 'main_categories.level3', 'main_categories.level4', 'description', 'ordered_qty', 'total_ordered', 'stock_qty', 'rating_summary', 'media_gallery', 'in_stock'), $allAttributes);
            $excludedAttributes = $this->getExcludedAttributes();
            $productAttributes = array_diff($productAttributes, $excludedAttributes);
            foreach ($productAttributes as $attributeCode) {
                self::$_productAttributes[$attributeCode] = $config->getAttribute('catalog_product', $attributeCode)->getFrontendLabel();
            }
        }
        $attributes = self::$_productAttributes;
        if ($add_empty_row === true) {
            $attributes[''] = '';
        }
        uksort($attributes, function ($a, $b) {
            return strcmp($a, $b);
        });
        return $attributes;
    }