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


PHP Category::getAttributes方法代碼示例

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


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

示例1: testGetAttributes

 public function testGetAttributes()
 {
     $attributes = $this->_model->getAttributes();
     $this->assertArrayHasKey('name', $attributes);
     $this->assertArrayHasKey('custom_design', $attributes);
     $attributes = $this->_model->getAttributes(true);
     $this->assertArrayHasKey('name', $attributes);
     $this->assertArrayNotHasKey('custom_design', $attributes);
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:9,代碼來源:CategoryTest.php

示例2: upgrade

 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     if (version_compare($context->getVersion(), '2.0.0.2') < 0) {
         $newBackendModel = 'Magento\\Catalog\\Model\\Attribute\\Backend\\Startdate';
         $connection = $setup->getConnection();
         $connection->startSetup();
         $connection->update($setup->getTable('eav_attribute'), ['backend_model' => $newBackendModel], ['backend_model = ?' => 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\Startdate']);
         /** @var \Magento\Catalog\Model\Resource\Eav\Attribute $attribute */
         foreach ($this->category->getAttributes() as $attribute) {
             if ($attribute->getAttributeCode() == 'custom_design_from') {
                 $attribute->setBackendModel($newBackendModel);
                 $attribute->save();
                 break;
             }
         }
         $connection->endSetup();
     }
 }
開發者ID:niranjanssiet,項目名稱:magento2,代碼行數:21,代碼來源:UpgradeData.php

示例3: dateTimePreprocessing

 /**
  * Datetime data preprocessing
  *
  * @param \Magento\Catalog\Model\Category $category
  * @param array $postData
  *
  * @return array
  */
 protected function dateTimePreprocessing($category, $postData)
 {
     $dateFieldFilters = [];
     $attributes = $category->getAttributes();
     foreach ($attributes as $attrKey => $attribute) {
         if ($attribute->getBackend()->getType() == 'datetime') {
             if (array_key_exists($attrKey, $postData) && $postData[$attrKey] != '') {
                 $dateFieldFilters[$attrKey] = $this->getDateTimeFilter();
             }
         }
     }
     $inputFilter = new \Zend_Filter_Input($dateFieldFilters, [], $postData);
     return $inputFilter->getUnescaped();
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:22,代碼來源:Category.php

示例4: getAttributes

 /**
  * {@inheritdoc}
  */
 public function getAttributes($noDesignAttributes = false)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getAttributes');
     if (!$pluginInfo) {
         return parent::getAttributes($noDesignAttributes);
     } else {
         return $this->___callPlugins('getAttributes', func_get_args(), $pluginInfo);
     }
 }
開發者ID:HaonanXu,項目名稱:der-snack-backup,代碼行數:12,代碼來源:Interceptor.php


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