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


PHP Option::getTitle方法代碼示例

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


在下文中一共展示了Option::getTitle方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateOptionRequiredFields

 /**
  * Validate option required fields
  *
  * @param Option $option
  * @return bool
  */
 protected function validateOptionRequiredFields(Option $option)
 {
     $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
     $product = $option->getProduct();
     if ($product) {
         $storeId = $product->getStoreId();
     }
     $title = $option->getTitle();
     return $this->isValidOptionTitle($title, $storeId) && !$this->isEmpty($option->getType());
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:16,代碼來源:DefaultValidator.php

示例2: _getPriceConfiguration

 /**
  * Get price configuration
  *
  * @param \Magento\Catalog\Model\Product\Option\Value|\Magento\Catalog\Model\Product\Option $option
  * @return array
  */
 protected function _getPriceConfiguration($option)
 {
     $optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false);
     $data = ['prices' => ['oldPrice' => ['amount' => $this->pricingHelper->currency($option->getRegularPrice(), false, false), 'adjustments' => []], 'basePrice' => ['amount' => $this->_catalogData->getTaxPrice($option->getProduct(), $optionPrice, false, null, null, null, null, null, false)], 'finalPrice' => ['amount' => $this->_catalogData->getTaxPrice($option->getProduct(), $optionPrice, true, null, null, null, null, null, false)]], 'type' => $option->getPriceType(), 'name' => $option->getTitle()];
     return $data;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:Options.php

示例3: buildImageValidator

 /**
  * @param \Zend_File_Transfer_Adapter_Http|\Zend_Validate $object
  * @param \Magento\Catalog\Model\Product\Option $option
  * @param array $fileFullPath
  * @return \Zend_File_Transfer_Adapter_Http|\Zend_Validate $object
  * @throws \Magento\Framework\Exception\InputException
  */
 protected function buildImageValidator($object, $option, $fileFullPath = null)
 {
     $dimensions = [];
     if ($option->getImageSizeX() > 0) {
         $dimensions['maxwidth'] = $option->getImageSizeX();
     }
     if ($option->getImageSizeY() > 0) {
         $dimensions['maxheight'] = $option->getImageSizeY();
     }
     if (count($dimensions) > 0) {
         if ($fileFullPath !== null && !$this->isImage($fileFullPath)) {
             throw new \Magento\Framework\Exception\InputException(__('File \'%1\' is not an image.', $option->getTitle()));
         }
         $object->addValidator(new \Zend_Validate_File_ImageSize($dimensions));
     }
     // File extension
     $allowed = $this->parseExtensionsString($option->getFileExtension());
     if ($allowed !== null) {
         $object->addValidator(new \Zend_Validate_File_Extension($allowed));
     } else {
         $forbidden = $this->parseExtensionsString($this->getConfigData('forbidden_extensions'));
         if ($forbidden !== null) {
             $object->addValidator(new \Zend_Validate_File_ExcludeExtension($forbidden));
         }
     }
     $object->addValidator(new \Zend_Validate_File_FilesSize(['max' => $this->fileSize->getMaxFileSize()]));
     return $object;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:35,代碼來源:Validator.php

示例4: validateOptionRequiredFields

 /**
  * Validate option required fields
  *
  * @param Option $option
  * @return bool
  */
 protected function validateOptionRequiredFields(Option $option)
 {
     return !$this->isEmpty($option->getTitle()) && !$this->isEmpty($option->getType());
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:10,代碼來源:DefaultValidator.php

示例5: _createOptionDataObject

 /**
  * Create option data object
  *
  * @param \Magento\Catalog\Model\Product\Option $option
  * @return \Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option array
  */
 protected function _createOptionDataObject(\Magento\Catalog\Model\Product\Option $option)
 {
     $data = array(Data\Option::OPTION_ID => $option->getId(), Data\Option::TITLE => $option->getTitle(), Data\Option::TYPE => $option->getType(), Data\Option::IS_REQUIRE => $option->getIsRequire(), Data\Option::SORT_ORDER => $option->getSortOrder(), Data\Option::METADATA => $this->optionMetadataReader->read($option));
     return $this->optionBuilder->populateWithArray($data)->create();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:11,代碼來源:ReadService.php


注:本文中的Magento\Catalog\Model\Product\Option::getTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。