Skip to main content
added 127 characters in body
Source Link
Rick Kuipers
  • 4.3k
  • 2
  • 20
  • 24

There is no core functionality to archive this in the backend.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName() . '<br />';
}

Tested and working.

You can put this in a seperate file and just run that file to get the product's categories.

EDIT

There is no core functionality to view this in the backend. I believe it would take a slight backend modification to have the enabled categories expanded (perhaps with some JS)

There is no core functionality to archive this in the backend.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName() . '<br />';
}

Tested and working.

You can put this in a seperate file and just run that file to get the product's categories.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName() . '<br />';
}

Tested and working.

You can put this in a seperate file and just run that file to get the product's categories.

EDIT

There is no core functionality to view this in the backend. I believe it would take a slight backend modification to have the enabled categories expanded (perhaps with some JS)

There is no core functionality to archive this in the backend.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName() . '<br />';
}

Tested and working.

You can put this in a seperate file and just run that file to get the product's categories.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName() . '<br />';
}

Tested and working.

You can put this in a seperate file and just run that file to get the product's categories.

There is no core functionality to archive this in the backend.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName() . '<br />';
}

Tested and working.

You can put this in a seperate file and just run that file to get the product's categories.

added 14 characters in body
Source Link
Rick Kuipers
  • 4.3k
  • 2
  • 20
  • 24

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('default''admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName(); . '<br />';
}

Wrote this by heart, not tested.Tested and working.

You can put this in a seperate file and just run that file to get itsthe product's categories.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('default'); 
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName();
}

Wrote this by heart, not tested.

You can put this in a seperate file and just run that file to get its categories.

You can load the product by it's ID and then get the category ids.

require('app/Mage.php');
umask(0);
Mage::app('admin');
$id = 1; //Your product ID here
$product = Mage::getModel('catalog/product')->load($id);
$categoryIds = $product->getCategoryIds();
echo '<h1>' . $product->getName() . '</h1>';
foreach ($categoryIds as $cid) {
    $category = Mage::getModel('catalog/category')->load($cid);
    echo $category->getName() . '<br />';
}

Tested and working.

You can put this in a seperate file and just run that file to get the product's categories.

Source Link
Rick Kuipers
  • 4.3k
  • 2
  • 20
  • 24
Loading