For a project I built a custom products extension with multiple views (list, show, nav ... etc). The nav view is build right in the header and lists product categories, groups and the actual products.
Now there a way too many sql queries every time the page loads. My idea now is to select only a few necessary fields for the nav view, such as title, uid, group and category.
This is the navAction within the controller:
public function navAction() {
$produktenav = $this->produktRepository->findProductTitles();
$this->view->assign('produktenav', $produktenav);
}
This is the function 'findProductTitles' within the repository:
public function findProductTitles($uid) {
$query = $this->createQuery();
$query->statement('SELECT produktname,produktkategorie,produktgruppe,uid,pid,produktbild FROM tx_produkte_domain_model_produkt WHERE deleted = 0 AND hidden = 0');
return $query->execute();
}
This works as expected for the navAction. The issue I'm having is that the showAction now also only displays the fields I'm accessing by the SQL statement.
Both plugins are on the same page with the following statements:
temp.productNav = USER
temp.productNav {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = Produktnav
extensionName = Produkte
vendorName = Siteway
switchableControllerActions.Produkt.1 = nav
features < plugin.tx_produkte_produkte.features
view < plugin.tx_produkte_produkte.view
persistence < plugin.tx_produkte_produkte.persistence
settings < plugin.tx_produkte_produkte.settings
}
temp.productDetail = USER
temp.productDetail {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = Produkte
extensionName = Produkte
vendorName = Siteway
switchableControllerActions.Produkt.1 = show
features < plugin.tx_produkte_produkte.features
view < plugin.tx_produkte_produkte.view
persistence < plugin.tx_produkte_produkte.persistence
settings < plugin.tx_produkte_produkte.settings
}
My question here is: why is the showAction not ignoring the navAction statements? And how can I use both plugins on the same page?
The output for "produkte" should not be empty at any point. For some reason, only the data I require by sql (for navAction) are visible for the showAction.