我遇到了问题
我已经在我的购物车中添加了一些产品,但它们没有第一次显示:查看我必须刷新浏览器的产品。
然后我可以在购物车中看到产品信息。
到目前为止,我做到了这一点。
<?php
if($Cart->hasItems())
{
$i=0;
foreach ( $Cart->getItems() as $order_code=>$quantity)
{
$i++;
}
echo $i;
}
else
{
echo 0;
}
?>
</span>
Item - Rs.
<span class="price" id="header_total_price">
<?php
echo $_SESSION['total_amount'];?></span><span class="bottomarrow">
</span>
</span>
<div class="cart" id="carts">
<?php if ( $Cart->hasItems()) :
?>
<table width="150px" height="100px" id="mycartcart" border="1">
<tr>
<th>Image</th>
<th>Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th>Delete</th>
</tr>
<?php
$jid = $_REQUEST['projectid'];
?>
<?php
$total_price = $i = 0;
foreach ( $Cart->getItems() as $order_code=>$quantity):
$id=$Cart->getProductcode($order_code);
$product = "select * from ".JOB." where job_id='$jid'";
$product_access= $acedb->dbselect($product);
$price=$quantity*$product_access['price_of_lead'];
$total_price+=$quantity*$product_access['price_of_lead'];
?>
<tr>
<td>
<img alt="<?php echo $product_access['company_logo'];?>"
src="<?php echo BASE_URL;?>companylogo/<?php echo
$product_access['company_logo']; ?>" />
</td>
<td>
<span>
<?php echo strtoupper($product_access['job_title']); ?>
</span>
</td>
<td class="quantity">
<input size="1" disabled="disabled" type="text" class="cart_quantity"
name="quantity[<?php echo $order_code; ?>]"
value="<?php echo $quantity; ?>"
tabindex="<?php echo $i; ?>" />
</td>
<td class="unit_price">Rs.<?php echo $product_access['price_of_lead']; ?></td>
<td id="extended_price" class="extended_price">Rs.<?php echo $price; ?></td>
<td class="remove center">
<input class="deletecomeincart" type="button" name="remove[]" title="Remove"
style='color:#FFF; border-radius:20px; background-
image:url(../images/icons/close.png); padding:5px; background-color:#fff;
background-repeat:no-repeat; background-
position:center;border:0px;cursor:pointer; font-size: 0; height: 25px; width:
30px;' value="<?php echo $order_code; ?>" />
</td>
</tr>
<?php
endforeach;
$_SESSION['total_amount']=$total_price;
?>
</table>
<tr>
<td>
<a href="<?php echo BASE_URL; ?>product/viewcart.php" class="viewCart">View Cart
</a>
</td>
</tr>
<?php
else:
?>
<p>Your shopping cart is empty!</p>
<?php
endif;
?>
</div>
我不知道我做错了什么。