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