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


PHP CatalogProductSimple::getId方法代码示例

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


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

示例1: 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

示例2: processAssert

 /**
  * Assert that after applying changes, currency symbol changed on Catalog page
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductSimple $product
  * @param CurrencySymbolEntity $currencySymbol
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductSimple $product, CurrencySymbolEntity $currencySymbol)
 {
     $categoryName = $product->getCategoryIds()[0];
     $cmsIndex->open();
     $cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
     $cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
     $price = $catalogCategoryView->getListProductBlock()->getPrice($product->getId());
     preg_match('`(.*?)\\d`', $price, $matches);
     $symbolOnPage = isset($matches[1]) ? $matches[1] : null;
     \PHPUnit_Framework_Assert::assertEquals($currencySymbol->getCustomCurrencySymbol(), $symbolOnPage, 'Wrong Currency Symbol is displayed on Category page.');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:20,代码来源:AssertCurrencySymbolOnCatalogPage.php

示例3: 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

示例4: testProductUrlRewrite

 /**
  * Create product URL Rewrite
  *
  * @param CatalogProductSimple $product
  * @param UrlRewrite $urlRewrite
  * @return void
  */
 public function testProductUrlRewrite(CatalogProductSimple $product, UrlRewrite $urlRewrite)
 {
     //Precondition
     $product->persist();
     $filter = ['id' => $product->getId()];
     //Steps
     $this->urlRewriteIndex->open();
     $this->urlRewriteIndex->getPageActionsBlock()->addNew();
     $this->urlRewriteEdit->getUrlRewriteTypeSelectorBlock()->selectType('For product');
     $this->urlRewriteEdit->getProductGridBlock()->searchAndOpen($filter);
     $this->urlRewriteEdit->getTreeBlock()->skipCategorySelection();
     $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
     $this->urlRewriteEdit->getPageMainActions()->save();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:CreateProductUrlRewriteEntityTest.php


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