spree_taxon_group

Spree extension to create and manage groups of taxons

Last updated on: October 19 at 05:38 PM

source code bug tracker request upgrade
Opensource
1 1 1
0 / 0
owner:  Whelton

Spree Taxon Group

Easily create and manage groups of taxons, irrespective of their parent or children taxons/taxonomies and control the position/order of taxons in their groups. Useful if you need flexible taxon usage, for example a group of taxons for featured categories from different parent taxon/taxonomies.


Usage

If you want a taxon tree, similar to taxons_tree in the default spree sidebar. You can use the helper taxon_group_tree:

<nav id="featured-categories" class="sidebar-item" data-hook>
  <% featured = Spree::TaxonGroup.find_by_key('featured') %>
  <% cache [I18n.locale, featured] do %>
    <h4 class='taxon-group-root'><%= Spree.t(:shop_by_taxon_group, :taxon_group => featured.name) %></h4>
    <%= taxon_group_tree(featured, @taxon) %>
  <% end %>
</nav>

or for more control, without taxon_group_tree:

<% navigation_taxon_upcase_group = Spree::TaxonGroup.find_by_key('navigation') %>
<% cache [I18n.locale, navigation_taxon_upcase_group] do %>
  <%= navigation_taxon_upcase_group.taxons.map do |taxon|
        '<li class="hidden-lg hidden-md">' + link_to(taxon.name.upcase, seo_url(taxon)) + '</li>'
      end.join("\n").html_safe
  %>
<% end %>

Basic Installation

Add to your Gemfile:

gem 'spree_taxon_group', '3.1.0.beta'

Run:

bundle && bundle exec rails g spree_taxon_group:install

That's it!


Contributing

See corresponding guidelines and check out the issues.


Copyright (c) 2015 James Whelton and contributors, released under the New BSD License

comments

No comments yet

Add article
compatible spree versions
tags spree versions
master ~> 3.1.0.beta
v3.0.0.beta ~> 3.1.0.beta
v3.1.0.beta ~> 3.1.0.beta
authors
James Whelton