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().’ ’.$this->__(‘items’).'</a>)’;
} else {
echo ‘(<a class=”gotocart” href=”‘.Mage::getUrl(“checkout/cart”).'”>’.Mage::getSingleton(‘checkout/session’)->getQuote()->getItemsSummaryQty().’ ’.$this->__(‘item’).'</a>)’;
}
?>
Can you help me. Thank you,
Manon
3 answers
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().' '.$this->__('item').'</a>)';
} else{
echo '(<a class="gotocart" href="'.Mage::getUrl("checkout/cart").'">'.Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty().' '.$this->__('items').'</a>)';
}
} else {
echo '(<a class="gotocart" href="'.Mage::getUrl("checkout/cart").'">'.Mage::getSingleton('checkout/session')->getQuote()->getItemsSummaryQty().' '.$this->__('item').'</a>)';
}
?>
Please let me know if you need help further.
Best Regards,
Ziven.
Hi Ziven,
With the code you gave me it work perfectly. Thank you very much. Manon 🙂
Hi Manon,
You are welcome. Please let me know if you need help further.
Best Regards,
Ziven.