Price lists (Vendor)
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
Executive summary
Section titled “Executive summary”Vendor price lists hold retail and wholesale unit prices per catalog SKU on a list. Each list has an type audience: 0 = retail and wholesale, 1 = retail only, 2 = wholesale only (replaces legacy code). POS and wholesale create-order pick lists filtered by sale_channel. Lines are stored in price_list_items with a variant_key so multiple JSON-defined variants (no item_variation_id) do not overwrite each other.
The vendor UI loads lines via GET /vendor/price-lists/:id/items and saves only changed rows with PATCH /vendor/price-lists/:id/items. List headers omit embedded items unless ?include_items=true.
Routes (vendor-web)
Section titled “Routes (vendor-web)”| Route | Screen |
|---|---|
/dashboard/products/price-lists | Price list index |
/dashboard/products/price-lists/:id | List detail + items panel |
Module product (write for create/edit/items).
API (backend)
Section titled “API (backend)”Base path: /vendor/price-lists (JWT + VendorModuleGuard).
| Method | Path | Purpose |
|---|---|---|
GET | /:id | List header + scopes. Items omitted unless ?include_items=true. |
GET | /:id/items | Paginated lines (page, limit, search on product name). |
PATCH | /:id/items | Partial upsert: body { items: [...] } — only sent rows are written. |
POST | /:id/items | Legacy bulk upsert (avoid for single-product edits). |
DELETE | /:id/items | Remove one line or all lines for a product (all_variants). |
Line identity
Section titled “Line identity”Each row is unique on:
(price_list_id, item_id, item_variation_id, variant_key)
item_variation_id: catalog variation row when present.variant_key: required whenitem_variation_idis null (e.g. label from product JSON variants like42@Large). Send on PATCH and DELETE (?variant_key=...).
Partial save (recommended)
Section titled “Partial save (recommended)”- Load lines:
GET .../items?limit=5000(or paginate). - Edit one product in the UI →
PATCH .../itemswith only that product’s lines, each includingvariant_keywhen variation id is null. - Remove a line →
DELETE .../items?item_id=&item_variation_id=or?item_id=&variant_key=for JSON variants.
Database migration
Section titled “Database migration”Migration PriceListItemVariantKey1783531000000 adds variant_key, backfills duplicate legacy groups with legacy-{id}, and replaces unique index UQ_price_list_items_line with UQ_price_list_items_line_v2.
Run backend migrations on each environment before deploying API/UI that depend on variant_key.
Related guides
Section titled “Related guides”- Catalog and products — products, variations, and price history tabs.
- POS — resolves cart prices from active lists.