<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
$cols = $p_cols;

?>

		<div class="newprod">
				<div class="newprod_title">产品中心</div>
				<div class="newprod_top"></div>
				<div class="newprod_con">

            <script type="text/javascript" language="javascript">
            <!--
                function updatecartstate(response) {
                    var o_result = _eval_json(response);
                    if (!o_result) {
                        return addprodfailed(response);
                    }
                    
                    if (o_result.result == "ERROR") {
                        alert(o_result.errmsg);
                        return false;
                    } else if (o_result.result == "OK") {
                        $("#disp_n_prds").html(o_result.n_prds);
                        alert("<?php _e('The product has been added to cart!'); ?>");
                        return true;
                    } else {
                        return on_failure(response);
                    }
                }
                
                function addprodfailed(response) {
                    alert("<?php _e('Request failed!'); ?>");
                    return false;
                }
                
                function add2cart(p_id) {
                    var p_num = document.getElementById("prod_num_" + p_id).value;
                    _ajax_request("mod_cart", "addtocart", 
                        { p_id: p_id, p_num: p_num }, updatecartstate, addprodfailed);
                }
            //-->
            </script>
			
<?php
$n_prd = sizeof($products);
$i=0;
if ($n_prd > 0){

foreach ($products as $product) {
		$product->loadRelatedObjects(REL_PARENT, array('ProductCategory'));
		$i++;
?>					
						<div class="newprod_list">
							
							<div class="newprod_pic"><a href="<?php echo $product->feature_img; ?>" class="thickbox"><img src="<?php echo $product->feature_smallimg;?>" /></a></div>
								<div class="newprod_name"><a href="index.php?<?php echo Html::xuriquery('mod_product', 'view', array('p_id' => $product->id)); ?>" target="_blank"><?php echo $product->name?></a></div>							
								<div class="newprod_price1">原价：￥<?php echo ($product->price) ?> | <span>现价：￥<?php echo ($product->discount_price) ?></span></div>
								<div class="newprod_intr"><?php echo $product->introduction;?></div>
														
						</div>
						<?php if ($i % $cols == ($cols-1)) { ?><div class="blankbar1"></div><?php } ?>
					<?php }
					} ?>
					
				<div class="blankbar1"></div>
				</div>
				<div class="list_bot"></div>
			</div>
			<div class="blankbar"></div>
			