forked from chip/shopping_cart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
65 lines (48 loc) · 2.13 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
ShoppingCart
============
This Ruby on Rails plugin provides simple shopping cart functionality
that uses with ActiveMerchant for merchant gateway processing.
*Tested with Rails 2.3.3
Example
=======
./script/plugin install git@github.com:chip/shopping_cart.git
rake shopping_cart:setup
This will create:
* A database migration file
* Views for carts, orders and products
# You will need to setup the following in routes.rb:
# Root route is only necessary if you don't already have one setup
# map.root :controller => 'products', :action => 'index'
# Remaining routes for shopping cart plugin
map.resources :products
map.current_cart 'cart', :controller => 'carts', :action => 'show', :id => 'current'
map.resources :carts
map.resources :line_items
map.resources :orders
# You will need to setup your merchant gateway credentials (Example provided is for Paypal):
# (config/development.rb):
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
:login => "your paypal sandbox login",
:password => "your paypal sandbox password",
:signature => "your paypal sandbox signature"
)
# (config/test.rb):
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::BogusGateway.new
end
# (config/production.rb):
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
:login => "your paypal login",
:password => "your paypal password",
:signature => "your paypal signature"
)
# You will need to install and configure your gems:
sudo gem install activemerchant haml highline
# You will need to restart your web server after editing environment.rb:
config.gem 'haml'
config.gem "activemerchant", :lib => "active_merchant", :version => "1.4.1"
# Optionally, you can populate your products table with a few sample products
rake shopping_cart:products
Copyright (c) 2009 Chip Castle Dot Com, Inc. released under the MIT license