Spree Price
Heavily inspired by spree-contrib/spree_price_book.
-
Support multiple store price
-
Support multiple type of prices (e.g. sales price, marked price, manufacturer's suggested retail price
-
Support price book. Price book can be prioritized at store.
-
Auto adjust prices according to exchange rate.
-
Price is found by the following order.
- Manual set price
- Price book with higher priority in the same store
- First price matching the currency and price type
- First price matching the currency TODO: Find the price from parent price type without sacrificing the performance too much
-
The price will not be populated from parent price type by default. You can either fill nil prices from parent price book with adjustment factor or refresh all prices from parent price book in admin panel.
-
Line item and order will save all prices for each price type.
Usage
Create your own price book for each currency, price type, store, user roles
You can update the prices in price book from parent price book, either filling nil prices from parent price book with adjustment factor or refreshing all prices in price book.
Update the price from product page with store, price type and role filter. If the price is not set manually, it will show you the reference price.
Installation
Add spree_price_books to your Gemfile:
gem 'spree_price', github: 'EONIQ/spree_price'
Bundle your dependencies and run the installation generator:
bundle
bundle exec rails g spree_price:install
Configuration
Once installed you can seed default currency exchange rates via open exchange rate
Get your app id from https://openexchangerates.org/signup
Add open_exchange_rate.rb to config/initializers
Rails.application.config.openExchangeRate = {
appId: 'YOUR APP ID HERE',
}
bundle exec rake spree_price:currency_rates
Testing
TODO: Need to work on rspec
First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.
On the first run you may need to create the Postgresql role (ex. createuser -d postgres)
bundle
bundle exec rake
When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:
require 'spree_price/factories'
Credit
spree/spree spree-contrib/spree_price_book
Copyright (c) 2018 EONIQ (HK) LIMITED, released under the New BSD License