Magento Forum

   
Multi-store not working
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 

Hello,

i have 2 stores and uses multistore. This works but the problem is that the multistore name is not added to the url.

So i get: http://www.website.nl\catalog\product.html

And i want: http://www.website.nl\store1\catalog\product.html

This is important for search engines. Otherwise you get a wrong link and the customer can find the product but is redirected to the wrong store view.

I know there is an option in the system like Store Code in URLs. But this doesn’t work, even when i reindex and flush the cache.

Does someone know this problem of can help me out? I use Magento 1.7.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
vjtemplates
Guru
 
Avatar
Total Posts:  408
Joined:  2010-12-15
Washington, USA
 

You can define the complete base URL for each store from System - Config - Web.

 
Magento Community Magento Community
Magento Community
Magento Community
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 

Thanks,

I tried this before but a payment option which is in the root doesn’t work any more then.

But is it save to do?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ydeveloper
Jr. Member
 
Total Posts:  2
Joined:  2012-03-06
 

Are you talking about multistores as two separate sub domains running on a single domain, then you should copy sitemap and create a structure that is to be easy for search engine to crawl.

If above is not true, the another scenario is to handle multiple ecommerce store running on different platforms managed by a single system, and you want to customize it, then i recommend you to refer this page, [http://www.ydeveloper.com/multiple-store-management-from-single-admin-panel.html]

 
Magento Community Magento Community
Magento Community
Magento Community
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 

thanks,

I have tried to make 2 store on 1 domain.

Store 1: http://www.spellenhuis.nl/warhammer/
Store 2: http://www.spellenhuis.nl/spellen/

Both works but the problem is the next.  When i have an url with warhammer in the name, the url goes to that store. For example: http://www.spellenhuis.nl/warhammer/
But when i’m on this store and i put in an url with spellen in it. I get een error and the the warhammer store stay’s on. So for example: http://www.spellenhuis.nl/spellen/

So what has i done wrong?

What i did is changing the Basis link-URL from http://www.spellenhuis.nl to http://www.spellenhuis.nl/spellen/. And ofcourse for the other store the same with warhammer.

So why does it works on one store and not on the other?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

Have you modified your index.php in the magento root folder? Please post the file content here.

 
Magento Community Magento Community
Magento Community
Magento Community
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 

Yes i have modified them.

So i made a copy of index and htaccess and put them in the directory of each store view. So the index file for the spellen directory is:

if (version_compare(phpversion(), '5.2.0''<')===true{
    
echo  '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
    exit;
}

/**
 * Error reporting
 */
error_reporting(E_ALL E_STRICT);

/**
 * Compilation includes configuration file
 */
$compilerConfig 'includes/config.php';
if (
file_exists($compilerConfig)) {
    
include $compilerConfig;
}

$mageFilename 
'/xxx/xxx/xxxxx/public_html/app/Mage.php';
$maintenanceFile 'maintenance.flag';

if (!
file_exists($mageFilename)) {
    
if (is_dir('downloader')) {
        header
("Location: downloader");
    
else {
        
echo $mageFilename." was not found";
    
}
    
exit;
}

if (file_exists($maintenanceFile)) {
    
include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}

require_once $mageFilename;

#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage
::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE''';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE''store';

$mageRunCode 'spellen';
$mageRunType 'store';
Mage::run($mageRunCode$mageRunType);

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

...in the directory of each store view.

How is your folder structure for the different store views? There are a few ways to implement multishop, how dit you do it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 

Hello,

I use subdirectory’s.

So i made 2 directory’s in the root. So 1 is called warhammer and the other is called spellen.

After that i copied the index and htaccess files from the root and put them in both directory’s.

And changed the index file in both directory’s from:

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE''';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE''store';

Mage::run($mageRunCode$mageRunType);

to:

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE''';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE''store';

$mageRunCode 'warhammer';
$mageRunType 'store';
Mage::run($mageRunCode$mageRunType);

This works but not 100%

 
Magento Community Magento Community
Magento Community
Magento Community
 
leebcdter
Jr. Member
 
Total Posts:  2
Joined:  2012-12-11
 

I get the same issue, thanks for any help about it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

You don`t need subfolders for multistores.

1) Set the base url for the warhammer store to http://www.spellenhuis.nl/warhammer/
2) Set the base url for the spellen store to http://www.spellenhuis.nl/spellen/
3) Edit the index.php from the root directory (the subfolders for warhammer and spellen can be deleted) such like this on the bottom:

switch($_SERVER['HTTP_HOST']{
      
case "www.spellenhuis.nl/warhammer/":
      case 
"spellenhuis.nl/warhammer/":
        
Mage::run("warhammer""store");
    break;

    default:
        
Mage::run("spellen""store");
    break;
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 

Thanks,

That should be much better indeed.

I tried:

switch($_SERVER[\'HTTP_HOST\']{
      
case \"www.spellenhuis.nl/warhammer/\":
      case 
\"spellenhuis.nl/warhammer/\":
        
Mage::run(\"warhammer\"\"store\");
    break;
    
    case 
\"www.spellenhuis.nl/spellen/\":
      case 
\"spellenhuis.nl/spellen/\":
        
Mage::run(\"spellen\"\"store\");
    break;

    default:
        
Mage::run(\"spellen\"\"store\");
    break;
}

I look like it works but the urls are not right. When i wanna go to http://www.spellenhuis.nl/spellen/bordspellen it gives an error and stay on the homepage. And if i remove spellen/ from the url it will work. Switch between the stores is no problem.

So what else has to change? And ofcourse i have deleted cache.

And i removed:

/* Store or website code */
$mageRunCode = isset($_SERVER[\'MAGE_RUN_CODE\']) ? $_SERVER[\'MAGE_RUN_CODE\'\'\';

/* Run store or run website */
$mageRunType = isset($_SERVER[\'MAGE_RUN_TYPE\']) ? $_SERVER[\'MAGE_RUN_TYPE\'\'store\';

Mage::run($mageRunCode$mageRunType);

from the index in the root.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

I just tryed http://www.spellenhuis.nl/spellen/bordspellen and it works.....

 
Magento Community Magento Community
Magento Community
Magento Community
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 

That is true because i changed it back. It is a working website so when it doesn’t work i change it back.

So your code would work if i don’t add the name “spellen” of “warhammer” to the url. So why can’t he find that url with these name in it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
steefking
Member
 
Total Posts:  46
Joined:  2012-01-22
 
Siggi_Schmitz - 12 December 2012 12:51 AM

You don`t need subfolders for multistores.

1) Set the base url for the warhammer store to http://www.spellenhuis.nl/warhammer/
2) Set the base url for the spellen store to http://www.spellenhuis.nl/spellen/
3) Edit the index.php from the root directory (the subfolders for warhammer and spellen can be deleted) such like this on the bottom:

switch($_SERVER['HTTP_HOST']{
      
case "www.spellenhuis.nl/warhammer/":
      case 
"spellenhuis.nl/warhammer/":
        
Mage::run("warhammer""store");
    break;

    default:
        
Mage::run("spellen""store");
    break;
}

I see what i have done. I changed the Basis link-URL instead of the Basis-URL. I was hopping this could work. Now i’m lossing the old links.

It also kills the link to js and skin files. So you have to change them as well.

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