Codeigniter 将会话购物车存储到数据库
很抱歉问这个老问题,我知道在我问之前我已经读过了,它可以使用数据库添加更多购物车而不受限制。我已经尝试使用ci_sessions表来存储会话,但仍然没有成功,我最多只能添加6个项目 请帮助我,我为这几乎两天寻找一些例子,结果是什么都没有 已编辑 这是我的看法Codeigniter 将会话购物车存储到数据库,codeigniter,session,shopping-cart,Codeigniter,Session,Shopping Cart,很抱歉问这个老问题,我知道在我问之前我已经读过了,它可以使用数据库添加更多购物车而不受限制。我已经尝试使用ci_sessions表来存储会话,但仍然没有成功,我最多只能添加6个项目 请帮助我,我为这几乎两天寻找一些例子,结果是什么都没有 已编辑 这是我的看法 <table id="box-table-a" summary="Employee Pay Sheet"> <thead> <tr>
<table id="box-table-a" summary="Employee Pay Sheet">
<thead>
<tr>
<th scope="col">Description</th>
<th scope="col">Price</th>
<th class="centered" scope="col">Options</th>
</tr>
</thead>
<tbody>
<?php foreach ($foto_produk->result() as $key => $value) {?>
<tr>
<td><?php echo $value->description;?></td>
<td><?php echo $value->price;?></td>
<td class="centered"><input type="checkbox" name="produk_foto[]" value="<?php echo $value->id;?>" /></td>
</tr>
<?php }?>
</tbody>
</table>
描述
价格
选择权
好的,我自己解决了
我不知道在产品名称中是否有特殊的字符
还有我的耻辱
但无论如何谢谢你你说你尝试了……,你面临的错误是什么?@Alessandro Minoccheri我尝试插入更多购物车,但我总是最多有6件物品adding@Venkat这里没有错误,但我想插入6个以上的项目..没有code@Alessandro我已经发布了我的代码
if($this->input->post('produk_foto')){
$id_foto = $this->input->post('produk_foto');
foreach ($id_foto as $key => $value) {
$this->db->where('id', $value);
$query = $this->db->get('foto_product');
if($query->num_rows() > 0){
foreach($query->result() as $ids => $rows){
echo $rows->id.'<br />';
$data_produk = array(
'user_data'=> array(
'id' => $rows->id,
'price' => $rows->price,
'name' => $rows->description,
'qty' => $rows->aantal
)
);
$this->cart->insert($data_produk);
}
}
}
}
<?php if(!$this->cart->contents()):?>
<div class="alert-box warning">The regular products are empty.</div>
<div class="clearfix"></div>
<?php else:?>
<hr>
<h4>REGULAR PRODUCTS</h4>
<div class="order_detail" id="Display">
<table>
<thead>
<tr>
<th>DESCRIPTION</th>
<th>QUANTITY</th>
<th>PRICE PER ITEM(S)</th>
<th>TOTAL</th>
<th>REMOVE</th>
</tr>
</thead>
<tbody>
<?php foreach($this->cart->contents() as $rows):?>
<tr>
<td style="font-weight:bold;"><?php echo $rows['name'];?></td>
<td>
<?php echo form_open(current_url());?>
<input type="text" size="3" name="quantity" value="<?php echo $rows['qty'];?>" />
<input type="hidden" size="3" name="rowid" value="<?php echo $rows['rowid'];?>" />
<input type="submit" name="update" value="Update" />
<?php echo form_close();?>
</td>
<td><?php echo $rows['price'];?></td>
<td><?php echo $this->cart->format_number($rows['subtotal']);?></td>
<td><a href="<?php echo base_url('index.php/en/payment/delete_item_product/'.$rows['rowid'].'');?>">delete</a></td>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan="3">Total Products</td>
<td colspan="3">€ <?php echo $this->cart->format_number($this->cart->total());?></td>
</tr>
<tr>
<td colspan="3">Total Shipping</td>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="3"></td>
<td colspan="3" style="padding:0;text-align:center;">
<p>TOTAL :</p>
<span class="tot">€ <?php echo $this->cart->format_number($this->cart->total());?></span>
</td>
</tr>
</tfoot>
</table>
</div>
<?php endif;?>