This is an extension for Spree, put together by jomz and upgraded for Rails 3 by joshmcarthur
This extension makes it possible to 'highlight' certain products that you can then easily show on the homepage for example. Highlighting a product updates a newly added timestamp on the Product model. There is also a named scope Product.highlighted, which selects all products that have been highlighted, and orders them so that the first in the result is the last one highlighted. There is no 'unhighlight' button.
I started off with paulcc's promotions extension, but the only thing left of it is the best_sellers method, which I moved to the Product model.. There is an other extension also called promotions, which better deserves the name, as it's about actual promotions (lowered prices), and not about promoting something to the home page.
- Add extension to your Gemfile
gem 'highlight_products', :git => 'https://github.com/3months/spree-highlight_products.git', :branch => 'rails3'
- Run
bundle install
- Copy migrations and assets to your application by running
rake highlight_products:install
- Run
rake db:migrate
to update your schema, and reboot the server.
Highlight products from the admin/products index page. Then you can use Product.highlighted(:limit => 3)
anywhere to get the last 3 highlighted products.