Feature #1123

Add Products Admin

Added by Pavan Rikhi over 2 years ago. Updated 28 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Pavan Rikhi% Done:


Category:AdminSpent time:-
Target version:v0.9.0 - Admin
Easy Pickings:


Add, List, & Edit Products

Adding a product should show all product/attribute/variant fields in a single form, along with a "multiple variants" button, that splits out the product/attribute fields followed by multiple variant forms.

Same for editing a single variant product.

Do not allow deleting products or variants. Instead, add an "inactive" field that prevents them from being returned by the search/details/category routes.

Require that a Product has at least one variant.

Sanitize the descriptions and names!

Associated revisions

Revision 49e251ed
Added by Pavan Rikhi about 1 month ago

[#1123] Add Admin API Route for Products List

Add a new Routes.Admin.Products module containing a productListRoute
that returns data about all products for the list/table view on the
admin site.

Refs #1123

Revision e9aba7dd
Added by Pavan Rikhi about 1 month ago

[#1123] Add Products List Page to the Admin Site

Add a new ProductList route that fetches & renders a table of all the
available Products. A toggle allows filtering out inactive products and
a search input allows querying the Name, SKU, ID, & Categories.

Refs #1123

Revision 51003ed2
Added by Pavan Rikhi about 1 month ago

[#1123] Add Admin API Routes for Creating Products

Add a newProductDataRoute for fetching the data needed to present the
New Product form as well as a newProductRoute for posting data to create
a new Product. Validation is done to ensure the slug & SKUs are unique
and that the specified Category exists.

Refs #1123

Revision 264a2d3b
Added by Pavan Rikhi about 1 month ago

[#1123] Add New Product Form to Admin Site

Add a ProductNew admin route responsible for rendering, updating,
validating, & submitting a form for creating new Products.

Refs #1123

Revision 4f1fc831
Added by Pavan Rikhi 29 days ago

[#1123] Refactor New Product Form

Extract the form specific parts of the New Product Page into a separate
set of Model, Msg, Update, & View types/functions. This will enable
re-use between the Add & Edit Product views.

Fix a bug where SeedAttributes would not be set if all attributes were

Refs #1123

Revision 4f24e27f
Added by Pavan Rikhi 28 days ago

[#1123] Add API Routes for Editing Products

Add an editProductDataRoute for fetching the data necessary to show the
Edit Product Form, as well as an editProductRoute for posting the
updated data for a product.

Add ToJSON instances for the NewVariantData & NewSeedData types.

Add an option ProductVariantId field to the NewVariantData type for
updating existing variants of a product.

Extract the duplicate skuSuffix checking function from the
NewProductParameters's Validation instance into a separate function so
it can be re-used in Validation for the EditProductParameters type.

Refs #1123

Revision e37889de
Added by Pavan Rikhi 28 days ago

[#1123] Add Edit Product Page to the Admin Site

Add a new ProductEdit AdminRoute responsible for fetching a Product's
data, rendering & updating a Form, and posting the new data to the API

This admin page behaves differently than previous ones. On the other
pages, the Edit Form keeps track of the fields that have changed with
respect to the original data that was fetched when the page was loaded &
only submits the updated fields. To quicken development, we instead use
the product data as the basis for the form & submit all the product data
to the server instead of only the changed fields. This means the product
data gets stored in the ProductAdmin's EditForm model instead of the
PageData type on the global model, so some tweaking is required in the
Main module's fetchDataForRoute function so that the
model.editProductForm gets updated instead of the model.pageData field.

Add links to the edit page to the Admin's Products List page/table.
Redirect users to the product's edit page after they successfully create
a new product.

Modify the ProductAdmin.formView function so that the submit button's
text is passed in as an argument. Show an existing image in the form if
one is specified.

Closes #1123


#1 Updated by Pavan Rikhi 11 months ago

  • Description updated (diff)

#2 Updated by Pavan Rikhi 5 months ago

When de-activating Products, make sure to remove them from Carts.

#3 Updated by Pavan Rikhi 4 months ago

  • Description updated (diff)

#4 Updated by Pavan Rikhi 28 days ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

Also available in: Atom PDF