-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cms): add products collection to CMS
- Loading branch information
Showing
3 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import { CollectionConfig } from "payload/types"; | ||
|
||
/** Products collection stores merch products offerings. */ | ||
export const Products: CollectionConfig = { | ||
slug: "products", | ||
admin: { | ||
description: "Merchandise products offerings", | ||
}, | ||
fields: [ | ||
// by default, payload generates an 'id' field each order automatically | ||
{ | ||
name: "name", | ||
type: "text", | ||
required: true, | ||
}, | ||
{ | ||
name: "colors", | ||
type: "select", | ||
hasMany: true, | ||
options: [ | ||
{ | ||
label: "Black", | ||
value: "black", | ||
}, | ||
{ | ||
label: "White", | ||
value: "white", | ||
}, | ||
{ | ||
label: "Blue", | ||
value: "blue", | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "sizes", | ||
type: "select", | ||
hasMany: true, | ||
options: [ | ||
{ | ||
label: "Small", | ||
value: "s", | ||
}, | ||
{ | ||
label: "Medium", | ||
value: "m", | ||
}, | ||
{ | ||
label: "Large", | ||
value: "l", | ||
}, | ||
{ | ||
label: "Extra Large", | ||
value: "xl", | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "images", | ||
type: "array", | ||
fields: [ | ||
{ | ||
name: "url", | ||
type: "text", | ||
required: true, | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "is_available", | ||
label: "Is Available", | ||
type: "checkbox", | ||
}, | ||
{ | ||
name: "price", | ||
type: "number", | ||
required: true, | ||
admin: { | ||
step: 0.01, | ||
}, | ||
min: 0, | ||
}, | ||
{ | ||
name: "category", | ||
type: "select", | ||
required: true, | ||
options: [ | ||
{ | ||
label: "Shirt", | ||
value: "shirt", | ||
}, | ||
{ | ||
label: "Hat", | ||
value: "hat", | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "size_chart", | ||
type: "text", | ||
}, | ||
{ | ||
name: "stock", | ||
type: "array", | ||
fields: [ | ||
{ | ||
name: "color", | ||
type: "select", | ||
options: ["black", "white", "blue"], | ||
required: true, | ||
}, | ||
{ | ||
name: "quantity", | ||
type: "number", | ||
admin: { | ||
step: 1, | ||
}, | ||
required: true, | ||
min: 0, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
export default Products; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters