Class: Spree::AppConfiguration

Inherits:
Preferences::Configuration show all
Defined in:
app/models/spree/app_configuration.rb

Instance Attribute Summary (collapse)

Attributes inherited from Preferences::Configuration

#preference_store

Instance Method Summary (collapse)

Methods inherited from Preferences::Configuration

#configure, preference, #reset, #set, #use_static_preferences!

Methods included from Preferences::Preferable

#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Attribute Details

- (Class) add_payment_sources_to_wallet_class

Allows providing your own class for adding payment sources to a user's “wallet” after an order moves to the complete state.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::Wallet::AddPaymentSourcesToWallet.



350
# File 'app/models/spree/app_configuration.rb', line 350

attr_writer :add_payment_sources_to_wallet_class

- (Boolean) address_requires_state

Returns should state/state_name be required

Returns:

  • (Boolean)

    should state/state_name be required



27
# File 'app/models/spree/app_configuration.rb', line 27

preference :address_requires_state, :boolean, default: true

- (String) admin_interface_logo

Returns URL of logo used in admin (default: 'logo/solidus_logo.png')

Returns:

  • (String)

    URL of logo used in admin (default: 'logo/solidus_logo.png')



31
# File 'app/models/spree/app_configuration.rb', line 31

preference :admin_interface_logo, :string, default: 'logo/solidus_logo.png'

- (Integer) admin_products_per_page

Returns Number of products to display in admin (default: 10)

Returns:

  • (Integer)

    Number of products to display in admin (default: 10)



35
# File 'app/models/spree/app_configuration.rb', line 35

preference :admin_products_per_page, :integer, default: 10

- (Integer) admin_variants_per_page

Returns Number of variants to display in admin (default: 20)

Returns:

  • (Integer)

    Number of variants to display in admin (default: 20)



39
# File 'app/models/spree/app_configuration.rb', line 39

preference :admin_variants_per_page, :integer, default: 20

- (String?) admin_vat_country_iso

Set this if you want to enter prices in the backend including value added tax.

Returns:

  • (String, nil)

    Two-letter ISO code of that Country for which prices are entered in the backend (default: nil)



129
# File 'app/models/spree/app_configuration.rb', line 129

preference :admin_vat_country_iso, :string, default: nil

- (Boolean) allow_checkout_on_gateway_error

Returns Allow checkout to complete after a failed payment (default: false)

Returns:

  • (Boolean)

    Allow checkout to complete after a failed payment (default: false)



43
# File 'app/models/spree/app_configuration.rb', line 43

preference :allow_checkout_on_gateway_error, :boolean, default: false

- (Boolean) allow_guest_checkout

Returns When false, customers must create an account to complete an order (default: true)

Returns:

  • (Boolean)

    When false, customers must create an account to complete an order (default: true)



47
# File 'app/models/spree/app_configuration.rb', line 47

preference :allow_guest_checkout, :boolean, default: true

- (Boolean) allow_return_item_amount_editing

Returns Determines whether an admin is allowed to change a return item's pre-calculated amount (default: false)

Returns:

  • (Boolean)

    Determines whether an admin is allowed to change a return item's pre-calculated amount (default: false)



51
# File 'app/models/spree/app_configuration.rb', line 51

preference :allow_return_item_amount_editing, :boolean, default: false

- (Boolean) alternative_billing_phone

Returns Request an extra phone number for bill address (default: false)

Returns:

  • (Boolean)

    Request an extra phone number for bill address (default: false)



55
# File 'app/models/spree/app_configuration.rb', line 55

preference :alternative_billing_phone, :boolean, default: false

- (Boolean) alternative_shipping_phone

Returns Request an extra phone number for shipping address (default: false)

Returns:

  • (Boolean)

    Request an extra phone number for shipping address (default: false)



59
# File 'app/models/spree/app_configuration.rb', line 59

preference :alternative_shipping_phone, :boolean, default: false

- (Boolean) always_put_site_name_in_title

Returns When true, site name is always appended to titles on the frontend (default: true)

Returns:

  • (Boolean)

    When true, site name is always appended to titles on the frontend (default: true)



63
# File 'app/models/spree/app_configuration.rb', line 63

preference :always_put_site_name_in_title, :boolean, default: true

- (Boolean) auto_capture

Note:

Setting this to true is not recommended. Performing an authorize and later capture has far superior error handing. VISA and MasterCard also require that shipments are sent within a certain time of the card being charged.

Returns Perform a sale/purchase transaction at checkout instead of a authorize and capture.

Returns:

  • (Boolean)

    Perform a sale/purchase transaction at checkout instead of a authorize and capture.



71
# File 'app/models/spree/app_configuration.rb', line 71

preference :auto_capture, :boolean, default: false

- (Boolean) auto_capture_exchanges

Returns automatically capture the credit card (as opposed to just authorize and capture later) (default: false)

Returns:

  • (Boolean)

    automatically capture the credit card (as opposed to just authorize and capture later) (default: false)



75
# File 'app/models/spree/app_configuration.rb', line 75

preference :auto_capture_exchanges, :boolean, default: false

- (Boolean) automatic_default_address

The default value of true preserves existing backwards compatible feature of treating the most recently used address in checkout as the user's default address. Setting to false means that the user should manage their own default via some custom UI that uses AddressBookController.

Returns:

  • (Boolean)

    Whether use of an address in checkout marks it as user's default



252
# File 'app/models/spree/app_configuration.rb', line 252

preference :automatic_default_address, :boolean, default: true

- (Boolean) binary_inventory_cache

Deprecated.
  • use inventory_cache_threshold instead

Only invalidate product caches when they change from in stock to out of stock. By default, caches are invalidated on any change of inventory quantity. Setting this to true should make operations on inventory faster. (default: false)

Returns:

  • (Boolean)


85
# File 'app/models/spree/app_configuration.rb', line 85

preference :binary_inventory_cache, :boolean, default: false

- (Boolean) can_restrict_stock_management

Returns Indicates if stock management can be restricted by location

Returns:

  • (Boolean)

    Indicates if stock management can be restricted by location



256
# File 'app/models/spree/app_configuration.rb', line 256

preference :can_restrict_stock_management, :boolean, default: false

- (ActionMailer::Base) carton_shipped_email_class

Allows providing your own Mailer for shipped cartons.

Returns:

  • (ActionMailer::Base)

    an object that responds to “shipped_email” (e.g. an ActionMailer with a “shipped_email” method) with the same signature as Spree::CartonMailer.shipped_email.



318
# File 'app/models/spree/app_configuration.rb', line 318

attr_writer :carton_shipped_email_class

- (String) checkout_zone

Returns Name of a Zone, which limits available countries to those included in that zone. (default: nil)

Returns:

  • (String)

    Name of a Zone, which limits available countries to those included in that zone. (default: nil)



104
# File 'app/models/spree/app_configuration.rb', line 104

preference :checkout_zone, :string, default: nil

- (Boolean) company

Returns Request company field for billing and shipping addresses. (default: false)

Returns:

  • (Boolean)

    Request company field for billing and shipping addresses. (default: false)



108
# File 'app/models/spree/app_configuration.rb', line 108

preference :company, :boolean, default: false

- (Integer) completable_order_created_cutoff

Returns the number of days to look back for updated orders which get returned to the user as last completed

Returns:

  • (Integer)

    the number of days to look back for updated orders which get returned to the user as last completed



89
# File 'app/models/spree/app_configuration.rb', line 89

preference :completable_order_created_cutoff_days, :integer, default: nil

- (Boolean) credit_to_new_allocation

Returns Creates a new allocation anytime StoreCredit#credit is called

Returns:



244
# File 'app/models/spree/app_configuration.rb', line 244

preference :credit_to_new_allocation, :boolean, default: false

- (String) currency

Currency to use by default when not defined on the site (default: “USD”)

Returns:

  • (String)

    ISO 4217 Three letter currency code



113
# File 'app/models/spree/app_configuration.rb', line 113

preference :currency, :string, default: "USD"

- (Integer) customer_returns_per_page

Returns Customer returns to show per-page in the admin (default: 15)

Returns:

  • (Integer)

    Customer returns to show per-page in the admin (default: 15)



179
# File 'app/models/spree/app_configuration.rb', line 179

preference :customer_returns_per_page, :integer, default: 15

- (Integer?) default_country_id

Deprecated.

Use the default country ISO preference instead

Returns id of Country to be selected by default in dropdowns (default: nil)

Returns:

  • (Integer, nil)

    id of Country to be selected by default in dropdowns (default: nil)



118
# File 'app/models/spree/app_configuration.rb', line 118

preference :default_country_id, :integer

- (String) default_country_iso

Default customer country ISO code

Returns:

  • (String)

    Two-letter ISO code of a Country to assumed as the country of an unidentified customer (default: “US”)



123
# File 'app/models/spree/app_configuration.rb', line 123

preference :default_country_iso, :string, default: 'US'

- (Class) default_payment_builder_class

Allows providing your own class for adding default payments to a user's order from their “wallet”.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::Wallet::DefaultPaymentBuilder.



339
# File 'app/models/spree/app_configuration.rb', line 339

attr_writer :default_payment_builder_class

- (Boolean) generate_api_key_for_all_roles

at role_user creation for all roles. (default: false)

Returns:

  • (Boolean)

    Allow generating api key automatically for user



134
# File 'app/models/spree/app_configuration.rb', line 134

preference :generate_api_key_for_all_roles, :boolean, default: false

- (Integer) inventory_cache_threshold

Only invalidate product caches when the count on hand for a stock item falls below or rises about the inventory_cache_threshold. When undefined, the product caches will be invalidated anytime the count on hand is changed.

Returns:

  • (Integer)


100
# File 'app/models/spree/app_configuration.rb', line 100

preference :inventory_cache_threshold, :integer

- (String) layout

Returns template to use for layout on the frontend (default: “spree/layouts/spree_application”)

Returns:

  • (String)

    template to use for layout on the frontend (default: “spree/layouts/spree_application”)



138
# File 'app/models/spree/app_configuration.rb', line 138

preference :layout, :string, default: 'spree/layouts/spree_application'

- (String) logo

Returns URL of logo used on frontend (default: 'logo/solidus_logo.png')

Returns:

  • (String)

    URL of logo used on frontend (default: 'logo/solidus_logo.png')



142
# File 'app/models/spree/app_configuration.rb', line 142

preference :logo, :string, default: 'logo/solidus_logo.png'

- (String) mails_from

Returns Email address used as From: field in transactional emails.

Returns:

  • (String)

    Email address used as From: field in transactional emails.



238
# File 'app/models/spree/app_configuration.rb', line 238

preference :mails_from, :string, default: 'spree@example.com'

- (Integer) max_level_in_taxons_menu

Returns maximum nesting level in taxons menu (default: 1)

Returns:

  • (Integer)

    maximum nesting level in taxons menu (default: 1)



155
# File 'app/models/spree/app_configuration.rb', line 155

preference :max_level_in_taxons_menu, :integer, default: 1

- (Boolean) order_bill_address_used

bill addresses on payment sources. (default: true)

Returns:

  • (Boolean)

    Use the order's bill address, as opposed to storing



147
# File 'app/models/spree/app_configuration.rb', line 147

preference :order_bill_address_used, :boolean, default: true

- (Integer) order_capturing_time_window

Returns the number of days to look back for fully-shipped/cancelled orders in order to charge for them

Returns:

  • (Integer)

    the number of days to look back for fully-shipped/cancelled orders in order to charge for them



151
# File 'app/models/spree/app_configuration.rb', line 151

preference :order_capturing_time_window, :integer, default: 14

- (Class) order_merger_class

Allows providing your own class for merging two orders.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::OrderMerger.



328
# File 'app/models/spree/app_configuration.rb', line 328

attr_writer :order_merger_class

- (Integer) order_mutex_max_age

Returns Max age of OrderMutex in seconds (default: 2 minutes)

Returns:

  • (Integer)

    Max age of OrderMutex in seconds (default: 2 minutes)



159
# File 'app/models/spree/app_configuration.rb', line 159

preference :order_mutex_max_age, :integer, default: 120

- (Integer) orders_per_page

Returns Orders to show per-page in the admin (default: 15)

Returns:

  • (Integer)

    Orders to show per-page in the admin (default: 15)



163
# File 'app/models/spree/app_configuration.rb', line 163

preference :orders_per_page, :integer, default: 15

- (Integer) products_per_page

Returns Products to show per-page in the frontend (default: 12)

Returns:

  • (Integer)

    Products to show per-page in the frontend (default: 12)



171
# File 'app/models/spree/app_configuration.rb', line 171

preference :products_per_page, :integer, default: 12

- (Object) promotion_chooser_class



293
294
295
# File 'app/models/spree/app_configuration.rb', line 293

def promotion_chooser_class
  @promotion_chooser_class ||= Spree::PromotionChooser
end

- (Integer) promotions_per_page

Returns Promotions to show per-page in the admin (default: 15)

Returns:

  • (Integer)

    Promotions to show per-page in the admin (default: 15)



175
# File 'app/models/spree/app_configuration.rb', line 175

preference :promotions_per_page, :integer, default: 15

- (Integer) properties_per_page

Returns Properties to show per-page in the admin (default: 15)

Returns:

  • (Integer)

    Properties to show per-page in the admin (default: 15)



167
# File 'app/models/spree/app_configuration.rb', line 167

preference :properties_per_page, :integer, default: 15

- (Boolean) require_master_price

Returns Require a price on the master variant of a product (default: true)

Returns:

  • (Boolean)

    Require a price on the master variant of a product (default: true)



183
# File 'app/models/spree/app_configuration.rb', line 183

preference :require_master_price, :boolean, default: true

- (Boolean) require_payment_to_ship

Returns Allows shipments to be ready to ship regardless of the order being paid if false (default: true)

Returns:

  • (Boolean)

    Allows shipments to be ready to ship regardless of the order being paid if false (default: true)



187
# File 'app/models/spree/app_configuration.rb', line 187

preference :require_payment_to_ship, :boolean, default: true

- (Integer) return_eligibility_number_of_days

Returns default: 365

Returns:

  • (Integer)

    default: 365



191
# File 'app/models/spree/app_configuration.rb', line 191

preference :return_eligibility_number_of_days, :integer, default: 365

- (Array) roles_for_auto_api_key

at role_user creation is desired when user has one of these roles. (default: ['admin'])

Returns:

  • (Array)

    An array of roles where generating an api key for a user



197
# File 'app/models/spree/app_configuration.rb', line 197

preference :roles_for_auto_api_key, :array, default: ['admin']

- (Object) searcher_class



260
261
262
# File 'app/models/spree/app_configuration.rb', line 260

def searcher_class
  @searcher_class ||= Spree::Core::Search::Base
end

- (Boolean) send_core_emails

Returns Whether to send transactional emails (default: true)

Returns:

  • (Boolean)

    Whether to send transactional emails (default: true)



234
# File 'app/models/spree/app_configuration.rb', line 234

preference :send_core_emails, :boolean, default: true

- (Boolean) shipping_instructions

Returns Request instructions/info for shipping (default: false)

Returns:

  • (Boolean)

    Request instructions/info for shipping (default: false)



201
# File 'app/models/spree/app_configuration.rb', line 201

preference :shipping_instructions, :boolean, default: false

- (Object) shipping_rate_selector_class



303
304
305
# File 'app/models/spree/app_configuration.rb', line 303

def shipping_rate_selector_class
  @shipping_rate_selector_class ||= Spree::Stock::ShippingRateSelector
end

- (Object) shipping_rate_sorter_class



298
299
300
# File 'app/models/spree/app_configuration.rb', line 298

def shipping_rate_sorter_class
  @shipping_rate_sorter_class ||= Spree::Stock::ShippingRateSorter
end

- (Object) shipping_rate_taxer_class



308
309
310
# File 'app/models/spree/app_configuration.rb', line 308

def shipping_rate_taxer_class
  @shipping_rate_taxer_class ||= Spree::Tax::ShippingRateTaxer
end

- (Boolean) show_only_complete_orders_by_default

Returns Only show completed orders by default in the admin (default: true)

Returns:

  • (Boolean)

    Only show completed orders by default in the admin (default: true)



205
# File 'app/models/spree/app_configuration.rb', line 205

preference :show_only_complete_orders_by_default, :boolean, default: true

- (Boolean) show_products_without_price

Returns Whether products without a price are visible in the frontend (default: false)

Returns:

  • (Boolean)

    Whether products without a price are visible in the frontend (default: false)



213
# File 'app/models/spree/app_configuration.rb', line 213

preference :show_products_without_price, :boolean, default: false

- (Boolean) show_raw_product_description

Returns Don't escape HTML of product descriptions. (default: false)

Returns:

  • (Boolean)

    Don't escape HTML of product descriptions. (default: false)



217
# File 'app/models/spree/app_configuration.rb', line 217

preference :show_raw_product_description, :boolean, default: false

- (Boolean) show_variant_full_price

Returns Displays variant full price or difference with product price. (default: false)

Returns:

  • (Boolean)

    Displays variant full price or difference with product price. (default: false)



209
# File 'app/models/spree/app_configuration.rb', line 209

preference :show_variant_full_price, :boolean, default: false

- (Class) tax_adjuster_class

Allows providing your own class for calculating taxes on an order.

This extension point is under development and may change in a future minor release.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::Tax::OrderAdjuster



363
# File 'app/models/spree/app_configuration.rb', line 363

attr_writer :tax_adjuster_class

- (Boolean) tax_using_ship_address

Returns Use the shipping address rather than the billing address to determine tax (default: true)

Returns:

  • (Boolean)

    Use the shipping address rather than the billing address to determine tax (default: true)



221
# File 'app/models/spree/app_configuration.rb', line 221

preference :tax_using_ship_address, :boolean, default: true

- (Object) track_inventory_levels

Determines whether to track on_hand values for variants / products. If you do not track inventory, or have effectively unlimited inventory for all products you can turn this on.

Returns:

  • Track on_hand values for variants / products. (default: true)



228
# File 'app/models/spree/app_configuration.rb', line 228

preference :track_inventory_levels, :boolean, default: true

- (Class) variant_price_selector_class

Allows implementing custom pricing for variants

Returns:

  • (Class)

    an object that conforms to the API of the standard variant price selector class Spree::Variant::PriceSelector.

See Also:



269
# File 'app/models/spree/app_configuration.rb', line 269

attr_writer :variant_price_selector_class

- (Object) variant_search_class



287
288
289
# File 'app/models/spree/app_configuration.rb', line 287

def variant_search_class
  @variant_search_class ||= Spree::Core::Search::Variant
end

Instance Method Details

- (Spree::Tax::TaxLocation) admin_vat_location

Default admin VAT location

An object that responds to :state_id and :country_id so it can double as a Spree::Address in Spree::Zone.for_address. Takes the `admin_vat_country_iso` as input.

Returns:

See Also:

  • The admin VAT country


383
384
385
386
387
# File 'app/models/spree/app_configuration.rb', line 383

def admin_vat_location
  @default_tax_location ||= Spree::Tax::TaxLocation.new(
    country: Spree::Country.find_by(iso: admin_vat_country_iso)
  )
end

- (variant_price_selector_class) default_pricing_options

Shortcut for the default pricing options

Returns:

  • (variant_price_selector_class)

    An instance of the pricing options class with default desired attributes



282
283
284
# File 'app/models/spree/app_configuration.rb', line 282

def default_pricing_options
  pricing_options_class.new
end

- (Class) pricing_options_class

Shortcut for getting the variant price selector's pricing options class

Returns:

  • (Class)

    The pricing options class to be used



277
# File 'app/models/spree/app_configuration.rb', line 277

delegate :pricing_options_class, to: :variant_price_selector_class

- (Object) static_model_preferences



368
369
370
# File 'app/models/spree/app_configuration.rb', line 368

def static_model_preferences
  @static_model_preferences ||= Spree::Preferences::StaticModelPreferences.new
end

- (Object) stock



372
373
374
# File 'app/models/spree/app_configuration.rb', line 372

def stock
  @stock_configuration ||= Spree::Core::StockConfiguration.new
end