camaleon_ecommerce 1.2 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/plugins/ecommerce/admin_product.js.coffee +17 -1
  3. data/app/controllers/plugins/ecommerce/admin/coupons_controller.rb +1 -1
  4. data/app/controllers/plugins/ecommerce/admin/orders_controller.rb +24 -21
  5. data/app/controllers/plugins/ecommerce/admin/payment_methods_controller.rb +2 -34
  6. data/app/controllers/plugins/ecommerce/admin/prices_controller.rb +3 -6
  7. data/app/controllers/plugins/ecommerce/admin/settings_controller.rb +2 -1
  8. data/app/controllers/plugins/ecommerce/admin/shipping_methods_controller.rb +2 -2
  9. data/app/controllers/plugins/ecommerce/admin/tax_rates_controller.rb +1 -1
  10. data/app/controllers/plugins/ecommerce/admin_controller.rb +2 -2
  11. data/app/controllers/plugins/ecommerce/front/checkout_controller.rb +34 -18
  12. data/app/controllers/plugins/ecommerce/front/orders_controller.rb +3 -4
  13. data/app/controllers/plugins/ecommerce/front_controller.rb +26 -11
  14. data/app/decorators/plugins/ecommerce/cart_decorator.rb +5 -5
  15. data/app/decorators/plugins/ecommerce/coupon_decorator.rb +8 -27
  16. data/app/decorators/plugins/ecommerce/order_decorator.rb +1 -1
  17. data/app/decorators/plugins/ecommerce/product_decorator.rb +33 -20
  18. data/app/decorators/plugins/ecommerce/product_item_decorator.rb +8 -2
  19. data/app/decorators/plugins/ecommerce/product_variation_decorator.rb +1 -1
  20. data/app/helpers/plugins/ecommerce/ecommerce_email_helper.rb +7 -6
  21. data/app/helpers/plugins/ecommerce/ecommerce_functions_helper.rb +276 -33
  22. data/app/helpers/plugins/ecommerce/ecommerce_helper.rb +59 -56
  23. data/app/models/plugins/ecommerce/attribute.rb +3 -0
  24. data/app/models/plugins/ecommerce/cart.rb +31 -7
  25. data/app/models/plugins/ecommerce/legacy_order.rb +1 -30
  26. data/app/models/plugins/ecommerce/order.rb +11 -5
  27. data/app/models/plugins/ecommerce/order_detail.rb +1 -0
  28. data/app/models/plugins/ecommerce/payment_method.rb +9 -5
  29. data/app/models/plugins/ecommerce/product_variation.rb +6 -0
  30. data/app/services/plugins/ecommerce/cart_service.rb +4 -17
  31. data/app/views/camaleon_cms/html_mailer/order_canceled.html.erb +2 -2
  32. data/app/views/camaleon_cms/html_mailer/order_confirmed.html.erb +2 -2
  33. data/app/views/camaleon_cms/html_mailer/order_received.html.erb +5 -3
  34. data/app/views/camaleon_cms/html_mailer/order_received_admin.html.erb +3 -3
  35. data/app/views/camaleon_cms/html_mailer/order_shipped.html.erb +2 -2
  36. data/app/views/camaleon_cms/html_mailer/recovery_cart.html.erb +3 -3
  37. data/app/views/plugins/ecommerce/admin/coupons/form.html.erb +11 -11
  38. data/app/views/plugins/ecommerce/admin/coupons/index.html.erb +11 -11
  39. data/app/views/plugins/ecommerce/admin/orders/form.html.erb +2 -2
  40. data/app/views/plugins/ecommerce/admin/orders/index.html.erb +53 -63
  41. data/app/views/plugins/ecommerce/admin/payment_methods/form.html.erb +30 -24
  42. data/app/views/plugins/ecommerce/admin/payment_methods/index.html.erb +8 -8
  43. data/app/views/plugins/ecommerce/admin/payment_methods/show.html.erb +22 -22
  44. data/app/views/plugins/ecommerce/admin/prices/form.html.erb +6 -6
  45. data/app/views/plugins/ecommerce/admin/prices/index.html.erb +8 -8
  46. data/app/views/plugins/ecommerce/admin/product_attributes.html.erb +1 -1
  47. data/app/views/plugins/ecommerce/admin/products/_variations.html.erb +4 -4
  48. data/app/views/plugins/ecommerce/admin/products/index.html.erb +5 -5
  49. data/app/views/plugins/ecommerce/admin/settings/index.html.erb +20 -8
  50. data/app/views/plugins/ecommerce/admin/shipping_methods/form.html.erb +5 -5
  51. data/app/views/plugins/ecommerce/admin/shipping_methods/index.html.erb +8 -9
  52. data/app/views/plugins/ecommerce/admin/shipping_methods/show.html.erb +4 -4
  53. data/app/views/plugins/ecommerce/admin/tax_rates/form.html.erb +3 -3
  54. data/app/views/plugins/ecommerce/admin/tax_rates/index.html.erb +7 -7
  55. data/app/views/plugins/ecommerce/front/checkout/index.html.erb +4 -4
  56. data/app/views/plugins/ecommerce/front/login.html.erb +3 -6
  57. data/app/views/plugins/ecommerce/front/orders/show.html.erb +7 -1
  58. data/app/views/plugins/ecommerce/partials/_cart_widget.html.erb +14 -29
  59. data/app/views/plugins/ecommerce/partials/checkout/_details.html.erb +1 -1
  60. data/app/views/plugins/ecommerce/partials/checkout/_payments.html.erb +100 -99
  61. data/app/views/plugins/ecommerce/partials/checkout/_user_info.html.erb +2 -2
  62. data/app/views/post_types/commerce/{_product_widget.html.erb → _post_list_item.html.erb} +0 -0
  63. data/app/views/post_types/commerce/_product_info.html.erb +45 -0
  64. data/app/views/post_types/commerce/single.html.erb +63 -85
  65. data/config/camaleon_plugin.json +3 -8
  66. data/config/custom_models.rb +28 -4
  67. data/config/locales/en.yml +27 -12
  68. data/config/locales/es.yml +70 -57
  69. data/config/routes.rb +1 -0
  70. data/db/migrate/20161202182552_add_cookie_key_to_cart.rb +5 -0
  71. data/lib/ecommerce/version.rb +1 -1
  72. metadata +7 -14
  73. data/app/helpers/plugins/ecommerce/ecommerce_payment_helper.rb +0 -6
  74. data/app/models/plugins/ecommerce/legacy_cart.rb +0 -50
  75. data/app/services/plugins/ecommerce/product_item_service.rb +0 -29
  76. data/app/services/plugins/ecommerce/product_service.rb +0 -17
  77. data/app/services/plugins/ecommerce/site_service.rb +0 -21
  78. data/app/services/plugins/ecommerce/user_cart_service.rb +0 -12
  79. data/app/services/plugins/ecommerce/user_product_service.rb +0 -29
  80. data/app/views/post_types/commerce.html.erb +0 -22
  81. data/app/views/post_types/commerce/category.html.erb +0 -23
@@ -1,5 +1,5 @@
1
1
  <div class="container" id="ecommerce_login_panel">
2
- <%= render 'camaleon_cms/flash_messages' %>
2
+ <%= render 'camaleon_cms/flash_messages', locals:{ flash: (flash[:cama_ecommerce] || {}).with_indifferent_access } %>
3
3
  <div class="row">
4
4
  <div class="col-md-6 col-md-offset-3">
5
5
  <ul class="nav nav-tabs" role="tablist">
@@ -10,10 +10,10 @@
10
10
  <%= form_tag plugins_ecommerce_login_path, id: 'login-form', class: 'tab-pane active', role: 'tabpanel' do %>
11
11
  <%= hidden_field_tag :kind_form, 'login-form' %>
12
12
  <div class="form-group">
13
- <input type="text" name="username" id="username" tabindex="1" class="form-control required" placeholder="<%= t('.username', default: 'Username') %>" value="">
13
+ <input type="text" name="email" tabindex="1" class="form-control required" placeholder="<%= t('.email', default: 'Email') %>" value="<%= params[:email] %>">
14
14
  </div>
15
15
  <div class="form-group">
16
- <input type="password" name="password" id="password" tabindex="2" class="form-control required" placeholder="<%= t('.password', default: 'Password') %>">
16
+ <input type="password" name="password" tabindex="2" class="form-control required" placeholder="<%= t('.password', default: 'Password') %>">
17
17
  </div>
18
18
  <div class="form-group">
19
19
  <%= button_tag t('.login', default: 'Login'), class: 'btn btn-default col-md-3', type: 'submit' %>
@@ -28,9 +28,6 @@
28
28
  <div class="form-group">
29
29
  <%= f.text_field :first_name, class: 'form-control required', tabindex: 1, placeholder: t('.full_name', default: 'Full Name') %>
30
30
  </div>
31
- <div class="form-group">
32
- <%= f.text_field :username, class: 'form-control required', tabindex: 2, placeholder: t('.username', default: 'User name') %>
33
- </div>
34
31
  <div class="form-group">
35
32
  <%= f.text_field :email, class: 'form-control email required', tabindex: 3, placeholder: t('.email', default: 'Email address') %>
36
33
  </div>
@@ -1,8 +1,14 @@
1
1
  <% order ||= @order %>
2
2
  <div class="order_details">
3
3
  <% unless defined?(as_partial) %>
4
+ <%= raw ecommerce_draw_breadcrumb %>
4
5
  <h1><%= t('.title', default: 'Order Details') %>: <%= order.slug %></h1>
5
6
  <% end %>
7
+ <div class="basic_info">
8
+ <% if order.received_at.present? %><b><%= t('.received_at', default: 'Received At') %>: </b> <%= order.received_at %><br> <% end %>
9
+ <b><%= t('.created_at', default: 'Created At') %>: </b> <%= order.created_at %><br>
10
+ <% if order.shipped_at.present? %><b><%= t('.shipped_at', default: 'Shipped At') %>: </b> <%= order.shipped_at %><br> <% end %>
11
+ </div>
6
12
  <div>
7
13
  <h4><%= t('.customer_info', default: 'Customer Info') %></h4>
8
14
  <ul class="ec-list-orders-address">
@@ -109,7 +115,7 @@
109
115
  <% if defined?(as_partial) %>
110
116
  <tr>
111
117
  <td>
112
- <%= raw order.get_meta('payment_data', {}).map { |k, v| "<b>#{k.to_s.titleize}</b>: #{v}" }.join('<br>') %>
118
+ <%= raw (order.get_meta('payment_data') || {}).map { |k, v| "<b>#{k.to_s.titleize}</b>: #{v}" }.join('<br>') %>
113
119
  </td>
114
120
  </tr>
115
121
  <% end %>
@@ -1,38 +1,23 @@
1
1
  <div class="row" style="min-height: 64px">
2
2
  <div class="col-md-9">
3
- <ol class="breadcrumb" style="margin: 0;">
4
- <% @ecommerce_breadcrumb.each_with_index do |m, index| %>
5
- <% if m[1].present? %>
6
- <li class="<%= "active" if @ecommerce_breadcrumb.size == index+1 %>">
7
- <a href="<%= m[1] %>"><%= m[0] %></a></li>
8
- <% else %>
9
- <li class="<%= "active" if @ecommerce_breadcrumb.size == index+1 %>"><span><%= m[0] %></span></li>
10
- <% end %>
11
- <% end %>
12
- </ol>
3
+ <%= raw ecommerce_draw_breadcrumb %>
13
4
  </div>
14
5
 
15
6
  <div class="col-md-3">
16
- <% if signin? %>
17
- <div class="well shopping_cart_box">
18
- <% @cart ||= current_site.carts.set_user(current_user).first_or_create(name: "Cart by #{current_user.id}").decorate %>
19
- <h4><%= t('.shopping_cart', default: 'Shopping Cart') %></h4>
20
- <p><%= t('.total_items', default: '(%{qty}) items', qty: @cart.items_total) %>, <%= t('.total', default: 'Total') %>: <%= @cart.the_total_amount %></p>
21
- <span>
22
- <a href="<%= @ecommerce_post_type.the_url %>" class="btn btn-default btn-xs"><%= t('.products_list', default: 'Products list') %></a>
23
- <% if (@cart.items_total > 0) %>
24
- <a href="<%= plugins_ecommerce_checkout_cart_path %>" class="btn btn-warning btn-xs"><%= t('.purchase', default: 'Purchase') %></a>
25
- <% end %>
26
- <a href="<%= plugins_ecommerce_orders_path %>" class="btn btn-success btn-xs"><%= t('.my_orders', default: 'My Orders') %></a>
27
- </span>
28
- </div>
29
- <% else %>
30
- <div class=" text-right">
31
- <a href="<%= @ecommerce_post_type.the_url %>" class="btn btn-default"><%= t('.products_list', default: 'Products list') %></a>
32
- </div>
33
- <% end %>
7
+ <div class="well shopping_cart_box">
8
+ <% @cart ||= e_current_cart %>
9
+ <h4><%= t('.shopping_cart', default: 'Shopping Cart') %></h4>
10
+ <p><%= t('.total_items', default: '(%{qty}) items', qty: @cart.items_total) %>, <%= t('.total', default: 'Total') %>: <%= @cart.the_total_amount %></p>
11
+ <span>
12
+ <a href="<%= cama_ecommerce_post_type.the_url %>" class="btn btn-default btn-xs"><%= t('.products_list', default: 'Products list') %></a>
13
+ <% if (@cart.items_total > 0) %>
14
+ <a href="<%= plugins_ecommerce_checkout_cart_path %>" class="btn btn-warning btn-xs"><%= t('.purchase', default: 'Purchase') %></a>
15
+ <% end %>
16
+ <a href="<%= plugins_ecommerce_orders_path %>" class="btn btn-success btn-xs"><%= t('.my_orders', default: 'My Orders') %></a>
17
+ </span>
18
+ </div>
34
19
  </div>
35
20
  </div>
36
21
  <div class="clearfix">
37
- <%= render partial: "/camaleon_cms/flash_messages.html.erb" %>
22
+ <%= render partial: "/camaleon_cms/flash_messages.html.erb", locals:{ flash: (flash[:cama_ecommerce] || {}).with_indifferent_access} %>
38
23
  </div>
@@ -18,7 +18,7 @@
18
18
  <h3><%= t('.shipping_options', default: 'Shipping Options') %></h3>
19
19
  <div class="form-group">
20
20
  <select class="form-control required" name="shipping_method" id="shipping_methods" >
21
- <% current_site.shipping_methods.each do |m| price = m.get_price_from_weight(@cart.weight_total); the_price = "#{current_site.current_unit}#{price}" %>
21
+ <% current_site.shipping_methods.each do |m| price = m.get_price_from_weight(@cart.weight_total); the_price = e_parse_price(price) %>
22
22
  <option value="<%= m.id %>" <%= 'selected' if @cart.shipping_method_id == m.id %> data-price="<%= price %>"><%= m.name %> (<%= the_price %>)</option>
23
23
  <% end %>
24
24
  </select>
@@ -4,17 +4,8 @@
4
4
  </div>
5
5
  <% else %>
6
6
  <div id="e-payments-types" role="tabpanel">
7
- <ul class="nav nav-tabs nav-justified" role="tablist">
7
+ <div class="panel-group" id="e_accordion_payments" role="tablist" aria-multiselectable="true">
8
8
  <% (payment_methods = current_site.payment_methods.actives.all).each_with_index do |payment, index| %>
9
- <li role="presentation" class="<%= "active" if index == 0 %>">
10
- <a href="#<%= payment.slug %>" aria-controls="<%= payment.slug %>" role="tab" data-toggle="tab"><%= t(".#{payment.options[:type]}", default: payment.options[:type].titleize) %></a>
11
- </li>
12
- <% end %>
13
- </ul>
14
-
15
- <!-- Tab panes -->
16
- <div class="tab-content">
17
- <% payment_methods.each_with_index do |payment, index| %>
18
9
  <% inputs = content_tag :div do %>
19
10
  <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>">
20
11
  <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>">
@@ -22,103 +13,113 @@
22
13
  <button class="btn btn-primary col-md-4" type="submit"><i class="fa fa-money"></i> <%= t('.order_now', default: 'Buy') %></button>
23
14
  </div>
24
15
  <% end %>
25
-
26
- <div role="tabpanel" class="tab-pane <%= "active" if index == 0 %>" id="<%= payment.slug %>">
27
- <p><%= payment.description.translate %></p>
28
- <% if payment.options[:type] == 'paypal' %>
29
- <div class="type-paypal">
30
- <img src="https://www.paypalobjects.com/webstatic/mktg/logo/bdg_payments_by_pp_2line.png" alt="Buy now with PayPal"/>
31
- <%= form_tag(plugins_ecommerce_checkout_pay_by_paypal_path(order: @cart.slug), :method => "post") do %>
32
- <%= inputs %>
16
+ <div class="panel panel-default">
17
+ <div class="panel-heading" role="tab" id="heading<%= payment.slug %>">
18
+ <a role="button" data-toggle="collapse" data-parent="#e_accordion_payments" href="#<%= payment.slug %>" aria-expanded="true" aria-controls="collapseOne"><%= t(".#{payment.options[:type]}", default: payment.options[:type].titleize) %></a>
19
+ </div>
20
+ <div id="<%= payment.slug %>" class="panel-collapse collapse <%= "in" if index == 0 %>" role="tabpanel" aria-labelledby="heading<%= payment.slug %>">
21
+ <div class="panel-body">
22
+ <p><%= payment.description.translate %></p>
23
+ <% if payment.options[:type] == 'paypal' %>
24
+ <div class="type-paypal">
25
+ <img src="https://www.paypalobjects.com/webstatic/mktg/logo/bdg_payments_by_pp_2line.png" alt="Buy now with PayPal"/>
26
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_paypal_path(order: @cart.slug), :method => "post") do %>
27
+ <%= inputs %>
28
+ <% end %>
29
+ </div>
33
30
  <% end %>
34
- </div>
35
- <% end %>
36
31
 
37
- <% if payment.options[:type] == 'bank_transfer' %>
38
- <%= form_tag(plugins_ecommerce_checkout_pay_by_bank_transfer_path(order: @cart.slug), :method => "post") do %>
39
- <ul class="ec-list-orders-address">
40
- <li><strong><%= t('.account_number', default: 'Account Number') %>: </strong><span> <%= payment.options[:bank_transfer_number_account] %></span></li>
41
- <li><strong><%= t('.details_transfer', default: 'Details') %>: </strong><span> <%= payment.options[:bank_transfer_detail] %></span></li>
42
- </ul>
43
- <div class="form-group">
44
- <label><%= t('.bank_name', default: 'Bank name') %></label>
45
- <input class="form-control required" type="text" name="details[bank_name]">
46
- </div>
47
- <div class="form-group">
48
- <label><%= t('.bank_owner', default: 'Owner name of bank account') %></label>
49
- <input class="form-control required" type="text" name="details[owner_name]">
50
- </div>
51
- <div class="form-group">
52
- <label><%= t('.cod_key', default: 'CODE / ID / KEY / TICKET') %></label>
53
- <input class="form-control required" type="text" name="details[code]">
54
- </div>
55
- <div class="form-group">
56
- <label><%= t('.descr', default: 'Description') %></label>
57
- <textarea name="details[description]" rows="4" class="form-control required" ></textarea>
58
- </div>
59
- <%= inputs %>
60
- <% end %>
61
- <% end %>
32
+ <% if payment.options[:type] == 'bank_transfer' %>
33
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_bank_transfer_path(order: @cart.slug), :method => "post") do %>
34
+ <ul class="ec-list-orders-address">
35
+ <li><strong><%= t('.account_number', default: 'Account Number') %>: </strong><span> <%= payment.options[:bank_transfer_number_account] %></span></li>
36
+ <li><strong><%= t('.details_transfer', default: 'Details') %>: </strong><span> <%= payment.options[:bank_transfer_detail] %></span></li>
37
+ </ul>
38
+ <div class="form-group">
39
+ <label><%= t('.bank_name', default: 'Bank name') %></label>
40
+ <input class="form-control required" type="text" name="details[bank_name]">
41
+ </div>
42
+ <div class="form-group">
43
+ <label><%= t('.bank_owner', default: 'Owner name of bank account') %></label>
44
+ <input class="form-control required" type="text" name="details[owner_name]">
45
+ </div>
46
+ <div class="form-group">
47
+ <label><%= t('.cod_key', default: 'CODE / ID / KEY / TICKET') %></label>
48
+ <input class="form-control required" type="text" name="details[code]">
49
+ </div>
50
+ <div class="form-group">
51
+ <label><%= t('.descr', default: 'Description') %></label>
52
+ <textarea name="details[description]" rows="4" class="form-control required" ></textarea>
53
+ </div>
54
+ <%= inputs %>
55
+ <% end %>
56
+ <% end %>
57
+ <% if payment.options[:type] == 'on_delivery' %>
58
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_on_delivery_path(order: @cart.slug), :method => "post") do %>
59
+ <%= inputs %>
60
+ <% end %>
61
+ <% end %>
62
62
 
63
- <% if payment.options[:type] == 'credit_card' %>
64
- <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Credit Card"/>
65
- <% end %>
63
+ <% if payment.options[:type] == 'credit_card' %>
64
+ <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Credit Card"/>
65
+ <% end %>
66
66
 
67
- <% if payment.options[:type] == 'authorize_net' %>
68
- <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/>
69
- <%= form_tag(plugins_ecommerce_checkout_pay_by_authorize_net_path(order: @cart.slug), :method => "post") do %>
70
- <div class="form-group">
71
- <label for="firstName"><%= t('.first_name', default: 'First Name') %></label>
72
- <input type="text" class="form-control required" name="firstName" value="<%= @cart.user.first_name %>" required autocomplete="off"/>
73
- </div>
74
- <div class="form-group">
75
- <label for="lastName"><%= t('.last_name', default: 'Last Name') %></label>
76
- <input type="text" class="form-control required" name="lastName" value="<%= @cart.user.last_name %>" autocomplete="off"/>
77
- </div>
78
- <div class="form-group">
79
- <label><%= t('.card_number', default: 'Card Number') %></label>
80
- <div class="input-group">
81
- <input type="text" class="form-control required" name="cardNumber" autocomplete="off"/>
82
- <span class="input-group-addon"><i class="fa fa-credit-card"></i></span>
83
- </div>
84
- </div>
85
- <div class="form-group">
86
- <label for="expMonth"><%= t('.exp_date', default: 'EXPIRATION DATE') %></label>
87
- <div class="row">
88
- <div class="col-xs-6 col-lg-6">
89
- <input type="text" class="form-control required" name="expMonth" placeholder="MM" autocomplete="off"/>
67
+ <% if payment.options[:type] == 'authorize_net' %>
68
+ <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/>
69
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_authorize_net_path(order: @cart.slug), :method => "post") do %>
70
+ <div class="form-group">
71
+ <label for="firstName"><%= t('.first_name', default: 'First Name') %></label>
72
+ <input type="text" class="form-control required" name="firstName" value="<%= @cart.user.first_name %>" required autocomplete="off"/>
90
73
  </div>
91
- <div class="col-xs-6 col-lg-6">
92
- <input type="text" class="form-control required" name="expYear" placeholder="YY" autocomplete="off"/>
74
+ <div class="form-group">
75
+ <label for="lastName"><%= t('.last_name', default: 'Last Name') %></label>
76
+ <input type="text" class="form-control required" name="lastName" value="<%= @cart.user.last_name %>" autocomplete="off"/>
93
77
  </div>
94
- </div>
95
- </div>
96
- <div class="form-group">
97
- <label for="cvCode"><%= t('.cvv', default: 'Cvv CODE') %></label>
98
- <input type="text" class="form-control required" name="cvCode" placeholder="cvv" autocomplete="off"/>
99
- </div>
100
- <%= inputs %>
101
- <% end %>
102
- <% end %>
103
-
104
- <% if payment.options[:type] == 'stripe' %>
105
- <%= form_tag(plugins_ecommerce_checkout_pay_by_stripe_path(order: @cart.slug), :method => "post") do %>
106
- <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>">
107
- <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>">
108
- <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/><br>
109
- <hr>
110
- <script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
111
- data-key="<%= payment.options[:stripe_key] %>"
112
- data-description="Payment Products: <%= @cart.products_title %>"
113
- data-amount="<%= commerce_to_cents(@cart.total_amount) %>"
114
- data-locale="<%= I18n.locale %>"></script>
115
- <% end %>
116
- <% end %>
78
+ <div class="form-group">
79
+ <label><%= t('.card_number', default: 'Card Number') %></label>
80
+ <div class="input-group">
81
+ <input type="text" class="form-control required" name="cardNumber" autocomplete="off"/>
82
+ <span class="input-group-addon"><i class="fa fa-credit-card"></i></span>
83
+ </div>
84
+ </div>
85
+ <div class="form-group">
86
+ <label for="expMonth"><%= t('.exp_date', default: 'EXPIRATION DATE') %></label>
87
+ <div class="row">
88
+ <div class="col-xs-6 col-lg-6">
89
+ <input type="text" class="form-control required" name="expMonth" placeholder="MM" autocomplete="off"/>
90
+ </div>
91
+ <div class="col-xs-6 col-lg-6">
92
+ <input type="text" class="form-control required" name="expYear" placeholder="YY" autocomplete="off"/>
93
+ </div>
94
+ </div>
95
+ </div>
96
+ <div class="form-group">
97
+ <label for="cvCode"><%= t('.cvv', default: 'Cvv CODE') %></label>
98
+ <input type="text" class="form-control required" name="cvCode" placeholder="cvv" autocomplete="off"/>
99
+ </div>
100
+ <%= inputs %>
101
+ <% end %>
102
+ <% end %>
117
103
 
118
- <% if(custom_method = ecommerce_custom_payment_methods[payment.options[:type].to_sym]).present? %>
119
- <%= render custom_method[:payment_form_view_path], payment: payment, options: payment.options, cart: @cart %>
120
- <% end %>
104
+ <% if payment.options[:type] == 'stripe' %>
105
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_stripe_path(order: @cart.slug), :method => "post") do %>
106
+ <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>">
107
+ <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>">
108
+ <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/><br>
109
+ <hr>
110
+ <script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
111
+ data-key="<%= payment.options[:stripe_key] %>"
112
+ data-description="Payment Products: <%= @cart.products_title %>"
113
+ data-amount="<%= Plugins::Ecommerce::UtilService.ecommerce_money_to_cents(@cart.total_amount) %>"
114
+ data-locale="<%= I18n.locale %>"></script>
115
+ <% end %>
116
+ <% end %>
121
117
 
118
+ <% if(custom_method = ecommerce_custom_payment_methods[payment.options[:type].to_sym]).present? %>
119
+ <%= render custom_method[:payment_form_view_path], payment: payment, options: payment.options, cart: @cart %>
120
+ <% end %>
121
+ </div>
122
+ </div>
122
123
  </div>
123
124
  <% end %>
124
125
  <%= content_tag(:div, 'No Payment Methods Defined', class: 'alert alert-danger') unless payment_methods.any? %>
@@ -28,7 +28,7 @@
28
28
  </div>
29
29
  <div class="form-group">
30
30
  <label><%= t('.country', default: 'Country') %></label>
31
- <%= country_select :billing_address, :country, {locale: I18n.locale.to_s, iso_codes: true, selected: billing_address[:country]}, { :name => 'order[billing_address][country]', class: 'form-control' } %>
31
+ <%= country_select :billing_address, :country, {locale: I18n.locale.to_s, iso_codes: true, selected: billing_address[:country], only: e_shipping_countries}, { :name => 'order[billing_address][country]', class: 'form-control' } %>
32
32
  </div>
33
33
  <div class="form-group">
34
34
  <label><%= t('.state', default: 'State') %></label>
@@ -72,7 +72,7 @@
72
72
  </div>
73
73
  <div class="form-group">
74
74
  <label><%= t('.country', default: 'Country') %></label>
75
- <%= country_select :shipping_address, :country, {locale: I18n.locale.to_s, iso_codes: true, selected: billing_address[:country]}, { :name => 'order[shipping_address][country]', class: 'form-control' } %>
75
+ <%= country_select :shipping_address, :country, {locale: I18n.locale.to_s, iso_codes: true, selected: billing_address[:country], only: e_shipping_countries}, { :name => 'order[shipping_address][country]', class: 'form-control' } %>
76
76
  </div>
77
77
  <div class="form-group">
78
78
  <label><%= t('.state', default: 'State') %></label>
@@ -0,0 +1,45 @@
1
+ <h1><%= product.the_title %> <%= product.the_edit_link %></h1>
2
+ <h3>
3
+ <%= t('plugins.ecommerce.single.sku', default: 'SKU') %>: <span id="product_sku"><%= product.the_sku %></span>
4
+ <span class="pull-right"><%= raw product.the_featured_status %></span>
5
+ </h3>
6
+ <h4><span id="product_price"><%= product.the_price %></span> <span class="pull-right"><%= raw product.the_stock_status %></span></h4>
7
+ <hr/>
8
+ <p><%= product.the_excerpt %></p>
9
+ <hr/>
10
+ <% if product.in_stock? %>
11
+ <% if product.the_qty_real.to_i > 0 || product.is_variation_product? %>
12
+ <%= form_tag(plugins_ecommerce_checkout_cart_add_path, :method => "post", :class => "form") do %>
13
+ <% if product.is_variation_product? %>
14
+ <div class="form-group">
15
+ <%= label_tag :variation_id %>
16
+ <select class="form-control required" name="variation_id" id="product_variation_id">
17
+ <% product.product_variations.each_with_index do |variation, index| %>
18
+ <option data-sku="<%= variation.sku %>" <%= 'selected' if index == 0 %> <%= 'disabled' if !product.in_stock?(variation.id) || product.the_qty_real(variation.id) <= 0 %> data-price="<%= product.the_price(variation.id) %>" value="<%= variation.id %>"><%= product.the_variation_title(variation.id) %></option>
19
+ <% end %>
20
+ </select>
21
+ </div>
22
+ <script>
23
+ jQuery(function(){
24
+ var panel = $('#product_view');
25
+ panel.find('#product_variation_id').change(function(){ var op = $(this).find('option:selected'); panel.find('#product_sku').html(op.attr('data-sku')); panel.find('#product_price').html(op.attr('data-price')); }).trigger('change');
26
+ if(panel.find('#product_variation_id option').not('[disabled]').length == 0){
27
+ panel.find('#e_add_to_cart_field_group').html('<p><%= t('plugins.ecommerce.single.noavailable_items', default: 'No items available') %></p>')
28
+ panel.find('#product_price').next().hide();
29
+ }
30
+ });
31
+ </script>
32
+ <% end %>
33
+ <div class="input-group" id="e_add_to_cart_field_group">
34
+ <span class="input-group-addon"><%= t('plugins.ecommerce.single.qty', default: 'Qty') %></span>
35
+ <%= number_field :cart, :qty, class: 'form-control', value: 1, min: 0, max: product.the_qty_real.to_i %>
36
+ <%= hidden_field :cart, :product_id, value: product.id %>
37
+ <span class="input-group-btn"><button class="btn btn-default" type="submit"><i class="fa fa-shopping-cart"></i> <%= t('plugins.ecommerce.single.add_to_cart', default: 'Add to cart') %></button></span>
38
+ </div>
39
+ <% end %>
40
+ <% else %>
41
+ <p><%= t('plugins.ecommerce.single.noavailable_items', default: 'No items available') %></p>
42
+ <% end %>
43
+ <% else %>
44
+ <p><%= t('plugins.ecommerce.single.no_stock', default: 'This product is not in stock') %></p>
45
+ <% end %>
@@ -1,107 +1,85 @@
1
- <%= render plugin_view('partials/cart_widget') %>
1
+ <% args={custom_slider: nil, custom_footer: nil, extra_footer: nil, custom_sidebar: nil, custom_cart_widget: nil, product: @post}; hooks_run('ecommerce_product_page', args) # permit custom footer %>
2
+ <% if args[:custom_cart_widget].nil? %>
3
+ <%= render plugin_view('partials/cart_widget') %>
4
+ <% else %>
5
+ <%= raw args[:custom_cart_widget] %>
6
+ <% end %>
2
7
  <div class="row">
3
8
  <div class="col-md-9 post-view">
4
9
  <article class="post-content" id="product_view">
5
10
  <div class="row">
6
11
  <div class="col-md-6">
7
- <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
8
- <!-- Indicators -->
9
- <ol class="carousel-indicators">
10
- <% @post.the_photos.each_with_index do |pthoto, index| %>
11
- <li data-target="#carousel-example-generic" data-slide-to="<%= index %>" class="<%= 'active' if index == 0 %>"></li>
12
- <% end %>
13
- </ol>
14
-
15
- <!-- Wrapper for slides -->
16
- <div class="carousel-inner" role="listbox">
17
- <% @post.the_photos.each_with_index do |pthoto, index| %>
18
- <div class="item <%= 'active' if index == 0 %>">
19
- <img src="<%= pthoto %>" class="center-block">
20
- </div>
21
- <% end %>
22
- </div>
23
-
24
- <!-- Controls -->
25
- <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
26
- <span class="glyphicon glyphicon-chevron-left fa fa-chevron-left" aria-hidden="true"></span>
27
- <span class="sr-only">Previous</span>
28
- </a>
29
- <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
30
- <span class="glyphicon glyphicon-chevron-right fa fa-chevron-right " aria-hidden="true"></span>
31
- <span class="sr-only">Next</span>
32
- </a>
33
- </div>
34
- </div>
12
+ <% unless args[:custom_slider].present? %>
13
+ <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
14
+ <!-- Indicators -->
15
+ <ol class="carousel-indicators">
16
+ <% @post.the_photos.each_with_index do |pthoto, index| %>
17
+ <li data-target="#carousel-example-generic" data-slide-to="<%= index %>" class="<%= 'active' if index == 0 %>"></li>
18
+ <% end %>
19
+ </ol>
35
20
 
36
- <div class="col-md-6">
37
- <h1><%= @post.the_title %></h1>
38
- <h3>
39
- <%= t('plugins.ecommerce.single.sku', default: 'SKU') %>: <span id="product_sku"><%= @post.the_sku %></span>
40
- <span class="pull-right"><%= raw @post.the_featured_status %></span>
41
- </h3>
42
- <h4><span id="product_price"><%= @post.the_price %></span> <span class="pull-right"><%= raw @post.the_stock_status %></span></h4>
43
- <hr/>
44
- <p><%= @post.the_excerpt %></p>
45
- <hr/>
46
- <% if @post.in_stock? %>
47
- <% if @post.the_qty_real.to_i > 0 %>
48
- <%= form_tag(plugins_ecommerce_checkout_cart_add_path, :method => "post", :class => "form") do %>
49
- <% if @post.is_variation_product? %>
50
- <div class="form-group">
51
- <%= label_tag :variation_id %>
52
- <select class="form-control required" name="variation_id" id="product_variation_id">
53
- <% @post.product_variations.each_with_index do |variation, index| %>
54
- <option data-sku="<%= variation.sku %>" <%= 'selected' if index == 0 %> <%= 'disabled' unless @post.in_stock?(variation.id) %> data-price="<%= @post.the_price(variation.id) %>" value="<%= variation.id %>"><%= @post.the_variation_title(variation.id) %></option>
55
- <% end %>
56
- </select>
21
+ <!-- Wrapper for slides -->
22
+ <div class="carousel-inner" role="listbox">
23
+ <% @post.the_photos.each_with_index do |pthoto, index| %>
24
+ <div class="item <%= 'active' if index == 0 %>">
25
+ <img src="<%= pthoto %>" class="center-block">
57
26
  </div>
58
27
  <% end %>
59
- <div class="input-group">
60
- <span class="input-group-addon"><%= t('plugins.ecommerce.single.qty', default: 'Qty') %></span>
61
- <%= number_field :cart, :qty, class: 'form-control', value: 1, min: 0, max: @post.the_qty_real.to_i %>
62
- <%= hidden_field :cart, :product_id, value: @post.id %>
63
- <span class="input-group-btn"><button class="btn btn-default" type="submit"><i class="fa fa-shopping-cart"></i> <%= t('plugins.ecommerce.single.add_to_cart', default: 'Add to cart') %></button></span>
64
- </div>
65
- <% end %>
66
- <% end %>
28
+ </div>
29
+
30
+ <!-- Controls -->
31
+ <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
32
+ <span class="glyphicon glyphicon-chevron-left fa fa-chevron-left" aria-hidden="true"></span>
33
+ <span class="sr-only">Previous</span>
34
+ </a>
35
+ <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
36
+ <span class="glyphicon glyphicon-chevron-right fa fa-chevron-right " aria-hidden="true"></span>
37
+ <span class="sr-only">Next</span>
38
+ </a>
39
+ </div>
67
40
  <% else %>
68
- <p><%= t('plugins.ecommerce.single.noavailable_items', default: 'No items available') %></p>
41
+ <%= raw args[:custom_slider] %>
69
42
  <% end %>
70
43
  </div>
71
- </div>
72
44
 
73
- <div class="row">
74
45
  <div class="col-md-6">
75
- <h3><%= t('plugins.ecommerce.single.descr', default: 'Description') %></h3>
76
- <div class="item-content">
77
- <%= raw @post.the_content %>
78
- </div>
46
+ <%= render 'post_types/commerce/product_info', product: @post %>
79
47
  </div>
80
- <% if (attrs = @post.the_attribute_fields('ecommerce_attrs').to_a).present? %>
48
+ </div>
49
+
50
+ <% unless args[:custom_footer].present? %>
51
+ <div class="row">
81
52
  <div class="col-md-6">
82
- <h3><%= t('plugins.ecommerce.single.attrs', default: 'Attributes') %></h3>
83
- <table class="table table-bordered">
84
- <% attrs.each_with_index do |attr, index| %>
85
- <tr>
86
- <td><strong><%= attr['attr'].to_s.translate %></strong></td>
87
- <td><%= attr['value'].to_s.translate %></td>
88
- </tr>
89
- <% end %>
90
- </table>
53
+ <h3><%= t('plugins.ecommerce.single.descr', default: 'Description') %></h3>
54
+ <div class="item-content">
55
+ <%= raw @post.the_content %>
56
+ </div>
91
57
  </div>
92
- <% end %>
93
- </div>
94
- <% if @post.is_variation_product? %>
95
- <script>
96
- jQuery(function(){
97
- var panel = $('#product_view');
98
- panel.find('#product_variation_id').change(function(){ var op = $(this).find('option:selected'); panel.find('#product_sku').html(op.attr('data-sku')); panel.find('#product_price').html(op.attr('data-price')); }).trigger('change');
99
- });
100
- </script>
58
+ <% if (attrs = @post.the_attribute_fields('ecommerce_attrs').to_a).present? %>
59
+ <div class="col-md-6">
60
+ <h3><%= t('plugins.ecommerce.single.attrs', default: 'Attributes') %></h3>
61
+ <table class="table table-bordered">
62
+ <% attrs.each_with_index do |attr, index| %>
63
+ <tr>
64
+ <td><strong><%= attr['attr'].to_s.translate %></strong></td>
65
+ <td><%= attr['value'].to_s.translate %></td>
66
+ </tr>
67
+ <% end %>
68
+ </table>
69
+ </div>
70
+ <% end %>
71
+ </div>
72
+ <% else %>
73
+ <%= raw args[:custom_footer] %>
101
74
  <% end %>
75
+ <%= raw args[:extra_footer] if args[:extra_footer].present? %>
102
76
  </article>
103
77
  </div>
104
78
  <div class="col-md-3">
105
- <%= render partial: 'partials/sidebar', locals: {post: @post, skip_fields: true} %>
79
+ <% unless args[:custom_sidebar].present? %>
80
+ <%= render partial: 'partials/sidebar', locals: {post: @post, skip_fields: true} %>
81
+ <% else %>
82
+ <%= raw args[:custom_sidebar] %>
83
+ <% end %>
106
84
  </div>
107
85
  </div>