Display %s item(s) in shopping cart on toolbar

Hi, The word “item” in the toolbar is always with a “s” even if there is just 1 item in the shopping cart:
“Shopping Cart (1 items)”.
But it work when there is 0 item:
“Shopping Cart (0 item)”.
See the toolbar website of my client in development: http://gid.dev3-dialoguenet.com/collections/100-ans-noir-sur-blanc.html 
Your code in jmtoolbar.phtml is: 

<span><?php echo $this->__(“Shopping Cart “) ?>
<?php
if(Mage::getSingleton(‘checkout/session’)->getQuote()->getSubtotal() > 0) {
echo ‘(<a class=”gotocart” href=”‘.Mage::getUrl(“checkout/cart”).'”>’.Mage::getSingleton(‘checkout/session’)->getQuote()->getItemsSummaryQty().’&nbsp;’.$this->__(‘items’).'</a>)’;
} else {
echo ‘(<a class=”gotocart” href=”‘.Mage::getUrl(“checkout/cart”).'”>’.Mage::getSingleton(‘checkout/session’)->getQuote()->getItemsSummaryQty().’&nbsp;’.$this->__(‘item’).'</a>)’;
}
?>

Can you help me. Thank you,
 
Manon
 

3 answers

Profile photo of Ziven Staff 100720.00 $tone August 23, 2016
Public

Hi Manon,
Please replace it with this code. 

 <span><?php echo $this->__("Shopping Cart ") ?>
<?php
$count = $this->helper('checkout/cart')->getSummaryCount(); //get total items in cart
if($count > 0) {
if($count == 1) {
echo '(<a class="gotocart" href="'.Mage::getUrl("checkout/cart").'">'.Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty().'&nbsp;'.$this->__('item').'</a>)';
} else{
echo '(<a class="gotocart" href="'.Mage::getUrl("checkout/cart").'">'.Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty().'&nbsp;'.$this->__('items').'</a>)';
}
} else {
echo '(<a class="gotocart" href="'.Mage::getUrl("checkout/cart").'">'.Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty().'&nbsp;'.$this->__('item').'</a>)';
}
?>

Please let me know if you need help further.
Best Regards,
Ziven.

#1

Please login or Register to Submit Answer

Written By

Comments