2013-02-20 59 views
0

对不起,问这个老问题,我知道我已经阅读之前,我问这里,它可以使用数据库添加更多的购物车没有限制。我已经尝试使用ci_sessions表来存储会话,但仍然没有运气,我只能最多添加6个项目。商店会议购物车到数据库

请帮帮我,我寻找一些例如这个几乎两天,结果是什么

EDITED 这是我的看法

<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> 

这里是我的控制器代码

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">&euro; <?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">&euro; <?php echo $this->cart->format_number($this->cart->total());?></span> 
        </td> 
       </tr> 
      </tfoot> 
     </table> 
    </div> 
    <?php endif;?> 

与此代码我想使用复选框以阵列插入,和我有超过6复选框

预先感谢您

+0

你面对的错误是什么,因为你说你尝试过...... – 2013-02-20 09:32:35

+0

@Alessandro Minoccheri我试图插入更多的车,但我总是有6个最大项添加 – ranggadablues 2013-02-20 09:39:50

+0

@Venkat没有错误,但我想要插入超过6个项目.. – ranggadablues 2013-02-20 09:40:52

回答

0

确定它是由我自己解决..

我不“知道,在产品的名称有特殊字符..

和我的耻辱..

但是谢谢你的好意