Add formula-based product pricing (P/W/MG) for Parsian-style unit prices.

Port FormulaPriceService from colleague app so admins can compute a single unit price from reference mid, weight, and wage instead of offset coefficients.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-10 16:47:29 +03:30
co-authored by Cursor
parent 71a48c9c08
commit f421fcb83f
9 changed files with 515 additions and 9 deletions
+6
View File
@@ -773,8 +773,14 @@ class Controller extends BaseController
'direct_price' => is_object($product) ? ($product->direct_price ?? null) : null,
'group_type' => is_object($product) ? ($product->group_type ?? null) : null,
'reading_method' => is_object($product) ? ($product->reading_method ?? null) : null,
'price_formula_enabled' => is_object($product) ? ($product->price_formula_enabled ?? null) : null,
];
// قیمت فرمولی = قیمت واحد هر عدد (وزن داخل فرمول است)
if (! empty($payload['price_formula_enabled'])) {
return 1.0;
}
if (! empty($payload['reading_method'])) {
return 1.0;
}