3 deleted 99 characters in body
source | link

Try this code in your view.phtml

<?php
        $productId = $_product->getId();
        $productCollection = Mage::getModel('catalog/product')->load($productId);
        $catIds = $productCollection->getCategoryIds();
         foreach ($catIds as $categoryId) {
            $_productCollection = Mage::getModel('catalog/category')->load($categoryId->getId())
                    ->getProductCollection()
                    ->addAttributeToSelect('*')
                    ->addAttributeToFilter('status', 1)
                    ->addAttributeToFilter('visibility', 4);
                    foreach ($_productCollection as $catProducts){
                        echo    $catProducts->getName();
                echo '<br>';
           // get your product here 
     // get your product here  
            }
         
}
         
?>

Try this code in your view.phtml

<?php
        $productId = $_product->getId();
        $productCollection = Mage::getModel('catalog/product')->load($productId);
        $catIds = $productCollection->getCategoryIds();
         foreach ($catIds as $categoryId) {
            $_productCollection = Mage::getModel('catalog/category')->load($categoryId->getId())
                    ->getProductCollection()
                    ->addAttributeToSelect('*')
                    ->addAttributeToFilter('status', 1)
                    ->addAttributeToFilter('visibility', 4);
                    foreach ($_productCollection as $catProducts){
                            $catProducts->getName();
                            // get your product here 
                     }
        }
        ?>

Try this code in your view.phtml

<?php
$productId = $_product->getId();
$productCollection = Mage::getModel('catalog/product')->load($productId);
$catIds = $productCollection->getCategoryIds();
 foreach ($catIds as $categoryId) {
    $_productCollection = Mage::getModel('catalog/category')->load($categoryId)
            ->getProductCollection()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('status', 1)
            ->addAttributeToFilter('visibility', 4);
            foreach($_productCollection as $catProducts){
                echo    $catProducts->getName();
                echo '<br>';
                    // get your product here  
            }
 
}
 
?>
2 added 1 character in body
source | link

Try this code in your view.phtml

<?php
        $productId = $_product->getId();
        $productCollection = Mage::getModel('catalog/product')->load($productId);
        $catIds = $productCollection->getCategoryIds();
         foreach ($catIds as $categoryId) {
            $_productCollection = Mage::getModel('catalog/category')->load($categoryId->getId())
                    ->getProductCollection()
                    ->addAttributeToSelect('*')
                    ->addAttributeToFilter('status', 1)
                    ->addAttributeToFilter('visibility', 4);
                    fareachforeach ($_productCollection as $catProducts){
                            $catProducts->getName();
                            // get your product here 
                    }
        }
        ?>

Try this code in your view.phtml

<?php
        $productId = $_product->getId();
        $productCollection = Mage::getModel('catalog/product')->load($productId);
        $catIds = $productCollection->getCategoryIds();
         foreach ($catIds as $categoryId) {
            $_productCollection = Mage::getModel('catalog/category')->load($categoryId->getId())
                    ->getProductCollection()
                    ->addAttributeToSelect('*')
                    ->addAttributeToFilter('status', 1)
                    ->addAttributeToFilter('visibility', 4);
                    fareach($_productCollection as $catProducts){
                            $catProducts->getName();
                            // get your product here 
                    }
        }
        ?>

Try this code in your view.phtml

<?php
        $productId = $_product->getId();
        $productCollection = Mage::getModel('catalog/product')->load($productId);
        $catIds = $productCollection->getCategoryIds();
         foreach ($catIds as $categoryId) {
            $_productCollection = Mage::getModel('catalog/category')->load($categoryId->getId())
                    ->getProductCollection()
                    ->addAttributeToSelect('*')
                    ->addAttributeToFilter('status', 1)
                    ->addAttributeToFilter('visibility', 4);
                    foreach ($_productCollection as $catProducts){
                            $catProducts->getName();
                            // get your product here 
                    }
        }
        ?>
1
source | link

Try this code in your view.phtml

<?php
        $productId = $_product->getId();
        $productCollection = Mage::getModel('catalog/product')->load($productId);
        $catIds = $productCollection->getCategoryIds();
         foreach ($catIds as $categoryId) {
            $_productCollection = Mage::getModel('catalog/category')->load($categoryId->getId())
                    ->getProductCollection()
                    ->addAttributeToSelect('*')
                    ->addAttributeToFilter('status', 1)
                    ->addAttributeToFilter('visibility', 4);
                    fareach($_productCollection as $catProducts){
                            $catProducts->getName();
                            // get your product here 
                    }
        }
        ?>