Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

Hiding certain elements when not logged in

Started by JHammond53, October 16, 2014, 11:21:41 AM

Previous topic - Next topic

JHammond53

Ok, this may be quite complicated. If someone is not logged in, I would like to hide the entire top menu except for login. I would also like to hide the cart just below the top menu. One other thing is featured items.

If someone is then logged in, all of these would reappear.

I am not afraid of changing code as I have changed some already. Just can't find the right files/code to implement.

abantecart

You can use be below condition in header.tpl file


if (!$this->customer->isLogged()) {
...
}

JHammond53

Quote from: abantecart on October 18, 2014, 08:42:53 PM
You can use be below condition in header.tpl file


if (!$this->customer->isLogged()) {
...
}


Thanks for the response. I have used this to remove the cart beneath the top menu, however the top menu is displayed as ($children_blocks[2]) not sure how to pick apart what I want to show when not logged in.

JHammond53

Well I figured it out. It may not be the best way to do it, but I got it done.

abantecart


JHammond53

#5
I modified the header.tpl file to read as such. Anything in red is what I added. You can see it in action at archmetalsfl.com

Quote<div class="headerstrip_blocks">

                  <div class="pull-left ml10"><?php echo ${$children_blocks[0]}; ?></div>

                  <div class="pull-left"><?php echo ${$children_blocks[1]}; ?></div>

                  <div class="pull-left">
                     <?php if ($this->customer->isLogged()) {   ?>                     
                     <?php echo ${$children_blocks[2]}; ?>
                  <?php } else {   ?>
                  <div class="navbar" id="topnav">
                      <div class="navbar-inner">
                     <ul id="main_menu_top" class="nav main_menu">
                     <li  data-id="menu_login"  class="dropdown hover"><a  class="top menu_login"  href="http://www.archmetalsfl.com/index.php?rt=account/login" ><span class="menu_text">Login</span></a></li>                  
                     </ul>
                     </div>
                     </div>
                  <?php } ?>
                  
                  </div>

abantecart


Forum Rules Code of conduct
AbanteCart.com 2010 -