Skip to content

Commit

Permalink
Adds public method get_items_weight()
Browse files Browse the repository at this point in the history
  • Loading branch information
damanic committed Feb 15, 2023
1 parent 6e111ff commit 926e7b9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions helpers/shop_packedbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ public function get_weight($unit='native'){

public function get_calculated_weight(){
$weight = $this->box->empty_weight ? $this->box->empty_weight : 0;
$weight += $this->get_item_weight();
return $weight;
}

protected function get_item_weight(){
$weight = 0;
foreach ($this->items as $item){
$weight += $item->total_weight();
}
$weight += $this->get_items_weight();
return $weight;
}

Expand All @@ -70,6 +62,14 @@ public function get_items_count(){
return $count;
}

public function get_items_weight(){
$weight = 0;
foreach ($this->items as $item){
$weight += $item->total_weight();
}
return $weight;
}

public function get_box(){
return $this->box;
}
Expand Down

0 comments on commit 926e7b9

Please sign in to comment.