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


PHP Product::addMessageTemplate方法代碼示例

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


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

示例1: __construct

 /**
  * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac
  * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac
  * @param array $params
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function __construct(\Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac, array $params)
 {
     $this->_attrSetColFac = $attrSetColFac;
     $this->_prodAttrColFac = $prodAttrColFac;
     if ($this->isSuitable()) {
         if (!isset($params[0]) || !isset($params[1]) || !is_object($params[0]) || !$params[0] instanceof \Magento\CatalogImportExport\Model\Import\Product) {
             throw new \Magento\Framework\Exception\LocalizedException(__('Please correct the parameters.'));
         }
         $this->_entityModel = $params[0];
         $this->_type = $params[1];
         foreach ($this->_messageTemplates as $errorCode => $message) {
             $this->_entityModel->addMessageTemplate($errorCode, $message);
         }
         $this->_initAttributes();
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:22,代碼來源:AbstractType.php

示例2: initMessageTemplates

 /**
  * @param array $templateCollection
  * @return $this
  */
 protected function initMessageTemplates(array $templateCollection)
 {
     foreach ($templateCollection as $errorCode => $message) {
         $this->_entityModel->addMessageTemplate($errorCode, $message);
     }
     return $this;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:11,代碼來源:AbstractType.php

示例3: _initMessageTemplates

 /**
  * Initialization of error message templates
  *
  * @return $this
  */
 protected function _initMessageTemplates()
 {
     // @codingStandardsIgnoreStart
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_STORE, __('Value for \'price\' sub attribute in \'store\' attribute contains incorrect value'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_TYPE, __('Value for \'type\' sub attribute in \'custom_options\' attribute contains incorrect value, acceptable values are: \'dropdown\', \'checkbox\''));
     $this->_productEntity->addMessageTemplate(self::ERROR_EMPTY_TITLE, __('Please enter a value for title.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_PRICE, __('Value for \'price\' sub attribute in \'custom_options\' attribute contains incorrect value'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_MAX_CHARACTERS, __('Value for \'maximum characters\' sub attribute in \'custom_options\' attribute contains incorrect value'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_SORT_ORDER, __('Value for \'sort order\' sub attribute in \'custom_options\' attribute contains incorrect value'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_ROW_PRICE, __('Value for \'value price\' sub attribute in \'custom_options\' attribute contains incorrect value'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_ROW_SORT, __('Value for \'sort order\' sub attribute in \'custom_options\' attribute contains incorrect value'));
     $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_NEW_NAMES, __('This name is already being used for custom option. Please enter a different name.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_OLD_NAMES, __('This name is already being used for custom option. Please enter a different name.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_TYPES, __('Custom options have different types.'));
     // @codingStandardsIgnoreEnd
     return $this;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:22,代碼來源:Option.php

示例4: _initMessageTemplates

 /**
  * Initialization of error message templates
  *
  * @return $this
  */
 protected function _initMessageTemplates()
 {
     // @codingStandardsIgnoreStart
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_STORE, __('Invalid custom option store.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_TYPE, __('Invalid custom option type.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_EMPTY_TITLE, __('Empty custom option title.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_PRICE, __('Invalid custom option price.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_MAX_CHARACTERS, __('Invalid custom option maximum characters value.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_SORT_ORDER, __('Invalid custom option sort order.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_ROW_PRICE, __('Invalid custom option value price.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_INVALID_ROW_SORT, __('Invalid custom option value sort order.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_NEW_NAMES, __('Custom option with such title already declared in source file.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_OLD_NAMES, __('There are several existing custom options with such name.'));
     $this->_productEntity->addMessageTemplate(self::ERROR_AMBIGUOUS_TYPES, __('Custom options have different types.'));
     // @codingStandardsIgnoreEnd
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:22,代碼來源:Option.php


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