@spree/docs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/dist/api-reference/platform/authentication.md +38 -0
- package/dist/api-reference/store-api/authentication.md +188 -0
- package/dist/api-reference/store-api/errors.md +277 -0
- package/dist/api-reference/store-api/idempotency.md +129 -0
- package/dist/api-reference/store-api/introduction.md +34 -0
- package/dist/api-reference/store-api/localization.md +279 -0
- package/dist/api-reference/store-api/metadata.md +160 -0
- package/dist/api-reference/store-api/monetary-amounts.md +65 -0
- package/dist/api-reference/store-api/querying.md +399 -0
- package/dist/api-reference/store-api/rate-limitting.md +103 -0
- package/dist/api-reference/store-api/relations.md +185 -0
- package/dist/api-reference/storefront/authentication.md +88 -0
- package/dist/api-reference/tutorials/adyen-integration-guide-for-android.md +165 -0
- package/dist/api-reference/tutorials/adyen-integration-guide-for-ios.md +194 -0
- package/dist/api-reference/tutorials/quick-checkout-with-stripe.md +248 -0
- package/dist/api-reference/v2/fetching-multiple-resources.md +26 -0
- package/dist/api-reference/v2/filtering-and-sorting.md +53 -0
- package/dist/api-reference/v2/introduction.md +22 -0
- package/dist/api-reference/v2/pagination.md +37 -0
- package/dist/api-reference/webhooks-events.md +883 -0
- package/dist/developer/admin/admin.md +205 -0
- package/dist/developer/admin/authentication.md +59 -0
- package/dist/developer/admin/components.md +711 -0
- package/dist/developer/admin/custom-css.md +243 -0
- package/dist/developer/admin/custom-javascript.md +116 -0
- package/dist/developer/admin/extending-ui.md +1964 -0
- package/dist/developer/admin/form-builder.md +444 -0
- package/dist/developer/admin/helper-methods.md +531 -0
- package/dist/developer/admin/navigation.md +805 -0
- package/dist/developer/admin/tables.md +491 -0
- package/dist/developer/advanced/adding_spree_to_rails_app.md +106 -0
- package/dist/developer/cli/quickstart.md +137 -0
- package/dist/developer/contributing/creating-an-extension.md +258 -0
- package/dist/developer/contributing/developing-spree.md +339 -0
- package/dist/developer/contributing/quickstart.md +32 -0
- package/dist/developer/contributing/updating-extensions.md +67 -0
- package/dist/developer/core-concepts/addresses.md +265 -0
- package/dist/developer/core-concepts/adjustments.md +107 -0
- package/dist/developer/core-concepts/architecture.md +177 -0
- package/dist/developer/core-concepts/calculators.md +323 -0
- package/dist/developer/core-concepts/customers.md +230 -0
- package/dist/developer/core-concepts/events.md +624 -0
- package/dist/developer/core-concepts/imports-exports.md +698 -0
- package/dist/developer/core-concepts/inventory.md +191 -0
- package/dist/developer/core-concepts/markets.md +250 -0
- package/dist/developer/core-concepts/media.md +167 -0
- package/dist/developer/core-concepts/metafields.md +187 -0
- package/dist/developer/core-concepts/orders.md +328 -0
- package/dist/developer/core-concepts/payments.md +710 -0
- package/dist/developer/core-concepts/pricing.md +163 -0
- package/dist/developer/core-concepts/products.md +360 -0
- package/dist/developer/core-concepts/promotions.md +322 -0
- package/dist/developer/core-concepts/reports.md +206 -0
- package/dist/developer/core-concepts/search-filtering.md +237 -0
- package/dist/developer/core-concepts/shipments.md +212 -0
- package/dist/developer/core-concepts/slugs.md +111 -0
- package/dist/developer/core-concepts/staff-roles.md +123 -0
- package/dist/developer/core-concepts/store-credits-gift-cards.md +317 -0
- package/dist/developer/core-concepts/stores.md +117 -0
- package/dist/developer/core-concepts/taxes.md +135 -0
- package/dist/developer/core-concepts/translations.md +120 -0
- package/dist/developer/core-concepts/users.md +299 -0
- package/dist/developer/core-concepts/webhooks.md +378 -0
- package/dist/developer/create-spree-app/quickstart.md +158 -0
- package/dist/developer/customization/api.md +93 -0
- package/dist/developer/customization/authentication.md +88 -0
- package/dist/developer/customization/checkout.md +204 -0
- package/dist/developer/customization/configuration.md +55 -0
- package/dist/developer/customization/decorators.md +523 -0
- package/dist/developer/customization/dependencies.md +232 -0
- package/dist/developer/customization/emails.md +21 -0
- package/dist/developer/customization/extensions.md +92 -0
- package/dist/developer/customization/metadata.md +236 -0
- package/dist/developer/customization/model-preferences.md +130 -0
- package/dist/developer/customization/permissions.md +265 -0
- package/dist/developer/customization/quickstart.md +229 -0
- package/dist/developer/customization/routes.md +24 -0
- package/dist/developer/customization/v4/admin-panel.md +78 -0
- package/dist/developer/customization/v4/authentication.md +210 -0
- package/dist/developer/customization/v4/checkout.md +212 -0
- package/dist/developer/customization/v4/deface.md +251 -0
- package/dist/developer/customization/v4/images.md +86 -0
- package/dist/developer/customization/v4/storefront.md +450 -0
- package/dist/developer/deployment/assets.md +87 -0
- package/dist/developer/deployment/aws.md +335 -0
- package/dist/developer/deployment/caching.md +27 -0
- package/dist/developer/deployment/cdn.md +39 -0
- package/dist/developer/deployment/database.md +155 -0
- package/dist/developer/deployment/docker.md +128 -0
- package/dist/developer/deployment/emails.md +77 -0
- package/dist/developer/deployment/environment_variables.md +111 -0
- package/dist/developer/deployment/heroku.md +51 -0
- package/dist/developer/deployment/render.md +95 -0
- package/dist/developer/getting-started/quickstart.md +82 -0
- package/dist/developer/how-to/custom-payment-method.md +374 -0
- package/dist/developer/how-to/custom-promotion.md +373 -0
- package/dist/developer/how-to/custom-report.md +387 -0
- package/dist/developer/how-to/custom-search-provider.md +230 -0
- package/dist/developer/multi-store/quickstart.md +71 -0
- package/dist/developer/multi-store/setup.md +38 -0
- package/dist/developer/multi-tenant/configuration.md +41 -0
- package/dist/developer/multi-tenant/core-concepts.md +75 -0
- package/dist/developer/multi-tenant/installation.md +96 -0
- package/dist/developer/multi-tenant/quickstart.md +20 -0
- package/dist/developer/multi-vendor/installation.md +45 -0
- package/dist/developer/multi-vendor/quickstart.md +17 -0
- package/dist/developer/sdk/admin/quickstart.md +22 -0
- package/dist/developer/sdk/authentication.md +89 -0
- package/dist/developer/sdk/configuration.md +225 -0
- package/dist/developer/sdk/quickstart.md +82 -0
- package/dist/developer/sdk/store/account.md +67 -0
- package/dist/developer/sdk/store/cart-checkout.md +140 -0
- package/dist/developer/sdk/store/markets.md +151 -0
- package/dist/developer/sdk/store/payments.md +96 -0
- package/dist/developer/sdk/store/products.md +149 -0
- package/dist/developer/sdk/store/wishlists.md +52 -0
- package/dist/developer/security/pci_compliance.md +15 -0
- package/dist/developer/security/security_policy.md +68 -0
- package/dist/developer/storefront/blocks.md +285 -0
- package/dist/developer/storefront/custom-css.md +260 -0
- package/dist/developer/storefront/custom-javascript.md +166 -0
- package/dist/developer/storefront/helper-methods.md +1288 -0
- package/dist/developer/storefront/links.md +298 -0
- package/dist/developer/storefront/nextjs/architecture.md +150 -0
- package/dist/developer/storefront/nextjs/customization.md +141 -0
- package/dist/developer/storefront/nextjs/deployment.md +180 -0
- package/dist/developer/storefront/nextjs/quickstart.md +92 -0
- package/dist/developer/storefront/nextjs/spree-next-package.md +314 -0
- package/dist/developer/storefront/pages.md +163 -0
- package/dist/developer/storefront/sections.md +569 -0
- package/dist/developer/storefront/storefront.md +56 -0
- package/dist/developer/storefront/themes.md +161 -0
- package/dist/developer/tutorial/admin.md +134 -0
- package/dist/developer/tutorial/extending-models.md +380 -0
- package/dist/developer/tutorial/file-uploads.md +121 -0
- package/dist/developer/tutorial/introduction.md +33 -0
- package/dist/developer/tutorial/model.md +41 -0
- package/dist/developer/tutorial/page-builder.md +487 -0
- package/dist/developer/tutorial/rich-text.md +73 -0
- package/dist/developer/tutorial/seo.md +332 -0
- package/dist/developer/tutorial/storefront.md +352 -0
- package/dist/developer/tutorial/testing.md +558 -0
- package/dist/developer/upgrades/2.0-to-2.1.md +46 -0
- package/dist/developer/upgrades/2.1-to-2.2.md +59 -0
- package/dist/developer/upgrades/2.2-to-2.3.md +44 -0
- package/dist/developer/upgrades/2.3-to-2.4.md +42 -0
- package/dist/developer/upgrades/3.0-to-3.1.md +47 -0
- package/dist/developer/upgrades/3.1-to-3.2.md +34 -0
- package/dist/developer/upgrades/3.2-to-3.3.md +70 -0
- package/dist/developer/upgrades/3.3-to-3.4.md +36 -0
- package/dist/developer/upgrades/3.4-to-3.5.md +44 -0
- package/dist/developer/upgrades/3.5-to-3.6.md +40 -0
- package/dist/developer/upgrades/3.6-to-3.7.md +62 -0
- package/dist/developer/upgrades/3.7-to-4.0.md +152 -0
- package/dist/developer/upgrades/4.0-to-4.1.md +92 -0
- package/dist/developer/upgrades/4.1-to-4.2.md +109 -0
- package/dist/developer/upgrades/4.10-to-5.0.md +129 -0
- package/dist/developer/upgrades/4.2-to-4.3.md +100 -0
- package/dist/developer/upgrades/4.3-to-4.4.md +125 -0
- package/dist/developer/upgrades/4.4-to-4.5.md +94 -0
- package/dist/developer/upgrades/4.5-to-4.6.md +119 -0
- package/dist/developer/upgrades/4.6-to-4.7.md +39 -0
- package/dist/developer/upgrades/4.8-to-4.9.md +24 -0
- package/dist/developer/upgrades/4.9-to-4.10.md +24 -0
- package/dist/developer/upgrades/4.x-to-4.8.md +52 -0
- package/dist/developer/upgrades/5.0-to-5.1.md +28 -0
- package/dist/developer/upgrades/5.1-to-5.2.md +127 -0
- package/dist/developer/upgrades/5.2-to-5.3.md +338 -0
- package/dist/developer/upgrades/5.3-to-5.4.md +248 -0
- package/dist/developer/upgrades/quickstart.md +36 -0
- package/dist/integrations/analytics/google-analytics.md +64 -0
- package/dist/integrations/analytics/google-tag-manager.md +78 -0
- package/dist/integrations/integrations.md +39 -0
- package/dist/integrations/marketing/klaviyo.md +99 -0
- package/dist/integrations/payments/adyen.md +90 -0
- package/dist/integrations/payments/paypal.md +41 -0
- package/dist/integrations/payments/razorpay.md +45 -0
- package/dist/integrations/payments/stripe.md +109 -0
- package/dist/integrations/search/meilisearch.md +236 -0
- package/dist/integrations/sso-mfa-social-login/admin-dashboard.md +57 -0
- package/dist/integrations/sso-mfa-social-login/storefront.md +56 -0
- package/package.json +27 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 4.1 to 4.2
|
|
3
|
+
section: upgrades
|
|
4
|
+
order: 0
|
|
5
|
+
description: This guide covers upgrading a 4.1 Spree application to Spree 4.2.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
> **NOTE:** If you're on an older version than 4.1 please follow previous upgrade guides and perform those upgrades incrementally**, eg.
|
|
9
|
+
>
|
|
10
|
+
> 1. [upgrade 3.7 to 4.0](3.7-to-4.0)
|
|
11
|
+
> 2. [upgrade 4.0 to 4.1](4.0-to-4.1)
|
|
12
|
+
|
|
13
|
+
## Update gems
|
|
14
|
+
|
|
15
|
+
Run the following command to update your gems to 4.2:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bundle update
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Remove SpreeMultiCurrency optional
|
|
22
|
+
|
|
23
|
+
If you used that gem in the past you need to remove it. Multi-Currency is now incorporated into Spree core and you cannot use that gem anymore.
|
|
24
|
+
|
|
25
|
+
1. Remove `spree_multi_currency` from your `Gemfile`
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bundle remove spree_multi_currency
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
2. Remove these preferences from your Spree initializer `config/initializers/spree.rb`:
|
|
32
|
+
* `allow_currency_change`
|
|
33
|
+
* `show_currency_selector`
|
|
34
|
+
* `supported_currencies`
|
|
35
|
+
3. Remove `//= require spree/frontend/spree_multi_currency` from `vendor/assets/javascripts/spree/frontend/all.js`
|
|
36
|
+
4. Remove `//= require spree/backend/spree_multi_currency` from `vendor/assets/javascripts/spree/backend/all.js`
|
|
37
|
+
|
|
38
|
+
## Optional Remove SpreeI18n config
|
|
39
|
+
|
|
40
|
+
All international configuration is now kept on the `Store` model in the database rather than in initializer files.
|
|
41
|
+
|
|
42
|
+
If you used `spree_i18n` gem before please remove any `SpreeI18n::Config`references from your `config/initializers/spree.rb` file.
|
|
43
|
+
|
|
44
|
+
## Optional Add `deface` gem
|
|
45
|
+
|
|
46
|
+
If you used [Deface overrides](../../advanced/deface_overrides_tutorial#organizing-overrides) you will need to include `deface` in your `Gemfile` as it was removed from Spree / Spree Auth Devise / Spree Gateway dependencies.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bundle add deface
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Fix RMA migration
|
|
53
|
+
|
|
54
|
+
Please find a `add_stock_location_to_rma` migration in your `db/migrate` directory and change:
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
class AddStockLocationToRma < ActiveRecord::Migration[4.2]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
to
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
class AddStockLocationToRMA < ActiveRecord::Migration[4.2]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Install missing migrations
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bin/rake spree:install:migrations
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Run migrations
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bin/rails db:migrate
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Other things to remember
|
|
79
|
+
|
|
80
|
+
### Replace `fast_json` with `jsonapi-serializer`
|
|
81
|
+
|
|
82
|
+
Please follow [this guide to migrate your custom serializers](https://github.com/jsonapi-serializer/jsonapi-serializer#migrating-from-netflixfast_jsonapi).
|
|
83
|
+
|
|
84
|
+
### Migrate select2 3.5 to 4
|
|
85
|
+
|
|
86
|
+
Only if you've added new Admin Panel pages with Select2 dropdown - [this guide will help](https://select2.org/upgrading/migrating-from-35)
|
|
87
|
+
|
|
88
|
+
### Make sure you've got up to date Spree templates Storefront
|
|
89
|
+
|
|
90
|
+
If you're using Spree default Storefront `spree_frontend` gem make sure to update your templates, especially:
|
|
91
|
+
|
|
92
|
+
* [app/views/spree/shared/_head.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_head.html.erb)
|
|
93
|
+
* [app/views/spree/shared/_locale_and_currency.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_locale_and_currency.html.erb)
|
|
94
|
+
* [app/views/spree/shared/_link_to_account.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_link_to_account.html.erb)
|
|
95
|
+
* [app/views/spree/shared/_internationalization_options.html.erb](https://github.com/spree/spree/blob/main/frontend/app/views/spree/shared/_internationalization_options.html.erb)
|
|
96
|
+
* [app/views/spree/shared/_locale_dropdown.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_locale_dropdown.html.erb)
|
|
97
|
+
* [app/views/spree/shared/_currency_dropdown.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_currency_dropdown.html.erb)
|
|
98
|
+
* [app/views/spree/shared/_mobile_navigation.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_mobile_navigation.html.erb)
|
|
99
|
+
* [app/views/spree/shared/_mobile_internationalization_options.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_mobile_internationalization_options.html.erb)
|
|
100
|
+
* [app/views/spree/shared/_nav_bar.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_nav_bar.html.erb)
|
|
101
|
+
* [app/views/spree/shared/_line_item.html.erb](https://github.com/spree/spree/blob/4-2-stable/frontend/app/views/spree/shared/_line_item.html.erb)
|
|
102
|
+
|
|
103
|
+
Or simply run `bin/rails g spree:frontend:copy_storefront`
|
|
104
|
+
|
|
105
|
+
## Read the release notes
|
|
106
|
+
|
|
107
|
+
For information about changes contained within this release, please read the [4.2.0 Release Notes](https://github.com/spree/spree/releases/tag/v4.2.0).
|
|
108
|
+
|
|
109
|
+
## More info
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Spree 5.0
|
|
3
|
+
description: This guide covers upgrading a Spree 4.10 application to Spree 5.0.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **INFO:** Before proceeding to upgrade, please ensure you're at [Spree 4.10](/developer/upgrades/4.9-to-4.10)
|
|
7
|
+
|
|
8
|
+
Spree 5.0 is a major upgrade that introduces many breaking changes. The major changes are:
|
|
9
|
+
|
|
10
|
+
- Dropped support for Rails < 7.2
|
|
11
|
+
- Dropped support for Spree Auth Devise gem (now using Devise gem directly via generator)
|
|
12
|
+
- Completely new modern mobile-friendly Storefront (old customizations won't work)
|
|
13
|
+
- Completely new Admin Dashboard (old customizations won't work)
|
|
14
|
+
- Completely new native Stripe extension
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
Before upgrading, please ensure you have the following prerequisites:
|
|
19
|
+
|
|
20
|
+
- Ruby 3.2 or later
|
|
21
|
+
- Rails 7.2 - [Upgrade guide for Rails 7.2](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-7-1-to-rails-7-2)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Upgrade steps
|
|
25
|
+
|
|
26
|
+
### 1. Remove old frontend/backend Spree gems
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bundle remove spree_auth_devise spree_backend spree_frontend
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **WARNING:** Remove any code referencing `Spree::Backend`, `Spree::Fronted` or `Spree::Auth` from your application, especially from `config/initializers/spree.rb`.
|
|
33
|
+
|
|
34
|
+
### 2. Update main Spree gem
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
bundle update spree
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. Install and run missing migrations
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
bin/rake spree:install:migrations && bin/rails db:migrate
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 4. Add new Spree gems
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bundle add spree_storefront spree_admin spree_stripe
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
And run the following generators:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
bin/rails g spree:storefront:install
|
|
56
|
+
bin/rails g spree:admin:install
|
|
57
|
+
bin/rails g spree_stripe:install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 5. Migrate from Spree Auth Devise gem
|
|
61
|
+
|
|
62
|
+
If you previously used the `spree_auth_devise` gem, you will need to run some commands to create User and connect it to Spree. We don't use the `spree_auth_devise` gem anymore to allow you more control over the authentication and access to all Devise options directly in your application.
|
|
63
|
+
|
|
64
|
+
First, install Devise and run the Devise generator:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
bundle add devise
|
|
68
|
+
bin/rails g devise:install
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Create `Spree::User` model:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mkdir -p app/models/spree && touch app/models/spree/user.rb
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Add the following code to your `Spree::User` model:
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
module Spree
|
|
81
|
+
class User < ApplicationRecord
|
|
82
|
+
devise :database_authenticatable # if you want to use the database_authenticatable feature
|
|
83
|
+
devise :recoverable # if you want to use the recoverable feature
|
|
84
|
+
devise :registerable # if you want to use the registerable feature
|
|
85
|
+
devise :confirmable # if you want to use the confirmable feature
|
|
86
|
+
devise :validatable # if you want to use the validatable feature
|
|
87
|
+
|
|
88
|
+
devise :rememberable, :trackable, :encryptable, encryptor: 'authlogic_sha512'
|
|
89
|
+
|
|
90
|
+
acts_as_paranoid
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
In you `config/initializers/spree.rb` file, add the following code:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
Spree.user_class = "Spree::User"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Now run the new authentication generator to connect your `Spree::User` model to Spree:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
bin/rails g spree:authentication:devise
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
And if you're using the default spree storefront, please run the following generator:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
bin/rails g spree:storefront:devise
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
This will add devise routes and create controllers for the storefront.
|
|
114
|
+
|
|
115
|
+
And that's it! You can now login to the admin panel and storefront using your existing users.
|
|
116
|
+
|
|
117
|
+
### 6. Migrate data to the new format
|
|
118
|
+
|
|
119
|
+
In Spree 5 we changed a bit of the data in some models so you will need to run these commands to fix it:
|
|
120
|
+
|
|
121
|
+
#### Taxons
|
|
122
|
+
|
|
123
|
+
```ruby
|
|
124
|
+
Spree::Taxon.all.each { |t| t.set_pretty_name; t.save }
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Read the release notes
|
|
128
|
+
|
|
129
|
+
For information about changes contained within this release, please read the [Spree 5.0 Release Notes.](https://github.com/orgs/spree/discussions/12604)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 4.2 to 4.3
|
|
3
|
+
section: upgrades
|
|
4
|
+
order: 0
|
|
5
|
+
hidden: true
|
|
6
|
+
description: This guide covers upgrading a 4.2 Spree application to Spree 4.3.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
> **NOTE:** If you're on an older version than 4.1 please follow previous upgrade guides and perform those upgrades incrementally**, eg.
|
|
10
|
+
>
|
|
11
|
+
> 1. [upgrade 3.7 to 4.0](3.7-to-4.0)
|
|
12
|
+
> 2. [upgrade 4.0 to 4.1](4.0-to-4.1)
|
|
13
|
+
> 3. [upgrade 4.1 to 4.2](4.1-to-4.2)
|
|
14
|
+
|
|
15
|
+
## Update Gemfile
|
|
16
|
+
|
|
17
|
+
Since Spree 4.3 `spree` gem doesn't include `spree_emails`, `spree_backend` and `spree_frontend` gems. It only consists of Spree Core and Spree API.
|
|
18
|
+
|
|
19
|
+
You need to add them to your Gemfile if you want to use them.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bundle add spree_emails spree_backend spree_frontend
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Remove gems merged into Spree Core
|
|
26
|
+
|
|
27
|
+
These gems were merged into Spree Core in version 4.3. All of their functionality is now included in the `spree` gem so you can remove them.
|
|
28
|
+
|
|
29
|
+
### Optional Remove SpreeMultiDomain
|
|
30
|
+
|
|
31
|
+
If you used that gem in the past you need to remove it. Multi-Store is now incorporated into Spree core and you cannot use that gem anymore.
|
|
32
|
+
|
|
33
|
+
1. Remove `spree_multi_domain` from your `Gemfile`
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bundle remove spree_multi_domain
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. Remove `//= require spree/frontend/spree_multi_domain` from `vendor/assets/javascripts/spree/frontend/all.js`
|
|
40
|
+
3. Remove `//= require spree/backend/spree_multi_domain` from `vendor/assets/javascripts/spree/backend/all.js`
|
|
41
|
+
|
|
42
|
+
### Optional Remove Spree Editor
|
|
43
|
+
|
|
44
|
+
Spree 4.3 includes TinyMCE 5 editor built-in. It's not recommended to use `spree_editor` gem anymore.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bundle remove spree_editor
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Optional Remove Spree Static Content
|
|
51
|
+
|
|
52
|
+
Spree 4.3 includes a built-in CMS. It's not recommended to use `spree_static_content`
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
bundle remove spree_static_content
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Install missing migrations
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
rake railties:install:migrations
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Run migrations
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
bin/rails db:migrate
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Additional fixes and hints
|
|
71
|
+
|
|
72
|
+
### Upgrade Sprockets to v4
|
|
73
|
+
|
|
74
|
+
In your project create `app/assets/config/manifest.jss` file with contents:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
//= link_tree ../images
|
|
78
|
+
//= link_tree ../javascripts
|
|
79
|
+
//= link_directory ../stylesheets .css
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
More [on this topic](https://github.com/rails/sprockets/blob/main/UPGRADING.md#manifestjs).
|
|
83
|
+
|
|
84
|
+
### Admin Panel fix
|
|
85
|
+
|
|
86
|
+
If you've developed custom features for your Admin Panel, please replace any occurrences of
|
|
87
|
+
|
|
88
|
+
```ruby
|
|
89
|
+
render partial: 'spree/shared/error_messages'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
to
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
render partial: 'spree/admin/shared/error_messages'
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Read the release notes
|
|
99
|
+
|
|
100
|
+
For information about changes contained within this release, please read the [Release notes](https://github.com/spree/spree/releases/v4.3.0).
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 4.3 to 4.4
|
|
3
|
+
description: This guide covers upgrading a 4.3 Spree application to Spree 4.4.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **NOTE:** If you're on an older version than 4.3 please follow previous upgrade guides and perform those upgrades incrementally, eg.
|
|
7
|
+
>
|
|
8
|
+
> 1. [upgrade 4.0 to 4.1](4.0-to-4.1)
|
|
9
|
+
> 2. [upgrade 4.1 to 4.2](4.1-to-4.2)
|
|
10
|
+
> 3. [upgrade 4.2 to 4.3](4.2-to-4.3)
|
|
11
|
+
|
|
12
|
+
## Update Gems
|
|
13
|
+
|
|
14
|
+
Run the following command to update your gems to 4.4:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bundle update
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
to install the new gems.
|
|
21
|
+
|
|
22
|
+
## Remove gems merged into Spree Core
|
|
23
|
+
|
|
24
|
+
These gems were merged into Spree Core in version 4.4. All of their functionality is now included in the `spree` gem so you can remove them.
|
|
25
|
+
|
|
26
|
+
### (Optional) Remove Spree Digital
|
|
27
|
+
|
|
28
|
+
If you used that gem in the past you need to remove it. Digital products are now incorporated into Spree core and you cannot use that gem anymore.
|
|
29
|
+
|
|
30
|
+
1. Remove `spree_digital` from your `Gemfile`
|
|
31
|
+
|
|
32
|
+
### (Optional) Remove Spree Wishlist
|
|
33
|
+
|
|
34
|
+
If you used that gem in the past you need to remove it. Wishlists are now incorporated into Spree core and you cannot use that gem anymore.
|
|
35
|
+
|
|
36
|
+
1. Remove `spree_wishlist` from your `Gemfile`
|
|
37
|
+
2. (Optional) Remove `//= require spree/frontend/spree_wishlist` from `vendor/assets/javascripts/spree/frontend/all.js`
|
|
38
|
+
3. (Optional) Remove `*= require spree/frontend/spree_wishlist` from `vendor/assets/stylesheets/spree/frontend/all.css`
|
|
39
|
+
|
|
40
|
+
## Update gems
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
bundle update
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Install missing migrations
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bin/rake spree:install:migrations
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Run migrations
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
bin/rails db:migrate
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Run install generators
|
|
59
|
+
|
|
60
|
+
This will copy some files from `spree_backend` to your application.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bin/rails g spree:backend:install
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If you're using `spree_frontend` you need to run the frontend install generator as well:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bin/rails g spree:frontend:install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Additional fixes and hints
|
|
73
|
+
|
|
74
|
+
### Make sure that Node is available in your cloud environment
|
|
75
|
+
|
|
76
|
+
On Heroku, you need to add the node buildpack - [https://devcenter.heroku.com/articles/buildpacks#using-multiple-buildpacks](https://devcenter.heroku.com/articles/buildpacks#using-multiple-buildpacks)
|
|
77
|
+
|
|
78
|
+
### Add Spree ActiveJob queues to your Sidekiq config
|
|
79
|
+
|
|
80
|
+
Spree uses ActiveJob for processing long running operations to not interrupt your web server performance.
|
|
81
|
+
|
|
82
|
+
If you're using [Sidekiq](https://github.com/mperham/sidekiq) you need to update your `config/sidekiq.yml` file and 2 new queues:
|
|
83
|
+
|
|
84
|
+
* `spree_stock_location_stock_items`
|
|
85
|
+
* `spree_webhooks`
|
|
86
|
+
|
|
87
|
+
### Disabling webhooks
|
|
88
|
+
|
|
89
|
+
Spree 4.4 introduces webhook events for most of the Spree resources (Products, Orders, Customers, etc). If you wish to disable this globally you can set the environment variable:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
DISABLE_SPREE_WEBHOOKS=true
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If you would like to disable firing webhooks for certain elements of your application you can wrap these methods in a block:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
Spree::Webhooks.disable_webhooks do
|
|
99
|
+
... run your code here ...
|
|
100
|
+
end
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Webhooks do not fire on touch events. Webhooks also do not do anything until there is a first webhook subscriber created which can be done in the Admin Dashboard or via Platform API.
|
|
104
|
+
|
|
105
|
+
### Update Spree Dependencies that was renamed
|
|
106
|
+
|
|
107
|
+
Please change in your codebase:
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
Spree::Dependencies.account_update_address_service
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
to
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
Spree::Dependencies.address_update_service
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Read the release notes
|
|
120
|
+
|
|
121
|
+
For information about changes contained within this release, please read the [CHANGELOG](https://github.com/spree/spree/releases/tag/v4.4.0).
|
|
122
|
+
|
|
123
|
+
## More info
|
|
124
|
+
|
|
125
|
+
If you have any questions or suggestions feel free to [contact us via email](https://spreecommerce.org/contact) or through [Spree slack channels](http://slack.spreecommerce.org/)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 4.4 to 4.5
|
|
3
|
+
description: This guide covers upgrading a 4.4 Spree application to Spree 4.5
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **WARNING:** We recommend [upgrading straight to 4.8](4.x-to-4.8), as we improved how we handle translations in 4.8.
|
|
7
|
+
> This also means easier database migration, especially if you have a big product catalog.
|
|
8
|
+
|
|
9
|
+
> **NOTE:** If you're on an older version than 4.4 please follow previous upgrade guides and perform those upgrades incrementally, eg.
|
|
10
|
+
>
|
|
11
|
+
> 1. [upgrade 4.1 to 4.2](4.1-to-4.2)
|
|
12
|
+
> 2. [upgrade 4.2 to 4.3](4.2-to-4.3)
|
|
13
|
+
> 3. [upgrade 4.3 to 4.4](4.3-to-4.4)
|
|
14
|
+
|
|
15
|
+
## Upgrade Rails
|
|
16
|
+
|
|
17
|
+
> **WARNING:** Rails 6.0 is no longer supported - if you haven’t already, you’ll need to upgrade to **Rails 6.1 or 7.x**.
|
|
18
|
+
|
|
19
|
+
The effort to upgrade to Rails 6.1 is relatively low and brings a lot of improvements around ActiveStorage and handling of CDNs. See the Rails docs [for upgrading from 6.0 to 6.1](https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-0-to-rails-6-1), and for [upgrading from 6.1 to 7.0](https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0).
|
|
20
|
+
|
|
21
|
+
> **NOTE:** If using Rails 7, you will need to [install libvips](https://www.libvips.org/install.html) on your cloud environment, as Rails 7 uses vips as its default variant processor. You can still use imagemagick, but you’ll need to manually set it in your [Rails config](https://edgeapi.rubyonrails.org/classes/ActiveStorage/Variant.html).
|
|
22
|
+
|
|
23
|
+
### Rails 7 specific changes
|
|
24
|
+
|
|
25
|
+
#### Update Spree Config
|
|
26
|
+
|
|
27
|
+
If you're upgrading your app to Rails 7, you'll need to make a slight update to your spree config initializer. In `config/initializers/spree.rb`, wrap the `Spree.config` block in a `Rails.application.config.after_initialize` block, like so:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
Rails.application.config.after_initialize do
|
|
31
|
+
Spree.config do |config|
|
|
32
|
+
# config settings initialized here
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If you don't perform this update to the code, you may expect to get the following error:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
/lib/spree/core/preferences/store.rb:96:in `should_persist?':
|
|
41
|
+
uninitialized constant Spree::Preference (NameError)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Update other initializers
|
|
45
|
+
|
|
46
|
+
Just like with `Spree::Config`, you may need to [update other intializers in your application, that use autoloadable constants](https://rubyonrails.org/2021/9/3/autoloading-in-rails-7-get-ready).
|
|
47
|
+
|
|
48
|
+
For example, if you use `spree_auth_devise`, you'll need to update `config/initializers/devise.rb` and wrap the configuration in `Rails.application.config.after_initialize` block:
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
Rails.application.config.after_initialize do
|
|
52
|
+
if defined?(Spree::Auth)
|
|
53
|
+
Spree::Auth::Config.signout_after_password_change = false
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Update gems
|
|
59
|
+
|
|
60
|
+
Run the following command to update your gems to 4.4:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bundle update
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Legacy REST API v1 was extracted from the spree gem in 4.4. If your application depends on the Spree v1 API, you'll have to include it as a gem in your `Gemfile`:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bundle add spree_api_v1
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Install missing migrations
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bin/rake spree:install:migrations
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Run migrations
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
bin/rails db:migrate
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Run Additional Commands for Frontend
|
|
85
|
+
|
|
86
|
+
If using [Spree Frontend](https://github.com/spree/spree_rails_frontend), run the following additional commands to get everything set up correctly with the updated gems:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
bin/rails g spree:frontend:install
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Read the release notes
|
|
93
|
+
|
|
94
|
+
For information about changes contained within this release, please read the [Spree 4.5.0 Release Notes](https://github.com/spree/spree/releases/tag/v4.5.0).
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 4.5 to 4.6
|
|
3
|
+
description: This guide covers upgrading a 4.5 Spree application to Spree 4.6.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **WARNING:** We recommend [upgrading straight to 4.8](4.x-to-4.8), as we improved how we handle translations in 4.8.
|
|
7
|
+
> This also means easier database migration, especially if you have a big product catalog.
|
|
8
|
+
|
|
9
|
+
> **NOTE:** If you're on an older version than 4.5 please follow previous upgrade guides and perform those upgrades incrementally, e.g.
|
|
10
|
+
>
|
|
11
|
+
> 1. [upgrade 4.2 to 4.3](4.2-to-4.3)
|
|
12
|
+
> 2. [upgrade 4.3 to 4.4](4.3-to-4.4)
|
|
13
|
+
> 3. [upgrade 4.4 to 4.5](4.4-to-4.5)
|
|
14
|
+
|
|
15
|
+
## Update gems
|
|
16
|
+
|
|
17
|
+
Run the following command to update your gems to 4.6:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bundle update
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## (Optional) Remove spree_globalize
|
|
24
|
+
|
|
25
|
+
If your application used the spree_globalize extension, you can remove it from your Gemfile, as translations are now supported out-of-the-box with the [Mobility](https://github.com/shioyama/mobility) gem.
|
|
26
|
+
|
|
27
|
+
We've configured Mobility to use [a strategy that uses a separate table to store translations](https://dejimata.com/2017/3/3/translating-with-mobility#strategy-2), just like how spree_globalize did. This means, you won't need to make any changes to the database structure or migrate data.
|
|
28
|
+
|
|
29
|
+
During the upgrade process, you may need to review your custom queries that rely on translations, as there are minor differences in how Mobility handles them. Spree 4.6 includes a few [built-in concerns](/developer/core-concepts/translations#resource-translations-implementation) to make it easier to work with translatable models.
|
|
30
|
+
|
|
31
|
+
Run the following command to remove spree_globalize from your Gemfile:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bundle remove spree_globalize
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Install missing migrations
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
bin/rake spree:install:migrations
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Run migrations
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bin/rails db:migrate
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> **NOTE:** If you didn't use `spree_globalize` before, this will install migrations that move some columns from `spree_products`, `spree_taxons`, to dedicated translation tables such as `spree_products_translations`, `spree_taxons_translations` etc.
|
|
50
|
+
>
|
|
51
|
+
> If you're using raw SQL queries (either in the application code, or running in external tools), you may need to review the new structure and update your queries accordingly.
|
|
52
|
+
|
|
53
|
+
### Run install generators
|
|
54
|
+
|
|
55
|
+
This will copy some files from `spree_backend` to your application.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bin/rails g spree:backend:install
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If you're using `spree_frontend` you need to run the frontend install generator as well:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bin/rails g spree:frontend:install
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Additional fixes and hints
|
|
68
|
+
|
|
69
|
+
### Update migrations for translation tables with additional columns
|
|
70
|
+
|
|
71
|
+
If you want to translate more fields in [translated resources](/developer/core-concepts/translations#resource-translations), you have to alter copied migrations or add new ones.
|
|
72
|
+
We're using the [Spree::TranslationMigrations](https://github.com/spree/spree/blob/main/core/lib/spree/translation_migrations.rb) to help with migrating data.
|
|
73
|
+
|
|
74
|
+
### Add or update the behavior of the translated model
|
|
75
|
+
|
|
76
|
+
Each translated resource has a corresponding `Translation` model, see [here](https://github.com/spree/spree/blob/v4.6.5/core/app/models/spree/product.rb#L44) for reference.
|
|
77
|
+
If you want to add some more behavior to the translation, you need to do it within the `Translation.class_eval` block.
|
|
78
|
+
|
|
79
|
+
If you overwrote Spree models in your application, you have to define this block yourself. Apart from that, please include these modules:
|
|
80
|
+
- `Spree::TranslatableResource` - required for all translated models
|
|
81
|
+
- `Spree::TranslatableResourceSlug` - required for translated models with slugs/permalinks
|
|
82
|
+
|
|
83
|
+
[Read more](/developer/core-concepts/translations#resource-translations-implementation) how Spree handles resource translations.
|
|
84
|
+
|
|
85
|
+
### Generating slugs with `friendly_id`
|
|
86
|
+
|
|
87
|
+
Generating slugs/permalinks in `Spree::Product` and `Spree::Taxon` models is now based on the translated name. If you use the `history` plugin, [read on how to use it](https://github.com/shioyama/friendly_id-mobility?tab=readme-ov-file#slug-history) with the `mobility` gem.
|
|
88
|
+
|
|
89
|
+
### Resource translations and encryption
|
|
90
|
+
|
|
91
|
+
Currently, it's not possible to translate encrypted data. If you're already encrypting data that Spree translates, you need to remove that functionality.
|
|
92
|
+
|
|
93
|
+
### Full text search with pg_search scopes
|
|
94
|
+
|
|
95
|
+
If you use the [pg_search](https://github.com/Casecommons/pg_search) for the full text search in [translated resources](/developer/core-concepts/translations#resource-translations), you need to move your scopes to the translated model, eg. from the `Spree::Product` to the `Spree::Product::Translation`.
|
|
96
|
+
|
|
97
|
+
If you still want to have the original scope, you need to rewrite it, from:
|
|
98
|
+
|
|
99
|
+
```ruby
|
|
100
|
+
pg_search_scope :search_by_name, against: :name
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
to:
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
self::Translation.class_eval do
|
|
107
|
+
include PgSearch::Model
|
|
108
|
+
pg_search_scope :search_by_name, against: :name
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
scope :search_by_name, lambda { |query|
|
|
112
|
+
product_ids = Spree::Product::Translation.search_by_name(query).pluck(:spree_product_id)
|
|
113
|
+
where(id: product_ids)
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Read the release notes
|
|
118
|
+
|
|
119
|
+
For information about changes contained within this release, please read the [Spree 4.6.0 Release Notes](https://github.com/spree/spree/releases/tag/v4.6.0).
|