Skip to content

Commit

Permalink
Merge branch 'master' of github.com:drhenner/ror_ecommerce
Browse files Browse the repository at this point in the history
  • Loading branch information
drhenner committed Oct 12, 2012
2 parents 4b541fc + 9d9631d commit 54a1267
Show file tree
Hide file tree
Showing 35 changed files with 386 additions and 252 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Expand Up @@ -28,7 +28,14 @@ coverage/*
ERD.pdf
Gemfile.lock
config/config.yml
config/settings.yml
config/database.yml
db/*.db
/db/*.sqlite3
doc
db/schema.rb

doc/*

config/settings.local.yml
config/settings/*.local.yml
config/environments/*.local.yml
3 changes: 2 additions & 1 deletion Gemfile
Expand Up @@ -21,6 +21,7 @@ gem 'compass-rails'
gem "friendly_id", "~> 3.3"
gem 'haml', ">= 3.0.13"#, ">= 3.0.4"#, "2.2.21"#,
gem "jquery-rails"
gem "rails_config"

#gem 'memcache-client', '~> 1.8.5'
group :production do
Expand Down Expand Up @@ -58,7 +59,7 @@ group :development do
end
group :test, :development do
gem "rspec-rails", "~> 2.8.0"
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
gem 'capybara', "~> 1.1"#, :git => 'git://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'database_cleaner'
end
Expand Down
162 changes: 100 additions & 62 deletions README.md
Expand Up @@ -2,137 +2,176 @@

##Project Overview

Please create a ticket if on github you have issues. They will be addressed ASAP.
Please create a ticket on github if you have issues.
They will be addressed ASAP.

[Please look at the homepage for more details](http://www.ror-e.com)
Please look at the [homepage](http://www.ror-e.com) for more details.

![RoR Ecommerce](http://ror-e.com/images/logo.png "ROR Ecommerce")
![RoR Ecommerce](http://ror-e.com/images/logo.png "ROR Ecommerce").

This is a Rails e-commerce platform. Other e-commerce projects that use rails, don't use rails in a standard way. They use engines or are a separate framework altogether.
This is a Rails e-commerce platform. Other e-commerce projects that use rails don't use rails in a standard way.
They use engines or are a separate framework altogether.

ROR ecommerce is a *Rails 3 application* with the intent to allow developers to create an ecommerce solution easily. This solution includes, an Admin for *Purchase Orders*, *Product creation*, *Shipments*, *Fulfillment* and *creating Orders*. There is a minimal customer facing shopping cart understanding that this will be customized. The cart allows you to track your customers *cart history* and includes a *double entry accounting system*.
ROR Ecommerce is a *Rails 3 application* with the intent to allow developers to create an ecommerce solution easily.
This solution includes an Admin for *Purchase Orders*, *Product creation*, *Shipments*, *Fulfillment* and *creating Orders*.
There is a minimal customer facing shopping cart understanding that this will be customized.
The cart allows you to track your customers' *cart history* and includes a *double entry accounting system*.

The project has *solr searching*, *compass* and *blueprint for CSS* and uses *jQuery*. The gem list is quite large and the project still has a large wish list but it is the most complete solution for Rails today and it will only get better.
The project has *Solr searching*, *Compass* and *Blueprint for CSS* and uses *jQuery*.
The gem list is quite large and the project still has a large wish list.
In spite of that, it is currently the most complete Rails solution, and it will only get better.

Please use *Ruby 1.9.2* and enjoy *Rails 3.2*.

ROR_ecommerce is designed differently. If you understand Rails you will understand ROR_ecommerce.
There is nothing in this project that you wouldn't see in a normal Rails application. If you don't like what is in the project just change it like you would in any other Rails app.
ROR Ecommerce is designed so that if you understand Rails you will understand ROR_ecommerce.
There is nothing in this project besides what you might see in a normal Rails application.
If you don't like something, you are free to just change it like you would in any other Rails app.

Contributors are welcome. Fork this repo, make *any* changes (big or small) and create a pull request.

We will always need help with UI, Documentation and code so feel free to help.
Contributors are welcome!
We will always need help with UI, documentation, and code, so feel free to pitch in.
To get started, simply fork this repo, make *any* changes (big or small), and create a pull request.

##Getting Started

We have a google group. Ask question and help answer questions.
[ror_ecommerce Google-group](http://groups.google.com/group/ror_ecommerce)
Please feel free to ask/answer questions in our [Google Group](http://groups.google.com/group/ror_ecommerce).

Install RVM with Ruby 1.9.2 Ruby 1.9.3. If you have 1.9.2 or 1.9.3 on your system you're good to go. Please refer to the [RVM](http://beginrescueend.com/rvm/basics/) site for more details.
Install RVM with Ruby 1.9.2 or Ruby 1.9.3.
If you have 1.9.2 or 1.9.3 on your system you're good to go.
Please refer to the [RVM](http://beginrescueend.com/rvm/basics/) site for more details.

Copy the `database.yml` for your setup. For SQLite3, `cp config/database.yml.sqlite3 config.database.yml` and for MySQL `cp config/database.yml.mysql config.database.yml` and update for your username/password.
Copy the `database.yml` for your setup.
For SQLite3, `cp config/database.yml.sqlite3 config/database.yml`.
For MySQL, `cp config/database.yml.mysql config/database.yml` and update your username/password.

Run `rake secret` and copy what it gives you and paste it under `encryption_key` in `config/config.yml`
Run `rake secret` and copy/paste the output as `encryption_key` in `config/config.yml`.

* gem install bundler
* bundle install
* rake db:create:all
* rake db:migrate db:seed
* rake db:test:prepare
gem install bundler
bundle install
rake db:create:all
rake db:migrate db:seed
rake db:test:prepare

Once everything is setup, start up the server with `rails server` and direct your web browser to [localhost:3000/admin/overviews](http://localhost:3000/admin/overviews). Write down the username/password (these are only shown once) and follow the directions.
Once everything is set up, start the server with `rails server` and direct your web browser to [localhost:3000/admin/overviews](http://localhost:3000/admin/overviews).
Write down the username/password (these are only shown once) and follow the directions.

##Quick Evaluation

If you just want to see what ror_ecommerce looks like, before you enter and products into the database run the following command:
If you just want to see what ror_ecommerce looks like, before you enter any products into the database, run the following command:

rake db:seed_fake

Now you should have a minimal dataset to go through the various parts of the app. Make should you have the `config/config.yml` setup before you try to checkout though. Also take a look at [The 15 minute e-commerce video](http://www.ror-e.com/info/videos/7)
You should now have a minimal dataset, and be able to see a demo of the various parts of the app.
Note: make sure you have `config/config.yml` set up correctly before you try to checkout.
Also, please take a look at [The 15 minute e-commerce video](http://www.ror-e.com/info/videos/7).

##YARDOCS

If you would like to see the docs then you can generate them with the following command:
If you would like to read the docs, you can generate them with the following command:

yardoc --no-private --protected app/models/*.rb

####compass install
####Compass Install

First, create `config/settings.yml` and change the encryption key and paypal/auth.net information.
You can also change `config/settings.yml.example` to `config/settings.yml` until you get your real info.

Paperclip will throw errors if not configured correctly.
You will need to find out where Imagemagick is installed.
Type: `which identify` in the terminal and set

```ruby
Paperclip.options[:command_path]
```

equal to that path in `environment.rb`.

Example:

Change:

Need to create config/config.yml and change the encryption key and paypal or auth.net information.
You can also change config/config.yml.example to config/config.yml until you get your real info.
```ruby
Paperclip.options[:command_path] = "/usr/local/bin"
```

Paperclip will throw errors if not configured correctly. You will need to find out where Imagemagick is installed.
Type `which identify` in the terminal and set `Paperclip.options[:command_path] equal` to that path in environment.rb: Examples:
Into:

Paperclip.options[:command_path] = "/usr/local/bin"
into:
Paperclip.options[:command_path] = "/usr/bin"
```ruby
Paperclip.options[:command_path] = "/usr/bin"
```

##Adding Dalli for cache and the session store
##Adding Dalli For Cache and the Session Store

This isn't required, but for a speedy site, using memcached is a good idea.
While optional, for a speedy site, using memcached is a good idea.

Install memcached, If you're on a Mac, the easiest way to install Memcached is to use [homebrew](http://mxcl.github.com/homebrew/) and run:
Install memcached.
If you're on a Mac, the easiest way to install Memcached is to use [homebrew](http://mxcl.github.com/homebrew/):

brew install memcached

memcached -vv

####TO TURN ON THE DALLI COOKIE STORE
####To Turn On the Dalli Cookie Store

Remove the cookie store on line one of config/initializers/session_store.rb go to the Gemfile and add
Remove the cookie store on line one of `config/initializers/session_store.rb`.
In your Gemfile add:

gem 'dalli'
```ruby
gem 'dalli'
```

then
then:

bundle install

Finally UNCOMMENT the next 2 lines in config/initializers/session_store.rb
Finally uncomment the next two lines in `config/initializers/session_store.rb`

require 'action_dispatch/middleware/session/dalli_store'
Hadean::Application.config.session_store :dalli_store, :key => '_hadean_session_ugrdr6765745ce4vy'
```ruby
require 'action_dispatch/middleware/session/dalli_store'
Hadean::Application.config.session_store :dalli_store, :key => '_hadean_session_ugrdr6765745ce4vy'
```

####TO TURN ON THE DALLI CACHE STORE
####To Turn On the Dalli Cache Store

It is also recommended to change the cache store in config/environments/*.rb

config.cache_store = :dalli_store


```ruby
config.cache_store = :dalli_store
```

## Adding Solr Search


brew install solr

Uncomment the following in your gemfile
Uncomment the following in your gemfile:

#gem 'sunspot_solr'
#gem 'sunspot_rails', '~> 1.3'
```ruby
#gem 'sunspot_solr'
#gem 'sunspot_rails', '~> 1.3'
```

then
then:

bundle install

start solr before starting you server
rake sunspot:solr:start

Go to the *bottom of product.rb* and uncomment the section with *"Product.class_eval"*

Start Solr before starting your server:

Take a look at setting up solr - [Solr in 5 minutes](http://github.com/outoftime/sunspot/wiki/adding-sunspot-search-to-rails-in-5-minutes-or-less)
rake sunspot:solr:start

Go to the bottom of `product.rb` and uncomment:

If you get the error, `Errno::ECONNREFUSED (Connection refused - connect(2)):` when you try to create a product or upload an image, you have not started solr search. You need to run `rake sunspot:solr:start` or remove solr completely.
```ruby
Product.class_eval
```

Take a look at setting up Solr - [Solr in 5 minutes](http://github.com/outoftime/sunspot/wiki/adding-sunspot-search-to-rails-in-5-minutes-or-less)

If you get the error, `Errno::ECONNREFUSED (Connection refused - connect(2)):` when you try to create a product or upload an image, you have not started Solr search.
You need to run `rake sunspot:solr:start`, or remove Solr completely.

##TODOs:
##TODO:

* product sales (eg. 20% off)
* more documentation / videos for creating products/variants
* easy setup of fake data for getting started

##Author

Expand All @@ -145,4 +184,3 @@ Shipping categories are categories based off price:
you might have two shipping categories (light items) & (heavy items)

Have fun!!!

12 changes: 12 additions & 0 deletions app/assets/javascripts/admin/fulfillment.js
@@ -1,3 +1,15 @@
jQuery(document).ready(function($) {
$("#create-shipment-button").click(function() {
var url = $(this).data("url");
jQuery.ajax( {
type : "PUT",
url : url,
dataType: 'script'
});
return false;
});
});

var Hadean = window.Hadean || {};


Expand Down
14 changes: 10 additions & 4 deletions app/controllers/admin/fulfillment/orders_controller.rb
Expand Up @@ -22,9 +22,18 @@ def edit
@order = Order.includes([:shipments, {:order_items => [:shipment, :variant]}]).find(params[:id])
end


def create_shipment
@order = Order.find_by_id(params[:id])
if @order
Shipment.create_shipments_with_items(@order)
@order.reload
end
end

# PUT /admin/fulfillment/orders/1
def update
@order = Order.find(params[:id])
@order = Order.find_by_id(params[:id])
@invoice = @order.invoices.find(params[:invoice_id])

payment = @order.capture_invoice(@invoice)
Expand All @@ -42,10 +51,7 @@ def update

respond_to do |format|
if payment && payment.success?
@shipments = Shipment.create_shipments_with_items(@order)
# reload order
format.html { render :partial => 'success_message' }
#format.html { redirect_to(admin_fulfillment_order_path(@order), :notice => 'Shipment was successfully updated.') }
else
format.html { render :partial => 'failure_message' }
end
Expand Down
@@ -1,6 +1,9 @@
class Admin::Shopping::Checkout::BillingAddressesController < Admin::Shopping::Checkout::BaseController
def index
@billing_address = Address.new
if !Settings.require_state_in_address && countries.size == 1
@billing_address.country = countries.first
end
form_info
respond_to do |format|
format.html # index.html.erb
Expand All @@ -11,6 +14,9 @@ def new
old_address = Address.find_by_id(params[:old_address_id])
attributes = old_address.try(:address_attributes)
@billing_address = session_admin_cart.customer.addresses.new(attributes)
if !Settings.require_state_in_address && countries.size == 1
@billing_address.country = countries.first
end
form_info
respond_to do |format|
format.html # new.html.erb
Expand Down
@@ -1,6 +1,9 @@
class Admin::Shopping::Checkout::ShippingAddressesController < Admin::Shopping::Checkout::BaseController
def index
@shipping_address = Address.new
if !Settings.require_state_in_address && countries.size == 1
@shipping_address.country = countries.first
end
form_info
respond_to do |format|
format.html # index.html.erb
Expand All @@ -16,6 +19,9 @@ def new
old_address = Address.find_by_id(params[:old_address_id])
attributes = old_address.try(:address_attributes)
@shipping_address = session_admin_cart.customer.addresses.new(attributes)
if !Settings.require_state_in_address && countries.size == 1
@shipping_address.country = countries.first
end
form_info
respond_to do |format|
format.html # new.html.erb
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/myaccount/addresses_controller.rb
Expand Up @@ -10,6 +10,9 @@ def show
def new
form_info
@address = Address.new
if !Settings.require_state_in_address && countries.size == 1
@address.country = countries.first
end
@address.default = true if current_user.default_shipping_address.nil?
end

Expand Down
3 changes: 3 additions & 0 deletions app/controllers/shopping/addresses_controller.rb
Expand Up @@ -3,6 +3,9 @@ class Shopping::AddressesController < Shopping::BaseController
# GET /shopping/addresses.xml
def index
@shopping_address = Address.new
if !Settings.require_state_in_address && countries.size == 1
@shopping_address.country = countries.first
end
form_info
respond_to do |format|
format.html # index.html.erb
Expand Down

0 comments on commit 54a1267

Please sign in to comment.