本文整理汇总了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;
}