Here are 2 ways to get home URL of Magento stores
1. By store CODE
2. By store ID
1. By store CODE
01
02
03
04
05
06
07
08
09
10
11
12
13
| function getStoreByCode( $storeCode ) { $stores = array_keys (Mage::app()->getStores()); foreach ( $stores as $id ){ $store = Mage::app()->getStore( $id ); if ( $store ->getCode()== $storeCode ) { return $store ; } } return null; // if not found } $store = getStoreByCode( 'default' ); $store ->getUrl( '' ); |
2. By store ID
1
2
| $storeId = 1; Mage::getModel( 'core/store' )->load( $storeId )->getUrl( '' ); |
No comments:
Post a Comment