protected function _load($name) { $elems = explode('.', $name, $limit = 2); $count = count($elems); $last_index = $count - 1; if ($count == 2) { switch ($elems[0]) { case 'attribute_set': return $this->getAttributeSet()->{$elems[1]}; case 'stock': return $this->_getStockItem()->{$elems[1]}; case 'category': $category = $this->_getCategory(); return $category ? $category->{$elems[1]} : null; } } switch ($name) { case 'attribute_set': return $this->getAttributeSet()->name; // Compatibility // Compatibility case 'category': // Compatibility $category = $this->_getCategory(); return $category ? $category->name : null; case 'categories': // Compatibility $categories = $this->getCategories(); $output = array(); foreach ($categories as $category) { $output[] = $category->name; } return $output; case 'categories.id': // Compatibility $categories = $this->getCategories(); $output = array(); foreach ($categories as $category) { $output[] = $category->id; } return $output; default: return parent::_load($name); } }