本文整理匯總了PHP中XLite\Model\AEntity::getItemId方法的典型用法代碼示例。如果您正苦於以下問題:PHP AEntity::getItemId方法的具體用法?PHP AEntity::getItemId怎麽用?PHP AEntity::getItemId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XLite\Model\AEntity
的用法示例。
在下文中一共展示了AEntity::getItemId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validateOrderItem
/**
* Validate order item
*
* @param \XLite\Model\AEntity $entity Entity
* @param boolean $isUpdate True if entity is updated; false if created
*
* @return boolean
*/
protected function validateOrderItem(\XLite\Model\AEntity $entity, $isUpdate = false)
{
$result = true;
if ($isUpdate && !$this->getChangedFields($entity->getItemId())) {
// Ignore order item validation if item was updated but was not changed
} elseif (!$entity->isActualAttributes()) {
$data = $this->getRequestData();
if (isset($data['order_items'][$entity->getItemId()]['attribute_values'])) {
$message = static::t('Order item attributes are out-of-date and cannot be edited');
}
} elseif (!$this->isValidEntity($entity)) {
$result = false;
$message = static::t('Product with selected properties cannot be purchased');
} elseif (!$isUpdate && $entity->hasWrongAmount()) {
$result = false;
$message = static::t('The specified amount of product exceeds maximum amount of product in stock', array('value' => $entity->getAmount(), 'max' => $entity->getProductAvailableAmount()));
} elseif ($isUpdate && $entity->isItemHasWrongAmount($entity)) {
$result = false;
$message = static::t('The specified amount of product exceeds maximum amount of product in stock', array('value' => $entity->getAmount(), 'max' => $entity->getProductAvailableAmount() + $this->orderItemsData[$entity->getItemId()]['amount']));
}
if (!$result) {
$this->errorMessages[] = sprintf('[%s] %s: %s', static::t('Error'), $message, $this->formatItem($entity));
} elseif (!empty($message)) {
$this->warningMessages[] = sprintf('[%s] %s: %s', static::t('Warning'), $message, $this->formatItem($entity));
}
return $result;
}