camaleon_ecommerce 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/plugins/ecommerce/switch.png +0 -0
  3. data/app/assets/javascripts/plugins/ecommerce/admin_product.js.coffee +1 -1
  4. data/app/assets/javascripts/plugins/ecommerce/admin_settings.js +16 -0
  5. data/app/assets/javascripts/plugins/ecommerce/cart.js +1 -0
  6. data/app/assets/javascripts/plugins/ecommerce/jquery.multi-select.js +535 -0
  7. data/app/assets/stylesheets/plugins/ecommerce/multi-select.css.scss +94 -0
  8. data/app/controllers/plugins/ecommerce/admin/orders_controller.rb +37 -20
  9. data/app/controllers/plugins/ecommerce/admin/settings_controller.rb +2 -2
  10. data/app/controllers/plugins/ecommerce/front/checkout_controller.rb +16 -15
  11. data/app/decorators/plugins/ecommerce/cart_decorator.rb +19 -0
  12. data/app/decorators/plugins/ecommerce/order_decorator.rb +70 -0
  13. data/app/decorators/plugins/ecommerce/product_decorator.rb +16 -9
  14. data/app/decorators/plugins/ecommerce/product_item_decorator.rb +5 -1
  15. data/app/helpers/plugins/ecommerce/ecommerce_email_helper.rb +60 -59
  16. data/app/helpers/plugins/ecommerce/ecommerce_functions_helper.rb +5 -10
  17. data/app/helpers/plugins/ecommerce/ecommerce_helper.rb +12 -3
  18. data/app/models/plugins/ecommerce/cart.rb +3 -25
  19. data/app/models/plugins/ecommerce/order.rb +0 -21
  20. data/app/models/plugins/ecommerce/payment_method.rb +4 -0
  21. data/app/models/plugins/ecommerce/shipping_method.rb +4 -1
  22. data/app/services/plugins/ecommerce/cart_service.rb +0 -9
  23. data/app/views/plugins/ecommerce/admin/orders/index.html.erb +47 -51
  24. data/app/views/plugins/ecommerce/admin/orders/show.html.erb +1 -1
  25. data/app/views/plugins/ecommerce/admin/payment_methods/form.html.erb +2 -6
  26. data/app/views/plugins/ecommerce/admin/payment_methods/index.html.erb +4 -6
  27. data/app/views/plugins/ecommerce/admin/settings/index.html.erb +60 -20
  28. data/app/views/plugins/ecommerce/admin/shipping_methods/form.html.erb +1 -5
  29. data/app/views/plugins/ecommerce/admin/shipping_methods/index.html.erb +2 -4
  30. data/app/views/plugins/ecommerce/front/checkout/cart_index.html.erb +2 -2
  31. data/app/views/plugins/ecommerce/front/checkout/index.html.erb +1 -1
  32. data/app/views/plugins/ecommerce/front/login.html.erb +1 -1
  33. data/app/views/plugins/ecommerce/front/orders/index.html.erb +2 -2
  34. data/app/views/plugins/ecommerce/front/orders/show.html.erb +13 -14
  35. data/app/views/plugins/ecommerce/partials/checkout/_details.html.erb +1 -1
  36. data/app/views/plugins/ecommerce/partials/checkout/_payments.html.erb +116 -110
  37. data/app/views/plugins/ecommerce/partials/checkout/_products_detail.html.erb +5 -2
  38. data/app/views/plugins/ecommerce/partials/checkout/_user_info.html.erb +0 -1
  39. data/app/views/plugins/ecommerce/partials/email/_billing_address.html.erb +11 -0
  40. data/app/views/plugins/ecommerce/partials/email/_product_table.html.erb +46 -0
  41. data/app/views/plugins/ecommerce/partials/email/_shipping_address.html.erb +11 -0
  42. data/app/views/{plugins/ecommerce/partials → post_types/commerce}/_cart_widget.html.erb +0 -0
  43. data/app/views/post_types/commerce/_product_info.html.erb +30 -32
  44. data/app/views/post_types/commerce/single.html.erb +9 -13
  45. data/config/camaleon_plugin.json +2 -1
  46. data/config/custom_models.rb +43 -0
  47. data/config/locales/en.yml +0 -1
  48. data/config/locales/es.yml +69 -7
  49. data/config/routes.rb +1 -0
  50. data/db/migrate/20161213222142_add_invoice_number.rb +6 -0
  51. data/db/migrate/20161214224919_remove_ecommerce_stock_field.rb +7 -0
  52. data/lib/ecommerce/engine.rb +4 -2
  53. data/lib/ecommerce/version.rb +1 -1
  54. metadata +58 -15
  55. data/app/assets/javascripts/plugins/ecommerce/jquery.creditCardValidator.js +0 -208
  56. data/app/services/plugins/ecommerce/order_service.rb +0 -26
  57. data/app/views/camaleon_cms/html_mailer/order_canceled.html.erb +0 -2
  58. data/app/views/camaleon_cms/html_mailer/order_confirmed.html.erb +0 -2
  59. data/app/views/camaleon_cms/html_mailer/order_received.html.erb +0 -5
  60. data/app/views/camaleon_cms/html_mailer/order_received_admin.html.erb +0 -3
  61. data/app/views/camaleon_cms/html_mailer/order_shipped.html.erb +0 -2
  62. data/app/views/camaleon_cms/html_mailer/recovery_cart.html.erb +0 -4
@@ -3,7 +3,7 @@
3
3
  <h4><%= t('.title', default: 'Order Details') %>: <%= @order.slug %></h4>
4
4
  </div>
5
5
  <div class="panel-body">
6
- <%= render file: plugin_view('front/orders/show'), as_partial: true %>
6
+ <%= render file: plugin_view('front/orders/show'), locals:{as_partial: true} %>
7
7
  </div>
8
8
  <div class="panel-footer">
9
9
  <button class="btn btn-default" onclick="history.back()"><%= t('camaleon_cms.admin.button.back') %></button>
@@ -9,10 +9,6 @@
9
9
  <%= f.label t('plugins.ecommerce.table.name') %><br>
10
10
  <%= f.text_field :name, :class => "form-control required" %>
11
11
  </div>
12
- <div class="form-group hidden">
13
- <%= f.label t('camaleon_cms.admin.table.slug') %><br>
14
- <%= f.text_field :slug, :class => "form-control slug", "data-parent" => 'plugins_ecommerce_payment_method_name' %>
15
- </div>
16
12
  <div class="form-group">
17
13
  <%= f.label t('plugins.ecommerce.table.description') %><br>
18
14
  <%= f.text_area :description, :class => "form-control translatable", :rows => 4 %>
@@ -47,12 +43,12 @@
47
43
  </div>
48
44
  <div class="form-group">
49
45
  <label><%= t('plugins.ecommerce.table.details') %></label><br>
50
- <%= text_area_tag( "options[bank_transfer_detail]", options[:bank_transfer_detail], class: "form-control required") %>
46
+ <%= text_area_tag( "options[bank_transfer_detail]", options[:bank_transfer_detail], class: "form-control required translatable") %>
51
47
  </div>
52
48
  </div>
53
49
 
54
50
  <div class="tab-pane <%= 'active' if options[:type] == 'paypal' %>" id="tab9">
55
- <a href="http://support.berta.me/kb/online-shop/how-to-get-paypal-api-username-password-and-signature-information">Steps here: http://support.berta.me/kb/online-shop/how-to-get-paypal-api-username-password-and-signature-information</a>
51
+ <a target="_blank" href="http://support.berta.me/kb/online-shop/how-to-get-paypal-api-username-password-and-signature-information">Steps here: http://support.berta.me/kb/online-shop/how-to-get-paypal-api-username-password-and-signature-information</a>
56
52
  <%= hidden_field_tag( "options[type]", 'paypal') %>
57
53
  <div class="form-group">
58
54
  <label><%= t('plugins.ecommerce.table.username_login') %></label><br>
@@ -8,11 +8,10 @@
8
8
  <table class="table">
9
9
  <thead>
10
10
  <tr>
11
- <th id=""><%= t('plugins.ecommerce.table.id') %></th>
12
- <th id=""><%= t('plugins.ecommerce.table.name') %></th>
13
- <th id=""><%= t('plugins.ecommerce.table.method_type') %></th>
14
- <th id=""><%= t('plugins.ecommerce.table.status') %></th>
15
- <th id=""><%= t('plugins.ecommerce.table.description') %></th>
11
+ <th><%= t('plugins.ecommerce.table.name') %></th>
12
+ <th><%= t('plugins.ecommerce.table.method_type') %></th>
13
+ <th><%= t('plugins.ecommerce.table.status') %></th>
14
+ <th><%= t('plugins.ecommerce.table.description') %></th>
16
15
  <th><%= t('plugins.ecommerce.table.actions') %></th>
17
16
  </tr>
18
17
  </thead>
@@ -22,7 +21,6 @@
22
21
  row = row.decorate
23
22
  %>
24
23
  <tr>
25
- <td><%= row.slug %></td>
26
24
  <td><%= row.name %></td>
27
25
  <td><%= row.method_text %></td>
28
26
  <td><%= raw row.the_status %></td>
@@ -1,27 +1,71 @@
1
+ <%= stylesheet_link_tag plugin_asset_path('multi-select') %>
2
+ <%= javascript_include_tag plugin_asset_path('admin_settings') %>
3
+ <% keywords = "#{t('.keywords_to_use', default: 'Keywords to use')}: #{current_site.e_email_keys}" %>
1
4
  <div class="panel panel-default">
2
5
  <div class="panel-heading ui-draggable-handle">
3
- <h4><span class="fa fa-cogs"></span> <%= cama_t('plugins.ecommerce.e_commerce_settings') %></h4>
6
+ <h4><span class="fa fa-cogs"></span> <%= t('.title', default: 'E-Commerce Settings') %></h4>
4
7
  </div>
5
- <%= form_tag(url_for(action: :saved, :method => "post"), :class => "validate-settings", id: 'ecommerce_settings_form') do %>
8
+ <%= form_tag(url_for(action: :saved, :method => "post"), :class => "validate", id: 'ecommerce_settings_form') do %>
6
9
  <div class="panel-body">
7
- <div class="form-group col-md-4">
8
- <label><%= cama_t('plugins.ecommerce.table.system_currency_unit') %></label><br>
9
- <%= select_tag( "setting[current_unit]", options_for_select(e_get_all_currencies.collect{|k, x| ["#{x[:label]} (#{x[:symbol]})", k]}, e_system_currency), class: "form-control required masked_select", 'data-live-search' => true) %>
10
- </div>
10
+ <div class="row">
11
+ <div class="col-lg-3">
12
+ <div class="form-group">
13
+ <label><%= t('.system_currency_unit', default: 'System Currency Unit') %></label><br>
14
+ <%= select_tag( "setting[current_unit]", options_for_select(e_get_all_currencies.collect{|k, x| ["#{x[:label]} (#{x[:symbol]})", k]}, e_system_currency), class: "form-control required masked_select", 'data-live-search' => true) %>
15
+ </div>
16
+ <div class="form-group">
17
+ <label><%= t('.currency_weight', default: 'Currency Unit') %></label><br>
18
+ <%= select_tag( "setting[current_weight]", options_for_select(e_get_currency_weights.collect{|k,x| ["#{x} (#{k})", k]}, @setting[:current_weight] || 'kg'), class: "form-control required") %>
19
+ </div>
20
+ <div class="form-group">
21
+ <label><%= t('.invoice_number_from', default: 'Invoice Number From') %></label><br>
22
+ <%= text_field_tag( "setting[invoice_number_from]", current_site.e_invoice_number_from, class: "form-control required") %>
23
+ </div>
24
+ <div class="form-group">
25
+ <label><%= t('.invoice_number_to', default: 'Invoice Number To') %></label><br>
26
+ <%= text_field_tag( "setting[invoice_number_to]", current_site.e_invoice_number_to, class: "form-control required") %>
27
+ </div>
28
+ </div>
29
+ <div class="col-lg-4">
30
+ <div class="form-group">
31
+ <label><%= t('.shipping_countries', default: 'Shipping Countries') %></label><br>
32
+ <%= country_select :setting, :shipping_countries, {locale: I18n.locale.to_s, iso_codes: true, selected: e_shipping_countries}, { :name => 'setting[shipping_countries][]', class: 'form-control', multiple: true, 'data-live-search' => true, 'data-actions-box' => true } %>
33
+ <a href='#' class='shipping_countries_link select_all'><%= t('.select_all', default: 'Select All') %></a> /
34
+ <a href='#' class='shipping_countries_link deselect-all'><%= t('deselect_all', default: 'Deselect All') %></a>
35
+ </div>
36
+ </div>
11
37
 
12
- <div class="form-group col-md-4">
13
- <label><%= cama_t('plugins.ecommerce.table.available_currencies_unit') %></label><br>
14
- <%= select_tag( "setting[visitor_unit_currencies]", options_for_select(e_get_all_currencies.collect{|k, x| ["#{x[:label]} (#{x[:symbol]})", k]}, e_visitor_unit_currencies), class: "form-control required", multiple: true, 'data-live-search' => true) %>
38
+ <div class="form-group col-lg-5">
39
+ <label><%= t('.available_currencies_unit', default: 'Visitor Available Currencies') %></label><br>
40
+ <%= select_tag( "setting[visitor_unit_currencies]", options_for_select(e_get_all_currencies.collect{|k, x| ["#{x[:label]} (#{x[:symbol]})", k]}, e_visitor_unit_currencies), class: "form-control required", multiple: true, 'data-live-search' => true) %>
41
+ </div>
15
42
  </div>
43
+ <h3><%= t('.email_settings', default: 'Email Settings') %></h3>
44
+ <div>
45
+ <div class="form-group">
46
+ <label><%= t('.email_order_received', default: 'Order Received') %> <%= raw cama_html_tooltip(keywords, 'right') %></label><br>
47
+ <%= text_area_tag 'setting[email_order_received]', current_site.e_email_for('email_order_received'), class: 'form-control required required_all_langs translatable editor' %>
48
+ </div>
16
49
 
17
- <div class="form-group col-md-4">
18
- <label><%= cama_t('plugins.ecommerce.table.currency_weight') %></label><br>
19
- <%= select_tag( "setting[current_weight]", options_for_select(e_get_currency_weights.collect{|k,x| ["#{x} (#{k})", k]}, @setting[:current_weight] || 'kg'), class: "form-control required") %>
20
- </div>
50
+ <div class="form-group">
51
+ <label><%= t('.email_order_confirmed', default: 'Order Confirmed') %> <%= raw cama_html_tooltip(keywords, 'right') %></label><br>
52
+ <%= text_area_tag 'setting[email_order_confirmed]', current_site.e_email_for('email_order_confirmed'), class: 'form-control required required_all_langs translatable editor' %>
53
+ </div>
54
+
55
+ <div class="form-group">
56
+ <label><%= t('.email_order_shipped', default: 'Order Shipped') %> <%= raw cama_html_tooltip(keywords, 'right') %></label><br>
57
+ <%= text_area_tag 'setting[email_order_shipped]', current_site.e_email_for('email_order_shipped'), class: 'form-control required required_all_langs translatable editor' %>
58
+ </div>
59
+
60
+ <div class="form-group">
61
+ <label><%= t('.email_order_cancelled', default: 'Order Cancelled') %> <%= raw cama_html_tooltip(keywords, 'right') %></label><br>
62
+ <%= text_area_tag 'setting[email_order_cancelled]', current_site.e_email_for('email_order_cancelled'), class: 'form-control required required_all_langs translatable editor' %>
63
+ </div>
21
64
 
22
- <div class="form-group col-md-4">
23
- <label><%= cama_t('plugins.ecommerce.table.shipping_countries') %></label><br>
24
- <%= country_select :setting, :shipping_countries, {locale: I18n.locale.to_s, iso_codes: true, selected: e_shipping_countries}, { :name => 'setting[shipping_countries][]', class: 'form-control', multiple: true, 'data-live-search' => true, 'data-actions-box' => true } %>
65
+ <div class="form-group">
66
+ <label><%= t('.email_order_invoice', default: 'Invoice Template') %> <%= raw cama_html_tooltip(keywords, 'right') %></label><br>
67
+ <%= text_area_tag 'setting[email_order_invoice]', current_site.e_email_for('email_order_invoice'), class: 'form-control required required_all_langs translatable editor' %>
68
+ </div>
25
69
  </div>
26
70
  </div>
27
71
  <div class="panel-footer">
@@ -30,7 +74,3 @@
30
74
  </div>
31
75
  <% end %>
32
76
  </div>
33
- <script type="application/javascript">jQuery(function(){
34
- var form = $('#ecommerce_settings_form');
35
- form.find('select[multiple], .masked_select').selectpicker();
36
- })</script>
@@ -9,13 +9,9 @@
9
9
  <%= f.label t('plugins.ecommerce.table.name') %><br>
10
10
  <%= f.text_field :name, :class => "form-control required" %>
11
11
  </div>
12
- <div class="form-group">
13
- <%= f.label t('camaleon_cms.admin.table.slug') %><br>
14
- <%= f.text_field :slug, :class => "form-control slug", "data-parent" => 'plugins_ecommerce_shipping_method_name' %>
15
- </div>
16
12
  <div class="form-group">
17
13
  <%= f.label t('camaleon_cms.admin.table.description') %><br>
18
- <%= f.text_area :description, :class => "form-control", :rows => 4 %>
14
+ <%= f.text_area :description, :class => "form-control translatable", :rows => 4 %>
19
15
  </div>
20
16
 
21
17
  <% options = @shipping_method.options rescue {url_tracking: 'http://trackingurl.com/track/{{consignment_number}}'}
@@ -8,7 +8,6 @@
8
8
  <table class="table">
9
9
  <thead>
10
10
  <tr>
11
- <th id=""><%= t('plugins.ecommerce.table.id') %></th>
12
11
  <th id=""><%= t('plugins.ecommerce.table.name') %></th>
13
12
  <th id=""><%= t('plugins.ecommerce.table.status') %></th>
14
13
  <th id=""><%= t('plugins.ecommerce.table.description') %></th>
@@ -20,10 +19,9 @@
20
19
  @shipping_methods.each do |row|
21
20
  %>
22
21
  <tr>
23
- <td><%= row.slug %></td>
24
- <td><%= row.name %></td>
22
+ <td><%= row.name.to_s.translate %></td>
25
23
  <td><%= row.status %></td>
26
- <td><%= row.description %></td>
24
+ <td><%= row.description.to_s.translate %></td>
27
25
  <td>
28
26
  <%= link_to raw('<i class="fa fa-usd"></i> ' + "#{t('plugins.ecommerce.shipping_prices', default: 'Prices')}"), admin_plugins_ecommerce_shipping_method_prices_path(row.id), class: "btn btn-primary btn-xs" %>
29
27
  <%= link_to raw('<i class="fa fa-edit"></i>'), {action: :edit, id: row.id }, class: "btn btn-default btn-xs", title: "#{t('camaleon_cms.admin.button.edit')}" %>
@@ -1,5 +1,5 @@
1
1
  <div class="cart_view">
2
- <%= render plugin_view('partials/cart_widget') %>
2
+ <%= render 'post_types/commerce/cart_widget' %>
3
3
  <h1><%= t('.title', default: 'Shopping Cart') %></h1>
4
4
  <%= form_tag(plugins_ecommerce_checkout_cart_update_path, :method => "post", :class => "form") do %>
5
5
  <table id="table-shopping-cart" class="table table-bordered">
@@ -16,7 +16,7 @@
16
16
  <tbody>
17
17
  <% @products.each do |item| product = item.product.decorate %>
18
18
  <tr>
19
- <td><a href="<%= product.the_url %>"><%= product.the_variation_title(item.variation_id) %></a></td>
19
+ <td><a href="<%= item.the_url %>"><%= item.the_title %></a></td>
20
20
  <td><%= item.the_price %></td>
21
21
  <td><%= item.the_tax %></td>
22
22
  <td>
@@ -3,7 +3,7 @@
3
3
  <div class="alert alert-danger"><%= raw warning.join("<br>") %></div>
4
4
  <% end %>
5
5
  <div id="cama_checkout_view" class="row checkout_view">
6
- <%= render plugin_view('partials/cart_widget') %>
6
+ <%= render 'post_types/commerce/cart_widget' %>
7
7
  <h1><%= t('.check_out_process', default: 'Checkout Process') %></h1>
8
8
  <div class="stepwizard col-md-offset-3 col-sm-offset-3">
9
9
  <div class="stepwizard-row setup-panel">
@@ -1,5 +1,5 @@
1
1
  <div class="container" id="ecommerce_login_panel">
2
- <%= render 'camaleon_cms/flash_messages', locals:{ flash: (flash[:cama_ecommerce] || {}).with_indifferent_access } %>
2
+ <%= render 'post_types/commerce/cart_widget' %>
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">
@@ -1,4 +1,4 @@
1
- <%= render plugin_view('partials/cart_widget') %>
1
+ <%= render 'post_types/commerce/cart_widget' %>
2
2
  <h2><%= t('.title', default: 'My Orders') %></h2>
3
3
  <table id="table-shopping-cart" class="table">
4
4
  <thead>
@@ -27,7 +27,7 @@
27
27
  <td><%= order.cache_the_sub_total %></td>
28
28
  <td><%= order.cache_the_discounts %></td>
29
29
  <td><%= order.cache_the_total %></td>
30
- <td><%= order.paid_at %></td>
30
+ <td><%= order.the_paid_at %></td>
31
31
  <td><%= order.payment_method.name rescue '' %></td>
32
32
  <td>
33
33
  <a href="<%= plugins_ecommerce_order_show_path(order: order.slug) %>" class="btn btn-default btn-xs"><%= t('.view', default: 'View') %></a>
@@ -5,9 +5,10 @@
5
5
  <h1><%= t('.title', default: 'Order Details') %>: <%= order.slug %></h1>
6
6
  <% end %>
7
7
  <div class="basic_info">
8
- <% if order.received_at.present? %><b><%= t('.received_at', default: 'Received At') %>: </b> <%= order.received_at %><br> <% end %>
8
+ <% if order.invoice_number.present? %><b><%= t('.invoice_number', default: 'Invoice Number') %>: </b> <%= order.invoice_number %><br> <% end %>
9
+ <% if order.received_at.present? %><b><%= t('.received_at', default: 'Received At') %>: </b> <%= order.the_received_at %><br> <% end %>
9
10
  <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
+ <% if order.shipped_at.present? %><b><%= t('.shipped_at', default: 'Shipped At') %>: </b> <%= order.the_shipped_at %><br> <% end %>
11
12
  </div>
12
13
  <div>
13
14
  <h4><%= t('.customer_info', default: 'Customer Info') %></h4>
@@ -24,7 +25,7 @@
24
25
  <h4><%= t('.billing_address', default: 'Billing Address') %></h4>
25
26
  <% detail = order.get_meta("billing_address", {}) %>
26
27
  <ul class="ec-list-orders-address">
27
- <li><strong><%= t('.address', default: 'Address1') %>:</strong> <%= detail[:address1] %></li>
28
+ <li><strong><%= t('.address', default: 'Address') %>1:</strong> <%= detail[:address1] %></li>
28
29
  <li><strong><%= t('.address', default: 'Address') %>2:</strong> <%= detail[:address2] %></li>
29
30
  <li><strong><%= t('.city', default: 'City') %>:</strong> <%= detail[:city] %></li>
30
31
  <li><strong><%= t('.state', default: 'State') %>:</strong> <%= detail[:state] %></li>
@@ -38,7 +39,7 @@
38
39
  <h4><%= t('.shipping_address', default: 'Shipping Address') %></h4>
39
40
  <% detail = order.get_meta("shipping_address", {}) %>
40
41
  <ul class="ec-list-orders-address">
41
- <li><strong><%= t('.address', default: 'Address1') %>:</strong> <%= detail[:address1] %></li>
42
+ <li><strong><%= t('.address', default: 'Address') %>1:</strong> <%= detail[:address1] %></li>
42
43
  <li><strong><%= t('.address', default: 'Address') %>2:</strong> <%= detail[:address2] %></li>
43
44
  <li><strong><%= t('.city', default: 'City') %>:</strong> <%= detail[:city] %></li>
44
45
  <li><strong><%= t('.state', default: 'State') %>:</strong> <%= detail[:state] %></li>
@@ -57,17 +58,17 @@
57
58
  <table class="table table-bordered">
58
59
  <tbody>
59
60
  <tr>
60
- <th id="quantity_col"><%= t('.qty', default: 'Quantity') %></th>
61
- <th id="item_col"><%= t('.item', default: 'Item') %></th>
62
- <th id="price_col"><%= t('.price', default: 'Price') %></th>
61
+ <th><%= t('.qty', default: 'Quantity') %></th>
62
+ <th><%= t('.item', default: 'Item') %></th>
63
+ <th><%= t('.price', default: 'Price') %></th>
63
64
 
64
- <th id="tax_col"><%= t('.tax', default: 'Tax') %></th>
65
- <th id="subtotal_col"><%= t('.subtotal', default: 'Sub Total') %></th>
65
+ <th><%= t('.tax', default: 'Tax') %></th>
66
+ <th><%= t('.subtotal', default: 'Sub Total') %></th>
66
67
  </tr>
67
- <% order.product_items.each do |item| %>
68
+ <% order.product_items.decorate.each do |item| %>
68
69
  <tr>
69
70
  <td><%= item.qty %></td>
70
- <td><%= link_to(item.cache_the_title, item.product.try(:decorate).try(:the_url)) %></td>
71
+ <td><%= link_to(item.cache_the_title, item.the_url) %></td>
71
72
  <td><%= item.cache_the_price %></td>
72
73
  <td><%= item.cache_the_tax %></td>
73
74
  <td><%= item.cache_the_sub_total %></td>
@@ -130,14 +131,12 @@
130
131
  <th><%= t('.track_url', default: 'URL Tracking') %></th>
131
132
  </tr>
132
133
  <tr>
133
- <td><%= order.shipping_method.name rescue t('.no_shipping', default: 'Not Shipped Assigned') %></td>
134
+ <td><%= order.the_shipping_method || t('.no_shipping', default: 'Not Shipped Assigned') %></td>
134
135
  <td><%= order.shipped_at.presence || t('.no_shipped', default: 'Not Shipped') %></td>
135
136
  <td><%= order.the_url_tracking %></td>
136
137
  </tr>
137
138
  </tbody>
138
139
  </table>
139
- <div class="text-center">
140
- </div>
141
140
  </div>
142
141
  </div>
143
142
  </div>
@@ -19,7 +19,7 @@
19
19
  <div class="form-group">
20
20
  <select class="form-control required" name="shipping_method" id="shipping_methods" >
21
21
  <% current_site.shipping_methods.each do |m| price = m.get_price_from_weight(@cart.weight_total); the_price = e_parse_price(price) %>
22
- <option value="<%= m.id %>" <%= 'selected' if @cart.shipping_method_id == m.id %> data-price="<%= price %>"><%= m.name %> (<%= the_price %>)</option>
22
+ <option value="<%= m.id %>" <%= 'selected' if @cart.shipping_method_id == m.id %> data-price="<%= price %>"><%= m.name.translate %> (<%= the_price %>)</option>
23
23
  <% end %>
24
24
  </select>
25
25
  </div>
@@ -1,129 +1,135 @@
1
- <% if @cart.free_cart? %>
2
- <div class="free_order text-center col-md-12">
3
- <%= link_to(t('.complete_order', default: 'Complete Order'), plugins_ecommerce_checkout_complete_free_order_url, class: 'btn btn-primary col-md-4 col-md-offset-4') %>
4
- </div>
1
+ <% cart_errors = ecommerce_verify_cart_errors(@cart) %>
2
+ <% if cart_errors.present? %>
3
+ <%= content_tag :div, cart_errors.join('<br>').html_safe, class: 'alert alert-danger' %>
5
4
  <% else %>
6
- <div id="e-payments-types" role="tabpanel">
7
- <div class="panel-group" id="e_accordion_payments" role="tablist" aria-multiselectable="true">
8
- <% (payment_methods = current_site.payment_methods.actives.all).each_with_index do |payment, index| %>
9
- <% inputs = content_tag :div do %>
10
- <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>">
11
- <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>">
12
- <div class="form-group text-center">
13
- <button class="btn btn-primary col-md-4" type="submit"><i class="fa fa-money"></i> <%= t('.order_now', default: 'Buy') %></button>
14
- </div>
15
- <% end %>
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 %>
5
+ <% if @cart.free_cart? %>
6
+ <div class="free_order text-center col-md-12">
7
+ <%= link_to(t('.complete_order', default: 'Complete Order'), plugins_ecommerce_checkout_complete_free_order_url, class: 'btn btn-primary col-md-4 col-md-offset-4') %>
8
+ </div>
9
+ <% else %>
10
+ <div id="e-payments-types" role="tabpanel">
11
+ <div class="panel-group" id="e_accordion_payments" role="tablist" aria-multiselectable="true">
12
+ <% (payment_methods = current_site.payment_methods.actives.all).each_with_index do |payment, index| %>
13
+ <% inputs = content_tag :div do %>
14
+ <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>">
15
+ <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>">
16
+ <div class="form-group text-center">
17
+ <button class="btn btn-primary col-md-4" type="submit"><i class="fa fa-money"></i> <%= t('.order_now', default: 'Buy') %></button>
18
+ </div>
19
+ <% end %>
20
+ <div class="panel panel-default">
21
+ <div class="panel-heading" role="tab" id="heading<%= payment.id %>">
22
+ <a role="button" data-toggle="collapse" data-parent="#e_accordion_payments" href="#payment_tab_<%= payment.id %>" aria-expanded="true" aria-controls="collapseOne"><%= t(".#{payment.options[:type]}", default: payment.options[:type].titleize) %></a>
23
+ </div>
24
+ <div id="payment_tab_<%= payment.id %>" class="panel-collapse collapse <%= "in" if index == 0 %>" role="tabpanel" aria-labelledby="heading<%= payment.id %>">
25
+ <div class="panel-body">
26
+ <p><%= payment.description.translate %></p>
27
+ <% if payment.options[:type] == 'paypal' %>
28
+ <div class="type-paypal">
29
+ <img src="https://www.paypalobjects.com/webstatic/mktg/logo/bdg_payments_by_pp_2line.png" alt="Buy now with PayPal"/>
30
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_paypal_path(order: @cart.slug), :method => "post") do %>
31
+ <%= inputs %>
32
+ <% end %>
33
+ </div>
34
+ <% end %>
35
+
36
+ <% if payment.options[:type] == 'bank_transfer' %>
37
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_bank_transfer_path(order: @cart.slug), :method => "post") do %>
38
+ <ul class="ec-list-orders-address">
39
+ <li><strong><%= t('.account_number', default: 'Account Number') %>: </strong><span> <%= payment.options[:bank_transfer_number_account] %></span></li>
40
+ <li><strong><%= t('.details_transfer', default: 'Details') %>: </strong><span> <%= payment.options[:bank_transfer_detail].to_s.translate %></span></li>
41
+ </ul>
42
+ <div class="form-group">
43
+ <label><%= t('.bank_name', default: 'Bank name') %></label>
44
+ <input class="form-control required" type="text" name="details[bank_name]">
45
+ </div>
46
+ <div class="form-group">
47
+ <label><%= t('.bank_owner', default: 'Owner name of bank account') %></label>
48
+ <input class="form-control required" type="text" name="details[owner_name]">
49
+ </div>
50
+ <div class="form-group">
51
+ <label><%= t('.cod_key', default: 'CODE / ID / KEY / TICKET') %></label>
52
+ <input class="form-control required" type="text" name="details[code]">
53
+ </div>
54
+ <div class="form-group">
55
+ <label><%= t('.descr', default: 'Description') %></label>
56
+ <textarea name="details[description]" rows="4" class="form-control required" ></textarea>
57
+ </div>
27
58
  <%= inputs %>
28
59
  <% end %>
29
- </div>
30
- <% end %>
31
-
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
60
  <% 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 %>
61
+ <% if payment.options[:type] == 'on_delivery' %>
62
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_on_delivery_path(order: @cart.slug), :method => "post") do %>
63
+ <%= inputs %>
64
+ <% end %>
60
65
  <% end %>
61
- <% end %>
62
66
 
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 %>
67
+ <% if payment.options[:type] == 'credit_card' %>
68
+ <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Credit Card"/>
69
+ <% end %>
66
70
 
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>
71
+ <% if payment.options[:type] == 'authorize_net' %>
72
+ <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/>
73
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_authorize_net_path(order: @cart.slug), :method => "post") do %>
74
+ <div class="form-group">
75
+ <label for="firstName"><%= t('.first_name', default: 'First Name') %></label>
76
+ <input type="text" class="form-control required" name="firstName" value="<%= @cart.user.first_name %>" required autocomplete="off"/>
83
77
  </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"/>
78
+ <div class="form-group">
79
+ <label for="lastName"><%= t('.last_name', default: 'Last Name') %></label>
80
+ <input type="text" class="form-control required" name="lastName" value="<%= @cart.user.last_name %>" autocomplete="off"/>
81
+ </div>
82
+ <div class="form-group">
83
+ <label><%= t('.card_number', default: 'Card Number') %></label>
84
+ <div class="input-group">
85
+ <input type="text" class="form-control required" name="cardNumber" autocomplete="off"/>
86
+ <span class="input-group-addon"><i class="fa fa-credit-card"></i></span>
90
87
  </div>
91
- <div class="col-xs-6 col-lg-6">
92
- <input type="text" class="form-control required" name="expYear" placeholder="YY" autocomplete="off"/>
88
+ </div>
89
+ <div class="form-group">
90
+ <label for="expMonth"><%= t('.exp_date', default: 'EXPIRATION DATE') %></label>
91
+ <div class="row">
92
+ <div class="col-xs-6 col-lg-6">
93
+ <input type="text" class="form-control required" name="expMonth" placeholder="MM" autocomplete="off"/>
94
+ </div>
95
+ <div class="col-xs-6 col-lg-6">
96
+ <input type="text" class="form-control required" name="expYear" placeholder="YY" autocomplete="off"/>
97
+ </div>
93
98
  </div>
94
99
  </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 %>
100
+ <div class="form-group">
101
+ <label for="cvCode"><%= t('.cvv', default: 'Cvv CODE') %></label>
102
+ <input type="text" class="form-control required" name="cvCode" placeholder="cvv" autocomplete="off"/>
103
+ </div>
104
+ <%= inputs %>
105
+ <% end %>
101
106
  <% end %>
102
- <% end %>
103
107
 
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>
108
+ <% if payment.options[:type] == 'stripe' %>
109
+ <%= form_tag(plugins_ecommerce_checkout_pay_by_stripe_path(order: @cart.slug), :method => "post") do %>
110
+ <input type="hidden" name="payment[payment_id]" value="<%= payment.id %>">
111
+ <input type="hidden" name="payment[type]" value="<%= payment.options[:type] %>">
112
+ <img src="http://i76.imgup.net/accepted_c22e0.png" alt="Buy now with Authorize.net"/><br>
113
+ <hr>
114
+ <script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
115
+ data-key="<%= payment.options[:stripe_key] %>"
116
+ data-description="Payment Products: <%= @cart.products_title %>"
117
+ data-email="<%= cama_current_user.email %>"
118
+ data-amount="<%= Plugins::Ecommerce::UtilService.ecommerce_money_to_cents(@cart.total_amount) %>"
119
+ data-locale="<%= I18n.locale %>"></script>
120
+ <% end %>
115
121
  <% end %>
116
- <% end %>
117
122
 
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 %>
123
+ <% if(custom_method = ecommerce_custom_payment_methods[payment.options[:type].to_sym]).present? %>
124
+ <%= render custom_method[:payment_form_view_path], payment: payment, options: payment.options, cart: @cart %>
125
+ <% end %>
126
+ </div>
121
127
  </div>
122
128
  </div>
123
- </div>
124
- <% end %>
125
- <%= content_tag(:div, 'No Payment Methods Defined', class: 'alert alert-danger') unless payment_methods.any? %>
129
+ <% end %>
130
+ <%= content_tag(:div, 'No Payment Methods Defined', class: 'alert alert-danger') unless payment_methods.any? %>
131
+ </div>
126
132
  </div>
127
- </div>
128
- <script>jQuery(function(){ cama_ecommerce_payments(); })</script>
133
+ <script>jQuery(function(){ cama_ecommerce_payments(); })</script>
134
+ <% end %>
129
135
  <% end %>