Page 1 of 1
Elegant way / hook to redirect specific category_id to a "landingpage"
Posted: Tue Oct 04, 2022 1:27 pm
by loop
Hi All
I need a specific categories_id to redirected to a "new" page. is there a elegant way to do that? (of course i can change the template of index.php and say if($GLOBALS['current_category_id']==123) thenn ....else if ($category_depth == 'nested') { ....
but the question is if there is a better solution....
thanks!
Re: Elegant way / hook to redirect specific category_id to a "landingpage"
Posted: Tue Oct 04, 2022 1:34 pm
by Kofod95
Maybe the if in hooks/index and listen to inject_siteStart (I don't remember precisely how it's named)
//Daniel
Re: Elegant way / hook to redirect specific category_id to a "landingpage"
Posted: Tue Oct 04, 2022 1:35 pm
by ecartz
Code: Select all
class hook_shop_index_landing {
public function listen_siteWideStart() {
if ($GLOBALS['current_category_id'] == 123) {
// redirect
}
}
}
Re: Elegant way / hook to redirect specific category_id to a "landingpage"
Posted: Tue Oct 04, 2022 1:46 pm
by loop
hi ecartz
but does this work with a new content module?
i made a new contentmodule "landing_page" and want that the according content module is loaded instead of index_nested
Code: Select all
if($GLOBALS['current_category_id'] == 1009){
echo $GLOBALS['current_category_id'];
?>
<div class="row">
<?php echo $oscTemplate->getContent('landing_page'); ?>
</div>
<?php
}
does it work thenn with the hook?
Re: Elegant way / hook to redirect specific category_id to a "landingpage"
Posted: Wed Oct 05, 2022 1:35 pm
by loop
i tried it but it seems it doesnt work like this, as i make not a redirection, i want to include the content
Code: Select all
class hook_shop_index_landingpage {
public function listen_siteWideStart() {
if($GLOBALS['current_category_id'] == 1009){
?>
<div class="row">
<?php echo $oscTemplate->getContent('landing_page'); ?>
</div>
<?php
}
}
}
any ideas how to make it like this?