Add automated compute
This commit is contained in:
parent
300c91fd7f
commit
b7af046147
@ -640,6 +640,20 @@ class Product extends CommonObject
|
|||||||
$this->width_units = trim($this->width_units);
|
$this->width_units = trim($this->width_units);
|
||||||
$this->height = price2num($this->height);
|
$this->height = price2num($this->height);
|
||||||
$this->height_units = trim($this->height_units);
|
$this->height_units = trim($this->height_units);
|
||||||
|
// Automated compute surface and volume if not filled
|
||||||
|
if (empty($this->surface) && !empty($this->length) && !empty($this->width)
|
||||||
|
&& $this->length_units == $this->with_units
|
||||||
|
) {
|
||||||
|
$this->surface = $this->length * $this->width;
|
||||||
|
$this->surface_units = $this->width_units;
|
||||||
|
if (empty($this->volume) && !empty($this->height)
|
||||||
|
&& $this->length_units == $this->height_units
|
||||||
|
) {
|
||||||
|
$this->volume = $this->surface * $this->height;
|
||||||
|
$this->volume_units = $this->height_units;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->surface = price2num($this->surface);
|
$this->surface = price2num($this->surface);
|
||||||
$this->surface_units = trim($this->surface_units);
|
$this->surface_units = trim($this->surface_units);
|
||||||
$this->volume = price2num($this->volume);
|
$this->volume = price2num($this->volume);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user