判断一个产品是否为新品,组合产品,如果一个产品既是组合产品,又是新品,那么输出为:新产品!!!!

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

你可能感兴趣的:(Date,产品)