看起来很基本,但我坚持在这一个。foreach循环在循环内添加值
$value = 0;
foreach($this->products->result() as $this->product)
{
$value += $this->product->price;
}
//$value += $this->get_order_shipping_cost($orders_id);
return $value;
应该被添加到创建总价格,然后将外循环添加运输成本,但由于某些原因,我的循环只返回第一个值,所以我某处覆盖的东西的价值。
'$这个 - >产品 - >结果()'这是什么?它是一系列产品吗? – maxjackie 2012-01-02 12:53:26
你确定你的循环是否运行到预期的否。时间?可能只是它的一次运行! – Arfeen 2012-01-02 12:55:57