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

Magento Multiple Website issue
 
lwp2009
Jr. Member
 
Total Posts:  4
Joined:  2012-03-12
 

Hello -

I’ve been attempting to add an additional website to an existing install.

The existing install has a URL structure of: www.mydomain.com/store/

This URL directs to the default store installation (which is a store for the USA market).

Magento is installed in ~/public_html/store/ accordingly.

I’d like to no add a second website for the Canadian market (primarily to permit a different base currency and a different payment account on a gateway).

The ideal structure would either be: www.mydomain.com/store/ca/ or ca.mydomain.com/store/.

I’ve tried both, but hit the same problem - that problem being when I go to the new URL, I land on the default Magento theme and get a 404 error.

I’ve followed such examples as indicated here: http://www.crucialwebhost.com/kb/how-to-setup-multiple-magento-stores/

In either the sub-directory or sub-domain case, I’ve copied the base installation’s index.php and .htaccess, and made changes as indicated (I’ve included the subdomain case here for an example):

index.php:

$compilerConfig '../../public_html/store/includes/config.php';
if (
file_exists($compilerConfig)) {
    
include $compilerConfig;
}

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

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

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

Mage::run($mageRunCode$mageRunType);

.htaccess:

    
RewriteBase /store/

I’ve created the Website, Store, and Store view as appropriate, and updated the base_unsecure and base_secure URLs in the appropriate scope.

I’m looking for any suggestions as to why I’m getting a Magento 404 on the store’s main page when going to ca.mydomain.com/store/

Many thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
serpyre
Enthusiast
 
Avatar
Total Posts:  771
Joined:  2013-05-20
 

You need to create symlinks to the base install for both subdomain and subdirectory.

htdocs/website_01/
htdocs/website_01/index.php
htdocs/website_01/.htaccess <-- symlink
htdocs/website_01/app/ <--symlink
htdocs/website_01/includes/ <--symlink
htdocs/website_01/js/ <--symlink
htdocs/website_01/skin/ <--symlink
htdocs/website_01/media/ <--symlink
htdocs/website_01/var/ <--symlink

But unfortunately it will not help from a business perspective. You see, Google likes subdomains but visitors do not, visitors like sub-directories but Google does not (duplicate content among other things). The correct way is either multi-tld (.com & .ca) or just .com and multi-country. The problem is that multi-country on a single domain is not available in Magento, we license solutions to do this. Even though you can technically have it working with subdomains or subdirectories you will find in the coming months it only solves half your problem and only boosts your revenue by 20% instead of the 50-100% you are expecting.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lwp2009
Jr. Member
 
Total Posts:  4
Joined:  2012-03-12
 

Thanks for your reply.

For simplicity I’ll refer to the subdirectory method. So the primary (USA) store is at www.mydomain.com/store/ and is working just fine. The document base is at ~/public_html/store/

I’ve created a subdirectory at ~/public_html/store/ca/, copied .htaccess and index.php into the subdirectory, modified as above (minor correction, the ReWrite Base in .htaccess is /store/ca/ in the subdirectory), and symlink’ed the other pertinent directories (/app, /js, /skin, /media, ...).

My problem is I’m always getting the generic 404 page when I go to www.mydomain.com/store/ca/

The particular desired outcome is to have two identical stores, same categories, same descriptions, same prices. The only differences between the two stores:
1. Base Currency is USD for the USA store and CAD for the Canadian store. This is so Canadian customers are charged in Canadian dollars via the payment gateway
2. Displayed currencies are in USD for USA customers and CAD for Canadian customers.

I realize #2 could be achieved with multiple display currencies and a GeoIP store switcher, but #1 cannot.

The store already exists (as a ZenCart implementation) and is being migrated to Magento. But the inability to process Canadian payments in CAD and USA payments in USD is a significant issue. The only means I can find to resolve it is via the multiple websites. We’re not looking to increase business - we’re looking to cure a significant customer complaint (Canadian credit card companies charge a premium when billing in USD).

Any assistance is greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lwp2009
Jr. Member
 
Total Posts:  4
Joined:  2012-03-12
 

One other bit of information, in case it matters - both Stores in the Magento backend point to the same Root Category, and the root category is set to visible and anchor.

 
Magento Community Magento Community
Magento Community
Magento Community
 
serpyre
Enthusiast
 
Avatar
Total Posts:  771
Joined:  2013-05-20
 

Have you set the store home page in configuration, have you cleared the cache, have you set the store base url, have you change the store code in index.php. For (1) you do understand that you need to manually updae all the prices, if you change the USD store is does -not- update the CA store as well, it is one of the major failings of Magento. Category will make no difference.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lwp2009
Jr. Member
 
Total Posts:  4
Joined:  2012-03-12
 

Hi - Thanks again for your reply.

Everything is set correctly, as you’ve outlined.

I discovered the problem this morning by inserting:

var_dump($e->getTraceAsString());
into Mage.php immediately before the 404 exception is thrown. Turns out the issue was an incompatibility with this extension: http://www.wakamage.com/auto-switch-store-view-magento-extension

which had been previously installed to switch amongst store views in the Main Website. Once the extension was removed and it’s local version of App.php eliminated, the sub-directory website functions properly.

Prices changes actually do propagate correctly between the stores properly, and the base install relies upon the currency conversion tables for properly adjusting the prices.

Thanks again for your assistance.

 
Magento Community Magento Community
Magento Community
Magento Community
 
serpyre
Enthusiast
 
Avatar
Total Posts:  771
Joined:  2013-05-20
 

No problem, that is the cost of extensions, they have a habit of breaking things. Good luck.

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