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
?>

4 Responses to “Magento Essentials”

  1. tuba says:

    wow… perfect, I was looking for magento physical path to check if brand logo exists or not.

    Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) worked perfectly!

    thank you!

  2. Paul says:

    Thius displays the storeVIEWname, but we need storename, any idea how to get it? It all goes from website to storeview, none mention store itself;-)

    Mage::getStoreConfig(‘system/store/name’)

  3. tuba says:

    Nice information to develop magento theme, thanks!

Leave a Reply

top