spree_zoned 0.5.22 → 0.5.23
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'delocalize'
|
2
2
|
|
3
3
|
Spree::Admin::ProductsController.class_eval do
|
4
|
+
|
5
|
+
include ActionView::Helpers::NumberHelper
|
4
6
|
|
5
7
|
before_filter :delocSetPrice, :only => :update
|
6
8
|
|
@@ -12,6 +14,20 @@ Spree::Admin::ProductsController.class_eval do
|
|
12
14
|
inorout(@product.method :backtocountry)
|
13
15
|
end
|
14
16
|
|
17
|
+
def update
|
18
|
+
puts "Here spree/admin/products_controller/update"
|
19
|
+
puts "BEFORE: @product.price: #{@product.price}"
|
20
|
+
puts "params[:product][:price]: #{params[:product][:price]}"
|
21
|
+
params[:product][:price] = Delocalize::LocalizedNumericParser.parse(params[:product][:price])
|
22
|
+
puts "params[:product][:price] after parse: #{params[:product][:price]}"
|
23
|
+
# delete cprice to prevent mass assignemnt error in ActiveModel
|
24
|
+
# cprice has already been handled in before_filter "delocSetrPrice"
|
25
|
+
params[:product].delete :cprice
|
26
|
+
@product.update_attributes(params[:product])
|
27
|
+
puts "AFTER: @product.price: #{@product.price}"
|
28
|
+
redirect_to :action => 'edit'
|
29
|
+
end
|
30
|
+
|
15
31
|
protected
|
16
32
|
|
17
33
|
#
|
@@ -90,15 +106,11 @@ protected
|
|
90
106
|
end
|
91
107
|
|
92
108
|
def delocSetPrice
|
93
|
-
if params[:product] && params[:product][:price]
|
94
|
-
params[:product][:price] = Delocalize::LocalizedNumericParser.parse(
|
95
|
-
params[:product][:price])
|
96
|
-
end
|
97
109
|
country = session[:zoned] && session[:zoned][:prd_country]
|
98
|
-
if country && country != 0 && params[:product] && params[:product][:
|
99
|
-
|
110
|
+
if country && country.to_i != 0 && params[:product] && params[:product][:cprice]
|
111
|
+
puts "Here delocSetPrice before setprice: params[:product][:cprice]: #{params[:product][:cprice]}"
|
112
|
+
@product.setprice(country.to_i, BigDecimal.new(Delocalize::LocalizedNumericParser.parse(params[:product][:cprice])))
|
100
113
|
end
|
101
|
-
|
102
|
-
end
|
114
|
+
end
|
103
115
|
|
104
116
|
end
|
@@ -1,64 +1,73 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<% country = country ? country.to_i : 0 %>
|
6
|
-
<% c = Rails.application.config.commonCountriesForSelect.select {|e| e[1]==country} %>
|
7
|
-
<%= c.length == 1 ? c[0][0] : t(:nocountrysel) -%>
|
8
|
-
)<br />
|
9
|
-
<%= f.text_field :price, :value => number_with_precision(
|
10
|
-
getCPrice(@product), precision: 2)%>
|
11
|
-
<%= f.error_message_on :price %>
|
12
|
-
<% end %>
|
1
|
+
<% country = session[:zoned] && session[:zoned][:prd_country] %>
|
2
|
+
<% country = country ? country.to_i : 0 %>
|
3
|
+
<% c = Rails.application.config.commonCountriesForSelect.select {|e| e[1]==country} %>
|
4
|
+
<% csel = (c.length == 1) %>
|
13
5
|
|
14
|
-
|
15
|
-
|
16
|
-
<%= f.
|
17
|
-
|
18
|
-
<%= f.
|
6
|
+
<% if csel %>
|
7
|
+
<%= f.field_container :cprice do %>
|
8
|
+
<%= f.label :cprice, t(:country_price) %> <span class="required">*</span>
|
9
|
+
<br />(<%= t('country') + ": #{c[0][0]}" -%>)<br />
|
10
|
+
<%= f.text_field :cprice, :value => number_with_precision(
|
11
|
+
getCPrice(@product), precision: 2) %>
|
12
|
+
<%= f.error_message_on :cprice %>
|
19
13
|
<% end %>
|
14
|
+
<% end %>
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
<%= f.field_container :price do %>
|
17
|
+
<%= f.label :price, t(:master_price) %> <span class="required">*</span><br />
|
18
|
+
<%= f.text_field :price, :value => number_with_precision(
|
19
|
+
@product.price, precision: 2) %>
|
20
|
+
<%= f.error_message_on :price %>
|
21
|
+
<% end %>
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
<%= f.field_container :cost_price do %>
|
24
|
+
<%= f.label :cost_price, t(:cost_price) %><br />
|
25
|
+
<%= f.text_field :cost_price, :value => number_with_precision(
|
26
|
+
@product.cost_price, precision: 2) %>
|
27
|
+
<%= f.error_message_on :cost_price %>
|
28
|
+
<% end %>
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
<%= f.field_container :available_on do %>
|
31
|
+
<%= f.label :available_on, t(:available_on) %><br />
|
32
|
+
<%= f.error_message_on :available_on %>
|
33
|
+
<%= f.text_field :available_on, :class => 'datepicker' %>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% unless @product.has_variants? %>
|
37
|
+
<%= f.field_container :sku do %>
|
38
|
+
<%= f.label :sku, t(:sku) %><br />
|
39
|
+
<%= f.text_field :sku, :size => 16 %>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
<% if Spree::Config[:track_inventory_levels] %>
|
43
|
+
<%= f.field_container :on_hand do %>
|
44
|
+
<%= f.label :on_hand, t(:on_hand) %><br />
|
45
|
+
<%= f.number_field :on_hand, :min => 0 %>
|
38
46
|
<% end %>
|
47
|
+
<% end %>
|
39
48
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
49
|
+
<ul id="shipping_specs">
|
50
|
+
<li id="shipping_specs_weight_field">
|
51
|
+
<%= f.label :weight, t(:weight) %>
|
52
|
+
<%= f.text_field :weight, :size => 4, :value => number_with_precision(
|
53
|
+
@product.weight, precision: 1) %>
|
54
|
+
</li>
|
55
|
+
<li id="shipping_specs_height_field">
|
56
|
+
<%= f.label :height, t(:height) %>
|
57
|
+
<%= f.text_field :height, :size => 4, :value => number_with_precision(
|
58
|
+
@product.height, precision: 1) %>
|
59
|
+
</li>
|
60
|
+
<li id="shipping_specs_width_field">
|
61
|
+
<%= f.label :width, t(:width) %>
|
62
|
+
<%= f.text_field :width, :size => 4, :value => number_with_precision(
|
63
|
+
@product.width, precision: 1) %>
|
64
|
+
</li>
|
65
|
+
<li id="shipping_specs_depth_field">
|
66
|
+
<%= f.label :depth, t(:depth) %>
|
67
|
+
<%= f.text_field :depth, :size => 4, :value => number_with_precision(
|
68
|
+
@product.depth, precision: 1) %>
|
69
|
+
</li>
|
70
|
+
</ul>
|
62
71
|
<% end %>
|
63
72
|
|
64
73
|
<%= f.field_container :shipping_categories do %>
|
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/spree_zoned.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_zoned'
|
5
|
-
s.version = '0.5.
|
5
|
+
s.version = '0.5.23'
|
6
6
|
s.summary = 'A Spree extension to make your store zoned'
|
7
7
|
s.description = "Everything you need for a zoned Spree store: zoned pricing, zoned products, zoned product ordering, zoned locales, ...\nProbalbly essential to you if you operate outside of the US."
|
8
8
|
s.required_ruby_version = '>= 1.9.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_zoned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.23
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|