コード例 #1
0
 public function testVoDataComplete()
 {
     $vo = $this->ruleHydrator->createRuleVo(['id' => 2, 'sortOrder' => 1, 'definitionUid' => 's_articles::datum', 'descending' => false]);
     $this->assertEquals(2, $vo->getId());
     $this->assertEquals(1, $vo->getOrder());
     $this->assertEquals('s_articles::datum', $vo->getDefinitionUid());
     $this->assertEquals(false, $vo->isDescending());
 }
コード例 #2
0
 /**
  * @param Request              $request
  * @param Criteria             $criteria
  * @param ShopContextInterface $context
  */
 public function handleRequest(Request $request, Criteria $criteria, ShopContextInterface $context)
 {
     $requestedCategoryId = $request->getParam('sCategory', $request->getParam('categoryId', false));
     if (!$requestedCategoryId) {
         return;
     }
     $closestIdWithRules = $this->databaseAdapter->fetchClosestCategoryIdWithRule($requestedCategoryId);
     if (!$closestIdWithRules) {
         return;
     }
     $this->enabled = true;
     if ($request->sSort && $request->sSort != self::REQUEST_VALUE) {
         return;
     }
     $request->setParam('sSort', self::REQUEST_VALUE);
     $rules = $this->ruleHydrator->createRuleVos($this->databaseAdapter->fetchRawData($closestIdWithRules));
     $criteria->resetSorting();
     $criteria->addSorting(new DefaultSorting($rules));
 }