spree_zone_pricing 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,44 @@
1
+ # Uncomment this if you reference any of your controllers in activate
2
+ # require_dependency 'application'
3
+
4
+ class ZonePricingExtension < Spree::Extension
5
+ version "0.1.3"
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
+ end
@@ -0,0 +1,9 @@
1
+ class ZonePricingHooks < Spree::ThemeSupport::HookListener
2
+
3
+ # Add zone pricing tab to products admin area
4
+ insert_after :admin_product_tabs, :partial => "admin/shared/zp_product_tab"
5
+
6
+ # Add zone pricing to variant edit form
7
+ insert_after :admin_variant_edit_form, :partial => 'admin/shared/zone_prices'
8
+
9
+ 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.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -28,6 +28,8 @@ files:
28
28
  - config/routes.rb
29
29
  - config/locales/en_spree.yml
30
30
  - db/seeds.rb
31
+ - lib/zone_pricing_extension.rb
32
+ - lib/zone_pricing_hooks.rb
31
33
  - lib/spree/zone_pricing/checkouts_controller.rb
32
34
  - lib/spree/zone_pricing/countries_controller.rb
33
35
  - lib/spree/zone_pricing/get_country.rb