GithubHelp home page GithubHelp logo

mtessar / spree-multi-site Goto Github PK

View Code? Open in Web Editor NEW

This project forked from romul/spree-multi-site

2.0 2.0 1.0 130 KB

Fork of fork of eastmedia's spree-multi-site extension with new features and spree-edge support

spree-multi-site's Introduction

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.