Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. $cat = $_product->getCategoryIds();
  2. $name= Mage::getModel('catalog/category')->load( end($cat) )->getName();
  3.  
  4. $categoryIds = $product->getCategoryIds();
  5. $collection = Mage::getModel('catalog/category')->getCollection()
  6. ->addAttributeToSelect('name')
  7. ->addAttributeToFilter('entity_id', $categoryIds)
  8. ->addAttributeToFilter('is_active', 1);
  9. $collection->getSelect()->order('level DESC')->limit(1);
  10.  
  11. $name = $collection->getFirstItem()->getName();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement