Simple code in magento

It may help, for your doubt

(I). Get  Active Store details ?

Store =  Mage::app()->getStore();

Store Id  =  Mage::app()->getStore()->getStoreId();

Store code   = Mage::app()->getStore()->getCode();

Website Id =  Mage::app()->getStore()->getWebsiteId();

Store Name =  Mage::app()->getStore()->getName();

Is Active = Mage::app()->getStore()->getIsActive();

Store Home Url = Mage::app()->getStore()->getHomeUrl();

(II). Get the Total Price of items currently in the Cart :
<?php
echo $this->helper(‘checkout’)->formatPrice(Mage::getSingleton(‘checkout/cart’)->getQuote()->getGrandTotal());
?>

(III). Session Details :
<?php
$sessionId  = Mage::getModel(‘core/session’)->getSessionId();
$customerId = Mage::getModel(‘customer/session’)->getCustomerId();
$vistitorId = Mage::getModel(‘core/session’)->getVisitorId();
?>

(IV). How to enable Magento Compiler?

Magento Compiler comes by default in Magento 1.4 and higher versions.
To enable Magento Compiler follow the given steps:-
1. Goto Admin Panel
2. System -> Tools -> Compilation
3. Just click on “Enable” and then “Run Compilation Process”.

Leave a Reply