- 我有 site.com/rims/?vehicleCode=P0000061000
- 如果我使用代码过滤产品,则默认过滤器不起作用。
在 Bootstrap.php 文件的安装函数中,我订阅了 $this->subscribeEvent('Enlight_Controller_Action_PostDispatchSecure_Frontend_Listing', 'onPostDispatchListing'); 事件。之后在 onPostDispatchListing 函数中我有:
/** @var \Enlight_Controller_Action $controller */ $controller = $args->getSubject(); $request = $controller->Request(); // defines the default shopware VIEWS directory. $view = $controller->View(); $view->addTemplateDir( __DIR__ . '/Views/responsive' ); $shop = Shopware()->Shop(); $sCategorystart = $shop->getCategory()->getId(); $sCategoryID = $this->getCategoryCurrent($sCategorystart); $oDb = Shopware()->Db(); $EngineCode = $request->getParam('sVehicle'); $query = "SELECT va.`articleID` FROM `s_vehicle_articles` as va INNER JOIN `s_articles_categories` as ac ON ac.articleID=va.articleID WHERE ac.categoryID=" . $sCategoryID; $query .= ($EngineCode) ? " AND va.`VehicleCodeID`= '" . $EngineCode . "'" : " "; $mResults = $oDb->fetchAll($query); $articleModule = Shopware()->Modules()->Articles(); $aProducts = array(); foreach ($mResults as $key => $value) { $article = $articleModule->sGetArticleById($value['articleID'], $sCategoryID); $aProducts[] = $article; } $view->sArticles = $aProducts;
代码正常工作,产品被过滤,但默认过滤器不起作用,如价格过滤器等。
有人可以帮忙吗?