当前位置: 首页>>代码示例>>PHP>>正文


PHP CatalogProductAttribute::getData方法代码示例

本文整理汇总了PHP中Magento\Catalog\Test\Fixture\CatalogProductAttribute::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductAttribute::getData方法的具体用法?PHP CatalogProductAttribute::getData怎么用?PHP CatalogProductAttribute::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Catalog\Test\Fixture\CatalogProductAttribute的用法示例。


在下文中一共展示了CatalogProductAttribute::getData方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Move attribute To attribute set.
  *
  * @return array
  */
 public function run()
 {
     $filterAttribute = ['set_name' => $this->attributeSet->getAttributeSetName()];
     $this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute);
     $this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData());
     $this->catalogProductSetEdit->getPageActions()->save();
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:12,代码来源:AddAttributeToAttributeSetStep.php

示例2: run

 /**
  * Move attribute To attribute set.
  *
  * @return array
  */
 public function run()
 {
     $filterAttribute = ['set_name' => $this->productTemplate->getAttributeSetName()];
     $this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute);
     $this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData());
     $this->catalogProductSetEdit->getPageActions()->save();
     // Create product with attribute set mentioned above:
     $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $this->productTemplate]]]);
     $product->persist();
     return ['product' => $product];
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:16,代码来源:AddAttributeToProductTemplateStep.php

示例3: processAssert

 /**
  * Add this attribute to Default attribute Template. Create product and Assert that created attribute
  * is displayed on product form (Products > Inventory > Catalog).
  *
  * @param InjectableFixture $product
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $productEdit
  * @param CatalogProductAttribute $attribute
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttributeOriginal
  * @throws \Exception
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null)
 {
     if (!$product->hasData('sku')) {
         $product = $this->createProductWithAttributeSet($productAttributeOriginal, $attributeSet);
     }
     $filterProduct = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen($filterProduct);
     $catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData();
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:24,代码来源:AssertAddedProductAttributeOnProductForm.php

示例4: testDeleteSystemProductAttribute

 /**
  * Run delete system product attribute test
  *
  * @param CatalogProductAttribute $productAttribute
  * @param CatalogProductAttributeIndex $attributeIndex
  * @return void
  */
 public function testDeleteSystemProductAttribute(CatalogProductAttribute $productAttribute, CatalogProductAttributeIndex $attributeIndex)
 {
     $filter = $productAttribute->getData();
     // Steps
     $attributeIndex->open();
     $attributeIndex->getGrid()->searchAndOpen($filter);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:DeleteSystemProductAttributeTest.php

示例5: processAssert

 /**
  * Add this attribute to Default attribute Template. Create product and Assert that created attribute
  * is displayed on product form (Products > Inventory > Catalog)
  *
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductSetIndex $productSet
  * @param CatalogProductSetEdit $productSetEdit
  * @param CatalogAttributeSet $productTemplate
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductAttribute $productAttributeOriginal
  * @param CatalogProductEdit $productEdit
  * @param CatalogProductAttribute|null $productAttribute
  * @return void
  */
 public function processAssert(FixtureFactory $fixtureFactory, CatalogProductSetIndex $productSet, CatalogProductSetEdit $productSetEdit, CatalogAttributeSet $productTemplate, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $productAttribute, CatalogProductAttribute $productAttributeOriginal = null)
 {
     $filterAttribute = ['set_name' => $productTemplate->getAttributeSetName()];
     $productSet->open();
     $productSet->getGrid()->searchAndOpen($filterAttribute);
     $attributeData = $productAttributeOriginal !== null ? array_merge($productAttribute->getData(), $productAttributeOriginal->getData()) : $productAttribute->getData();
     $productSetEdit->getAttributeSetEditBlock()->moveAttribute($attributeData, 'Product Details');
     $productSetEdit->getPageActions()->save();
     $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category', 'data' => ['attribute_set_id' => ['attribute_set' => $productTemplate]]]);
     $product->persist();
     $filterProduct = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen($filterProduct);
     $catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $productAttribute->getData()) : $productAttribute->getData();
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:30,代码来源:AssertAddedProductAttributeOnProductForm.php

示例6: processAssert

 /**
  * Assert that displayed attribute data on edit page equals passed from fixture.
  *
  * @param CatalogProductAttributeIndex $catalogProductAttributeIndex
  * @param CatalogProductAttributeNew $catalogProductAttributeNew
  * @param CatalogProductAttribute $attribute
  * @throws \Exception
  * @return void
  */
 public function processAssert(CatalogProductAttributeIndex $catalogProductAttributeIndex, CatalogProductAttributeNew $catalogProductAttributeNew, CatalogProductAttribute $attribute)
 {
     $filter = ['attribute_code' => $attribute->getAttributeCode()];
     $catalogProductAttributeIndex->open()->getGrid()->searchAndOpen($filter);
     $errors = $this->verifyData($attribute->getData(), $catalogProductAttributeNew->getAttributeForm()->getData($attribute));
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:AssertAttributeForm.php

示例7: hasHtmlTagInAttributeValue

 /**
  * Check if attribute value contains tag.
  *
  * @param CatalogProductAttribute $attribute
  * @return bool
  */
 public function hasHtmlTagInAttributeValue(CatalogProductAttribute $attribute)
 {
     $data = $attribute->getData();
     $defaultValue = preg_grep('/^default_value/', array_keys($data));
     $selector = $this->resolveHtmlStructure($data[array_shift($defaultValue)]);
     $element = $this->getProductAttributes()[$attribute->getFrontendLabel()];
     return $this->checkHtmlTagStructure($element, $selector)->isVisible();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:Additional.php

示例8: processAssert

 /**
  * Add this attribute to Default attribute Template. Create product and Assert that created attribute
  * is displayed on product form (Products > Inventory > Catalog).
  *
  * @param InjectableFixture $product
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductIndex $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttributeOriginal
  * @throws \Exception
  * @return void
  */
 public function processAssert(InjectableFixture $product, FixtureFactory $fixtureFactory, CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null)
 {
     $this->fixtureFactory = $fixtureFactory;
     $this->catalogProductIndex = $catalogProductIndex;
     $this->catalogProductEdit = $catalogProductEdit;
     if (!$product->hasData('sku')) {
         if (!$productAttributeOriginal) {
             $productAttributeOriginal = $attribute;
         }
         $product = $this->objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductWithAttributeSetStep', ['attribute' => $productAttributeOriginal, 'attributeSet' => $attributeSet])->run();
         $product = $product['product'];
     }
     $filterProduct = ['sku' => $product->getSku()];
     $catalogProductIndex->open();
     $catalogProductIndex->getProductGrid()->searchAndOpen($filterProduct);
     $catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData();
     \PHPUnit_Framework_Assert::assertTrue($catalogProductEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:32,代码来源:AssertAddedProductAttributeOnProductForm.php

示例9: testCreateAttributeSet

 /**
  * Run CreateAttributeSetEntity test
  *
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttribute
  * @return void
  */
 public function testCreateAttributeSet(CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute)
 {
     $productAttribute->persist();
     //Steps
     $this->productSetIndex->open();
     $this->productSetIndex->getPageActionsBlock()->addNew();
     $this->productSetAdd->getAttributeSetForm()->fill($attributeSet);
     $this->productSetAdd->getPageActions()->save();
     $this->productSetEdit->getAttributeSetEditBlock()->moveAttribute($productAttribute->getData());
     $this->productSetEdit->getPageActions()->save();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:18,代码来源:CreateAttributeSetEntityTest.php

示例10: test

 /**
  * Run UpdateProductTemplate test
  *
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogAttributeSet $attributeSetOriginal
  * @param CatalogProductAttribute $productAttributeOriginal
  * @return void
  */
 public function test(CatalogAttributeSet $attributeSet, CatalogAttributeSet $attributeSetOriginal, CatalogProductAttribute $productAttributeOriginal)
 {
     // Precondition
     $attributeSetOriginal->persist();
     $productAttributeOriginal->persist();
     // Steps
     $filter = ['set_name' => $attributeSetOriginal->getAttributeSetName()];
     $this->productSetIndex->open();
     $this->productSetIndex->getGrid()->searchAndOpen($filter);
     $groupName = $attributeSet->getGroup();
     $this->productSetEdit->getAttributeSetEditBlock()->addAttributeSetGroup($groupName);
     $this->productSetEdit->getAttributeSetEditBlock()->moveAttribute($productAttributeOriginal->getData(), $groupName);
     $this->productSetEdit->getAttributeSetEditForm()->fill($attributeSet);
     $this->productSetEdit->getPageActions()->save();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:23,代码来源:UpdateAttributeSetTest.php

示例11: run

 /**
  * Move attribute To attribute set.
  *
  * @return array
  */
 public function run()
 {
     $filterAttribute = ['set_name' => $this->attributeSet->getAttributeSetName()];
     $this->catalogProductSetIndex->open()->getGrid()->searchAndOpen($filterAttribute);
     $this->catalogProductSetEdit->getAttributeSetEditBlock()->moveAttribute($this->attribute->getData());
     $this->catalogProductSetEdit->getPageActions()->save();
     // Create product with attribute set mentioned above:
     $customAttribute = $this->attribute;
     if ($this->attributeValue !== null) {
         $customAttribute = ['value' => $this->attributeValue, 'attribute' => $customAttribute];
     }
     $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $this->attributeSet], 'custom_attribute' => $customAttribute]]);
     $this->catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple');
     $productForm = $this->catalogProductEdit->getProductForm();
     $productForm->fill($product);
     $this->catalogProductEdit->getFormPageActions()->save();
     return ['product' => $product];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:23,代码来源:AddAttributeToAttributeSetStep.php

示例12: getDefaultAttributeValue

 /**
  * Get default value of custom attribute considering to it's type.
  * In case if default value isn't set for dropdown and multiselect return first option, for other types null.
  *
  * @param CatalogProductAttribute $attribute
  * @return string|null
  */
 protected function getDefaultAttributeValue(CatalogProductAttribute $attribute)
 {
     $data = $attribute->getData();
     $value = '';
     if (isset($data['options'])) {
         foreach ($data['options'] as $option) {
             if (isset($option['is_default']) && $option['is_default'] == 'Yes') {
                 $value = $option['admin'];
             }
         }
         if ($value == '') {
             $value = $data['options'][0]['admin'];
         }
     } else {
         $defaultValue = preg_grep('/^default_value/', array_keys($data));
         $value = !empty($defaultValue) ? $data[array_shift($defaultValue)] : null;
     }
     return $value;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:26,代码来源:CustomAttribute.php

示例13: prepareAttribute

 /**
  * Prepare attribute data.
  *
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductAttribute $productAttributeOriginal
  * @return CatalogProductAttribute
  */
 protected function prepareAttribute($attribute, $productAttributeOriginal)
 {
     $attributeData = array_merge($attribute->getData(), $productAttributeOriginal->getData());
     return $this->fixtureFactory->createByCode('catalogProductAttribute', ['data' => $attributeData]);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:12,代码来源:UpdateProductAttributeEntityTest.php


注:本文中的Magento\Catalog\Test\Fixture\CatalogProductAttribute::getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。