I want to know that which listing mode is running i.e. grid or list using cookie in magento. I hope magento already setting up cookies for list mode :)
Any Idea?
This line of code taken from app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php:523 should get you something like this:
Mage::getSingleton('catalog/session')->getDisplayMode()
And in the exact same file, above line 517:
if ($mode == $defaultMode) {
Mage::getSingleton('catalog/session')->unsDisplayMode();
}
So, that means that, if you have nothing from the code Mage::getSingleton('catalog/session')->getDisplayMode()
, you are in the default mode (the one configured as the default in your admin or in your template.)
To understand the full logic please have a look at Mage::getSingleton('catalog/session')->getDisplayMode()
And depending on where you are trying to do that you can also try
$this->getChild('toolbar')->getCurrentMode();
As in app/code/core/Mage/Catalog/Block/Product/List.php:130