Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

fixed duplicated items in slider, featured and latest products #127

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

gem 'spree', github: 'spree/spree', :branch => 'master'
gem 'spree', github: 'spree/spree', :branch => '2-3-stable'
# Provides basic authentication functionality for testing parts of your engine
gem 'spree_auth_devise', github: "spree/spree_auth_devise", :branch => 'master'
gem 'spree_auth_devise', github: "spree/spree_auth_devise", :branch => '2-3-stable'

gemspec
4 changes: 4 additions & 0 deletions app/controllers/spree/home_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
Spree::HomeController.class_eval do

def index
uniq_item = "DISTINCT (spree_products.id), spree_products.*, spree_products_taxons.position"
slider = Spree::Taxon.where(:name => 'Slider').first
@slider_products = slider.products.active if slider
@slider_products = @slider_products.select(uniq_item) if @slider_products

featured = Spree::Taxon.where(:name => 'Featured').first
@featured_products = featured.products.active if featured
@featured_products = @featured_products.select(uniq_item) if @featured_products

latest = Spree::Taxon.where(:name => 'Latest').first
@latest_products = latest.products.active if latest
@latest_products = @latest_products.select(uniq_item) if @latest_products
end

end
2 changes: 1 addition & 1 deletion spree_fancy.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.requirements << 'none'

s.add_dependency 'spree_core', '~> 2.3.0.beta'
s.add_dependency 'spree_core', '~> 2.3.0'
s.add_dependency 'compass-rails'
s.add_dependency 'jquery-ui-rails'
s.add_dependency 'deface', '~> 1.0.0rc3'
Expand Down