當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。