Sha256: eda8a5fb82bbfce728d4ef7de4ca2f9685d5cbae728ce5c2254e51b620a7335d
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
# Uncomment this if you reference any of your controllers in activate require_dependency 'application' class ShippingExtension < Spree::Extension version "1.0" description "Describe your extension here" url "http://yourwebsite.com/shipping" define_routes do |map| map.namespace :admin do |admin| admin.resources :shipping_methods admin.resources :shipping_categories end map.resources :shipments map.resources :orders, :has_many => :shipments, :member => {:fatal_shipping => :get} end def activate Order.class_eval do has_many :shipments, :dependent => :destroy include Spree::ShippingCalculator end AddressesController.class_eval do # limit the countries to the ones that are possible to ship to def load_countries @countries = @order.shipping_countries @countries = [Country.find(Spree::Config[:default_country_id])] if @countries.empty? end end Admin::ConfigurationsController.class_eval do before_filter :add_shipping_links, :only => :index def add_shipping_links @extension_links << {:link => admin_shipping_methods_path, :link_text => Globalite.localize(:ext_shipping_shipping_methods), :description => Globalite.localize(:ext_shipping_shipping_methods_description)} @extension_links << {:link => admin_shipping_categories_path, :link_text => Globalite.localize(:ext_shipping_shipping_categories), :description => Globalite.localize(:ext_shipping_shipping_categories_description)} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree-0.5.0 | vendor/extensions/shipping/shipping_extension.rb |
spree-0.5.1 | vendor/extensions/shipping/shipping_extension.rb |