erp_commerce 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL-3-LICENSE +674 -0
- data/README.rdoc +2 -0
- data/Rakefile +32 -0
- data/app/assets/javascripts/erp_commerce/application.js +9 -0
- data/app/assets/stylesheets/erp_commerce/application.css +7 -0
- data/app/controllers/erp_commerce/application_controller.rb +4 -0
- data/app/helpers/erp_commerce/application_helper.rb +4 -0
- data/app/models/credit_card.rb +54 -0
- data/app/models/credit_card_account.rb +4 -0
- data/app/models/credit_card_account_party_role.rb +8 -0
- data/app/models/credit_card_account_purpose.rb +6 -0
- data/app/models/credit_card_token.rb +12 -0
- data/app/models/extensions/charge_line.rb +3 -0
- data/app/models/extensions/currency.rb +3 -0
- data/app/models/extensions/financial_txn.rb +3 -0
- data/app/models/extensions/order_txn.rb +3 -0
- data/app/models/extensions/party.rb +21 -0
- data/app/models/extensions/product_instance.rb +5 -0
- data/app/models/extensions/product_type.rb +3 -0
- data/app/models/fee.rb +7 -0
- data/app/models/fee_type.rb +4 -0
- data/app/models/payment.rb +38 -0
- data/app/models/payment_gateway.rb +4 -0
- data/app/models/payment_gateway_action.rb +2 -0
- data/app/models/price.rb +25 -0
- data/app/models/price_component.rb +8 -0
- data/app/models/price_component_type.rb +3 -0
- data/app/models/pricing_plan.rb +37 -0
- data/app/models/pricing_plan_assignment.rb +6 -0
- data/app/models/pricing_plan_component.rb +36 -0
- data/app/models/valid_price_plan_component.rb +8 -0
- data/app/views/layouts/erp_commerce/application.html.erb +14 -0
- data/app/widgets/orders/base.rb +40 -0
- data/app/widgets/orders/javascript/orders.js +11 -0
- data/app/widgets/orders/views/index.html.erb +63 -0
- data/app/widgets/product_catalog/base.rb +56 -0
- data/app/widgets/product_catalog/javascript/product_catalog.js +62 -0
- data/app/widgets/product_catalog/views/add_to_cart.html.erb +10 -0
- data/app/widgets/product_catalog/views/index.html.erb +69 -0
- data/app/widgets/product_catalog/views/show.html.erb +23 -0
- data/app/widgets/shopping_cart/base.rb +178 -0
- data/app/widgets/shopping_cart/javascript/shopping_cart.js +107 -0
- data/app/widgets/shopping_cart/views/cart_items.html.erb +83 -0
- data/app/widgets/shopping_cart/views/confirmation.html.erb +10 -0
- data/app/widgets/shopping_cart/views/demographics.html.erb +142 -0
- data/app/widgets/shopping_cart/views/login.html.erb +1 -0
- data/app/widgets/shopping_cart/views/payment.html.erb +81 -0
- data/app/widgets/shopping_cart/views/price_summary.html.erb +4 -0
- data/config/routes.rb +2 -0
- data/db/data_migrations/20101011152441_payment_gateway_actions.rb +27 -0
- data/db/migrate/20100823174238_erp_commerce_base.rb +174 -0
- data/db/migrate/20100913154134_setup_payments.rb +57 -0
- data/db/migrate/20101103132342_pricing_migrations.rb +169 -0
- data/db/migrate/20110921150854_create_fees.rb +50 -0
- data/lib/erp_commerce/active_merchant_wrappers/brain_tree_gateway_wrapper.rb +66 -0
- data/lib/erp_commerce/active_merchant_wrappers/credit_card_validation.rb +34 -0
- data/lib/erp_commerce/active_merchant_wrappers.rb +2 -0
- data/lib/erp_commerce/engine.rb +15 -0
- data/lib/erp_commerce/extensions/active_record/acts_as_fee.rb +64 -0
- data/lib/erp_commerce/extensions/active_record/acts_as_priceable.rb +57 -0
- data/lib/erp_commerce/extensions.rb +2 -0
- data/lib/erp_commerce/order_helper.rb +254 -0
- data/lib/erp_commerce/version.rb +3 -0
- data/lib/erp_commerce.rb +8 -0
- data/lib/tasks/erp_commerce_tasks.rake +4 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +49 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/credit_card_account_party_role_spec.rb +11 -0
- data/spec/models/credit_card_account_purpose_spec.rb +11 -0
- data/spec/models/credit_card_account_spec.rb +11 -0
- data/spec/models/credit_card_spec.rb +11 -0
- data/spec/models/fee_spec.rb +11 -0
- data/spec/models/fee_type_spec.rb +11 -0
- data/spec/models/payment_gateway_action_spec.rb +11 -0
- data/spec/models/payment_gateway_spec.rb +11 -0
- data/spec/models/payment_spec.rb +11 -0
- data/spec/models/price_component_spec.rb +11 -0
- data/spec/models/price_component_type_spec.rb +11 -0
- data/spec/models/price_spec.rb +11 -0
- data/spec/models/pricing_plan_assignment_spec.rb +11 -0
- data/spec/models/pricing_plan_component_spec.rb +11 -0
- data/spec/models/pricing_plan_spec.rb +11 -0
- data/spec/models/valid_price_plan_component_spec.rb +11 -0
- data/spec/spec_helper.rb +60 -0
- metadata +285 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
<style type="text/css">
|
2
|
+
#products-view {
|
3
|
+
font-family:'Lucida Grande','Lucida Sans Unicode',sans-serif;
|
4
|
+
text-align:center;
|
5
|
+
font-size:14px;
|
6
|
+
width:100%;
|
7
|
+
border-collapse: collapse;
|
8
|
+
border: 2px solid #CCCCCC;
|
9
|
+
}
|
10
|
+
|
11
|
+
#products-view a {
|
12
|
+
text-decoration:none;
|
13
|
+
}
|
14
|
+
|
15
|
+
#products-view img {
|
16
|
+
height:60px;
|
17
|
+
width:65px;
|
18
|
+
padding-right:15px;
|
19
|
+
}
|
20
|
+
|
21
|
+
#products-view div
|
22
|
+
{
|
23
|
+
float:left;
|
24
|
+
text-align:left;
|
25
|
+
}
|
26
|
+
|
27
|
+
#products-view th {
|
28
|
+
padding: 0 0.5em;
|
29
|
+
height:30px;
|
30
|
+
text-align:center;
|
31
|
+
background:url("/images/knitkit/footer.png") repeat-x scroll 0 0 #29425E;
|
32
|
+
}
|
33
|
+
|
34
|
+
.highlight:hover
|
35
|
+
{
|
36
|
+
background-color:#FFFFEE;
|
37
|
+
}
|
38
|
+
|
39
|
+
#products-view td+td {
|
40
|
+
border-left: 1px solid #CCC;
|
41
|
+
text-align: center;
|
42
|
+
}
|
43
|
+
</style>
|
44
|
+
<div id="<%=widget_result_id%>">
|
45
|
+
<table id="products-view">
|
46
|
+
<thead>
|
47
|
+
<tr>
|
48
|
+
<th>Product</th>
|
49
|
+
<th># Available</th>
|
50
|
+
<th>Buy It</th>
|
51
|
+
</tr>
|
52
|
+
</thead>
|
53
|
+
<tbody>
|
54
|
+
<% ProductType.all.each do |product_type| %>
|
55
|
+
<tr class="product-wrap highlight">
|
56
|
+
<td>
|
57
|
+
<div><img src="<%=product_type.images.empty? ? '/images/img_blank.png' : product_type.images.first.data.url%>" alt="Product Image" /></div>
|
58
|
+
<div>
|
59
|
+
<span><%=link_to_remote product_type.description, build_widget_url(:show, product_type.id) %></span><br/>
|
60
|
+
<span><%=product_type.get_current_simple_amount_with_currency.nil? ? 'no price set' : product_type.get_current_simple_amount_with_currency%></span>
|
61
|
+
</div>
|
62
|
+
</td>
|
63
|
+
<td><%=product_type.inventory_entries.first.number_available%></td>
|
64
|
+
<td><%=link_to_remote 'Add To Cart', build_widget_url(:add_to_cart, product_type.id) %></td>
|
65
|
+
</tr>
|
66
|
+
<%end%>
|
67
|
+
</tbody>
|
68
|
+
</table>
|
69
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div id="<%=widget_result_id%>">
|
2
|
+
<%=link_to_remote "<- Back To List", build_widget_url(:back_to_catalog) %>
|
3
|
+
<br/><br/>
|
4
|
+
<ul style="margin: 0;padding: 0;list-style-type: none;">
|
5
|
+
<% @product_type.images.each do |image| %>
|
6
|
+
<li style="display: inline;background:none;">
|
7
|
+
<img src="<%=image.data.url%>" />
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
<br/>
|
12
|
+
<h2>
|
13
|
+
<%=@product_type.get_current_simple_amount_with_currency.nil? ? 'no price set' : @product_type.get_current_simple_amount_with_currency%>
|
14
|
+
<br/>
|
15
|
+
<%=@product_type.inventory_entries.first.number_available%> Available
|
16
|
+
</h2>
|
17
|
+
<hr/>
|
18
|
+
<p>
|
19
|
+
<%=raw @product_type.find_description_by_iid('long_description').description%>
|
20
|
+
</p>
|
21
|
+
<br/>
|
22
|
+
<%=link_to_remote 'Add To Cart', build_widget_url(:add_to_cart, @product_type.id) %>
|
23
|
+
</div>
|
@@ -0,0 +1,178 @@
|
|
1
|
+
module Widgets
|
2
|
+
module ShoppingCart
|
3
|
+
class Base < ErpApp::Widgets::Base
|
4
|
+
class Helper
|
5
|
+
include Singleton
|
6
|
+
include ActionView::Helpers::NumberHelper
|
7
|
+
end
|
8
|
+
|
9
|
+
def help
|
10
|
+
Helper.instance
|
11
|
+
end
|
12
|
+
|
13
|
+
def price_summary
|
14
|
+
@item_count = 0
|
15
|
+
@cart_items_url = params[:cart_items_url]
|
16
|
+
|
17
|
+
#if we have an order started get all charges
|
18
|
+
order = ErpCommerce::OrderHelper.new(self).get_order
|
19
|
+
@item_count = order.line_items.count unless order.nil?
|
20
|
+
set_total_price(order)
|
21
|
+
|
22
|
+
render
|
23
|
+
end
|
24
|
+
|
25
|
+
def cart_items
|
26
|
+
@price = 0
|
27
|
+
@products_url = params[:products_url]
|
28
|
+
@order = ErpCommerce::OrderHelper.new(self).get_order(true)
|
29
|
+
set_total_price(@order)
|
30
|
+
|
31
|
+
render
|
32
|
+
end
|
33
|
+
|
34
|
+
def remove_from_cart
|
35
|
+
@products_url = params[:products_url]
|
36
|
+
@order = ErpCommerce::OrderHelper.new(self).remove_from_cart(params[:id])
|
37
|
+
set_total_price(@order)
|
38
|
+
|
39
|
+
render :update => {:id => "#{@uuid}_result", :view => :cart_items}
|
40
|
+
end
|
41
|
+
|
42
|
+
def checkout_demographics
|
43
|
+
unless self.current_user.nil?
|
44
|
+
params[:ship_to_billing] = 'on'
|
45
|
+
params[:bill_to_email] = current_user.email
|
46
|
+
@products_url = params[:products_url]
|
47
|
+
@order = ErpCommerce::OrderHelper.new(self).get_order
|
48
|
+
set_total_price(@order)
|
49
|
+
|
50
|
+
render :update => {:id => "#{@uuid}_result", :view => :demographics}
|
51
|
+
else
|
52
|
+
render :update => {:id => "#{@uuid}_result", :view => :login}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def checkout_payment
|
57
|
+
@products_url = params[:products_url]
|
58
|
+
order_helper = ErpCommerce::OrderHelper.new(self)
|
59
|
+
@order = order_helper.get_order
|
60
|
+
set_total_price(@order)
|
61
|
+
|
62
|
+
messages = validate_demographics
|
63
|
+
unless messages.empty?
|
64
|
+
|
65
|
+
@billing_error_message = '<ul>'
|
66
|
+
messages.select{|item| item =~ /^B/}.collect{|item| "<li>#{item}</li>"}.each do |html| @billing_error_message << html end
|
67
|
+
@billing_error_message << '</ul>'
|
68
|
+
|
69
|
+
@shipping_error_message = '<ul>'
|
70
|
+
messages.select{|item| item =~ /^S/}.collect{|item| "<li>#{item}</li>"}.each do |html| @shipping_error_message << html end
|
71
|
+
@shipping_error_message << '</ul>'
|
72
|
+
|
73
|
+
render :update => {:id => "#{@uuid}_result", :view => :demographics}
|
74
|
+
else
|
75
|
+
@order = order_helper.set_demographic_info(params)
|
76
|
+
|
77
|
+
render :update => {:id => "#{@uuid}_result", :view => :payment}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def checkout_finalize
|
82
|
+
@products_url = params[:products_url]
|
83
|
+
success, @message, @order = ErpCommerce::OrderHelper.new(self).complete_order(params)
|
84
|
+
set_total_price(@order)
|
85
|
+
|
86
|
+
if success
|
87
|
+
render :update => {:id => "#{@uuid}_result", :view => :confirmation}
|
88
|
+
else
|
89
|
+
render :update => {:id => "#{@uuid}_result", :view => :payment}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def set_total_price(order)
|
96
|
+
@price = 0
|
97
|
+
|
98
|
+
#if we have an order started get all charges
|
99
|
+
unless order.nil?
|
100
|
+
order.get_total_charges.each do |money|
|
101
|
+
@price += money.amount
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
#format it
|
106
|
+
@price = help.number_to_currency(@price)
|
107
|
+
end
|
108
|
+
|
109
|
+
def validate_demographics
|
110
|
+
messages = []
|
111
|
+
|
112
|
+
fields = [
|
113
|
+
{:param => '_to_first_name', :name => 'First Name'},
|
114
|
+
{:param => '_to_last_name', :name => 'Last Name'},
|
115
|
+
{:param => '_to_address_line_1', :name => 'Address Line 1'},
|
116
|
+
{:param => '_to_city', :name => 'City'},
|
117
|
+
{:param => '_to_state', :name => 'State'},
|
118
|
+
{:param => '_to_postal_code', :name => 'Postal Code'},
|
119
|
+
{:param => '_to_country', :name => 'Country'},
|
120
|
+
{:param => '_to_phone', :name => 'Phone'},
|
121
|
+
{:param => '_to_email', :name => 'Email'}
|
122
|
+
]
|
123
|
+
|
124
|
+
#check billing fields
|
125
|
+
fields.each do |field|
|
126
|
+
param = ('bill'+field[:param]).to_sym
|
127
|
+
if params[param].blank?
|
128
|
+
messages << "Billing #{field[:name]} is required."
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
#check if shipping is different than billing
|
133
|
+
unless params[:ship_to_billing] == 'on'
|
134
|
+
#check shipping fields
|
135
|
+
fields.each do |field|
|
136
|
+
next if (field[:param] == '_to_phone' or field[:param] == '_to_email')
|
137
|
+
param = ('ship'+field[:param]).to_sym
|
138
|
+
if params[param].blank?
|
139
|
+
messages << "Shipping #{field[:name]} is required."
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
messages
|
145
|
+
end
|
146
|
+
|
147
|
+
#should not be modified
|
148
|
+
#modify at your own risk
|
149
|
+
def locate
|
150
|
+
File.dirname(__FILE__)
|
151
|
+
end
|
152
|
+
|
153
|
+
class << self
|
154
|
+
def title
|
155
|
+
"Shopping Cart"
|
156
|
+
end
|
157
|
+
|
158
|
+
def views_location
|
159
|
+
File.join(File.dirname(__FILE__),"/views")
|
160
|
+
end
|
161
|
+
|
162
|
+
def widget_name
|
163
|
+
File.basename(File.dirname(__FILE__))
|
164
|
+
end
|
165
|
+
|
166
|
+
def base_layout
|
167
|
+
begin
|
168
|
+
file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb")
|
169
|
+
IO.read(file)
|
170
|
+
rescue
|
171
|
+
return nil
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
end#Base
|
177
|
+
end#ShoppingCart
|
178
|
+
end#Widgets
|
@@ -0,0 +1,107 @@
|
|
1
|
+
Compass.ErpApp.Widgets.ShoppingCart = {
|
2
|
+
addShoppingCart:function(){
|
3
|
+
var addShoppingCartWidget = Ext.create("Ext.window.Window",{
|
4
|
+
layout:'fit',
|
5
|
+
width:300,
|
6
|
+
title:'Add Shopping Cart Widget',
|
7
|
+
height:130,
|
8
|
+
buttonAlign:'center',
|
9
|
+
items: Ext.create("Ext.form.Panel",{
|
10
|
+
labelWidth: 100,
|
11
|
+
frame:false,
|
12
|
+
bodyStyle:'padding:5px 5px 0',
|
13
|
+
defaults: {
|
14
|
+
width: 225
|
15
|
+
},
|
16
|
+
items: [
|
17
|
+
{
|
18
|
+
xtype: 'combo',
|
19
|
+
forceSelection:true,
|
20
|
+
store: [
|
21
|
+
[':price_summary','Price Summary'],
|
22
|
+
[':cart_items','Cart Items'],
|
23
|
+
],
|
24
|
+
fieldLabel: 'Widget View',
|
25
|
+
value:':price_summary',
|
26
|
+
name: 'widgetLayout',
|
27
|
+
allowBlank: false,
|
28
|
+
triggerAction: 'all',
|
29
|
+
listeners:{
|
30
|
+
change:function(field, newValue, oldValue){
|
31
|
+
var basicForm = field.findParentByType('form').getForm();
|
32
|
+
var cartItemsUrlField = basicForm.findField('cartItemsUrl');
|
33
|
+
var productsUrlField = basicForm.findField('productsUrl');
|
34
|
+
if(newValue == ':price_summary'){
|
35
|
+
cartItemsUrlField.show();
|
36
|
+
productsUrlField.hide();
|
37
|
+
cartItemsUrlField.setValue('/cart-summary');
|
38
|
+
}
|
39
|
+
else{
|
40
|
+
productsUrlField.show();
|
41
|
+
cartItemsUrlField.hide();
|
42
|
+
productsUrlField.setValue('/products');
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
},
|
47
|
+
{
|
48
|
+
xtype:'textfield',
|
49
|
+
fieldLabel:'Cart Items Url',
|
50
|
+
name:'cartItemsUrl',
|
51
|
+
hidden:false,
|
52
|
+
value:'/cart-items'
|
53
|
+
},
|
54
|
+
{
|
55
|
+
xtype:'textfield',
|
56
|
+
fieldLabel:'Products Url',
|
57
|
+
name:'productsUrl',
|
58
|
+
value:'/products',
|
59
|
+
hidden:true
|
60
|
+
},
|
61
|
+
]
|
62
|
+
}),
|
63
|
+
buttons: [{
|
64
|
+
text:'Submit',
|
65
|
+
listeners:{
|
66
|
+
'click':function(button){
|
67
|
+
var window = button.findParentByType('window');
|
68
|
+
var formPanel = window.query('form')[0];
|
69
|
+
var basicForm = formPanel.getForm();
|
70
|
+
var action = basicForm.findField('widgetLayout').getValue();
|
71
|
+
|
72
|
+
var data = {action:action};
|
73
|
+
if(action == ':price_summary'){
|
74
|
+
data.symbol = 'cart_items_url';
|
75
|
+
data.url = basicForm.findField('cartItemsUrl').getValue();
|
76
|
+
}
|
77
|
+
else{
|
78
|
+
data.symbol = 'products_url';
|
79
|
+
data.url = basicForm.findField('productsUrl').getValue();
|
80
|
+
}
|
81
|
+
|
82
|
+
var tpl = new Ext.XTemplate("<%= render_widget :shopping_cart,\n",
|
83
|
+
" :action => {action},\n",
|
84
|
+
" :params => {:{symbol} => '{url}'} %>");
|
85
|
+
|
86
|
+
//add rendered template to center region editor
|
87
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(tpl.apply(data));
|
88
|
+
addShoppingCartWidget.close();
|
89
|
+
}
|
90
|
+
}
|
91
|
+
},{
|
92
|
+
text: 'Close',
|
93
|
+
handler: function(){
|
94
|
+
addShoppingCartWidget.close();
|
95
|
+
}
|
96
|
+
}]
|
97
|
+
|
98
|
+
});
|
99
|
+
addShoppingCartWidget.show();
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
104
|
+
name:'Shopping Cart',
|
105
|
+
iconUrl:'/images/icons/shoppingcart/shoppingcart_48x48.png',
|
106
|
+
onClick:Compass.ErpApp.Widgets.ShoppingCart.addShoppingCart
|
107
|
+
});
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<style type="text/css">
|
2
|
+
#products-view {
|
3
|
+
font-family:'Lucida Grande','Lucida Sans Unicode',sans-serif;
|
4
|
+
text-align:center;
|
5
|
+
font-size:14px;
|
6
|
+
width:100%;
|
7
|
+
border-collapse: collapse;
|
8
|
+
border: 2px solid #CCCCCC;
|
9
|
+
}
|
10
|
+
|
11
|
+
#products-view a {
|
12
|
+
text-decoration:none;
|
13
|
+
}
|
14
|
+
|
15
|
+
#products-view img {
|
16
|
+
height:60px;
|
17
|
+
width:65px;
|
18
|
+
padding-right:15px;
|
19
|
+
}
|
20
|
+
|
21
|
+
#products-view div
|
22
|
+
{
|
23
|
+
float:left;
|
24
|
+
text-align:left;
|
25
|
+
}
|
26
|
+
|
27
|
+
#products-view th {
|
28
|
+
padding: 0 0.5em;
|
29
|
+
height:30px;
|
30
|
+
text-align:center;
|
31
|
+
background:url("/images/knitkit/footer.png") repeat-x scroll 0 0 #29425E;
|
32
|
+
}
|
33
|
+
|
34
|
+
.highlight:hover
|
35
|
+
{
|
36
|
+
background-color:#FFFFEE;
|
37
|
+
}
|
38
|
+
|
39
|
+
#products-view td+td {
|
40
|
+
border-left: 1px solid #CCC;
|
41
|
+
text-align: center;
|
42
|
+
}
|
43
|
+
</style>
|
44
|
+
<div id="<%=widget_result_id%>">
|
45
|
+
<h2>Cart Items</h2>
|
46
|
+
<% unless @order.order_line_items.empty? %>
|
47
|
+
<table id="products-view">
|
48
|
+
<thead>
|
49
|
+
<tr>
|
50
|
+
<th>Product</th>
|
51
|
+
<th>Description</th>
|
52
|
+
<th>Quantity</th>
|
53
|
+
<th>Remove</th>
|
54
|
+
<th>Total</th>
|
55
|
+
</tr>
|
56
|
+
</thead>
|
57
|
+
<tbody>
|
58
|
+
<% @order.order_line_items.each do |order_line_item| %>
|
59
|
+
<tr class="product-wrap highlight">
|
60
|
+
<td>
|
61
|
+
<div><img src="<%=order_line_item.product_type.images.empty? ? '/images/img_blank.png' : order_line_item.product_type.images.first.data.url%>" alt="Product Image" /></div>
|
62
|
+
<div>
|
63
|
+
<span><%= raw order_line_item.product_type.description %></span><br/>
|
64
|
+
</div>
|
65
|
+
</td>
|
66
|
+
<td><%= raw order_line_item.product_type.descriptions.find_by_internal_identifier('long_description').description%></td>
|
67
|
+
<td>1</td>
|
68
|
+
<td><%=link_to_remote 'Remove', build_widget_url(:remove_from_cart, order_line_item.id)%></td>
|
69
|
+
<td><span><%=order_line_item.product_type.get_current_simple_amount_with_currency.nil? ? 'no price set' : order_line_item.product_type.get_current_simple_amount_with_currency%></span></td>
|
70
|
+
</tr>
|
71
|
+
<%end%>
|
72
|
+
</tbody>
|
73
|
+
</table>
|
74
|
+
<hr />
|
75
|
+
<div style="float:right"><h2>Total <%=@price%></h2></div>
|
76
|
+
<a href="<%=@products_url%>">Continue Shopping</a><%=link_to_remote ' | Check Out', build_widget_url(:checkout_demographics) unless @order.order_line_items.empty?%>
|
77
|
+
<%else%>
|
78
|
+
<h2>No items in cart.</h2>
|
79
|
+
<%end%>
|
80
|
+
</div>
|
81
|
+
<script type="text/javascript">
|
82
|
+
Compass.ErpApp.Widgets.refreshWidget('shopping_cart', 'price_summary');
|
83
|
+
</script>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div id="<%=widget_result_id%>">
|
2
|
+
<p>Your order is complete.
|
3
|
+
<br/>Your should receive a confirmation email.
|
4
|
+
<br/>Your order number is <%=@order.order_number%>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
</div>
|
8
|
+
<script type="text/javascript">
|
9
|
+
Compass.ErpApp.Widgets.refreshWidget('shopping_cart', 'price_summary');
|
10
|
+
</script>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
<div id="<%=widget_result_id%>">
|
2
|
+
<h2>What you're buying...</h2>
|
3
|
+
<table id="products-view">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Product</th>
|
7
|
+
<th>Description</th>
|
8
|
+
<th>Quantity</th>
|
9
|
+
<th>Total</th>
|
10
|
+
<th>Remove</th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
<tbody>
|
14
|
+
<% @order.order_line_items.each do |order_line_item| %>
|
15
|
+
<tr class="product-wrap">
|
16
|
+
<td>
|
17
|
+
<div><img src="<%=order_line_item.product_type.images.empty? ? '/images/img_blank.png' : order_line_item.product_type.images.first.data.url%>" alt="Product Image" /></div>
|
18
|
+
<div>
|
19
|
+
<span><%= raw order_line_item.product_type.description %></span><br/>
|
20
|
+
</div>
|
21
|
+
</td>
|
22
|
+
<td><%= raw order_line_item.product_type.descriptions.find_by_internal_identifier('long_description').description%></td>
|
23
|
+
<td>1</td>
|
24
|
+
<td><%=link_to 'Remove', build_widget_url(:remove_from_cart, order_line_item.id), :remote => true, :class => 'ajax_replace'%></td>
|
25
|
+
<td><span><%=order_line_item.product_type.get_current_simple_amount_with_currency.nil? ? 'no price set' : order_line_item.product_type.get_current_simple_amount_with_currency%></span></td>
|
26
|
+
</tr>
|
27
|
+
<%end%>
|
28
|
+
</tbody>
|
29
|
+
</table>
|
30
|
+
<hr/>
|
31
|
+
<div style="text-align:right;"><h2>Total <%=@price%></h2></div>
|
32
|
+
<hr/>
|
33
|
+
|
34
|
+
<div>
|
35
|
+
<h2>Step 1 of 3 Billing Information</h2>
|
36
|
+
<div style="color:red">
|
37
|
+
<%= raw @billing_error_message%>
|
38
|
+
</div>
|
39
|
+
<%= form_remote_tag build_widget_url(:checkout_payment), :id => 'demographics_form' do %>
|
40
|
+
<div class="form_settings">
|
41
|
+
<p>
|
42
|
+
<span>First Name</span>
|
43
|
+
<%= text_field_tag :bill_to_first_name, params[:bill_to_first_name] %>
|
44
|
+
</p>
|
45
|
+
<p>
|
46
|
+
<span>Last Name</span>
|
47
|
+
<%= text_field_tag :bill_to_last_name, params[:bill_to_last_name] %>
|
48
|
+
</p>
|
49
|
+
<p>
|
50
|
+
<span>Address Line 1</span>
|
51
|
+
<%= text_field_tag :bill_to_address_line_1, params[:bill_to_address_line_1] %>
|
52
|
+
</p>
|
53
|
+
<p>
|
54
|
+
<span>Address Line 2</span>
|
55
|
+
<%= text_field_tag :bill_to_address_line_2, params[:bill_to_address_line_2] %>
|
56
|
+
</p>
|
57
|
+
<p>
|
58
|
+
<span>City</span>
|
59
|
+
<%= text_field_tag :bill_to_city, params[:bill_to_city] %>
|
60
|
+
</p>
|
61
|
+
<p>
|
62
|
+
<span>State</span>
|
63
|
+
<%= select_tag(:bill_to_state, options_for_select(GeoZone.all.collect{|item| [item.zone_name,item.zone_code]}, params[:bill_to_state])) %>
|
64
|
+
</p>
|
65
|
+
<p>
|
66
|
+
<span>Country</span>
|
67
|
+
<%= select_tag(:bill_to_country, options_for_select(GeoCountry.find_all_by_display(true).collect{|item| [item.name,item.iso_code_2]}, params[:bill_to_country])) %>
|
68
|
+
</p>
|
69
|
+
<p>
|
70
|
+
<span>Postal/Zip Code</span>
|
71
|
+
<%= text_field_tag :bill_to_postal_code, params[:bill_to_postal_code] %>
|
72
|
+
</p>
|
73
|
+
<p>
|
74
|
+
<span>Email</span>
|
75
|
+
<%= text_field_tag :bill_to_email, params[:bill_to_email] %>
|
76
|
+
</p>
|
77
|
+
<p>
|
78
|
+
<span>Phone Number</span>
|
79
|
+
<%= text_field_tag :bill_to_phone, params[:bill_to_phone] %>
|
80
|
+
</p>
|
81
|
+
<br/>
|
82
|
+
<input type="checkbox" name="ship_to_billing" style="width:10px;" <%= if params[:ship_to_billing] == 'on' then raw('checked="checked"') end%> onclick="
|
83
|
+
if(this.checked){
|
84
|
+
Ext.get('shippingToBillingMessage').setStyle('display','');
|
85
|
+
Ext.get('shippingInfoDiv').setStyle('display','none');
|
86
|
+
Ext.get('shipToErrorMessages').setStyle('display','none');
|
87
|
+
}
|
88
|
+
else{
|
89
|
+
Ext.get('shippingInfoDiv').setStyle('display','');
|
90
|
+
Ext.get('shipToErrorMessages').setStyle('display','');
|
91
|
+
Ext.get('shippingToBillingMessage').setStyle('display','none');
|
92
|
+
}"/> Ship items to the above billing address
|
93
|
+
<br/>
|
94
|
+
<div class="form_settings">
|
95
|
+
<h2>Step 2 of 3 Shipping Information</h2>
|
96
|
+
<div style="color:red" id="shipToErrorMessages">
|
97
|
+
<%= raw @shipping_error_message%>
|
98
|
+
</div>
|
99
|
+
<p id="shippingToBillingMessage" <%= if params[:ship_to_billing].blank? then raw('style="display:none;"') end%>>Item(s) will be shipped to your billing address.</p>
|
100
|
+
<div id="shippingInfoDiv" <%= if params[:ship_to_billing] == 'on' then raw('style="display:none;"') end%>>
|
101
|
+
<p>
|
102
|
+
<span>First Name</span>
|
103
|
+
<%= text_field_tag :ship_to_first_name, params[:ship_to_first_name] %>
|
104
|
+
</p>
|
105
|
+
<p>
|
106
|
+
<span>Last Name</span>
|
107
|
+
<%= text_field_tag :ship_to_last_name, params[:ship_to_last_name] %>
|
108
|
+
</p>
|
109
|
+
<p>
|
110
|
+
<span>Address Line 1</span>
|
111
|
+
<%= text_field_tag :ship_to_address_line_1, params[:ship_to_address_line_1] %>
|
112
|
+
</p>
|
113
|
+
<p>
|
114
|
+
<span>Address Line 2</span>
|
115
|
+
<%= text_field_tag :ship_to_address_line_2, params[:ship_to_address_line_2] %>
|
116
|
+
</p>
|
117
|
+
<p>
|
118
|
+
<span>City</span>
|
119
|
+
<%= text_field_tag :ship_to_city, params[:ship_to_city] %>
|
120
|
+
</p>
|
121
|
+
<p>
|
122
|
+
<span>State</span>
|
123
|
+
<%= select_tag(:ship_to_state, options_for_select(GeoZone.all.collect{|item| [item.zone_name,item.zone_code]}, params[:ship_to_state])) %>
|
124
|
+
</p>
|
125
|
+
<p>
|
126
|
+
<span>Country</span>
|
127
|
+
<%= select_tag(:ship_to_country, options_for_select(GeoCountry.find_all_by_display(true).collect{|item| [item.name,item.iso_code_2]}, params[:ship_to_country])) %>
|
128
|
+
</p>
|
129
|
+
<p>
|
130
|
+
<span>Postal/Zip Code</span>
|
131
|
+
<%= text_field_tag :ship_to_postal_code, params[:ship_to_postal_code] %>
|
132
|
+
</p>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
<hr/>
|
136
|
+
<p style="padding-top: 15px">
|
137
|
+
<%= submit_tag "Continue", :disable_with => "Please wait...", :class => "submit", :style => 'margin:0px;' %> | <a href="<%=@products_url%>">Back to store</a>
|
138
|
+
</p>
|
139
|
+
</div>
|
140
|
+
<%end%>
|
141
|
+
</div>
|
142
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<script type="text/javascript">window.location.href = '/login'</script>
|