spree_zone_pricing 0.1.12 → 0.1.13
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.
@@ -0,0 +1,9 @@
|
|
1
|
+
<% content_for :sub_menu do %>
|
2
|
+
<ul id="sub_nav" data-hook="admin_product_sub_tabs">
|
3
|
+
<%= tab :products, :match_path => '/products' %>
|
4
|
+
<%= tab :option_types, :match_path => '/option_types' %>
|
5
|
+
<%= tab :properties %>
|
6
|
+
<%= tab :prototypes %>
|
7
|
+
<%= tab :prototypes %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
data/lib/spree_zone_pricing.rb
CHANGED
@@ -5,46 +5,43 @@ module SpreeZonePricing
|
|
5
5
|
|
6
6
|
class Engine < Rails::Engine
|
7
7
|
|
8
|
-
|
8
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
9
9
|
|
10
10
|
def self.activate
|
11
11
|
|
12
12
|
=begin
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
::
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
::
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
accepts_nested_attributes_for :translations, :reject_if => proc { |attributes| attributes['presentation'].blank? }
|
41
|
-
validates_presence_of :name
|
42
|
-
end
|
13
|
+
|
14
|
+
# Add helper to retrieve the users country
|
15
|
+
ApplicationHelper.send(:include, Spree::ZonePricing::GetCountry)
|
16
|
+
# Add helper to retrieve the users country, used by a number of controllers
|
17
|
+
Spree::BaseController.send(:include, Spree::ZonePricing::GetCountry)
|
18
|
+
|
19
|
+
# Add additional associations to allow m:m relationship
|
20
|
+
# between zones<->variants
|
21
|
+
Spree::Zone.send(:include, Spree::ZonePricing::Zone)
|
22
|
+
Spree::Variant.send(:include, Spree::ZonePricing::Variant)
|
23
|
+
|
24
|
+
# Override add_variant method so that we can use zone pricing
|
25
|
+
Spree::Order.send(:include, Spree::ZonePricing::Order)
|
26
|
+
|
27
|
+
# Override price
|
28
|
+
Spree::ProductsHelper.send(:include, Spree::ZonePricing::ProductsHelper)
|
29
|
+
|
30
|
+
# Add action to countries controller to handle country selection
|
31
|
+
CountriesController.send(:include, Spree::ZonePricing::CountriesController)
|
32
|
+
# Add code to set the currently country in the order
|
33
|
+
OrdersController.send(:include, Spree::ZonePricing::OrdersController)
|
34
|
+
# Add code to save zone prices
|
35
|
+
Admin::VariantsController.send(:include, Spree::ZonePricing::Admin::VariantsController)
|
36
|
+
# Add code to check zone prices after address is saved during checkout, if ship
|
37
|
+
# country not the same change prices in order
|
38
|
+
CheckoutsController.send(:include, Spree::ZonePricing::CheckoutsController)
|
39
|
+
|
43
40
|
=end
|
44
41
|
|
45
42
|
end
|
46
43
|
|
47
|
-
|
44
|
+
config.to_prepare &method(:activate).to_proc
|
48
45
|
|
49
46
|
end
|
50
47
|
|
@@ -1,4 +1,10 @@
|
|
1
1
|
Deface::Override.new(:virtual_path => "layouts/spree_application",
|
2
2
|
:name => "logo",
|
3
3
|
:replace_contents => "#logo",
|
4
|
-
:text => "Store")
|
4
|
+
:text => "Store")
|
5
|
+
|
6
|
+
# Add zone pricing tab to products admin area
|
7
|
+
#insert_after :admin_product_tabs, :partial => "admin/shared/zp_product_tab"
|
8
|
+
|
9
|
+
# Add zone pricing to variant edit form
|
10
|
+
#insert_after :admin_variant_edit_form, :partial => 'admin/shared/zone_prices'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_zone_pricing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -20,6 +20,7 @@ extensions: []
|
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
22
|
- app/models/zone_price.rb
|
23
|
+
- app/views/admin/shared/_product_sub_menu.html.erb
|
23
24
|
- app/views/admin/shared/_zone_prices.html.erb
|
24
25
|
- app/views/admin/shared/_zp_product_tab.html.erb
|
25
26
|
- app/views/admin/variants/zone_prices.html.erb
|