searchgoods.phtml 2.31 KB
<?php 
$field = 'less';
$imgSize = '290x388';
$type = 'showskn';
$is_new = empty($params['is_new']) ? 'N' : $params['is_new'];
if (!empty($params['recom_list'])) {//推荐商品
	if (!empty($params['recom_list']['recom'])) {
		$data_list = $params['recom_list']['recom'];
	}else if (!empty($params['recom_list']['sales'])) {//销量商品
		$data_list = $params['recom_list']['sales']['match_list'];
		$type = '';
	}
}

if (!empty($data_list)) {
	foreach ($data_list as $key => $val) {
		
		if ($type == 'showskn') {
			$key = QINProduct_Models_Product_Client::getProductIdByProductSkn($val['product_skn']);
		}
		$goodsList = QINProduct_Models_Goods_Client::getValidGoodsByProduct($key);
		if(empty($goodsList)){
			continue;
		}
		$price = QINProduct_Models_Price_Client::getPrice($key);
		if(empty($price)){
			continue;
		}
		$selectColor = 0;
		$showGoods = QLibView_Sidebar::selectGoodsByColor($goodsList,$selectColor);
		$product = QINProduct_Models_Product_Client::getOneProduct($key,$field);
		$yohood = QINProduct_Models_Activities_Link_Client::getActivitiesBySkn($product['erp_product_id'], 1);
		$cnAlphabet = $product['cn_alphabet'];
		$showUrl = QLibConfigs_Static::$siteUrl . QINLib_Utils::getProductUrl($key, $showGoods['id'], $cnAlphabet);
		$showProductImg = QINLib_Images::QFSImage($showGoods['color_image'], 'goodsimg', $imgSize, 4);
		?>
	                 <li><b>
			            <a href="<?php echo $showUrl;?>">
			            <?php if (!empty($yohood)) {?>
            <div id="yohood-tag"><img src="http://static.yohobuy.com/m/v1/img/weixin/yohood_03.png" width="52"/></div>
            <?php }?>
			                <img src="<?php echo $showProductImg;?>" alt="<?php echo $product['product_name'];?>" />
			            </a>
			            <?php if($is_new == 'Y'){?><p class="tag">新品推荐</p><?php }?>
			            <p class="name"><a href="<?php echo $showUrl;?>" ><?php print Q_Utils_String::format()->mbSubstr( $product['product_name'],28);?></a></p>
			            <p class="price"><?php if ($price['market_price'] == $price['sales_price']) {?>
	                    ¥<?php echo number_format($price['sales_price'],2);} else {?><a class="line">¥<?php echo number_format($price['market_price'], 2);?></a> <a class="red">¥<?php echo number_format($price['sales_price'], 2);?></a><?php }?></p>
	            	</b></li>
	<?php }
}?>