Last active
December 15, 2015 04:29
-
-
Save loopool/5202103 to your computer and use it in GitHub Desktop.
Get magento store urls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get Magento Store Info | |
Get store data | |
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(); | |
//Get Url in phtml files | |
1. Get Base Url : | |
Mage::getBaseUrl(); | |
2. Get Skin Url : | |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); | |
(a) Unsecure Skin Url : | |
$this->getSkinUrl('images/imagename.jpg'); | |
(b) Secure Skin Url : | |
$this->getSkinUrl('images/imagename.gif', array('_secure'=>true)); | |
3. Get Media Url : | |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); | |
4. Get Js Url : | |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); | |
5. Get Store Url : | |
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); | |
6. Get Current Url | |
Mage::helper('core/url')->getCurrentUrl(); | |
//Get Url in cms pages or static blocks | |
1. Get Base Url : | |
{{store url=""}} | |
2. Get Skin Url : | |
{{skin url='images/imagename.jpg'}} | |
3. Get Media Url : | |
{{media url='/imagename.jpg'}} | |
4. Get Store Url : | |
{{store url='mypage.html'}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment