{"id":23765812,"url":"https://github.com/solidusio-contrib/solidus_related_products","last_synced_at":"2025-05-16T14:05:14.479Z","repository":{"id":5807631,"uuid":"53448943","full_name":"solidusio-contrib/solidus_related_products","owner":"solidusio-contrib","description":"🍴 Related products extension for Solidus","archived":false,"fork":false,"pushed_at":"2025-04-02T06:02:11.000Z","size":458,"stargazers_count":34,"open_issues_count":2,"forks_count":46,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-13T00:41:24.980Z","etag":null,"topics":["coupons","discount","ecommerce","ecommerce-platform","solidus"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solidusio-contrib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-08T22:10:34.000Z","updated_at":"2025-04-02T06:02:16.000Z","dependencies_parsed_at":"2025-01-15T01:18:43.664Z","dependency_job_id":"1520e4a4-1b00-424e-ab6f-cde562236707","html_url":"https://github.com/solidusio-contrib/solidus_related_products","commit_stats":{"total_commits":338,"total_committers":85,"mean_commits":3.976470588235294,"dds":0.9053254437869822,"last_synced_commit":"06441664b9470b966d3d48da181ca472d9e0f941"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_related_products","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_related_products/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_related_products/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_related_products/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solidusio-contrib","download_url":"https://codeload.github.com/solidusio-contrib/solidus_related_products/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254377779,"owners_count":22061220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coupons","discount","ecommerce","ecommerce-platform","solidus"],"created_at":"2024-12-31T23:17:57.839Z","updated_at":"2025-05-16T14:05:14.458Z","avatar_url":"https://github.com/solidusio-contrib.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solidus Related Products\n\n[![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_related_products.svg?style=shield)](https://circleci.com/gh/solidusio-contrib/solidus_related_products)\n[![codecov](https://codecov.io/gh/solidusio-contrib/solidus_related_products/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio-contrib/solidus_related_products)\n\nThis 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.\n\nYou can manage RelationTypes via the admin configuration menu, and you can maintain product relationships via __Related Products__ tab on the edit product UI or via __Related Products__ section on the edit variant UI.\n\n## Possible uses\n\n* Accessories\n* Cross Sells\n* Up Sells\n* Compatible Products\n* Replacement Products\n* Warranty \u0026 Support Products\n\n## Installation\n\nAdd solidus_related_products to your Gemfile:\n\n```ruby\ngem 'solidus_related_products'\n```\n\nTo get the latest changes, we suggest using the Github version:\n```ruby\ngem 'solidus_related_products', github: 'solidusio-contrib/solidus_related_products'\n```\n\nBundle your dependencies and run the installation generator:\n\n```shell\nbin/rails generate solidus_related_products:install\n```\n\n## Usage\n\n### Relation Types\n\nYou can create four different RelationTypes:\n\n| Applies From | Applies To | Bi-Directional available |\n| - | - | - |\n| Spree::Product | Spree::Product | Yes |\n| Spree::Product | Spree::Variant | No  |\n| Spree::Variant | Spree::Product | No  |\n| Spree::Variant | Spree::Variant | Yes |\n\n**Bi-Directional**\nYou can optionally set the bi-directional flag (if available) to automatically create the inverse relation,\nthe flag can be set only on the type creation and can't be changed later, this is needed to avoid unpredictable behavior\nin the case that the flag is changed.\nKeep in mind that if you remove one side of the relation, also the other hand will be removed, the same way happens\nfor the description.\nThe discounts are disabled for Bi-Directional by setting the discount amount to be only zero, this is needed\nbecause it's not clear how this feature should behave in this case.\n\nThe following examples use a `Spree::Product -\u003e Spree::Product` relation type.\n\nWhen you create a RelationType you can access that set of related products by referencing the relation_type name, see below for an example:\n```ruby\nrt = Spree::RelationType.create(name: 'Accessories', applies_from: 'Spree::Product', applies_to: 'Spree::Product')\n =\u003e #\u003cSpree::RelationType id: 4, name: \"Accessories\" ...\u003e\nproduct = Spree::Product.last\n =\u003e #\u003cSpree::Product id: 1060500592 ...\u003e\nproduct.accessories\n =\u003e []\n```\n\nSince respond_to? will not work in this case, you can test whether a relation_type method exists with has_related_products?(method):\n\n```ruby\nproduct.has_related_products?('accessories')\n# =\u003e true\n\nif product.has_related_products?('accessories')\n  # Display an accessories box..\nend\n```\n\nYou can access all related products regardless of RelationType by:\n```ruby\nproduct.relations\n =\u003e []\n```\n\n**Discounts**\nYou can optionally specify a discount amount to be applied if a customer purchases both products.\n\nNote: In order for the coupon to be automatically applied, you must create a promotion leaving the __code__ value empty, and adding an Action of type : __RelatedProductDiscount__  (blank codes are required for coupons to be automatically applied).\n\n## Development\n\n### Testing the extension\n\nFirst bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy\napp if it does not exist, then it will run specs. The dummy app can be regenerated by using\n`bin/rake extension:test_app`.\n\n```shell\nbin/rake\n```\n\nTo run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run\n\n```shell\nbundle exec rubocop\n```\n\nWhen testing your application's integration with this extension you may use its factories.\nSimply add this require statement to your spec_helper:\n\n```ruby\nrequire 'solidus_related_products/factories'\n```\n\n### Running the sandbox\n\nTo run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for\nthe sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to\n`sandbox/bin/rails`.\n\nHere's an example:\n\n```\n$ bin/rails server\n=\u003e Booting Puma\n=\u003e Rails 6.0.2.1 application starting in development\n* Listening on tcp://127.0.0.1:3000\nUse Ctrl-C to stop\n```\n\n### Updating the changelog\n\nBefore and after releases the changelog should be updated to reflect the up-to-date status of\nthe project:\n\n```shell\nbin/rake changelog\ngit add CHANGELOG.md\ngit commit -m \"Update the changelog\"\n```\n\n### Releasing new versions\n\nPlease refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki.\n\n## License\n\nCopyright (c) 2010-2015 [Brian Quinn][1] and [contributors][2], released under the [New BSD License][3]\n\n[1]: https://github.com/BDQ\n[2]: https://github.com/solidusio-contrib/solidus_related_products/graphs/contributors\n[3]: https://github.com/solidusio-contrib/solidus_related_products/blob/master/LICENSE.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidusio-contrib%2Fsolidus_related_products","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidusio-contrib%2Fsolidus_related_products","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidusio-contrib%2Fsolidus_related_products/lists"}