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


PHP Category::getAffectedProductIds方法代码示例

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


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

示例1: aroundReindex

 /**
  * Reindex category's products after reindexing the category
  *
  * @param \Magento\Catalog\Model\Category $subject The cateogry being reindexed
  * @param callable                        $proceed The parent function we are plugged on
  *                                                 : Magento\Catalog\Model\Category::reindex()
  *
  * @return \Magento\Catalog\Model\Category
  */
 public function aroundReindex(\Magento\Catalog\Model\Category $subject, callable $proceed)
 {
     $proceed();
     if (!empty($subject->getAffectedProductIds())) {
         $this->processFullTextIndex($subject->getAffectedProductIds());
     }
     return;
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:17,代码来源:ReindexProductsAfterSave.php

示例2: afterSave

 /**
  * @param \Magento\Catalog\Model\Category $subject
  * @param \Magento\Catalog\Model\Category $result
  * @return \Magento\Catalog\Model\Category
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterSave(\Magento\Catalog\Model\Category $subject, \Magento\Catalog\Model\Category $result)
 {
     /** @var \Magento\Catalog\Model\Category $result */
     $productIds = $result->getAffectedProductIds();
     if ($productIds) {
         $this->productRuleProcessor->reindexList($productIds);
     }
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:Category.php

示例3: generateProductUrlRewrites

 /**
  * Generate url rewrites for products assigned to category
  *
  * @param Category $category
  * @return array
  */
 public function generateProductUrlRewrites(Category $category)
 {
     $this->isSkippedProduct = [];
     $saveRewriteHistory = $category->getData('save_rewrites_history');
     $storeId = $category->getStoreId();
     $productUrls = [];
     if ($category->getAffectedProductIds()) {
         $this->isSkippedProduct = $category->getAffectedProductIds();
         $collection = $this->productCollectionFactory->create()->setStoreId($storeId)->addIdFilter($category->getAffectedProductIds())->addAttributeToSelect('name')->addAttributeToSelect('url_key')->addAttributeToSelect('url_path');
         foreach ($collection as $product) {
             $product->setStoreId($storeId);
             $product->setData('save_rewrites_history', $saveRewriteHistory);
             $productUrls = array_merge($productUrls, $this->productUrlRewriteGenerator->generate($product));
         }
     } else {
         $productUrls = array_merge($productUrls, $this->getCategoryProductsUrlRewrites($category, $storeId, $saveRewriteHistory));
     }
     foreach ($this->childrenCategoriesProvider->getChildren($category, true) as $childCategory) {
         $productUrls = array_merge($productUrls, $this->getCategoryProductsUrlRewrites($childCategory, $storeId, $saveRewriteHistory));
     }
     return $productUrls;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:28,代码来源:UrlRewriteHandler.php


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