Hello All,
I am writing here the script to get category ids , for the given product.
<?php $product_model = Mage::getModel('catalog/product'); //get product model $all_cats = array(); $product_model->reset(); $_product = $product_model->load($product_id); // $product_id is the given product id $all_cats = $product_model->getCategoryIds($_product); // all the categories to which this product is assigned ?>
Hope this is useful
in /app/design/frontend/PACKAGE/TEHEME/template/catalog/product/view/media.phtml
getProduct();
$_helper = $this->helper(‘catalog/output’);
$_product->getCategoryIds(); // Array
?>
Hi,
I want to display all categories a product is added to on the product view page. If i use your code nothing happens. Can you help me with this? Using magento 1.4.1.1
@Rudy – All categories id will be in array $all_cats