Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Related products extension for Spree Commerce.

License

NotificationsYou must be signed in to change notification settings

k2p-ed/spree_related_products

 
 

Repository files navigation

Build StatusCode Climate

Related Products is aSpree Commerce extension that 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 viaRelated 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=Spree::RelationType.create(name:'Accessories',applies_to:'Spree::Product')=>#<Spree::RelationType id: 4, name: "Accessories" ...>product=Spree::Product.last=>#<Spree::Product id: 1060500592 ...>product.accessories=>[]

Since respond_to? will not work in this case, you can test whether a relation_type method exists with has_related_products?(method):

product.has_related_products?('accessories')# => trueifproduct.has_related_products?('accessories')# Display an accessories box..end

You can access all related products regardless of RelationType by:

product.relations=>[]

DiscountsYou can optionally 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 promotion leaving thecode value empty, and adding an Action of type :RelatedProductDiscount (blank codes are required for coupons to be automatically applied).


Installation

  1. Add this extension to your Gemfile with this line:

Spree >= 3.1

gem'spree_related_products',github:'spree-contrib/spree_related_products'

Spree 3.0 and Spree 2.x

gem'spree_related_products',github:'spree-contrib/spree_related_products',branch:'X-X-stable'

Thebranch option is important: it must match the version of Spree you're using.For example, use3-0-stable if you're using Spree3-0-stable or any3.0.x version.

  1. Install the gem using Bundler:
bundleinstall
  1. Copy & run migrations
bundleexecrailsgspree_related_products:install
  1. Restart your server

If your server was running, restart it so that it can find the assets properly.


Contributing

See correspondingguidelines


Copyright (c) 2010-2015Brian Quinn andcontributors, released under theNew BSD License

About

Related products extension for Spree Commerce.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby82.6%
  • HTML17.2%
  • Other0.2%

[8]ページ先頭

©2009-2025 Movatter.jp