Sachin Endait
Sachin Endait

Reputation: 135

Cart items in magento

I want to display the cart items in magento. Currently it's display on the basis on product qty, but I want to display them on number of product added into the cart.

E.g. If I added 1 product of 1kg and other product of 0.500grms then in header displays 1.5 items, I want to display it as 2 items.

Any suggestions? My Magento version is 1.9.0.1

Upvotes: 0

Views: 158

Answers (3)

piCode
piCode

Reputation: 36

There is a config setting field under System > Configuration > Sales > Checkout > My Cart Link with two options: "Display number of items in cart" and "Display item quantities". Choose the second option and your displaying issue will be solved.

Upvotes: 1

Kandarp B Patel
Kandarp B Patel

Reputation: 1061

There are 2 functions available for Item count.

1) Mage::helper('checkout/cart')->getItemsCount() -- return shopping cart items count means how many sku add to shopping cart.

2) Mage::helper('checkout/cart')->getSummaryCount() -- return shopping cart items summary (suppose you add sku1 6 qty and sku2 3 qty = total 9 qty return)

You can use 1st function.

Upvotes: 2

Vladimir Ramik
Vladimir Ramik

Reputation: 1930

Documentation here:

app\code\core\Mage\Checkout\Block\Cart\Minicart.php

Points to a config setting in Magento admin:

admin/system_config/edit/section/checkout/

My cart link

For edge cases you may need to loop through the cart and quantify as desired yourself.

Upvotes: 0

Related Questions