Feature #1398

Add Product/Category Sales

Added by Pavan Rikhi 12 months ago. Updated 4 months ago.

Status:ClosedStart date:07/23/2019
Priority:NormalDue date:07/27/2019
Assignee:Pavan Rikhi% Done:


Category:CheckoutSpent time:-
Target version:v0.6.0 - Checkout
Easy Pickings:


Need to investigate what functionality zencart provides & what we actually use.

Migrate previous sales.

ZenCart SaleMaker

  • Sale Name
  • Deduction: Amount & Type (% or Flat)
  • Start Date
  • End Date
  • Categories

ZenCart Specials

  • Sale Price
  • Start Date
  • End Date
  • Product

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.

Associated revisions

Revision 9de7cec2
Added by Pavan Rikhi 5 months ago

[#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
ZenCart database.

Refs #1398

Revision 3a243e11
Added by Pavan Rikhi 4 months ago

[#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.

Refs #1398

Revision 95defa81
Added by Pavan Rikhi 4 months ago

[#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
being tested.

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.

Refs #1398

Revision 97854711
Added by Pavan Rikhi 4 months ago

[#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.

Closes #1398


#1 Updated by Pavan Rikhi 5 months ago

  • Start date set to 07/23/2019
  • Status changed from New to In Progress
  • Description updated (diff)

#2 Updated by Pavan Rikhi 4 months ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#3 Updated by Pavan Rikhi 4 months ago

  • Due date set to 07/27/2019

Also available in: Atom PDF