I am new in magento platform.
I want to display recommended product category in the product page.
I have some codes but its not working properly.
it will show all the products, instead of just the recommended categories.
Recommended product cat I am taking product adding time.
my code is
<?php
$product_id = Mage::registry('current_product')->getId();
$_product = Mage::getModel('catalog/product')->load($product_id);
$pr_data = $_product->getData();
?>
<?php if ($pr_data['recommended_categories']): ?>
<?php
$category = new Mage_Catalog_Model_Category();
$category->load($categoryid);
$collection = $category->getProductCollection();
$collection->addAttributeToSelect('*');
?>
<div class="col-lg-7 col-md-7 col-sm-7 cpl-xs-12">
<div class="ndlSimilarTop">
<div class="ndlSimilatProductTitle">RECOMMENDED PRODUCTS</div>
<div id="amazingcarousel-container-1" style="overflow:hidden">
<div id="amazingcarousel-1" style="display:block;position:relative;width:100%;max-width:711px;margin:0px auto 0px;">
<div class="amazingcarousel-list-container" style="overflow:hidden;">
<ul class="amazingcarousel-list">
<?php foreach ($collection as $_item): ?>
<li class="amazingcarousel-item">
<div class="amazingcarousel-item-container">
<div class="amazingcarousel-image">
<img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(217, 173) ?>" alt="product-img" />
<ul class="mask mask1">
<li class="ndlHoverContent ndlHoverContent1">
<a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="ndlListWishlist ndlListWishlist1 ndlListWishlist2"><img src="<?php echo $this->getSkinUrl() ?>images/wishlist-white-icon.png" alt="">Add to wishlist</a>
<a href="#" class="ndlListAddtobag ndlListAddtobag1 ndlListAddtobag2"><img src="<?php echo $this->getSkinUrl() ?>images/mybag-white-icon.png" alt="">Add to bag</a>
</li>
</ul>
</div>
<div class="ndlListDetail">
<div class="ndlProductListName"><?php echo $this->escapeHtml($_item->getName()) ?></div>
<?php echo $this->getPriceHtml($_item, true, '-related') ?>
</div>
</div>
</li>
<?php endforeach; ?>