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

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;
?>

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注