spree_zone_pricing 0.1.7 → 0.1.8
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.
- data/lib/spree_zone_pricing.rb +2 -55
- data/lib/spree_zone_pricing/custom_hooks.rb +11 -0
- metadata +2 -1
data/lib/spree_zone_pricing.rb
CHANGED
@@ -1,55 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class ZonePricingExtension < Spree::Extension
|
4
|
-
|
5
|
-
version "0.1.7"
|
6
|
-
description "Spree Zone Pricing"
|
7
|
-
url "https://github.com/henriquebf/spree-zone-pricing"
|
8
|
-
|
9
|
-
# Please use zone_pricing/config/routes.rb instead for extension routes.
|
10
|
-
|
11
|
-
# def self.require_gems(config)
|
12
|
-
# config.gem "gemname-goes-here", :version => '1.2.3'
|
13
|
-
# end
|
14
|
-
|
15
|
-
def activate
|
16
|
-
|
17
|
-
# Add helper to retrieve the users country
|
18
|
-
ApplicationHelper.send(:include, Spree::ZonePricing::GetCountry)
|
19
|
-
# Add helper to retrieve the users country, used by a number of controllers
|
20
|
-
Spree::BaseController.send(:include, Spree::ZonePricing::GetCountry)
|
21
|
-
|
22
|
-
# Add additional associations to allow m:m relationship
|
23
|
-
# between zones<->variants
|
24
|
-
Zone.send(:include, Spree::ZonePricing::Zone)
|
25
|
-
Variant.send(:include, Spree::ZonePricing::Variant)
|
26
|
-
|
27
|
-
# Override add_variant method so that we can use zone pricing
|
28
|
-
Order.send(:include, Spree::ZonePricing::Order)
|
29
|
-
|
30
|
-
# Override price
|
31
|
-
ProductsHelper.send(:include, Spree::ZonePricing::ProductsHelper)
|
32
|
-
|
33
|
-
# Add action to countries controller to handle country selection
|
34
|
-
CountriesController.send(:include, Spree::ZonePricing::CountriesController)
|
35
|
-
# Add code to set the currently country in the order
|
36
|
-
OrdersController.send(:include, Spree::ZonePricing::OrdersController)
|
37
|
-
# Add code to save zone prices
|
38
|
-
Admin::VariantsController.send(:include, Spree::ZonePricing::Admin::VariantsController)
|
39
|
-
# Add code to check zone prices after address is saved during checkout, if ship
|
40
|
-
# country not the same change prices in order
|
41
|
-
CheckoutsController.send(:include, Spree::ZonePricing::CheckoutsController)
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
class ZonePricingHooks < Spree::ThemeSupport::HookListener
|
48
|
-
|
49
|
-
# Add zone pricing tab to products admin area
|
50
|
-
insert_after :admin_product_tabs, :partial => "admin/shared/zp_product_tab"
|
51
|
-
|
52
|
-
# Add zone pricing to variant edit form
|
53
|
-
insert_after :admin_variant_edit_form, :partial => 'admin/shared/zone_prices'
|
54
|
-
|
55
|
-
end
|
1
|
+
require 'spree_core'
|
2
|
+
require 'spree_zone_pricing/custom_hooks'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module SpreeZonePricing
|
2
|
+
class CustomHooks < Spree::ThemeSupport::HookListener
|
3
|
+
|
4
|
+
# Add zone pricing tab to products admin area
|
5
|
+
insert_after :admin_product_tabs, :partial => "admin/shared/zp_product_tab"
|
6
|
+
|
7
|
+
# Add zone pricing to variant edit form
|
8
|
+
insert_after :admin_variant_edit_form, :partial => 'admin/shared/zone_prices'
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
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.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- config/locales/en_spree.yml
|
30
30
|
- db/seeds.rb
|
31
31
|
- lib/spree_zone_pricing.rb
|
32
|
+
- lib/spree_zone_pricing/custom_hooks.rb
|
32
33
|
- lib/spree/zone_pricing/checkouts_controller.rb
|
33
34
|
- lib/spree/zone_pricing/countries_controller.rb
|
34
35
|
- lib/spree/zone_pricing/get_country.rb
|