Add custom-only department pricing enforcement
This commit is contained in:
@@ -22,6 +22,7 @@ class departments_o extends db
|
||||
public object_property $dimension; // The dimension of the department
|
||||
public object_property $visible; // The visibility of the department
|
||||
public object_property $archived; // Whether the department is archived
|
||||
public object_property $custom_pricing_only; // Whether missing department prices must not fall back to defaults
|
||||
public object_property $branding; // The branding of the department
|
||||
public object_property $longitude; // The longitude of the department (Can be null)
|
||||
public object_property $latitude; // The latitude of the department (Can be null)
|
||||
@@ -107,6 +108,7 @@ class departments_o extends db
|
||||
$this->branding = new object_property($this->table, $this->id, 'branding', 'int', false);
|
||||
$this->visible = new object_property($this->table, $this->id, 'visible', 'int', false);
|
||||
$this->archived = new object_property($this->table, $this->id, 'archived', 'boolean', false);
|
||||
$this->custom_pricing_only = new object_property($this->table, $this->id, 'custom_pricing_only', 'boolean', false);
|
||||
$this->longitude = new object_property($this->table, $this->id, 'longitude', 'float', false);
|
||||
$this->latitude = new object_property($this->table, $this->id, 'latitude', 'float', false);
|
||||
$this->order_priority = new object_property($this->table, $this->id, 'order_priority', 'int', false);
|
||||
@@ -185,6 +187,12 @@ class departments_o extends db
|
||||
return $department;
|
||||
}
|
||||
|
||||
public function isCustomPricingOnly(int $department_id): bool
|
||||
{
|
||||
$department = $this->getDepartmentById($department_id);
|
||||
return (bool)(int)($department['custom_pricing_only'] ?? 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price of a product in a department
|
||||
* @param int $department_id
|
||||
|
||||
Reference in New Issue
Block a user