public function Order::getProductCount in Ubercart 8.4
Returns the number of products in an order.
Return value
int The number of products.
Overrides OrderInterface::getProductCount
1 call to Order::getProductCount()
- Order::preSave in uc_order/
src/ Entity/ Order.php - Acts on an entity before the presave hook is invoked.
File
- uc_order/
src/ Entity/ Order.php, line 394
Class
- Order
- Defines the order entity class.
Namespace
Drupal\uc_order\EntityCode
public function getProductCount() {
$count = 0;
foreach ($this->products as $product) {
$count += $product->qty->value;
}
return $count;
}