当前位置: 首页>>代码示例>>PHP>>正文


PHP AEntity::getItemId方法代码示例

本文整理汇总了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;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:35,代码来源:OrderItem.php


注:本文中的XLite\Model\AEntity::getItemId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。