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; }
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_without_path', 'description', 'ordered_qty', 'stock_qty', 'price_with_tax', 'rating_summary'), $allAttributes); $excludedAttributes = array('all_children', 'available_sort_by', 'children', 'children_count', 'custom_apply_to_products', 'custom_design', 'custom_design_from', 'custom_design_to', 'custom_layout_update', 'custom_use_parent_settings', 'default_sort_by', 'display_mode', 'filter_price_range', 'global_position', 'image', 'include_in_menu', 'is_active', 'is_always_include_in_menu', 'is_anchor', 'landing_page', 'level', 'lower_cms_block', 'page_layout', 'path_in_store', 'position', 'small_image', 'thumbnail', 'url_key', 'url_path', 'visible_in_menu'); $productAttributes = array_diff($productAttributes, $excludedAttributes); foreach ($productAttributes as $attributeCode) { self::$_productAttributes[$attributeCode] = $config->getAttribute('catalog_category', $attributeCode)->getFrontendLabel(); } } $attributes = self::$_productAttributes; if ($add_empty_row === true) { $attributes[''] = ''; } uksort($attributes, function ($a, $b) { return strcmp($a, $b); }); return $attributes; }