I have set my cart sidebar to show only 2 items that have been added to the basket through the admin panel, what I want to be able to do is create a link if more than 2 items have been added, so if a user added say 5 products the cart sidebar would display 2 items as normal and a link saying "view all 5 products in basket". I don't want the link to be visible if there are 2 or less items in the basket.

<?php $itemsCount = Mage::getSingleton('checkout/cart')->getItemsCount();?>
<?php if ($itemsCount > 2) : ?>
    <a href="<?php echo $this->getUrl('checkout/cart')?>"><?php echo $this->__('view all items')?></a>
<?php endif;?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.