I am adapting the modern theme to create a new theme to use.
I need to display all the products in the customers basket. I have this code and currently it only displays up to three items. Is there a different command I can use instead of getRecentItems()
to display all the items in their basket? I tried using getAllItems()
but this does not seem to do anything.
<?php $items = $this->getRecentItems();?>
<?php if(count($items)): ?>
<ol id="cart-header" class="mini-products-list">
<?php foreach($items as $item): ?>
<?php echo $this->getItemHtml($item) ?>
<?php endforeach; ?>
</ol>
<?php else: ?>
<?php echo $this->__('There are no items in your shopping Basket.') ?>
<?php endif ?>
Any Ideas ?
Check in System > Configuration > Checkout > Shopping Cart Side Bar
There is a setting to set the number of products that can be visible in the mini cart.
Maximum Display Recently Added Item(s) by default is 3. Increase it to what you want it to be or rather a high number to always show all products in the cart.
EDIT: To override the default magento behavior based on your comments you could use the following.
<?php
$session= Mage::getSingleton('checkout/session');
$items = $session->getQuote()->getAllItems();
?>
<?php if(count($items)): ?>
<ol id="cart-header" class="mini-products-list">
<?php foreach($items as $item): ?>
<?php echo $this->getItemHtml($item) ?>
<?php endforeach; ?>
</ol>
<?php else: ?>
<?php echo $this->__('There are no items in your shopping Basket.') ?>
<?php endif ?>
The Mage_Checkout_Block_Cart_Sidebar method getRecentItems() accepts a count param, just call it in this way to retrieve the full cart items.
<?php $items = $this->getRecentItems(10000);?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With