view.phtmlファイルで次のコードを使用して、ランダムに取り上げられた製品を表示しています。
<?php
$catId = $this->getCat_id();
$cat=Mage::getModel("catalog/category")->load($catId);
$prodCollection = $cat->getProductCollection();
$pids=array();
foreach($prodCollection as $product)
{
array_push($pids,$product->getId());
}
$randProductId=array_rand($pids);
$product = Mage::getModel('catalog/product')->load($randProductId);
$product->getName();
?>
<div class="catalog-h-price">
<img src="<?php echo $product->getImageUrl();?>" height="64" width="64" /><?php echo $product->getName();?><br /><span class="price"><sup>$</sup><?php echo number_format($product->getData('price'), 0); ?></span> <span class="msrp">U.S. MSRP</span><a href="#"><a href="<?php echo $product->getProductUrl();?>">
<img src="http://coloresg.com/skin/frontend/default/modern/images/view-now.gif" width="36" height="28" /></a>
</div>
現在、カタログ全体からランダムな製品が表示されています。現在のカテゴリからのみプルするように調整する方法を知りたいです。ありがとう、-サム