search
top

Magento Essentials

I am listing below important variable used in Magento.


<?php
echo Mage::app()->getFrontController()->getRequest()->getHttpHost();
//displays host name

echo Mage::getBaseDir();  //gives  physical path of the sites root directory

echo $this->getSkinURL(); //gives  relative path of the sites default skin folder

echo Mage::getBaseURL(); //gives  relative path of the site

echo Mage::getURL(); //gives  relative path of the site

echo $customerEntityType = Mage::getModel('eav/entity')->setType('customer')->getTypeId();
//customer type

$website = Mage::getModel('core/website')->load( 'base', 'code');
echo $websiteID = $website->getId(); //current website id

echo $websiteID = Mage::app()->getStore()->getWebsite()->getId();
//current website id

echo Mage::getStoreConfig('system/website/name');
//displays website name

echo Mage::getStoreConfig('system/store/name');
//displays store name

echo $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
//currency code ex.EUR

echo $currency_code = Mage::app()->getStore()->getBaseCurrency();
//currency code  

echo $currency_code = Mage::app()->getStore()->getDefaultCurrency();
//currency code 

$_coreHelper = $this->helper('core');
echo $_coreHelper->currency('5');
//will output $5, if default currency is Dollar
?>

Leave a Reply

top