public function parseResults(LoopResult $loopResult) { $loopResult = parent::parseResults($loopResult); /** @var LoopResultRow $loopResultRow */ foreach ($loopResult as $loopResultRow) { // do nothing if no count is present (simple mode) if ($loopResultRow->get('PSE_COUNT') === null) { continue; } $product = ProductQuery::create()->findPk($loopResultRow->get('ID')); // do nothing if we don't use legacy attributes for this product $productCheckEvent = new ProductCheckEvent($product->getId()); $this->dispatcher->dispatch(LegacyProductAttributesEvents::PRODUCT_CHECK_LEGACY_ATTRIBUTES_APPLY, $productCheckEvent); if (!$productCheckEvent->getResult()) { continue; } // nothing to do if the product has no template (and thus no attributes) if ($product->getTemplate() === null) { continue; } $virtualPseCount = 1; foreach ($product->getTemplate()->getAttributes() as $attribute) { $virtualPseCount *= $attribute->countAttributeAvs(); } $loopResultRow->set('PSE_COUNT', $virtualPseCount); } return $loopResult; }
public function parseResults(LoopResult $results) { $results = parent::parseResults($results); foreach ($results as $loopResultRow) { $accessoryProductId = $loopResultRow->get('ID'); \Thelia\Log\Tlog::getInstance()->notice($this->accessoryId); $loopResultRow->set("ID", $this->accessoryId[$accessoryProductId])->set("POSITION", $this->accessoryPosition[$accessoryProductId])->set("ACCESSORY_ID", $accessoryProductId); } return $results; }
private function baseProductSearch($params) { $productLoop = new Product($this->getContainer()); $productLoop->initializeArgs($params); return $productLoop->exec($paginate); }
public function buildModelCriteria() { $search = parent::buildModelCriteria(); $search->leftJoin('ProductCategory')->addJoinCondition('ProductCategory', 'ProductCategory.DefaultCategory = 1')->withColumn('COALESCE(ProductCategory.CategoryId, 0)', 'DefaultCategoryId'); return $search; }
/** * @param LoopResult $loopResult * * @return LoopResult */ public function parseResults(LoopResult $loopResult) { return parent::parseResults($loopResult); }