We are running one Magento install over multiple domains and are using a script to fetch information from the database to help users filter the products.
In our coding we have the $_SERVER
function calling the store which seems to be store 1 (which is on domain 1), I was wondering what I would need to change to fetch the information from store 2 (which is on domain 2).
echo Mage::getBaseUrl ();
will return the Store url only i.e. abc.com/store1.
In order to get the Main store URL (domain name), use the following code
echo Mage::getBaseUrl (Mage_Core_Model_Store::URL_TYPE_WEB);
OR
you can get the current domain by the $_SERVER['HTTP_HOST'];
Be aware that $_SERVER['SERVER_NAME'] is not available on Magento scheduler (cron) tasks (unless you put some effort on it) - just realised that today
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With