当前位置: 首页>>代码示例>>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;未经允许,请勿转载。