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


PHP CatalogCategoryView::getLayeredNavigationBlock方法代碼示例

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


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

示例1: processAssert

 /**
  * Check whether the attribute filter is displayed on the frontend in Layered navigation.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param CmsIndex $cmsIndex
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory)
 {
     $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['category_ids' => ['presets' => null, 'category' => $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]]]])->persist();
     $cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:17,代碼來源:AssertProductAttributeIsFilterable.php

示例2: processAssert

 /**
  * Assertion that filtered product list via layered navigation are displayed correctly.
  *
  * @param Category $category
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param array $layeredNavigation
  * @return void
  */
 public function processAssert(Category $category, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $layeredNavigation)
 {
     $this->products = $category->getDataFieldConfig('category_products')['source']->getProducts();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
     foreach ($layeredNavigation as $filters) {
         foreach ($filters as $filter) {
             $catalogCategoryView->getLayeredNavigationBlock()->applyFilter($filter['title'], $filter['linkPattern']);
             $productNames = $this->getProductNames($filter['products']);
             sort($productNames);
             $pageProductNames = $catalogCategoryView->getListProductBlock()->getProductNames();
             sort($pageProductNames);
             \PHPUnit_Framework_Assert::assertEquals($productNames, $pageProductNames);
         }
         $catalogCategoryView->getLayeredNavigationBlock()->clearAll();
     }
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:26,代碼來源:AssertFilterProductList.php

示例3: processAssert

 /**
  * Check out if the attribute in the navigation bar on the search results page in Layered navigation.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute)
 {
     $cmsIndex->open()->getSearchBlock()->search($product->getName());
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on search page.');
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:15,代碼來源:AssertProductAttributeIsFilterableInSearch.php


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