Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

If cart has contents then…
 
the311guy
Sr. Member
 
Avatar
Total Posts:  120
Joined:  2007-10-18
 

I need to make something appear if the cart contents are > 1.  Is there a snippet of code for the number of items in the cart?

thanks! smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
eklusman
Jr. Member
 
Avatar
Total Posts:  25
Joined:  2008-10-09
 

Look for sidebar.phtml, you will see that it gets the number of items in the cart and calls the variable $_cartQty.
There it also checks if its >0 and other things, so you can see how it works.

 
Magento Community Magento Community
Magento Community
Magento Community
 
the311guy
Sr. Member
 
Avatar
Total Posts:  120
Joined:  2007-10-18
 

I need to add this if to my footer (or a page which appears everywhere), but it is not working.... am I doing something wrong?  im not a coder, so im just trying to hack my way through.... (failing).....heres the code i am trying:

<?php if ($_cartQty>0): ?>
        
         there is more than zero items in cart


            <?php 
endif ?>

any help would be wonderful

 
Magento Community Magento Community
Magento Community
Magento Community
 
the311guy
Sr. Member
 
Avatar
Total Posts:  120
Joined:  2007-10-18
 

bump!  please help!  pleeeaaassseeee!

 
Magento Community Magento Community
Magento Community
Magento Community
 
the311guy
Sr. Member
 
Avatar
Total Posts:  120
Joined:  2007-10-18
 

okay, I found this bit of code:  <?php echo $this->getSummaryCount() ?> it seems to work on the sidebar cart, but if I add it to the header or footer it does not work, no variable appears.  Why is this?  Do I have to include something with this to make it work on other pages?

much thanks!!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top