Add Product/Category Sales
|Assignee:||Pavan Rikhi||% Done:|
|Target version:||v0.6.0 - Checkout|
Need to investigate what functionality zencart provides & what we actually use.
Migrate previous sales.
- Sale Name
- Deduction: Amount & Type (% or Flat)
- Start Date
- End Date
- Sale Price
- Start Date
- End Date
Add 2 tables: product sales & category sales
Show crossed out normal price & sale price(in red?) for product sales.
When getting product/cart/checkout info, check each product to see if there is an ongoing sale & calculate the current price.
Add tests for sale calculations.
Maybe ignore importing sales(or at least product sales). I think there's ongoing category sales we don't actually want.
Use variation IDs for product sales.
[#1398] Add Database Models for Sales
Add CategorySale & ProductSale database models for storing data about
sales. These include the items they apply to, along with a date range in
which they are active. Product sales simply change the price of a
variant, while Category sales can be either a percentage or flat
Modify the DataMigration script so that old sales are imported from the
[#1398] Apply Sales to Variant Data Returned By Server
Modify the Product, Category, Cart/Checkout routes so instead of
directly returning a ProductVariant from the database, they transform
the ProductVariant into a VariantData value, which contains an extra
field for a potential Sale Price for the variant.
Add functions to the CommonData module for querying the database for
sales and apply any applicable Product & Category sales to the variants.
[#1398] Add Tests for Category & Product Sales
Add tests to the server for verifying the calculations for both Category
& Product sales. This requires adding a Show instance for the
ProductVariant database model, pulling the DB->API transformation
out into it's own function(makeVariantData), adding new Generator
functions, & exposing the functions in the CommonData module that are
Modify the ProductVariant to VariantData transformation so that no sale
price is set if the PercentSale's price is greater than or equal to the
price of the ProductVariant.
[#1398] Show Sale Prices for Products
Add the salePrice field to the ProductVariant type & add a variantPrice
function that returns the salePrice and falls back to the normal price
when the Variant is not on sale.
Show sale prices in red, below a crossed-out regular price, on the
Category & Product pages. Simply replace the normal price with the sale
price on the Cart, Checkout, & Order Details pages.