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


PHP CatalogProductSimple::getDataFieldConfig方法代码示例

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


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

示例1: processAssert

 /**
  * Assert that product is not displayed in up-sell section.
  *
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture[]|null $promotedProducts
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, array $promotedProducts = null)
 {
     if (!$promotedProducts) {
         $promotedProducts = $product->hasData('up_sell_products') ? $product->getDataFieldConfig('up_sell_products')['source']->getProducts() : [];
     }
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($promotedProducts as $promotedProduct) {
         \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->getProductItem($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in up-sells products.');
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:AssertProductAbsentUpSells.php

示例2: processAssert

 /**
  * Check whether the attribute is unique.
  *
  * @param CatalogProductIndex $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductSimple $product,
  * @param FixtureFactory $fixtureFactory
  * @throws \Exception
  * @return void
  */
 public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogProductSimple $product, FixtureFactory $fixtureFactory)
 {
     $simpleProduct = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $product->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()], 'custom_attribute' => $attribute]]);
     $catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple');
     $productForm = $catalogProductEdit->getProductForm();
     $productForm->fill($simpleProduct);
     $catalogProductEdit->getFormPageActions()->save();
     $failedAttributes = $productForm->getRequireNoticeAttributes($simpleProduct);
     $actualMessage = isset($failedAttributes['product-details'][$attribute->getFrontendLabel()]) ? $failedAttributes['product-details'][$attribute->getFrontendLabel()] : null;
     \PHPUnit_Framework_Assert::assertEquals(sprintf(self::UNIQUE_MESSAGE, $attribute->getFrontendLabel()), $actualMessage, 'JS error notice on product edit page is not equal to expected.');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:AssertProductAttributeIsUnique.php

示例3: processAssert

 /**
  * Assert that specified prices with fpt are actual on category, product and cart pages
  *
  * @param CatalogProductSimple $product
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param array $prices
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, array $prices)
 {
     $this->cmsIndex = $cmsIndex;
     $this->catalogCategoryView = $catalogCategoryView;
     $this->catalogProductView = $catalogProductView;
     $this->checkoutCart = $checkoutCart;
     $this->fptLabel = $product->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getFrontendLabel();
     $this->clearShoppingCart();
     $actualPrices = $this->getPrices($product);
     //Prices verification
     \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, 'Prices on front should be equal to defined in dataset');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:23,代码来源:AssertFptApplied.php

示例4: processAssert

 /**
  * Assert that product url in url rewrite grid.
  *
  * @param CatalogProductSimple $product
  * @param CatalogProductSimple $initialProduct
  * @param UrlRewriteIndex $urlRewriteIndex
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, CatalogProductSimple $initialProduct, UrlRewriteIndex $urlRewriteIndex)
 {
     $urlRewriteIndex->open();
     $category = $product->getDataFieldConfig('category_ids')['source']->getCategories()[0];
     $targetPath = "catalog/product/view/id/{$initialProduct->getId()}/category/{$category->getId()}";
     $url = strtolower($product->getCategoryIds()[0] . '/' . $product->getUrlKey());
     $filter = ['request_path' => $url, 'target_path' => $targetPath];
     \PHPUnit_Framework_Assert::assertTrue($urlRewriteIndex->getUrlRedirectGrid()->isRowVisible($filter, true, false), "URL Rewrite with request path '{$url}' is absent in grid.");
     $categoryInitial = $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0];
     $targetPath = "catalog/product/view/id/{$initialProduct->getId()}/category/{$categoryInitial->getId()}";
     \PHPUnit_Framework_Assert::assertFalse($urlRewriteIndex->getUrlRedirectGrid()->isRowVisible(['target_path' => $targetPath], true, false), "URL Rewrite with target path '{$targetPath}' is present in grid.");
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:20,代码来源:AssertUrlRewriteUpdatedProductInGrid.php

示例5: test

 /**
  * Run update product simple entity test
  *
  * @param CatalogProductSimple $initialProduct
  * @param CatalogProductSimple $product
  * @return array
  */
 public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product)
 {
     // Preconditions
     $initialProduct->persist();
     $initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
     $category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
     // Steps
     $filter = ['sku' => $initialProduct->getSku()];
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->searchAndOpen($filter);
     $this->editProductPage->getProductForm()->fill($product);
     $this->editProductPage->getFormPageActions()->save();
     return ['category' => $category];
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:21,代码来源:UpdateSimpleProductEntityTest.php

示例6: processAssert

 /**
  * Assert that product is not displayed in cross-sell section.
  *
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param InjectableFixture[]|null $promotedProducts
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, array $promotedProducts = null)
 {
     if (!$promotedProducts) {
         $promotedProducts = $product->hasData('cross_sell_products') ? $product->getDataFieldConfig('cross_sell_products')['source']->getProducts() : [];
     }
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     foreach ($promotedProducts as $promotedProduct) {
         \PHPUnit_Framework_Assert::assertFalse($checkoutCart->getCrosssellBlock()->getProductItem($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in cross-sell section.');
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:25,代码来源:AssertProductAbsentCrossSells.php

示例7: test

 /**
  * Create product URL Rewrite.
  *
  * @param CatalogProductSimple $product
  * @param UrlRewrite $urlRewrite
  * @return void
  */
 public function test(CatalogProductSimple $product, UrlRewrite $urlRewrite)
 {
     //Precondition
     $product->persist();
     $filter = ['id' => $product->getId()];
     //Steps
     $this->urlRewriteIndex->open();
     $this->urlRewriteIndex->getPageActionsBlock()->addNew();
     $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
     $this->urlRewriteEdit->getProductGridBlock()->searchAndOpen($filter);
     $category = $product->hasData('category_ids') ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
     $this->urlRewriteEdit->getTreeBlock()->selectCategory($category);
     $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
     $this->urlRewriteEdit->getPageMainActions()->save();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:22,代码来源:CreateProductUrlRewriteEntityTest.php

示例8: test

 /**
  * Run update product simple entity test.
  *
  * @param CatalogProductSimple $initialProduct
  * @param CatalogProductSimple $product
  * @param string $configData
  * @return array
  */
 public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData = '')
 {
     $this->configData = $configData;
     // Preconditions
     $initialProduct->persist();
     $initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
     $category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
     // Steps
     $filter = ['sku' => $initialProduct->getSku()];
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->searchAndOpen($filter);
     $this->editProductPage->getProductForm()->fill($product);
     $this->editProductPage->getFormPageActions()->save();
     return ['category' => $category];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:24,代码来源:UpdateSimpleProductEntityTest.php

示例9: createSimpleProductFixture

 /**
  * Create simple product fixture.
  *
  * @param CatalogProductSimple $product
  * @param CatalogProductAttribute $attribute
  * @return CatalogProductSimple
  */
 protected function createSimpleProductFixture(CatalogProductSimple $product, CatalogProductAttribute $attribute)
 {
     return $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $product->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()], 'custom_attribute' => $attribute]]);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:11,代码来源:AssertProductAttributeIsUnique.php

示例10: prepareCondition

 /**
  * Prepare condition for catalog price rule.
  *
  * @param CatalogProductSimple $productSimple
  * @param string $conditionEntity
  * @return array
  */
 protected function prepareCondition(CatalogProductSimple $productSimple, $conditionEntity)
 {
     $result = [];
     switch ($conditionEntity) {
         case 'category':
             $result['%category_id%'] = $productSimple->getDataFieldConfig('category_ids')['source']->getIds()[0];
             break;
         case 'attribute':
             /** @var \Magento\Catalog\Test\Fixture\CatalogProductAttribute[] $attrs */
             $attributes = $productSimple->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes();
             $result['%attribute_name%'] = $attributes[0]->getFrontendLabel();
             $result['%attribute_value%'] = $attributes[0]->getOptions()[0]['view'];
             break;
     }
     return ['conditions' => ['conditions' => $result]];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:23,代码来源:CreateCatalogRuleTest.php

示例11: test

 /**
  * Run mass update product simple entity test.
  *
  * @param CatalogProductSimple $initialProduct
  * @param CatalogProductSimple $product
  * @param string $configData
  * @return array
  */
 public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData)
 {
     $this->configData = $configData;
     // Preconditions
     $initialProduct->persist();
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
     // Steps
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->updateAttributes([['sku' => $initialProduct->getSku()]]);
     $this->attributeMassActionPage->getAttributesBlockForm()->fill($product);
     $this->attributeMassActionPage->getFormPageActions()->save();
     $data = array_merge($initialProduct->getData(), $product->getData());
     $product = $this->objectManager->create('Magento\\Catalog\\Test\\Fixture\\CatalogProductSimple', ['data' => $data]);
     return ['category' => $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0], 'product' => $product];
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:23,代码来源:MassProductUpdateTest.php


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