Skip to content

Instantly share code, notes, and snippets.

@anunay
Last active August 29, 2015 14:01
Show Gist options
  • Save anunay/ff8628cdfebd72dda87d to your computer and use it in GitHub Desktop.
Save anunay/ff8628cdfebd72dda87d to your computer and use it in GitHub Desktop.
Magento: Get category from product
<?php
// Magento: Getting categroy from product
$categoryIds = $_product->getCategoryIds();
if(count($categoryIds) ){
$firstCategoryId = $categoryIds[0];
$_category = Mage::getModel('catalog/category')->load($firstCategoryId);
echo $_category->getData('categorysecondimage');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment