Community Forums

[How To] Multi-Store on Localhost

General support for technical problems with OpenCart v1.x

[How To] Multi-Store on Localhost

Postby fido-x » Fri Apr 30, 2010 2:14 am

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".
Image
If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
User avatar
fido-x
 
Posts: 1958
Joined: Fri Jun 27, 2008 12:09 pm
Location: Tasmania, Australia

Re: [How To] Multi-Store on Localhost

Postby Qphoria » Fri Apr 30, 2010 9:14 am

Awesome. Thanks for this
ImageImage
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 19127
Joined: Mon Jul 21, 2008 2:02 pm
Donate to Qphoria

Re: [How To] Multi-Store on Localhost

Postby buckmajor » Sun May 16, 2010 10:17 am

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 :)
buckmajor
 
Posts: 99
Joined: Mon May 03, 2010 10:29 pm
Location: Brisbane

Re: [How To] Multi-Store on Localhost

Postby SteveSherry » Sun May 16, 2010 5:27 pm

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.
SteveSherry
 
Posts: 583
Joined: Wed Apr 07, 2010 6:47 pm
Location: Wirral, UK

Re: [How To] Multi-Store on Localhost

Postby cmebd » Mon May 17, 2010 6:51 am

Could Fido's helpful piece be put into the Documentation please?
A stupid question is the one you -don't- ask.........(Anon)

)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4
User avatar
cmebd
 
Posts: 403
Joined: Thu Nov 12, 2009 10:17 pm
Location: Tasmania, Australia

Re: [How To] Multi-Store on Localhost

Postby SteveSherry » Tue May 25, 2010 7:24 am

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.
SteveSherry
 
Posts: 583
Joined: Wed Apr 07, 2010 6:47 pm
Location: Wirral, UK

Re: [How To] Multi-Store on Localhost

Postby nzoli » Wed Jun 02, 2010 9:46 am

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
nzoli
 
Posts: 6
Joined: Mon May 17, 2010 6:56 am

Re: [How To] Multi-Store on Localhost

Postby SteveSherry » Wed Jun 02, 2010 5:54 pm

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.
SteveSherry
 
Posts: 583
Joined: Wed Apr 07, 2010 6:47 pm
Location: Wirral, UK

Re: [How To] Multi-Store on Localhost

Postby fido-x » Thu Jun 03, 2010 7:13 am

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!
Image
If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
User avatar
fido-x
 
Posts: 1958
Joined: Fri Jun 27, 2008 12:09 pm
Location: Tasmania, Australia

Re: [How To] Multi-Store on Localhost

Postby karlpers » Mon Jun 07, 2010 10:57 am

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!
karlpers
 
Posts: 172
Joined: Tue Jun 09, 2009 9:35 am

Re: [How To] Multi-Store on Localhost

Postby SteveSherry » Mon Jun 07, 2010 11:14 am

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.
SteveSherry
 
Posts: 583
Joined: Wed Apr 07, 2010 6:47 pm
Location: Wirral, UK

Re: [How To] Multi-Store on Localhost

Postby karlpers » Wed Jun 09, 2010 9:14 am

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..

:/
karlpers
 
Posts: 172
Joined: Tue Jun 09, 2009 9:35 am

Re: [How To] Multi-Store on Localhost

Postby SteveSherry » Wed Jun 09, 2010 11:02 am

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.
SteveSherry
 
Posts: 583
Joined: Wed Apr 07, 2010 6:47 pm
Location: Wirral, UK

Re: [How To] Multi-Store on Localhost

Postby MattGSX » Wed Jun 09, 2010 3:53 pm

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?
Last edited by MattGSX on Wed Jun 09, 2010 4:02 pm, edited 1 time in total.
MattGSX
 
Posts: 54
Joined: Wed May 26, 2010 5:18 pm
Location: Oshkosh, WI US

Re: [How To] Multi-Store on Localhost

Postby MattGSX » Wed Jun 09, 2010 3:56 pm

Edit: Mod, feel free to delete - unnecessary multi-post
Last edited by MattGSX on Wed Jun 09, 2010 4:02 pm, edited 1 time in total.
MattGSX
 
Posts: 54
Joined: Wed May 26, 2010 5:18 pm
Location: Oshkosh, WI US

Re: [How To] Multi-Store on Localhost

Postby MattGSX » Wed Jun 09, 2010 3:59 pm

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.
MattGSX
 
Posts: 54
Joined: Wed May 26, 2010 5:18 pm
Location: Oshkosh, WI US

Re: [How To] Multi-Store on Localhost

Postby airlinetimetables » Sun Jun 13, 2010 10:30 am

If you set up multistores, do you have to use separate domains, or could you use subdomains (store1.domain.com, store2.domain.com)?
airlinetimetables
 
Posts: 3
Joined: Fri Jun 04, 2010 5:25 pm

Re: [How To] Multi-Store on Localhost

Postby fido-x » Mon Jun 14, 2010 12:45 am

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.
Image
If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
User avatar
fido-x
 
Posts: 1958
Joined: Fri Jun 27, 2008 12:09 pm
Location: Tasmania, Australia

Re: [How To] Multi-Store on Localhost

Postby OCyvon2 » Sat Jul 10, 2010 5:45 am

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]

User avatar
OCyvon2
 
Posts: 274
Joined: Sun Jan 31, 2010 7:00 am
Location: Zaandam, The Netherlands

Re: [How To] Multi-Store on Localhost

Postby OCyvon2 » Sat Jul 10, 2010 6:11 am

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?
User avatar
OCyvon2
 
Posts: 274
Joined: Sun Jan 31, 2010 7:00 am
Location: Zaandam, The Netherlands

Next

Return to General Support

Who is online

Users browsing this forum: hjay, JAY6390, oxidegarlic, paulfeakins, rph, yslimsg and 145 guests

Hosted by Arvixe Web Hosting