-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Primary Breadcrumb Taxon feature to Spree products
- Introduced a new `primary_breadcrumb_taxon_id` reference field in the `spree_products` table to associate a primary breadcrumb taxon with products. - Updated the `Spree::Product` model to include a `belongs_to :primary_breadcrumb_taxon` association, allowing optional linkage to a taxon. - Modified the `Spree::Api::ApiConfiguration` to include `primary_breadcrumb_taxon_id` in `product_attributes`, enabling API support for this attribute. - Enhanced API tests to cover creation and updating of products with a primary breadcrumb taxon. - Updated the admin product form to allow selection of a primary breadcrumb taxon. - Improved frontend JavaScript for autocomplete functionality when selecting a primary breadcrumb taxon. - Added `primary_breadcrumb_taxon_id` to the list of permitted attributes for safe updates via the admin interface and API. - Included test cases to verify the functionality of the `primary_breadcrumb_taxon` association, ensuring proper model validation and API behavior. This change is backward-compatible, allowing products to exist without a primary breadcrumb taxon while enhancing the product management capabilities in both the admin interface and API.
- Loading branch information
1 parent
dfe87ae
commit fc7a95d
Showing
9 changed files
with
109 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
core/db/migrate/20250207104016_add_primary_breadcrumb_taxon_to_products.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddPrimaryBreadcrumbTaxonToProducts < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :spree_products, :primary_breadcrumb_taxon_id, :integer, null: true | ||
add_foreign_key :spree_products, :spree_taxons, column: :primary_breadcrumb_taxon_id | ||
add_index :spree_products, :primary_breadcrumb_taxon_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters