Related Products

Official Extension

Official extensions are maintained and supported by Rails Dog and the Spree community. Every effort is made to ensure these extensions are updated to support each Spree release.

Related Products

This extension provides a generic way for you to define different types of relationships between your products, by defining a RelationType for each type of relationship you’d like to maintain.

You can manage RelationTypes via the admin configuration menu, and you can maintain product relationships via Related Products tab on the edit product UI.

Possible uses

  • Accessories
  • Cross Sells
  • Up Sells
  • Compatible Products
  • Replacement Products
  • Warranty & Support Products

Relation Types

When you create a RelationType you can access that set of related products by referencing the relation_type name, see below for an example:

rt = RelationType.create(:name => “Accessories”, :applies_to => “Product”) => #<RelationType id: 4, name: “Accessories” …> product = Product.last => # product.accessories => []

You can access all related products regardless of RelationType by:

product.relations => []

Discounts

If you install the spree-automatic-coupons extension you can also specify a discount amount to be applied if a customer purchases both products. Note: In order for the coupon to be automatically applied, you must create a coupon of type: RelatedProductDiscount and leave the code value empty (blank codes are required for coupons to be automatically applied).



Comments

brian fe said on January 18, 2011:

Help, can anybody post some sample code some where to do a front end for this extension, say when your in the description page (before the basket page)of spree and underneath the properties and values I need to have product variants rendered i.e a thumbnail, a truncated description, permalink and price, I am sure it would take some expert 10 minutes, want to learn rails so bad but it will take me too long and I am nearly bald, I would be very great full of the help thanks B.

Ram Singla said on January 25, 2011:

To install for the 0.11.1 goto the following page and download the archive. https://github.com/spree/spree_related_products/tree/357ec1e0d78b069fe36895893c0d504c2fe885d4

Spencer Steffen said on January 30, 2011:

Doesn't seem to be working with ruby 1.9.2. ActionView::Template::Error (undefined local variable or method `to_ary' for #<Product:0x00000106839f80>): 34: <% end %> 35: <td class="actions"> 36: <%= hook :admin_products_index_row_actions, locals do %> 37: <%= link_to_edit product unless product.deleted? %> 38: &nbsp; 39: <%= link_to_clone product %> 40: &nbsp;

Juris Perunov said on February 09, 2011:

Hi. I have a question to Rails Dog team. When you're planing to launch this extension's new version? We're developing new site on Spree 0.4, and we're waiting with Spree 0.4 compatible version. Thanks for your answer.

Patrick McElwee said on January 27, 2012:

Just a note to anyone installing on 0.60.x ... the version was bumped on GitHub, but not here. You should install gem 'spree_related_products', :git => 'git://raw.github.com/spree/spree_related_products.git', :ref => 'ace985694e2ffa63d53e0abac8e1ec5694d99d33'

Login to Comment.

This project is maintained by a core team of developers and is freely available for commercial use under the terms of the New BSD License.

Spree, Spree Commerce and the Spree logo are all trademarks of Spree Commerce, Inc.