$data = array(
'id' => $product['id'],
'qty' => $num,
'price' => $product['price'],
'name' => $product['name'],
'options' => array( 'weight' => $product['weight'],'is_group' =>$is_group )
);
$this->cart3->insert($data);
VIEW里面
<?php foreach($this->cart3->contents() as $items): ?>
<?php echo $items['qty']; ?>
<?php endforeach; ?>
是不是用的时候错了
$this->load->library('cart3');
$data = array(
'id' => $product['id'],
'qty' => 2,
'price' => $product['price'],
'name' => $product['name'],
'options' => array( 'weight' => $product['weight'],'is_group' =>1 )
);
$this->cart3->insert($data);
echo round($this->cart3->total(),2);
以上调运后,结果显示为0 在线等待,确实挺郁闷的。 好像CI成了负担,怎么会有这样的感觉!?碰到问题还不要解决!还请版主帮忙在看看,谢谢! 找到问题了,是这个位置被赋false。没法insert。把这个判断条件去掉就OK了,奇怪了!?
// --------------------------------------------------------------------
// Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods.
// Note: These can be user-specified by setting the $this->product_name_rules variable.
// if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name']))
// {
// log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces');
// return FALSE;
// }
本帖最后由 jeongee 于 2011-6-22 21:00 编辑
heping45 发表于 2011-6-22 20:57 static/image/common/back.gif
找到问题了,是这个位置被赋false。没法insert。把这个判断条件去掉就OK了,奇怪了!?
// ------------- ...
呵呵,name还有中文了?我之前精简了这个购物车类,呵呵
在哪儿?提供下,我看看!我直接把他给删了。哈哈问题是暂时决绝了!
heping45 发表于 2011-6-22 21:14 static/image/common/back.gif
在哪儿?提供下,我看看!我直接把他给删了。哈哈问题是暂时决绝了!
呵呵,如果你想要,明天上班时间问我要吧,在公司的电脑上呢 多个购物车很好搞啊
购物车里面不是有个option的选项吗?在option里面定义一个属性,比如:cart_no就可以了。 :Q 这个 session key值改哪个呢
页:
1
[2]