本文整理汇总了PHP中Includes\Utils\ArrayManager::sumObjectsArrayFieldValues方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayManager::sumObjectsArrayFieldValues方法的具体用法?PHP ArrayManager::sumObjectsArrayFieldValues怎么用?PHP ArrayManager::sumObjectsArrayFieldValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\ArrayManager
的用法示例。
在下文中一共展示了ArrayManager::sumObjectsArrayFieldValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMinQuantity
/**
* Return minimum quantity
*
* @return integer
*/
protected function getMinQuantity()
{
$minQuantity = $this->getProduct()->getMinQuantity($this->getCart()->getProfile() ? $this->getCart()->getProfile()->getMembership() : null);
$result = parent::getMinQuantity();
$minimumQuantity = $minQuantity ? $minQuantity : $result;
if (!$this->isCartPage()) {
$items = \XLite\Model\Cart::getInstance()->getItemsByProductId($this->getProduct()->getProductId());
$quantityInCart = $items ? \Includes\Utils\ArrayManager::sumObjectsArrayFieldValues($items, 'getAmount', true) : 0;
$result = $minimumQuantity > $quantityInCart ? $minimumQuantity - $quantityInCart : $result;
} else {
$result = $minimumQuantity;
}
return $result;
}
示例2: getLockedAmount
/**
* Return "locked" amount: items already added to the cart
*
* @return integer
*/
public function getLockedAmount()
{
return \Includes\Utils\ArrayManager::sumObjectsArrayFieldValues($this->getLockedItems(), 'getAmount', true);
}
示例3: checkDiskFreeSpace
/**
* Check if there is enough disk free space.
* Return message on error
*
* @return string
*/
protected function checkDiskFreeSpace()
{
$message = null;
$totalSize = \Includes\Utils\ArrayManager::sumObjectsArrayFieldValues($this->getEntries(), 'getPackSize');
$freeSpaceRaw = \Includes\Utils\FileManager::getDiskFreeSpace(LC_DIR_TMP);
$freeSpace = null !== $freeSpaceRaw ? max(0, $freeSpaceRaw - self::FREE_SPACE_RESERVE) : null;
if (null !== $freeSpace && $totalSize > $freeSpace) {
$message = \XLite\Core\Translation::getInstance()->translate('Not enough disk space. Required: {{req}} (+{{reserve}} reserve). Available: {{avail}}', array('req' => \XLite\Core\Converter::formatFileSize($totalSize), 'reserve' => \XLite\Core\Converter::formatFileSize(self::FREE_SPACE_RESERVE), 'avail' => \XLite\Core\Converter::formatFileSize($freeSpace)));
}
return $message;
}