diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 4b2e0983d1..5820fa5124 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -41,7 +41,7 @@ class EnterprisesController < BaseController @products = [] if @enterprise.is_primary_producer - @distributors = Enterprise.distributing_any_product_of(@enterprise.supplied_products) + @distributors = Enterprise.distributing_any_product_of(@enterprise.supplied_products).by_name.all end if current_order_cycle diff --git a/app/views/enterprises/show.html.haml b/app/views/enterprises/show.html.haml index 9c42953079..305f294a81 100644 --- a/app/views/enterprises/show.html.haml +++ b/app/views/enterprises/show.html.haml @@ -11,5 +11,8 @@ %p.hint Select a hub to start shopping: %ul#supplier-distributors + - if @distributors.delete @enterprise + %li= link_to "Buy direct from the farm", shop_enterprise_path(@enterprise), {class: temp_landing_page_distributor_link_class(@enterprise)} + - @distributors.each do |distributor| %li= link_to distributor.name, shop_enterprise_path(distributor), {class: temp_landing_page_distributor_link_class(distributor)}