當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AEntity::isActualAttributes方法代碼示例

本文整理匯總了PHP中XLite\Model\AEntity::isActualAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP AEntity::isActualAttributes方法的具體用法?PHP AEntity::isActualAttributes怎麽用?PHP AEntity::isActualAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XLite\Model\AEntity的用法示例。


在下文中一共展示了AEntity::isActualAttributes方法的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::isActualAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。