Skip to content

fork of squeejee's spree-multi-site extension with spelling error corrections, bug fixes, and new features

Notifications You must be signed in to change notification settings

eastmedia/spree-multi-site

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Squeejee Spree Multi-Site Extension

The extension will allow you to setup multiple sites with one spree installation. It gives you the ability to have different domains that direct to different stores with different layouts. Orders, taxonomies and products will all be site specific entities now.

Site Overview

To administer all of the sites go to /admin/sites. There you can create a site instance. Each site needs the following defined:

  1. Name: Each site needs a name defined for it. It is used purely for display purposes in the admin tool. It can be used in a layout template as well.

  2. Domain: Each site requires a domain to tell which site it should display. So, if you want a site on www.spreeshopping.com you would enter in that domain name here. It will identify the site regardless of what port number you are coming in on (3000 which is the default for the development, 80 for http, and 443 for https).

  3. Layout (optional): If you want a different layout for your site, you enter in the layout name here. Example: 'localhost' would look for the layout 'localhost.html.erb' in your app/views/layout directory. In addition, if nothing is provided, it will use the default 'application' layout.

Admin Changes

In addition to having a new section in the admin to manage sites and their domain, a few more things have been added to the following sections.

  1. Taxonomies: In the Taxonomies section, you will now see that they are associated with Sites. If you loaded the sample data you will see that they are associated with 'local'. You can change what site a taxonomy is associated with by editing the taxonomy. Click 'edit' on a taxonomy and you will have a drop-down now where you can associate which site the taxonomy is associated with. Only taxonomies that are associated with a site will display for that site

  2. Products: If you select a product from the admin to edit you will now notice in the 'Product Details' section that the site name for a product is selected from a dropdown ('local' by default). Only products that are associated with a site will display in a site.

  3. Orders: On the 'order listing' page, you will now see what site an order was placed on. If you click into the details of the order you will also see what site the order was placed on in the 'Order Details' section.

Note that sites are also now stored in a parent/child relationship using nested sets. With this, an admin of a parent site is able to see orders and products for their site and all child sites.

Installation

To install:

script/plugin install git://github.com/collectiveidea/awesome_nested_set.git  
script/extension install git://github.com/tunagami/spree-multi-site.git

If you haven't already "bootstrapped" the spree database, when you run the bootstrap rake task, all of the the schemas and sample data will be created/updated. If you just want to install the table schema and not use the sample data you can just run the rake task:

rake db:migrate

...otherwise if you want to have all of the sample data along with the sample data, you can run these rake tasks:

rake db:migrate
rake spree:extensions:multi_site:bootstrap_multi_site

Update "config/spree_permissions" file with the following so that an top level admin can give admin access to users at lower level sites:

'Admin::BaseController':
  permission1:
    roles : [admin]
    options :
      unless : "current_user.is_a?(User) and current_user.has_role?('admin_' + current_site.name)"

To Do's

  • Potentially allow products & taxonomies to be associated with multiple sites (If this makes sense to do)

About

fork of squeejee's spree-multi-site extension with spelling error corrections, bug fixes, and new features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%