Page 1 of 6

[How To] Multi-Store on Localhost

Posted: Fri Apr 30, 2010 3:14 pm
by fido-x
Objective
Create 2 "sub" stores of your main store, called "store_1" and "store_2".

Assumptions
XAMPP for Windows
XAMPP installation directory: C:\xampp
OpenCart Store directory: C:\xampp\htdocs\store
Main Store URL: http://localhost/store

Edit Apache Configuration File
What we are going to do is create an "alias" for each store.
Open the Apache configuration file (C:\xampp\apache\conf\httpd.conf) and find the section that starts with "<IfModule alias_module>", and insert the following inside this section:-

Code: Select all

Alias /store_1 "C:/xampp/htdocs/store"
Alias /store_2 "C:/xampp/htdocs/store"
Then restart your Apache server from the XAMPP control panel.

There are 2 things you should note about the above alias entries:
(1) Forward slashes are used for directory paths in the Apache configuration file, NOT backslashes as would normally be used in Windows.
(2) Both aliases point to the same directory - your main store's directory. This would be the same for any other "sub" store you may wish to create.

OpenCart Configuration
Log in to your administration and from the menu, select "System->Settings" and create 2 new stores. You can call them whatever you want.
Give one a Store URL of "http://localhost/store_1/" and the other a Store URL of "http://localhost/store_2/".

You should now be able to access your new stores at "http://localhost/store_1" and "http://localhost/store_2", with your main store still at "http://localhost/store".

Re: [How To] Multi-Store on Localhost

Posted: Fri Apr 30, 2010 10:14 pm
by Qphoria
Awesome. Thanks for this

Re: [How To] Multi-Store on Localhost

Posted: Sun May 16, 2010 11:17 pm
by buckmajor
Cool! Are we able to build Multi-Store when we go online? If so, what are the maximum stores to have on one website?

Thanks in advance
CHEERS :)

Re: [How To] Multi-Store on Localhost

Posted: Mon May 17, 2010 6:27 am
by SteveSherry
This has worked very well for me, and I can really see this working in the future.
Does anyone know how to apply this to a website?

I assume that I'd need to have 2(or more) domain names on the one hosting account, but i'm not sure.
I'm with UK fasthosts, and they are not the most helpful on support.

Re: [How To] Multi-Store on Localhost

Posted: Mon May 17, 2010 7:51 pm
by cmebd
Could Fido's helpful piece be put into the Documentation please?

Re: [How To] Multi-Store on Localhost

Posted: Tue May 25, 2010 8:24 pm
by SteveSherry
I've now moved to another host and have set up multi-store.
it works like a dream.

there area few little "problems", but these are related to modules etc not being restricted to one store, but in general it is a great idea.

Re: [How To] Multi-Store on Localhost

Posted: Wed Jun 02, 2010 10:46 pm
by nzoli
Thanks for this! It's working!!
I have a question too :)

How do I specify a different addresses in my shop (not url)?
So the main 1. shop's address is e.g. Paris Eiffel street, the second shop's address is Budapest Heroes square....

thanks again

Re: [How To] Multi-Store on Localhost

Posted: Thu Jun 03, 2010 6:54 am
by SteveSherry
nzoli wrote:How do I specify a different addresses in my shop (not url)?
You can't.

Multistore is possibly going to be looked at in future versions, but nothing in the most recent versions, or the upcoming 1.4.8 will handle this.

Re: [How To] Multi-Store on Localhost

Posted: Thu Jun 03, 2010 8:13 pm
by fido-x
SteveSherry wrote:
nzoli wrote:How do I specify a different addresses in my shop (not url)?
You can't.

Multistore is possibly going to be looked at in future versions, but nothing in the most recent versions, or the upcoming 1.4.8 will handle this.
I've been doing a bit of work on some kind of "Store Manager" for a client that will do this. I've been trying to keep it as independent as I can but, obviously, modifying some of the core files is unavoidable, especially when it comes to validation of product ownership (individual "store managers" should only be able to see their own products, not those of other users). There's also the issue of what they should be allowed to access in the administration. And then, there's some kind of "payment manager" that needs to be associated with each user, so that payment received for products sold goes to the right store owner. Lot of work!

Re: [How To] Multi-Store on Localhost

Posted: Mon Jun 07, 2010 11:57 pm
by karlpers
Hi everyone,

I take the chance to ask a stupid question in this thread.

Lets say I want to use the multistore functionality. (only in reason to have more then one language indexing at google)

I havent found any documentation about installing several stores anywere. But tell me what I do wrong:)

1. I installed the "main store" at one domain.
2. I configured the main store to have two stores, the second store was placed at another domain at the same host.
3. I uploaded all files even to the second domain.

I guess there is something missing in the connection between the second store and the admin panel that works for the main store.

How do I configure it? Please, I guess more users would have a step by step guide how to set up multistores.

Thanks!

Re: [How To] Multi-Store on Localhost

Posted: Tue Jun 08, 2010 12:14 am
by SteveSherry
You need to "point" your second domain to the folder which contains your existing OC installation.
this will enable both www.domain1.com and www.domain2.com to run the same installed code.

Re: [How To] Multi-Store on Localhost

Posted: Wed Jun 09, 2010 10:14 pm
by karlpers
Hi again,

Thanks for the answer.

Right now I have made a setup at domain1, and have pointed the domain2 to the domain1 and configured a new store via the admin panel as a multistore correctly (I think)

Isnt there any more to do? Right now Im just directed to the domain1 to the same store as the one which is configured as domain2 if im typing in domain2.com..

:/

Re: [How To] Multi-Store on Localhost

Posted: Thu Jun 10, 2010 12:02 am
by SteveSherry
bear in mind that this is adding a domain to your account and then pointing it to the same folder as the other.
it is NOT forwarding one domain to another.

Re: [How To] Multi-Store on Localhost

Posted: Thu Jun 10, 2010 4:53 am
by MattGSX
EDIT: I resolved this issue and posted "how" as it was a simple user error, likely the cause of other problems as well.

I'm actually having a similar problem, so I am pretty sure it's not a domain redirect issue.

1. Create subdomain teststore.domain.com.
2. Set document root for teststore.domain.com as public_html/ (doc root for my live store).
3. Set up multistore on domain.com.
4. When I go to teststore.domain.com, it displays my main site, even though I specified a diff. template, etc. Technically, I should have an empty framework, as I didn't specify any products or product categories for my 2nd site.

My thought is it has to do with my .htacess and the way the server is handling redirection. Keep in mind, I'm also using SmartOptimizer (to cache pages server-side to improve load time), and I was trying to handle my www resolve redirect through htaccess, which could also be causing the problem.

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

RewriteEngine On
RewriteBase / 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$


RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$


<IfModule mod_expires.c>
	<FilesMatch "\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt)$">
		ExpiresActive On
		ExpiresDefault "access plus 10 years"
	</FilesMatch>
</IfModule>
<IfModule mod_rewrite.c>
	RewriteEngine On
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.*\.(js|css))$ smartoptimizer/?$1
	
	<IfModule mod_expires.c>
		RewriteCond %{REQUEST_FILENAME} -f
		RewriteRule ^(.*\.(js|css|html?|xml|txt))$ smartoptimizer/?$1
	</IfModule>

	<IfModule !mod_expires.c>
		RewriteCond %{REQUEST_FILENAME} -f
		RewriteRule ^(.*\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt))$ smartoptimizer/?$1
	</IfModule>
</IfModule>
<FilesMatch "\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt)$">
	FileETag none
</FilesMatch>
Any thoughts? I know it's not the SmartOptimizer, but I'm thinking maybe SEO URLs + www resolve?

Re: [How To] Multi-Store on Localhost

Posted: Thu Jun 10, 2010 4:56 am
by MattGSX
Edit: Mod, feel free to delete - unnecessary multi-post

Re: [How To] Multi-Store on Localhost

Posted: Thu Jun 10, 2010 4:59 am
by MattGSX
ISSUE SOLVED!

I think that it is the same thing that karlpers is experiencing.

In the multistore setup, you MUST have a / at the end of the address. I had the store set as http://test.domain.com, and it should have been http://test.store.com/.

______________________

Now, I have one more issue that I need to figure out regarding checkout.

I want to allow shoppers from my "multi-store" to use their credit card, which goes through FirstData using the API (not connect). Fortunately, I can send req's from any URL that I want, but my SSL is registered to www.domain.com, so using SSL at http://test.domain.com is out. I obviously don't want customers to enter CC data w/o security, so I need to figure out a way to handle ALL checkout through domain.com instead of individualstores.domain.com and have cookie data transfer.

Re: [How To] Multi-Store on Localhost

Posted: Sun Jun 13, 2010 11:30 pm
by airlinetimetables
If you set up multistores, do you have to use separate domains, or could you use subdomains (store1.domain.com, store2.domain.com)?

Re: [How To] Multi-Store on Localhost

Posted: Mon Jun 14, 2010 1:45 pm
by fido-x
airlinetimetables wrote:If you set up multistores, do you have to use separate domains, or could you use subdomains (store1.domain.com, store2.domain.com)?
Yes, you can use subdomains.

Re: [How To] Multi-Store on Localhost

Posted: Sat Jul 10, 2010 6:45 pm
by OCyvon2
What do I have to write in de htaccess file when I have two diferent shops on one domain (each in a different subdomein).
something like this:

Code: Select all

Options +FollowSymlinks

RewriteEngine On
RewriteBase / 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ /shop1/index.php?_route_=$1 [L,QSA]
RewriteRule ^(.*)\?*$ /shop2/index.php?_route_=$1 [L,QSA]


Re: [How To] Multi-Store on Localhost

Posted: Sat Jul 10, 2010 7:11 pm
by OCyvon2
fido-x wrote:Objective
Create 2 "sub" stores of your main store, called "store_1" and "store_2".

Assumptions
XAMPP for Windows
XAMPP installation directory: C:\xampp
OpenCart Store directory: C:\xampp\htdocs\store
Main Store URL: http://localhost/store

Edit Apache Configuration File
What we are going to do is create an "alias" for each store.
Open the Apache configuration file (C:\xampp\apache\conf\httpd.conf) and find the section that starts with "<IfModule alias_module>", and insert the following inside this section:-

Code: Select all

Alias /store_1 "C:/xampp/htdocs/store"
Alias /store_2 "C:/xampp/htdocs/store"
Then restart your Apache server from the XAMPP control panel.

There are 2 things you should note about the above alias entries:
(1) Forward slashes are used for directory paths in the Apache configuration file, NOT backslashes as would normally be used in Windows.
(2) Both aliases point to the same directory - your main store's directory. This would be the same for any other "sub" store you may wish to create.

OpenCart Configuration
Log in to your administration and from the menu, select "System->Settings" and create 2 new stores. You can call them whatever you want.
Give one a Store URL of "http://localhost/store_1/" and the other a Store URL of "http://localhost/store_2/".

You should now be able to access your new stores at "http://localhost/store_1" and "http://localhost/store_2", with your main store still at "http://localhost/store".
Wow this really works a lot better.
Can you tell me how I can do this online on a real domain?