Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Multiple Stores > Home Page > Alternatives
 
Jack the Knife
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2007-09-06
Saint Louis
 

I’ve looked high and low for an answer to this, we are testing this albeit in a very beta mode, our company hopes to run this once RC is available.  So my boss has me “running it through the ringer” stage right now.

We have four sites running on the installation, and have been configuring one Skin/Template, now we’re getting to the content of the Home pages, there’s no way to set alternate content in the home page according to the CMS, there is however a home.phtml in /app/design/frontend/TEMPLATE/default/template/catalog/ it houses the same information but does it not call upon this file if there’s a “home” in the CMS?

Thank you in advance for any help you can provide, it’s vexing me something fierce.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Magnus Wester
Member
 
Avatar
Total Posts:  42
Joined:  2007-09-02
Stockholm, Sweden
 

This whole business is very much hard-coded into the 0.6.12383 build. For the time being, I’ve solved it the way described below. There may be more elegant solutions, and the “official” way will probably be completely different, but for now this works for me.

This solution ignores the Default URL settings in Admin > System > Configuration > Web, but so does the Magento code in this build.

This solution doesn’t support multiple languages - it shows the same “not-found” page regardless of the language setting. So does the Magento code in this build.

INDEX FILE

I modified the index file to call the right store depending on the URL. This allows me to park additional URLs on top of the base Magento URL.

My index file also sets a global array through which I can pass parameters into Magento.

// Remove the port number, if any, from the host name
$httpHost explode(':'$_SERVER['HTTP_HOST']);

// Split the full domain name into its parts
$domainParts explode("."$httpHost[0]);

// Remove a leading "www" since it is not a true subdomain
if ($domainParts[0] == "www"{
    array_shift
($domainParts);
}
// Determine the highest offset
$domainPartsUBound sizeof($domainParts) - 1;

// Assemble the base domain name (e.g. microsoft.com)
$domainName $domainParts[$domainPartsUBound-1] "." $domainParts[$domainPartsUBound];

// Re-assemble the subdomain name (e.g. support.microsoft.com) without the "www"
$subdomainName $domainParts[0];
for (
$x=1$x <= $domainPartsUBound$x++) {
    $subdomainName 
$subdomainName "." $domainParts[$x];
}

// Determine what store this is for
switch($domainName{
  
case 'firstsite.com':
    
$userGlobals['home'"mbfa-home";
    
$userGlobals['no-route'"mbfa-en-not-found";
    
$userGlobals['favicon'"mbfa.ico";
    
$store "mbfaen";
        break;
  case 
'demosite.com':
    
$userGlobals['home'"home";
    
$userGlobals['no-route'"no-route";
    
$userGlobals['favicon'"favicon.ico";
    
$store "base";
        break;
}

require 'app/Mage.php';
Mage::run($store);

INDEXCONTROLLER.PHP

The IndexController.php script uses hard-coded names for the home and no-route pages. I simply modified it to use the setting from the index file instead.

The path for this file is /app/code/core/Mage/Cms/controllers/.

class Mage_Cms_IndexController extends Mage_Core_Controller_Front_Action
{
    
public function indexAction($coreRoute null)
    
{
      
global $userGlobals// Magnus
      
if (isset($userGlobals['home']))
      
{
        Mage
::getSingleton('cms/page')->load($userGlobals['home']);
      
}
      
else
      
{
        Mage
::getSingleton('cms/page')->load('home');
      
}
        $this
->_forward('view''page');
    
}
    
    
public function noRouteAction($coreRoute null)
    
{
      
global $userGlobals// Magnus
      
if (isset($userGlobals['no-route']))
      
{
        Mage
::getSingleton('cms/page')->load($userGlobals['no-route']);
      
}
      
else
      
{
        Mage
::getSingleton('cms/page')->load('no-route');
      
}
        $this
->_forward('view''page');
    
}
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Magnus Wester
Member
 
Avatar
Total Posts:  42
Joined:  2007-09-02
Stockholm, Sweden
 

Sorry, there was a typo in the second global statement in the IndexController.php mod - fixed.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jack the Knife
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2007-09-06
Saint Louis
 

Thank you for the info, I will give that a try!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top