Skip to main content

Menambah Jumlah qty(quantity) di cart CI

June 9, 2011 by fananicenter

fananicenter's picture

hi semua,, mohon bantunnya!
saya lagi membuat Shopping cart menggunakan Library Cart Ci.

   <?php foreach($this->cart->contents() as $items): ?>
   <?php echo $items['qty']; ?>  //output 1,2 
   <?php endforeach;?> 

Jadi di atas adalah looping nilai dari $items['qty'] dan outputnya adalah 1 dan 2

Yang saya tanyakan bagaimana Menjumlah Value dari $items['qty']..??

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

akhirnya Ketemu jawabanya

June 11, 2011 by fananicenter, 2 days 23 hours ago
Comment: 8335

fananicenter's picture

jadi Untuk menjumlah quantity di cart Ci
seperti berikut

//deklarasi variable 
$totalqty = 0;
 
//looping Value dari Cart
<?php foreach($this->cart->contents() as $items): ?>
$totalqty += $items['qty'];
<?php endforeach; ?>
 
//menampilkan jumlah cart quantity
echo $totalqty;

hehe.. ^_^ semalaman g tidur teryata cuma gitu aja

Cuma butuh variabel

June 11, 2011 by ekopackerjozz, 2 days 22 hours ago
Comment: 8339

ekopackerjozz's picture

Intinya kita bikin variabel penampung jumlah

nubi ijin nyimak

June 11, 2011 by yudaprabu, 3 days 1 hour ago
Comment: 8333

yudaprabu's picture

ijin nyimak bos,,,
maaf sy msh pemula di CI

Premium Drupal Themes by Adaptivethemes