Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit 1a8b9f9

Browse files
damianlegawiecgitbook-bot
authored andcommitted
GitBook: [master] one page modified
1 parent d22de10 commit 1a8b9f9

File tree

1 file changed

+9
-43
lines changed

1 file changed

+9
-43
lines changed

internals/preferences.md

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ section: internals
55

66
# Preferences
77

8+
{% hint style="warning" %}
9+
We do not advise to use Preferences anymore, we're working on a path forward limitting Preferences in Spree codebase
10+
{% endhint %}
11+
812
## Overview
913

10-
Spree Preferences support general application configuration and preferences per model instance. Spree comes with preferences for your store like `logo` and `currency`. Additional preferences can be added by your application or included extensions.
14+
Spree Preferences support general application configuration and preferences per model instance. Spree comes with preferences for your application like `track_inventory_levels`. Additional preferences can be added by your application or included extensions.
1115

1216
To implement preferences for a model, simply add a new column called `preferences`. This is an example migration for the `spree_products` table:
1317

@@ -37,7 +41,7 @@ Both use cases are handled by Spree Preferences. They are easy to define, provid
3741

3842
## General Settings
3943

40-
Spree comes with many application-wide preferences. They are defined in `core/app/models/spree/app_configuration.rb` and made available to your code through `Spree::Config`, e.g., `Spree::Config.logo`.
44+
Spree comes with many application-wide preferences. They are defined in `core/app/models/spree/app_configuration.rb` and made available to your code through `Spree::Config`, e.g., `Spree::Config.track_inventory_levels`.
4145

4246
A limited set of the general settings are available in the admin interface of your store \(`/admin/general_settings`\).
4347

@@ -205,8 +209,6 @@ The `Spree::Config` constant returns an instance of `Spree::AppConfiguration` wh
205209
You can access these preferences directly in code. To see this in action, just fire up `rails console` and try the following:
206210

207211
```ruby
208-
>> Spree::Config.admin_interface_logo
209-
=> "logo/spree_50.png"
210212
>> Spree::Config.admin_products_per_page
211213
=> 10
212214
```
@@ -243,18 +245,17 @@ During the Spree installation process, an initializer file is created within you
243245
```ruby
244246
Spree.config do |config|
245247
# Example:
246-
# Uncomment to override the default logo location.
247-
# config.logo = 'logo/my_store.png'
248+
# Uncomment to stop tracking inventory levels in the application
249+
# config.track_inventory_levels = false
248250
end
249251
```
250252

251253
The `Spree.config` block acts as a shortcut to setting `Spree::Config` multiple times. If you have multiple default preferences you would like to override within your code you may override them here. Using the initializer for setting the defaults is a nice shortcut, and helps keep your preferences organized in a standard location.
252254

253-
For example if you would like to change the logo location and if you want to tax using the shipping address you can accomplish this by doing the following:
255+
For example, if you would like to tax using the shipping address you can accomplish this by doing the following:
254256

255257
```ruby
256258
Spree.config do |config|
257-
config.logo = 'logo/my_store.png'
258259
config.tax_using_ship_address = true
259260
end
260261
```
@@ -313,10 +314,6 @@ This section lists all of the configuration options for the current version of S
313314

314315
Will determine if the state field should appear on the checkout page. Defaults to `true`.
315316

316-
`admin_interface_logo`
317-
318-
The path to the logo to display on the admin interface. Can be different from `Spree::Config[:logo]`. Defaults to `logo/spree_50.png`.
319-
320317
`admin_products_per_page`
321318

322319
How many products to display on the products listing in the admin interface. Defaults to 30.
@@ -329,43 +326,12 @@ Continues the checkout process even if the payment gateway error failed. Default
329326

330327
Determines if an alternative phone number should be present for the shipping address on the checkout page. Defaults to `false`.
331328

332-
`always_put_site_name_in_title`
333-
334-
Determines if the site name \(`current_store.site_name`\) should be placed into the title. Defaults to `true`.
335-
336-
`attachment_default_url`
337-
338-
Tells `Paperclip` the form of the URL to use for attachments which are missing.
339-
340-
`attachment_path`
341-
342-
Tells `Paperclip` the path at which to store images.
343-
344-
`attachment_styles`
345-
346329
A JSON hash of different styles that are supported by attachments. Defaults to:
347330

348-
```javascript
349-
{
350-
"mini":"48x48>",
351-
"small":"100x100>",
352-
"product":"240x240>",
353-
"large":"600x600>"
354-
}
355-
```
356-
357-
`attachment_default_style`
358-
359-
A key from the list of styles from `Spree::Config[:attachment_styles]` that is the default style for images. Defaults to the the `product` style.
360-
361331
`auto_capture`
362332

363333
Depending on whether or not Spree is configured to "auto capture" the credit card, either a purchase or an authorize operation will be performed on the card \(via the current credit card gateway\). Defaults to `false`.
364334

365-
`checkout_zone`
366-
367-
Limits the checkout to countries from a specific zone, by name. Defaults to `nil`.
368-
369335
`company`
370336

371337
Determines whether or not a field for "Company" displays on the checkout pages for shipping and billing addresses. Defaults to `false`.

0 commit comments

Comments
 (0)