慕容的工作随笔

慕容的工作随笔

记录学习和工作

判断一个产品是否为新品,组合产品

2011-10-24 21:49:00

<?php
//判断是否为组合产品!
if($_product->getTypeId()==“grouped”){
// echo “product type:”.$_product->getTypeId();
$group_s = 1;
}
?>
<?php
//判断是否为新品。
$news_from_date = strtotime($_product[’news_from_date’]);
$news_to_date = strtotime($_product[’news_to_date’]);
$now1 = strtotime(date(‘Y-m-d h:i:s’,time()));
if(($news_to_date>$now1)&&($news_from_date<$now1)){
$new_s = 1;
//echo ’new-product’;
}
?>
<?php
if($new_s ==1){
echo ’new-product’;
}elseif($group_s==1){
echo “product type:”.$_product->getTypeId();
}
$new_s = 0;
$group_s = 0;
?>

评论 (0)

还没有评论,来做第一个吧。

发表评论

提交后需管理员审核通过后显示