Shopping Cart - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Shopping Cart (/showthread.php?tid=52316) Pages:
1
2
|
Shopping Cart - El Forum - 06-06-2012 [eluser]the_unforgiven[/eluser] I put in this = Code: <?php echo (count($this->cart->total_items())); ?> Which shows 1 once I add 1 item to the cart but adding more items currently there's 6 in it still shows 1, any idea's please? Thanks in advance... :-) Shopping Cart - El Forum - 06-06-2012 [eluser]beaudierman[/eluser] The reason it's returning 1 is because you're using the PHP count function, which isn't working because of the multi-dimensional array that is being put in it. The cart class' total_items function returns an integer already so the count function isn't needed. This should return 6 if you have 6 items in your cart: Code: <?php echo $this->cart->total_items(); ?> Shopping Cart - El Forum - 06-06-2012 [eluser]the_unforgiven[/eluser] Yer, silly me!! :0 thanks for that, well now i can move on everything else works the update the cart destroy it was just the total items things that was holding me up! Now i can move on with great thanks to you "beaudierman" Shopping Cart - El Forum - 06-06-2012 [eluser]beaudierman[/eluser] You're welcome, I'm glad I could help! |