caboose-store 0.0.39 → 0.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose_store/modules/cart.js +1 -0
- data/app/assets/javascripts/caboose_store/modules/checkout_step1.js +5 -0
- data/app/assets/javascripts/caboose_store/modules/checkout_step2.js +1 -1
- data/app/assets/javascripts/caboose_store/modules/checkout_step4.js +6 -1
- data/app/assets/javascripts/caboose_store/modules/product.js +2 -11
- data/app/assets/templates/caboose_store/cart/line_items.jst.ejs +2 -2
- data/app/assets/templates/caboose_store/product/options.jst.ejs +1 -1
- data/app/controllers/caboose_store/cart_controller.rb +1 -0
- data/app/controllers/caboose_store/checkout_controller.rb +18 -15
- data/app/controllers/caboose_store/products_controller.rb +45 -0
- data/app/helpers/caboose_store/checkout_helper.rb +2 -2
- data/app/mailers/caboose_store/orders_mailer.rb +4 -3
- data/app/models/caboose_store/payment_processors/authorizenet.rb +34 -2
- data/app/models/caboose_store/payment_processors/payscape.rb +1 -0
- data/app/models/caboose_store/states.rb +2 -2
- data/app/models/caboose_store/variant.rb +1 -0
- data/app/views/caboose_store/checkout/relay.html.erb +17 -6
- data/app/views/caboose_store/checkout/step_four.html.erb +11 -9
- data/app/views/caboose_store/checkout/step_one.html.erb +8 -2
- data/app/views/caboose_store/checkout/step_two.html.erb +4 -3
- data/app/views/caboose_store/orders/admin_edit.html.erb +17 -15
- data/app/views/caboose_store/products/admin_edit_variants.html.erb +33 -7
- data/config/routes.rb +2 -1
- data/lib/caboose-store.rb +2 -1
- data/lib/caboose-store/engine.rb +2 -1
- data/lib/caboose-store/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTE4MTFjMWIzNDc0ODU2NjNlMjY0MTVhYjE5ZWU3ZjllZTU0OTZjNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTg0ZmNlM2ZjYmI4Mjk3YjVhZjEyNDdmYjk0MjI3MjNkNGM1MDhhOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjYyZTQ3MTNiZjE5MzMzNWNlZmZjYTg4MTQ2MGY5MzlmMzZiOTdkMmY2MTFl
|
10
|
+
YzZjZTY0ZmZkZThmMTkzYzBkOTM4MGE1YWFmYzQxMTAwMzZjNGNmZDU4Yjgz
|
11
|
+
ODFlYTI3YWU4MjNkZTMxMmRlZmEyYjY3MDJlNmVmNWU1NWFiZTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWM3ZjdjYTczYThiMDIyYzgyNzJlN2VlZDUxOTIwOWQ1NWM0N2IyYWFkMjM2
|
14
|
+
YTVlOTk1YWU0MzcxMTdiYThhNzViNGFmMTU2OGQ1MGU2NzY2NDQxMDMwMDQx
|
15
|
+
ZWI5ODA4MGU4NTFiOWJiM2Q3NDA0YTY2NGIwYzc3ZGJiNTllNDc=
|
@@ -105,6 +105,7 @@ Caboose.Store.Modules.Cart = (function() {
|
|
105
105
|
if (!self.$addToCart.find('.message').length) {
|
106
106
|
self.$addToCart.append($('<p/>').hide().addClass('message').text('Successfully added to cart'));
|
107
107
|
self.$addToCart.find('.message').fadeIn();
|
108
|
+
Caboose.Store.Modules.Product.$product.trigger('added-to-cart');
|
108
109
|
|
109
110
|
setTimeout(function() {
|
110
111
|
self.$addToCart.find('.message').fadeOut(function() { $(this).remove() });
|
@@ -61,6 +61,11 @@ Caboose.Store.Modules.CheckoutStep1 = (function() {
|
|
61
61
|
}
|
62
62
|
$('#' + form + '_button').addClass('selected');
|
63
63
|
$('#message').empty();
|
64
|
+
|
65
|
+
$('html, body').animate({
|
66
|
+
scrollTop: $('#checkout-login').offset().top
|
67
|
+
}, 600);
|
68
|
+
|
64
69
|
self.current_form = form;
|
65
70
|
};
|
66
71
|
|
@@ -29,7 +29,7 @@ Caboose.Store.Modules.CheckoutStep2 = (function() {
|
|
29
29
|
if (resp.errors && resp.errors.length > 0)
|
30
30
|
$('#message').html("<p class='note error'>" + resp.errors[0] + "</p>");
|
31
31
|
else if (resp.success)
|
32
|
-
window.location = '/checkout/step-three';
|
32
|
+
window.location = '/checkout/step-three';
|
33
33
|
}
|
34
34
|
});
|
35
35
|
return false;
|
@@ -9,13 +9,17 @@ Caboose.Store.Modules.CheckoutStep4 = (function() {
|
|
9
9
|
$('#checkout-confirm').hide();
|
10
10
|
$('#relay').hide();
|
11
11
|
self.bind_event_handlers();
|
12
|
+
self.expiration_change_handler();
|
12
13
|
};
|
13
14
|
|
14
15
|
self.bind_event_handlers = function() {
|
15
16
|
$('#checkout-payment form#payment select').change(self.expiration_change_handler);
|
16
17
|
$('#checkout-continue button').click(self.continue_handler);
|
17
18
|
$('#checkout-confirm #edit_payment').click(self.edit_payment_handler);
|
18
|
-
|
19
|
+
|
20
|
+
$(window).on('message', function(event) {
|
21
|
+
relay_handler(event.originalEvent.data);
|
22
|
+
});
|
19
23
|
};
|
20
24
|
|
21
25
|
self.expiration_change_handler = function(event) {
|
@@ -83,6 +87,7 @@ Caboose.Store.Modules.CheckoutStep4 = (function() {
|
|
83
87
|
|
84
88
|
function relay_handler(resp)
|
85
89
|
{
|
90
|
+
console.log('RELAY');
|
86
91
|
if (resp.success == true)
|
87
92
|
window.location = '/checkout/thanks';
|
88
93
|
else if (resp.message)
|
@@ -176,15 +176,6 @@ Caboose.Store.Modules.Product = (function() {
|
|
176
176
|
};
|
177
177
|
|
178
178
|
self.getOptionsWithAllValues = function() {
|
179
|
-
//return _.map(self.getOptionsFromProduct(), function(optionName) {
|
180
|
-
// return {
|
181
|
-
// name: optionName,
|
182
|
-
// values: _.uniq(_.map(self.product.variants, function(variant) {
|
183
|
-
// return variant[self.getOptionAttribute(optionName)];
|
184
|
-
// }))
|
185
|
-
// };
|
186
|
-
//});
|
187
|
-
|
188
179
|
var options = [];
|
189
180
|
if (self.product.option1) options.push({ name: self.product.option1, values: self.option1_values });
|
190
181
|
if (self.product.option2) options.push({ name: self.product.option2, values: self.option2_values });
|
@@ -277,8 +268,8 @@ Caboose.Store.Modules.Product = (function() {
|
|
277
268
|
//
|
278
269
|
|
279
270
|
self.setImageFromVariant = function(variant) {
|
280
|
-
if (!variant || !variant.images || variant.images.length == 0 || !variant.images[0])
|
281
|
-
|
271
|
+
if (!variant || !variant.images || variant.images.length == 0 || !variant.images[0]) return;
|
272
|
+
self.$product.trigger('variant:updated');
|
282
273
|
|
283
274
|
var $figure = self.$images.children('figure');
|
284
275
|
if (variant.images && variant.images.length > 0 && variant.images[0]) {
|
@@ -26,14 +26,14 @@
|
|
26
26
|
</section>
|
27
27
|
|
28
28
|
<section>
|
29
|
-
<p class="price">$<%= lineItem.price %></p>
|
29
|
+
<p class="price">$<%= parseFloat(Math.round(lineItem.price * 100) / 100).toFixed(2) %></p>
|
30
30
|
</section>
|
31
31
|
</li>
|
32
32
|
<% }); %>
|
33
33
|
|
34
34
|
<li>
|
35
35
|
<footer>
|
36
|
-
<a href="/checkout" class="btn blue">
|
36
|
+
<a href="/checkout" class="btn blue">Checkout</a>
|
37
37
|
<h4>Subtotal: <span class="subtotal">$<%= parseFloat(Math.round(order.subtotal * 100) / 100).toFixed(2) %></span></h4>
|
38
38
|
</footer>
|
39
39
|
</li>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<% _.each(options, function(option, index) { %>
|
12
12
|
<h3><%= option.name %></h3>
|
13
13
|
<ul id="<%= 'option' + (index + 1) %>" data-name="<%= option.name %>">
|
14
|
-
<% _.each(option.values, function(value) { %>
|
14
|
+
<% _.each(_.sortBy(option.values, function(option) { return parseFloat(option) }), function(value) { %>
|
15
15
|
<li data-value="<%= value %>"><%= value %></li>
|
16
16
|
<% }); %>
|
17
17
|
</ul>
|
@@ -2,6 +2,7 @@ module CabooseStore
|
|
2
2
|
class CheckoutController < CabooseStore::ApplicationController
|
3
3
|
helper :authorize_net
|
4
4
|
before_filter :ensure_line_items, :only => [:step_one, :step_two]
|
5
|
+
protect_from_forgery :except => :relay
|
5
6
|
|
6
7
|
def ensure_line_items
|
7
8
|
redirect_to '/checkout/empty' if @order.line_items.empty?
|
@@ -31,15 +32,15 @@ module CabooseStore
|
|
31
32
|
end
|
32
33
|
|
33
34
|
# GET /checkout/step-three
|
34
|
-
def step_three
|
35
|
+
def step_three
|
35
36
|
redirect_to '/checkout/step-one' and return if !logged_in?
|
36
37
|
redirect_to '/checkout/step-two' and return if @order.shipping_address.nil? || @order.billing_address.nil?
|
37
|
-
@rates = ShippingCalculator.rates(@order)
|
38
|
+
@rates = ShippingCalculator.rates(@order)
|
38
39
|
@selected_rate = ShippingCalculator.rate(@order)
|
39
40
|
end
|
40
41
|
|
41
42
|
# GET /checkout/step-four
|
42
|
-
def step_four
|
43
|
+
def step_four
|
43
44
|
redirect_to '/checkout/step-one' and return if !logged_in?
|
44
45
|
redirect_to '/checkout/step-two' and return if @order.shipping_address.nil? || @order.billing_address.nil?
|
45
46
|
redirect_to '/checkout/step-three' and return if @order.shipping_method_code.nil?
|
@@ -199,20 +200,22 @@ module CabooseStore
|
|
199
200
|
|
200
201
|
# POST /checkout/relay/:order_id
|
201
202
|
def relay
|
203
|
+
ap '--HOOK RELAY'
|
202
204
|
@order = CabooseStore::Order.find(params[:order_id])
|
205
|
+
@success = CabooseStore::PaymentProcessor.authorize(@order, params)
|
206
|
+
@message = @success ? 'Payment processed successfully' : 'There was a problem processing your payment'
|
207
|
+
|
208
|
+
#case CabooseStore::payment_processor
|
209
|
+
# when 'authorize.net'
|
210
|
+
# @success = params[:x_response_code] == '1'
|
211
|
+
# @message = jarams[:x_response_reason_text]
|
212
|
+
# @order.transaction_id = params[:x_trans_id] if params[:x_trans_id]
|
213
|
+
# when 'payscape'
|
214
|
+
# @success = CabooseStore::PaymentProcessor.authorize(@order, params)
|
215
|
+
# @message = @success ? 'Payment processed successfully' : 'There was a problem processing your payment'
|
216
|
+
# @order.transaction_id = params['transaction-id'] if params['transaction-id']
|
217
|
+
#end
|
203
218
|
|
204
|
-
case CabooseStore::payment_processor
|
205
|
-
when 'authorize.net'
|
206
|
-
@success = params[:x_response_code] == '1'
|
207
|
-
@message = params[:x_response_reason_text]
|
208
|
-
@order.transaction_id = params[:x_trans_id] if params[:x_trans_id]
|
209
|
-
when 'payscape'
|
210
|
-
@success = CabooseStore::PaymentProcessor.authorize(@order, params)
|
211
|
-
@message = @success ? 'Payment processed successfully' : 'There was a problem processing your payment'
|
212
|
-
@order.transaction_id = params['transaction-id'] if params['transaction-id']
|
213
|
-
end
|
214
|
-
ap @success
|
215
|
-
ap '---------'
|
216
219
|
if @success
|
217
220
|
@order.financial_status = 'authorized'
|
218
221
|
@order.status = 'pending'
|
@@ -185,6 +185,51 @@ module CabooseStore
|
|
185
185
|
redirect_to "/admin/products/#{params[:id]}/variants"
|
186
186
|
end
|
187
187
|
|
188
|
+
# POST /admin/products/:id/varaints/add-multiple
|
189
|
+
def admin_add_multiple_variants
|
190
|
+
product = Product.find(params[:id])
|
191
|
+
|
192
|
+
params[:variants_csv].split("\r\n").each do |variant|
|
193
|
+
row = variant.split(',')
|
194
|
+
|
195
|
+
render :json => { :success => false, :error => "Quantity is not defined for variant: #{row[0].strip}" } and return if row[1].nil?
|
196
|
+
render :json => { :success => false, :error => "Price is not defined for variant: #{row[0].strip}" } and return if row[2].nil?
|
197
|
+
|
198
|
+
attributes = {
|
199
|
+
:alternate_id => row[0].strip,
|
200
|
+
:quantity_in_stock => row[1].strip.to_i,
|
201
|
+
:price => '%.2f' % row[2].strip.to_f,
|
202
|
+
:status => 'Active'
|
203
|
+
}
|
204
|
+
|
205
|
+
if product.option1 && row[3].nil?
|
206
|
+
render :json => { :success => false, :error => "#{product.option1} not defined for variant: #{attributes[:alternate_id]}" } and return
|
207
|
+
elsif product.option1
|
208
|
+
attributes[:option1] = row[3].strip
|
209
|
+
end
|
210
|
+
|
211
|
+
if product.option2 && row[4].nil?
|
212
|
+
render :json => { :success => false, :error => "#{product.option2} not defined for variant: #{attributes[:alternate_id]}" } and return
|
213
|
+
elsif product.option2
|
214
|
+
attributes[:option2] = row[4].strip
|
215
|
+
end
|
216
|
+
|
217
|
+
if product.option3 && row[5].nil?
|
218
|
+
render :json => { :success => false, :error => "#{product.option3} not defined for variant: #{attributes[:alternate_id]}" } and return
|
219
|
+
elsif product.option3
|
220
|
+
attributes[:option3] = row[5].strip
|
221
|
+
end
|
222
|
+
|
223
|
+
if product.variants.find_by_alternate_id(attributes[:alternate_id])
|
224
|
+
product.variants.find_by_alternate_id(attributes[:alternate_id]).update_attributes(attributes)
|
225
|
+
else
|
226
|
+
Variant.create(attributes.merge(:product_id => product.id))
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
render :json => { :success => true }
|
231
|
+
end
|
232
|
+
|
188
233
|
# POST /admin//products/:id/variants/remove
|
189
234
|
def admin_remove_variants
|
190
235
|
params[:variant_ids].each do |variant_id|
|
@@ -30,7 +30,7 @@ module CabooseStore
|
|
30
30
|
|
31
31
|
def checkout_nav(i)
|
32
32
|
str = ""
|
33
|
-
str << "<div id='nav'>"
|
33
|
+
str << "<div id='checkout-nav'>"
|
34
34
|
str << " <ul>"
|
35
35
|
str << " <li class='odd' id='checkout_nav1'><a href='#{i <= 1 ? '#' : '/checkout/step-one' }' class='#{i == 1 ? 'current' : (i < 1 ? 'not_done' : 'done')}'><span>User Account </span></a></li>"
|
36
36
|
str << " <li class='even' id='checkout_nav2'><a href='#{i <= 2 ? '#' : '/checkout/step-two' }' class='#{i == 2 ? 'current' : (i < 2 ? 'not_done' : 'done')}'><span>Addresses </span></a></li>"
|
@@ -41,6 +41,6 @@ module CabooseStore
|
|
41
41
|
str << "</div>"
|
42
42
|
return str
|
43
43
|
end
|
44
|
-
|
45
44
|
end
|
46
45
|
end
|
46
|
+
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module CabooseStore
|
2
2
|
class OrdersMailer < ActionMailer::Base
|
3
|
-
default :from => '
|
3
|
+
default :from => CabooseStore::from_address.nil? ? 'caboose-store.actionmailer@gmail.com' : CabooseStore::from_address
|
4
4
|
|
5
5
|
# Sends a confirmation email to the customer about a new order
|
6
6
|
def customer_new_order(order)
|
7
7
|
@order = order
|
8
|
-
mail(:to => order.customer
|
8
|
+
mail(:to => order.customer.email, :subject => 'Thank you for your order!')
|
9
9
|
end
|
10
10
|
|
11
11
|
# Sends a notification email to the fulfillment dept about a new order
|
@@ -23,7 +23,8 @@ module CabooseStore
|
|
23
23
|
# Sends a notification email to the customer that the status of the order has been changed
|
24
24
|
def customer_status_updated(order)
|
25
25
|
@order = order
|
26
|
-
mail(:to => order.customer
|
26
|
+
mail(:to => order.customer.email, :subject => 'Order status update')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
@@ -2,20 +2,52 @@ class CabooseStore::PaymentProcessors::Authorizenet < CabooseStore::PaymentProce
|
|
2
2
|
def self.api(root, body, test=false)
|
3
3
|
end
|
4
4
|
|
5
|
-
def self.form_url(order)
|
6
|
-
#
|
5
|
+
def self.form_url(order=nil)
|
6
|
+
#if Rails.env == 'development'
|
7
7
|
'https://test.authorize.net/gateway/transact.dll'
|
8
|
+
#else
|
9
|
+
# 'https://secure.authorize.net/gateway/transact.dll'
|
10
|
+
#end
|
8
11
|
end
|
9
12
|
|
10
13
|
def self.authorize(order, params)
|
14
|
+
order.update_attribute(:transaction_id, params[:x_trans_id]) if params[:x_trans_id]
|
15
|
+
return params[:x_response_code] == '1'
|
11
16
|
end
|
12
17
|
|
13
18
|
def self.void(order)
|
19
|
+
response = AuthorizeNet::SIM::Transaction.new(
|
20
|
+
CabooseStore::authorize_net_login_id,
|
21
|
+
CabooseStore::authorize_net_transaction_key,
|
22
|
+
order.total,
|
23
|
+
:transaction_type => 'VOID',
|
24
|
+
:transaction_id => order.transaction_id
|
25
|
+
)
|
26
|
+
|
27
|
+
ap response
|
14
28
|
end
|
15
29
|
|
16
30
|
def self.capture(order)
|
31
|
+
response = AuthorizeNet::SIM::Transaction.new(
|
32
|
+
CabooseStore::authorize_net_login_id,
|
33
|
+
CabooseStore::authorize_net_transaction_key,
|
34
|
+
order.total,
|
35
|
+
:transaction_type => 'CAPTURE_ONLY',
|
36
|
+
:transaction_id => order.transaction_id
|
37
|
+
)
|
38
|
+
|
39
|
+
ap response
|
17
40
|
end
|
18
41
|
|
19
42
|
def self.refund(order)
|
43
|
+
response = AuthorizeNet::SIM::Transaction.new(
|
44
|
+
CabooseStore::authorize_net_login_id,
|
45
|
+
CabooseStore::authorize_net_transaction_key,
|
46
|
+
order.total,
|
47
|
+
:transaction_type => 'CREDIT',
|
48
|
+
:transaction_id => order.transaction_id
|
49
|
+
)
|
50
|
+
|
51
|
+
ap response
|
20
52
|
end
|
21
53
|
end
|
@@ -69,6 +69,7 @@ class CabooseStore::PaymentProcessors::Payscape < CabooseStore::PaymentProcessor
|
|
69
69
|
|
70
70
|
def self.authorize(order, params)
|
71
71
|
response = self.api 'complete-action', { 'token-id' => params['token-id'] }, order.test?
|
72
|
+
order.update_attribute(:transaction_id, params['transaction-id']) if params['transaction-id']
|
72
73
|
return response['result-code'].to_i == 100
|
73
74
|
end
|
74
75
|
|
@@ -19,6 +19,7 @@ module CabooseStore
|
|
19
19
|
:price, # Variant’s price.
|
20
20
|
:ignore_quantity,
|
21
21
|
:quantity,
|
22
|
+
:quantity_in_stock,
|
22
23
|
:allow_backorder, # Whether to allow items with no inventory to be added to the cart
|
23
24
|
:status, # Current status: active, inactive, deleted
|
24
25
|
:weight, # The weight of the variant. This will always be in metric grams.
|
@@ -1,12 +1,23 @@
|
|
1
1
|
<!DOCTYPE>
|
2
2
|
<html>
|
3
3
|
<body>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
<% if CabooseStore::payment_processor == 'payscape' %>
|
5
|
+
<script type="text/javascript">
|
6
|
+
parent.relay_handler({
|
7
|
+
"success": <%= @success %>,
|
8
|
+
"message": "<%= @message %>"
|
9
|
+
});
|
10
|
+
</script>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% if CabooseStore::payment_processor == 'authorize.net' %>
|
14
|
+
<script>
|
15
|
+
parent.postMessage({
|
16
|
+
"success": <%= @success %>,
|
17
|
+
"message": "<%= @message %>"
|
18
|
+
}, "<%= CabooseStore::root_url %>");
|
19
|
+
</script>
|
20
|
+
<% end %>
|
10
21
|
</body>
|
11
22
|
</html>
|
12
23
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
<div id="checkout">
|
3
2
|
<h2>Checkout</h2>
|
4
3
|
<%= raw checkout_nav(4) %>
|
@@ -8,11 +7,16 @@
|
|
8
7
|
<% if CabooseStore::payment_processor == 'authorize.net' %>
|
9
8
|
<form id="payment" target="relay" action="<%= CabooseStore::PaymentProcessor.form_url(@order) %>" method="post">
|
10
9
|
<%= sim_fields(@sim_transaction) %>
|
10
|
+
|
11
11
|
<label>Card Number</label>
|
12
|
-
<input name="x_card_num" type="text" />
|
13
|
-
|
14
|
-
<
|
12
|
+
<input name="x_card_num" type="text" maxlength="16" />
|
13
|
+
<!--<br />
|
14
|
+
<label>Security Code</label><br />
|
15
|
+
<input id="x_card_code" name="x_card_code" type="text" />-->
|
15
16
|
<br />
|
17
|
+
|
18
|
+
<label>Expiration</label>
|
19
|
+
<input id="expiration" name="x_exp_date" type="hidden" />
|
16
20
|
<select id="month" name="month">
|
17
21
|
<option value="01">01 - Jan</option>
|
18
22
|
<option value="02">02 - Feb</option>
|
@@ -32,10 +36,8 @@
|
|
32
36
|
<% (DateTime.now.year...DateTime.now.year + 20).each do |i| %>
|
33
37
|
<option value="<%= i-2000 %>"><%= i %></option>
|
34
38
|
<% end %>
|
35
|
-
</select
|
36
|
-
<br />
|
37
|
-
<label>Security Code</label>
|
38
|
-
<input id="x_card_code" name="x_card_code" type="text" />
|
39
|
+
</select><br />
|
40
|
+
<br />
|
39
41
|
<input type="submit" value="Submit" />
|
40
42
|
</form>
|
41
43
|
<% end %>
|
@@ -88,4 +90,4 @@
|
|
88
90
|
|
89
91
|
<%= content_for :caboose_js do %>
|
90
92
|
<%= javascript_include_tag 'caboose_store/modules/checkout_step4' %>
|
91
|
-
<% end %>
|
93
|
+
<% end %>
|
@@ -10,6 +10,7 @@
|
|
10
10
|
<li><p>No thanks </p><button data-login-action="guest" id='guest_button' >Continue As Guest</button></li>
|
11
11
|
</ul>
|
12
12
|
</div>
|
13
|
+
|
13
14
|
<section id='checkout-login-form'>
|
14
15
|
<div class="wrapper" id='signin_form_container'>
|
15
16
|
<form action="/login" method="post" id='signin_form'>
|
@@ -18,6 +19,7 @@
|
|
18
19
|
<input type="submit" value="Submit" />
|
19
20
|
</form>
|
20
21
|
</div>
|
22
|
+
|
21
23
|
<div class="wrapper" id='register_form_container'>
|
22
24
|
<form action="/register" method="post" id='register_form'>
|
23
25
|
<input name="first_name" type="text" placeholder="First Name" />
|
@@ -29,6 +31,7 @@
|
|
29
31
|
<input type="submit" value="Submit" />
|
30
32
|
</form>
|
31
33
|
</div>
|
34
|
+
|
32
35
|
<div class="wrapper" id='guest_form_container'>
|
33
36
|
<form action="/checkout/attach-guest" method="post" id='guest_form'>
|
34
37
|
<input name="email" type="text" placeholder="Email" />
|
@@ -36,7 +39,10 @@
|
|
36
39
|
<input type="submit" value="Submit" />
|
37
40
|
</form>
|
38
41
|
</div>
|
39
|
-
|
42
|
+
|
43
|
+
<div class="wrapper">
|
44
|
+
<div id='message'></div>
|
45
|
+
</div>
|
40
46
|
</section>
|
41
47
|
</section>
|
42
48
|
|
@@ -47,4 +53,4 @@
|
|
47
53
|
|
48
54
|
<%= content_for :caboose_js do %>
|
49
55
|
<%= javascript_include_tag 'caboose_store/modules/checkout_step1' %>
|
50
|
-
<% end %>
|
56
|
+
<% end %>
|
@@ -17,7 +17,7 @@ ba = @order.billing_address
|
|
17
17
|
<label><span>Address 1 </span> <input name="shipping[address1]" type="text" value="<%= sa ? sa.address1 : "" %>" /></label>
|
18
18
|
<label><span>Address 2 </span> <input name="shipping[address2]" type="text" value="<%= sa ? sa.address2 : "" %>" /></label>
|
19
19
|
<label><span>City </span> <input name="shipping[city]" type="text" value="<%= sa ? sa.city : "" %>" /></label>
|
20
|
-
<label><span>State </span> <select name="shipping[state]"><% States.all.each do |abbr, state| %><option value="<%= abbr %>" <%= sa && sa.state == abbr ? 'selected' : "" %>><%= state %></option><% end %></select></label>
|
20
|
+
<label><span>State </span> <select name="shipping[state]"><% CabooseStore::States.all.each do |abbr, state| %><option value="<%= abbr %>" <%= sa && sa.state == abbr ? 'selected' : "" %>><%= state %></option><% end %></select></label>
|
21
21
|
<label><span>Zip </span> <input name="shipping[zip]" type="text" value="<%= sa ? sa.zip : "" %>" /></label>
|
22
22
|
<label><input name="use_as_billing" type="checkbox" value="false" /> Use as billing address</label>
|
23
23
|
</fieldset>
|
@@ -31,7 +31,7 @@ ba = @order.billing_address
|
|
31
31
|
<label><span>Address 1 </span> <input name="billing[address1]" type="text" value="<%= ba ? ba.address1 : "" %>" /></label>
|
32
32
|
<label><span>Address 2 </span> <input name="billing[address2]" type="text" value="<%= ba ? ba.address2 : "" %>" /></label>
|
33
33
|
<label><span>City </span> <input name="billing[city]" type="text" value="<%= ba ? ba.city : "" %>" /></label>
|
34
|
-
<label><span>State </span> <select name="billing[state]"><% States.all.each do |abbr, state| %><option value="<%= abbr %>" <%= ba && ba.state == abbr ? 'selected' : "" %>><%= state %></option><% end %></select></label>
|
34
|
+
<label><span>State </span> <select name="billing[state]"><% CabooseStore::States.all.each do |abbr, state| %><option value="<%= abbr %>" <%= ba && ba.state == abbr ? 'selected' : "" %>><%= state %></option><% end %></select></label>
|
35
35
|
<label><span>Zip </span> <input name="billing[zip]" type="text" value="<%= ba ? ba.zip : "" %>" /></label>
|
36
36
|
</fieldset>
|
37
37
|
</section>
|
@@ -48,4 +48,5 @@ ba = @order.billing_address
|
|
48
48
|
|
49
49
|
<%= content_for :caboose_js do %>
|
50
50
|
<%= javascript_include_tag 'caboose_store/modules/checkout_step2' %>
|
51
|
-
<% end %>
|
51
|
+
<% end %>
|
52
|
+
|
@@ -11,17 +11,19 @@ captured = @order.financial_status == 'captured'
|
|
11
11
|
|
12
12
|
<table class='data'>
|
13
13
|
<tr>
|
14
|
-
<th
|
14
|
+
<th><%= if @order.customer.nil? then 'Guest' else 'Customer' end %></th>
|
15
15
|
<th>Shipping Address</th>
|
16
16
|
<th>Order Status</th>
|
17
17
|
<th>Payment Status</th>
|
18
|
-
|
18
|
+
<th>Transaction ID</th>
|
19
19
|
</tr>
|
20
20
|
<tr>
|
21
21
|
<td valign='top'>
|
22
22
|
<%= "#{@order.shipping_address.first_name} #{@order.shipping_address.last_name}" %><br />
|
23
23
|
<% if @order.customer %>
|
24
|
-
<a href=
|
24
|
+
<a href="mailto:<%= "#{@order.customer.email}" %>"><%= "#{@order.customer.email}" %></a><br />
|
25
|
+
<% elsif @order.email %>
|
26
|
+
<a href="mailto:<%= @order.email %>"><%= @order.email %></a>
|
25
27
|
<% end %>
|
26
28
|
<%= @order.customer ? @order.customer.phone : @order.shipping_address.phone %>
|
27
29
|
</td>
|
@@ -38,7 +40,7 @@ captured = @order.financial_status == 'captured'
|
|
38
40
|
for <%= number_to_currency(@order.auth_amount) %>
|
39
41
|
<% end %>
|
40
42
|
</td>
|
41
|
-
|
43
|
+
<td valign="top"><%= @order.transaction_id %></td>
|
42
44
|
</tr>
|
43
45
|
</table><br />
|
44
46
|
|
@@ -93,11 +95,11 @@ captured = @order.financial_status == 'captured'
|
|
93
95
|
|
94
96
|
<% if @order.financial_status == 'authorized' %>
|
95
97
|
<input type='button' value='Capture Funds' onclick="capture_funds(<%= @order.id %>);" />
|
96
|
-
|
98
|
+
<input type='button' value='Void' onclick="void_order(<%= @order.id %>);" />
|
97
99
|
<% end %>
|
98
100
|
|
99
101
|
<% if @order.financial_status == 'captured' %>
|
100
|
-
|
102
|
+
<input type='button' value='Refund' onclick="refund_order(<%= @order.id %>);" />
|
101
103
|
<% end %>
|
102
104
|
|
103
105
|
<input type='button' value='Resend Confirmation' onclick="resend_confirmation(<%= @order.id %>)" />
|
@@ -110,15 +112,15 @@ captured = @order.financial_status == 'captured'
|
|
110
112
|
|
111
113
|
function resend_confirmation(order_id)
|
112
114
|
{
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
115
|
+
modal.autosize("<p class='loading'>Resending confirmation..</p>");
|
116
|
+
$.ajax({
|
117
|
+
type: 'post',
|
118
|
+
url: '/admin/orders/' + order_id + '/resend-confirmation',
|
119
|
+
success: function(resp) {
|
120
|
+
if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
121
|
+
if (resp.success) modal.autosize("<p class='note success'>" + resp.success + "</p>");
|
122
|
+
}
|
123
|
+
});
|
122
124
|
}
|
123
125
|
|
124
126
|
function capture_funds(order_id, confirm)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<% content_for :caboose_css do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
<style>
|
3
|
+
ul {
|
4
|
+
list-style-type: square;
|
5
|
+
padding: 0 0 0 24px;
|
6
|
+
margin: 12px 0 24px;
|
7
|
+
}
|
8
|
+
</style>
|
9
9
|
<% end %>
|
10
10
|
|
11
11
|
<%
|
@@ -82,6 +82,13 @@ end
|
|
82
82
|
|
83
83
|
<p><input type='button' value='New Variant' onclick="add_variant(<%= p.id %>);" /></p>
|
84
84
|
|
85
|
+
<form id="add-multiple" action="/admin/products/<%= @product.id %>/variants/add-multiple" method="post">
|
86
|
+
<p style="margin: 0 0 12px"><small>CSV format: Alternate ID, Quantity, Price<%= ', ' if @product.option1 || @product.option2 || @product.option3 %><%= [@product.option1, @product.option2, @product.option3].compact.join(', ') %></small></p>
|
87
|
+
<textarea id="variants_csv" name="variants_csv" rows="8" cols="12" style="min-width: 500px; min-height: 250px; margin: 0 0 16px; padding: 12px"></textarea><br />
|
88
|
+
<input type="submit" value="Submit" />
|
89
|
+
<p class="message" style="margin: 12px 0 0; color: red"></p>
|
90
|
+
</form>
|
91
|
+
|
85
92
|
<%= render :partial => 'caboose_store/products/admin_footer' %>
|
86
93
|
|
87
94
|
<% content_for :caboose_css do %>
|
@@ -95,6 +102,25 @@ td.sort_handle { background: #ccc; width: 20px; }
|
|
95
102
|
<script type='text/javascript'>
|
96
103
|
|
97
104
|
$(document).ready(function() {
|
105
|
+
$('form#add-multiple').on('submit', function(event) {
|
106
|
+
event.preventDefault();
|
107
|
+
var $form = $(event.target);
|
108
|
+
|
109
|
+
$.ajax({
|
110
|
+
type: $form.attr('method'),
|
111
|
+
url: $form.attr('action'),
|
112
|
+
data: $form.serialize(),
|
113
|
+
success: function(response) {
|
114
|
+
console.log(response);
|
115
|
+
if (response.success) {
|
116
|
+
location.reload();
|
117
|
+
} else {
|
118
|
+
$form.find('.message').empty().text(response.error);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
});
|
122
|
+
});
|
123
|
+
|
98
124
|
<% p.variants.each do |v| %>
|
99
125
|
new ModelBinder({
|
100
126
|
name: 'Variant',
|
data/config/routes.rb
CHANGED
@@ -27,7 +27,7 @@ CabooseStore::Engine.routes.draw do
|
|
27
27
|
#get '/checkout/payment' => 'checkout#payment'
|
28
28
|
get '/checkout/relay/:order_id' => 'checkout#relay'
|
29
29
|
post '/checkout/relay/:order_id' => 'checkout#relay'
|
30
|
-
|
30
|
+
get '/checkout/empty' => 'checkout#empty'
|
31
31
|
|
32
32
|
# Products
|
33
33
|
|
@@ -44,6 +44,7 @@ CabooseStore::Engine.routes.draw do
|
|
44
44
|
get '/admin/products/:id/variants/group' => 'products#admin_group_variants'
|
45
45
|
post '/admin/products/:id/variants/add' => 'products#admin_add_variants'
|
46
46
|
post '/admin/products/:id/variants/remove' => 'products#admin_remove_variants'
|
47
|
+
post '/admin/products/:id/variants/add-multiple' => 'products#admin_add_multiple_variants'
|
47
48
|
|
48
49
|
get '/admin/products/add-upcs' => 'products#admin_add_upcs'
|
49
50
|
|
data/lib/caboose-store.rb
CHANGED
data/lib/caboose-store/engine.rb
CHANGED
@@ -87,7 +87,8 @@ module CabooseStore::BootStrapper
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# Log the order and set an instance variable up
|
90
|
-
|
90
|
+
@order = CabooseStore::Order.find(session[:cart_id])
|
91
91
|
session[:new_cart_items] ||= Array.new
|
92
92
|
end
|
93
93
|
end
|
94
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caboose-cms
|