Reputation: 56
My website category page has product with dropdown filter range 16, 32, 64 and show all. Now I want rest filters including '16 product per page' will works only if user is logged-in otherwise only "16 product per page" is available for not logged in user and they will be redirect to login page for rest filters.
I have checked logged-in and filled the dropdown options like this:
<?php if (!$logged) { ?>
<!-- My code to fill dropdown option-->
<?php } else { >
<!-- By default dropdown option-->
<?php } ?>
But this is causing an error: "Notice: Undefined variable: logged in"
Upvotes: 1
Views: 3238
Reputation: 2018
Add below line in controller > category.php file where you getting the other variable of $category_info.
$this->data['logged'] = $this->customer->isLogged();
Upvotes: 3
Reputation: 1464
In Your controller you can do this:
if($this->customer->isLogged()) {
echo "Customer is logged in and his ID is " . $this->customer->isLogged();
} else {
echo "Customer is not logged in";
}
Upvotes: 1