<!--
for
show other product-->
<?php
$categories
=
$_product
->getCategoryIds(); ?>
<?php
$result
=
array
();
foreach
(
$categories
as
$cat_id
) {
$category
= Mage::getModel(
’catalog/category’
);
$category
->load(
$cat_id
);
$collection
=
$category
->getProductCollection();
foreach
(
$collection
as
$product
) {
$result
[] =
$product
->getId();
}
}
?>
<div
class
=
"box-others-also-like"
>
<ul>
<?php
if
(sizeof(
$result
) >= 5)
{
$ourneed
=
array_rand
(
$result
,5);
foreach
(
$ourneed
as
$cc
)
{
$thisproduct
= Mage::getModel(
’catalog/product’
)->load(
$result
[
$cc
]);
?>
<li>
<a href=
"<?php echo $thisproduct->getProductUrl(); ?>"
title=
"<?php echo $thisproduct->getName(); ?>"
><img src=
"<?php echo $this->helper(’catalog/image’)->init($thisproduct, ’small_image’)->resize(200) ?>"
width=
"200"
height=
"200"
alt=
"<?php echo $thisproduct->getName(); ?>"
/></a>
</li>
<?php } ?>
<?php
}
else
{
foreach
(
$result
as
$cc
)
{
$thisproduct
= Mage::getModel(
’catalog/product’
)->load(
$cc
);
?>
<li>
<a href=
"<?php echo $thisproduct->getProductUrl(); ?>"
title=
"<?php echo $thisproduct->getName(); ?>"
><img src=
"<?php echo $this->helper(’catalog/image’)->init($thisproduct, ’small_image’)->resize(200) ?>"
width=
"200"
height=
"200"
alt=
"<?php echo $thisproduct->getName(); ?>"
/></a>
</li>
<?php
}
}
?>
</ul>
</div>
<!--
for
show other product-->