How Price Matrix Management and Branch Push Works
Source: price_matrices_controller.rb:43-118
- A price matrix cannot be deleted if it still has matrix items (product group entries) -- remove all items first
- A price matrix with associated customers is soft-deleted (deleted = true) rather than hard-deleted
- Adding all product groups to a matrix creates one entry per group, all with 0% percentage as a starting point
- "Groups not in matrix" query identifies which product groups are not yet in the matrix, so you can add them individually
- Pushing a matrix to branches requires being a branch owner; it creates or updates matrices at each franchise company based on branch_owner_matrix_id
- If no matching matrix exists at the branch (or the match has a blank branch_owner_matrix_id), a new matrix is created rather than updating the existing one
Support scenarios
- "Why can't I delete this price matrix?" → It still has matrix items or customers assigned to it
- "Why was a new price matrix created at the branch instead of updating?" → The branch matrix's branch_owner_matrix_id was blank or did not match, so a new one was created
- "How do I see which product groups are missing from my price matrix?" → Use the "groups not in matrix" function to identify gaps
- "Why can't I push price matrices to branches?" → Only branch owners can push matrices to franchise companies