2017-08-09 3 views
0

Ich möchte die Menge eines Einkaufswagens aktualisieren. Ich habe es viel google aber konnte es nicht tun.Wie wird die Warenkorbmenge in CodeIgniter aktualisiert?

Maximale Seiten zeigen, was ich nicht will. Genaue Lösung bekomme ich nicht. Hoffentlich komme ich hierher. Bitte hilf mir, es zu tun. Hier ist meine Ansicht Seite.

**<table class="table table-hover table-bordered table-striped snipcart-details "> <thead> 
       <tr> 
        <th style="color:#FF0033; font-weight:bolder; text-align:center;" >Delete Cart</th> 
        <th style="color:#FF0033; font-weight:bolder; text-align:center;" >Product Name</th> 
        <th style="color:#FF0033; font-weight:bolder; text-align:center;" >Image</th> 
        <th style="color:#FF0033; font-weight:bolder; text-align:center;" >Price</th> 
        <th style="color:#FF0033; font-weight:bolder; text-align:center;" >Quantity</th>      
        <th colspan="2" style="color:#FF0033; font-weight:bolder; text-align:center;" >Total</th> 
       </tr> 
       </thead> 
       <tbody>     
       <?php foreach ($this->cart->contents() as $items) { ?> 
       <tr>      
        <td style="color:#000000; font-weight:bolder; text-align:center;" > 
        <a href="#" class="remove_cart" title="delete" row_id="<?php echo $items['rowid']; ?>" rel="1"> 
        <i class="fa fa-times fa-2x" style="color:red;" aria-hidden="true"></i> </a></td> 
        <td style="color:#000000; font-weight:bolder; text-align:center;" ><?php echo $items['name']; ?></td> 
        <td align="center"><img src="<?php echo base_url('resource/allproduct/'.$items['productImage']);?>" height="50px;" /></td></td> 
        <td style="color:#000000; font-weight:bolder; text-align:center;"><?php echo $items['price']; ?></td> 
        <td align="center"><input type="number" name="qty" id="qty" value="<?php echo $items['qty']; ?>"></td>    
      <td colspan="2" style="color:#000000; font-weight:bolder; text-align:center;">TK <?php echo $this->cart->format_number($items['subtotal']); ?></td> 
       </tr> 
       <?php } ?> 
      </tbody>     
      <tbody> 
       <tr>      
        <th scope="row"><a href=""> <input type="button" name="submit" value="Update" class="button" /> </a></th> 
        <td align="center"><a href="<?php echo site_url('home'); ?>"> <input type="button" name="submit" value="Continue Shopping" class="button" /></a></td> 
        <td colspan="3" class="button" align="center" >  
            <?php if(!empty($userid)){?> 
            <a href="<?php echo site_url("checkout"); ?>"><input class="button" type="submit" value="Place Order"></a> 
            <?php } else {?> 
            <a href="<?php echo site_url("login"); ?>"><input class="button" type="submit" value="Place Order"></a>          
            <?php }?>              
        </td> 
        <td align="center" style="color:#000000;" > <h4>Grand Total</h4> </td> 
        <td style="font-size:24px; font-weight:800; color:green;">TK <?php echo $this->cart->format_number($this->cart->total()); ?></td>   
       </tr> 
      </tbody> 
     </table>** 

Und hier ist Controler.

public function index() 
{ 
    $data['basicinfo']   = $this->M_cloud->basicall('basic_info'); 
    $where      = array('status' => 1); 
    $data['categoryinfo']  = $this->M_cloud->categoryinfo('item_manage', $where); 
    $data['rows']    = count($this->cart->contents());  
    $data['userid']    = $this->session->userdata('user_id');  
    $data['subcategoryinfo'] = $this->M_cloud->findAll2('sub_category', array('status' => 1));  
    $data['menuinformation'] = $this->M_cloud->findReport('our_service', array('serviceType'=> 2), 'menuname asc'); 
    $data['menuservice']  = $this->M_cloud->findReport('our_service', array('serviceType'=> 1), 'menuname asc');  
    $data['socialmedia']  = $this->M_cloud->findAll('social_tbl', 'name asc'); 
    $data['newsinfo']   = $this->M_cloud->findAll('news_table', 'newstitle DESC'); 
    $this->load->view('cartPage', $data);  
} 

    public function buy() 
{ 
    $proId = $this->input->post('proId'); 
    $Qty = $this->input->post('Qty'); 
    $prosize = $this->input->post('prosize');  
    $result = $this->M_cloud->find('product_manage', array('proid' => $proId));  
    $data2 = array(
       'id'     => $proId, 
       'qty'     => $Qty, 
       'name'     => $result->proName, 
       'price'     => $result->price, 
       'prosize'    => $prosize, 
       'productImage'   => $result->proimg1, 
       'product_code'   => $result->procode     
      ); 
    $this->cart->insert($data2);   
    redirect('cart'); 
} 

public function deleteCartItem() { 
    $row_id    = $this->input->post('row_id'); 
    $data = array(
     'rowid' => $row_id, 
     'qty'  => 0 
    ); 
    $this->cart->update($data); 
} 

Bitte helfen Sie mir, die Warenkorbmenge zu aktualisieren. Danke im Voraus.

Antwort

0

Zum Warenkorb Artikel aktualisieren:

function updateCartItem(){ 
     $data=array(
      'rowid'=>$this->input->post('rowid',TRUE), 
      'qty'=> $this->input->post('quantity',TRUE) 
      ); 

       if ($this->cart->update($data)) { 
       echo "Success";   
       }else{ 
        echo "Faliure"; 
       } 

} 

den Artikel aus dem Warenkorb zu entfernen:

function deleteCartItem(){ 
$row_id = $this->input->post('row_id',TRUE); 
    if ($rowid) { 
      return $this->cart->remove($rowid); 
     } 
} 
+0

Wo ist die Ansicht Seite Aktion? – Sumonto

+0

Ich kann Ihnen mit Fehlern nicht mit der Funktionalität helfen Sie müssen Ihre eigene Warenkorb Seite –

+0

Ich möchte sagen, wie in Aktion die Kontrolle zu rufen? das ist es nur oder etwas anderes, was ich anrufen sollte ???? Bitte lassen Sie mich wissen – Sumonto

Verwandte Themen