|
谢谢limpiang的提醒,我试验了几遍
第一步:
把view.php原代码中<?php echo $curr_product->delivery_fee; ?>
修改为<?php echo intval($curr_product->delivery_fee); ?>
结果:没有出现问题
第二步:
把viewok.php原代码中<?php echo $curr_product->discount_price; ?>
修改为<?php echo intval($curr_product->discount_price); ?>
结果:没有出错
第三步:
在view.php里做下面更改后会报错,
把viewok.php原代码中<?php echo $curr_product->price; ?>
修改为 <?php echo intval($curr_product->price); ?>
点击商品后,链接的商品页面不表示内容,
Parse error: syntax error, unexpected ';' in C:\wwwroot\web\view\mod_product\view.php on line 15
-----------------------------------------------------------------------------------------------------------
view.php修改后的源码
<?php if (!defined('IN_CONTEXT')) die('access violation error!'); ?>
<div class="art_list">
<div class="art_list_title product_title"><?php echo $curr_product->name; ?></div>
<div class="prodview_info"><?php _e('Category'); ?>: <?php echo $curr_product->masters['ProductCategory']->name; ?>
<?php _e('Publish Time'); ?>: <?php echo date('Y-m-d H:i', $curr_product->create_time); ?> </div>
<div class="artview_intr"><?php echo $curr_product->introduction; ?></div>
<div class="prodview_pic jqzoom"><!--a href="<?php echo $curr_product->feature_img; ?>" title="<?php echo $curr_product->name; ?>" class="thickbox">
<img name="picautozoom" src="<?php echo $curr_product->feature_smallimg; ?>" alt="" border="0" align="left" class="productimg" /></a-->
<img name="picautozoom" src="<?php echo $curr_product->feature_smallimg; ?>" alt="" jqimg="<?php echo $curr_product->feature_img; ?>" /></div>
<div class="prodview_prices">
<?php if ($curr_product->online_orderable && EZSITE_LEVEL=='2') { ?>
<?php if ($curr_product->discount_price != $curr_product->price) { ?>
<?php _e('Price'); ?> : ¥<?php echo intval($curr_product->price); ?><br />
<?php _e('Discount Price'); ?> : ¥<?php echo intval($curr_product->discount_price); ?><br />
<?php } else { ?>
<?php _e('Price'); ?> : ¥<?php echo intval($curr_product->price); ?><br />
<?php } ?>
<?php _e('Delivery Fee'); ?> : ¥<?php echo intval($curr_product->delivery_fee); ?><br />
<?php _e('Quantity'); ?> : <?php echo Html::input('text', 'prod_num_'.$curr_product->id, $_COOKIE['n_prd'][$curr_product->id]?$_COOKIE['n_prd'][$curr_product->id]:1, 'size="4"'); ?><br />
<input type="button" class="add_to_cart_b_view" value="<?php _e('Add to cart'); ?>" onclick="add2cart('<?php echo $curr_product->id; ?>');return false;" />
<?php } ?></div>
<div class="prodview_content"><?php
$pos = strpos($_SERVER['PHP_SELF'],'/index.php');
$path = substr($_SERVER['PHP_SELF'],0,$pos);
if(strpos($curr_product->description,$path.'/') == 0) {
$curr_product->description = str_replace('/admin/fckeditor',$path.'/admin/fckeditor',$curr_product->description);
}
echo $curr_product->description; ?></div>
<?php if (defined('SYSVER')) { ?>
<p id="product_gallery">
<?php
$curr_product->loadRelatedObjects(REL_CHILDREN, array('ProductPic'));
$ext_pics = $curr_product->slaves['ProductPic'];
if (sizeof($ext_pics) > 0) {
foreach ($ext_pics as $pic) {
?>
<a href="<?php echo $pic->pic; ?>" rel="product_gallery" class="thickbox">
<img class="product_gallery_pic" src="<?php echo $pic->pic; ?>" /></a>
<?php
}
}
?>
</p>
<?php } ?>
</div>
-------------------------------------------------------------------------------------------------------------------
view.php修改前的源码
<?php if (!defined('IN_CONTEXT')) die('access violation error!'); ?>
<div class="art_list">
<div class="art_list_title product_title"><?php echo $curr_product->name; ?></div>
<div class="prodview_info"><?php _e('Category'); ?>: <?php echo $curr_product->masters['ProductCategory']->name; ?>
<?php _e('Publish Time'); ?>: <?php echo date('Y-m-d H:i', $curr_product->create_time); ?> </div>
<div class="artview_intr"><?php echo $curr_product->introduction; ?></div>
<div class="prodview_pic jqzoom"><!--a href="<?php echo $curr_product->feature_img; ?>" title="<?php echo $curr_product->name; ?>" class="thickbox">
<img name="picautozoom" src="<?php echo $curr_product->feature_smallimg; ?>" alt="" border="0" align="left" class="productimg" /></a-->
<img name="picautozoom" src="<?php echo $curr_product->feature_smallimg; ?>" alt="" jqimg="<?php echo $curr_product->feature_img; ?>" /></div>
<div class="prodview_prices">
<?php if ($curr_product->online_orderable && EZSITE_LEVEL=='2') { ?>
<?php if ($curr_product->discount_price != $curr_product->price) { ?>
<?php _e('Price'); ?> : ¥<?php echo $curr_product->price; ?><br />
<?php _e('Discount Price'); ?> : ¥<?php echo intval($curr_product->discount_price); ?><br />
<?php } else { ?>
<?php _e('Price'); ?> : ¥<?php echo intval($curr_product->price); ?><br />
<?php } ?>
<?php _e('Delivery Fee'); ?> : ¥<?php echo intval($curr_product->delivery_fee); ?><br />
<?php _e('Quantity'); ?> : <?php echo Html::input('text', 'prod_num_'.$curr_product->id, $_COOKIE['n_prd'][$curr_product->id]?$_COOKIE['n_prd'][$curr_product->id]:1, 'size="4"'); ?><br />
<input type="button" class="add_to_cart_b_view" value="<?php _e('Add to cart'); ?>" onclick="add2cart('<?php echo $curr_product->id; ?>');return false;" />
<?php } ?></div>
<div class="prodview_content"><?php
$pos = strpos($_SERVER['PHP_SELF'],'/index.php');
$path = substr($_SERVER['PHP_SELF'],0,$pos);
if(strpos($curr_product->description,$path.'/') == 0) {
$curr_product->description = str_replace('/admin/fckeditor',$path.'/admin/fckeditor',$curr_product->description);
}
echo $curr_product->description; ?></div>
<?php if (defined('SYSVER')) { ?>
<p id="product_gallery">
<?php
$curr_product->loadRelatedObjects(REL_CHILDREN, array('ProductPic'));
$ext_pics = $curr_product->slaves['ProductPic'];
if (sizeof($ext_pics) > 0) {
foreach ($ext_pics as $pic) {
?>
<a href="<?php echo $pic->pic; ?>" rel="product_gallery" class="thickbox">
<img class="product_gallery_pic" src="<?php echo $pic->pic; ?>" /></a>
<?php
}
}
?>
</p>
<?php } ?>
</div>
--------------------------------------------------------------------------------------------------------------
修改前的状态可以去掉优惠价和邮费的小数点,价格上的小数点去不掉。 |
|