Implemented simlified shop flow.

This commit is contained in:
alexs333
2013-09-04 20:32:21 +10:00
parent 25b25b7681
commit 999bc2697a
19 changed files with 181 additions and 96 deletions

View File

@@ -1,4 +1,5 @@
include Spree::ProductsHelper
include OrderCyclesHelper
class EnterprisesController < BaseController
@@ -29,8 +30,8 @@ class EnterprisesController < BaseController
@enterprise = Enterprise.find params[:id]
@searcher = Spree::Config.searcher_class.new(options)
@products = @searcher.retrieve_products
@products = []
@products = current_order_cycle.products if current_order_cycle
end
def shop
@@ -39,6 +40,7 @@ class EnterprisesController < BaseController
if order.distributor and order.distributor != distributor
order.empty!
order.set_order_cycle! nil
end
order.distributor = distributor

View File

@@ -53,6 +53,7 @@ Spree::OrdersController.class_eval do
redirect_to request.referer
elsif params[:commit] == 'Choose Order Cycle'
@order.empty! # empty cart
order_cycle = OrderCycle.active.find params[:order][:order_cycle_id]
@order.set_order_cycle! order_cycle
@@ -61,6 +62,14 @@ Spree::OrdersController.class_eval do
end
end
def clear
@order = current_order(true)
current_distributor = @order.distributor
@order.order_cycle = nil
@order.set_order_cycle! nil
redirect_to main_app.shop_enterprise_path(current_distributor.id)
end
private
def populate_variant_attributes

View File

@@ -6,7 +6,7 @@ Spree::ProductsController.class_eval do
include OpenFoodWeb::SplitProductsByDistribution
respond_override :index => { :html => { :success => lambda {
@products, @products_local, @products_remote = split_products_by_distribution @products, current_distributor, current_order_cycle
@products = current_order_cycle.products if current_order_cycle
} } }
end