Post by olynnow11 » Mon May 01, 2017 6:56 pm

Hi,
Does anybody know how to make Search appear only on homepage?
I've tried moving the code from header.tpl to home.tpl, but it didn't go that well.

Thank you

Newbie

Posts

Joined
Fri Dec 30, 2016 4:22 am

Post by sachin6609 » Mon May 01, 2017 7:00 pm

Hii

Please Share the which Opencart Vesrion You Are Using? and the site url

THanks
Sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by olynnow11 » Mon May 01, 2017 8:35 pm

Hi Sachin,

I'm using version 2.3.0.2.

On second thought, it's better for me if I move search on home.tpl. Do you know what I should do?

Thanks
O

Newbie

Posts

Joined
Fri Dec 30, 2016 4:22 am

Post by sachin6609 » Mon May 01, 2017 8:49 pm

Hii

Yes i find the ans and try in my localhost demo opencart

I also refer you the ans link

http://stackoverflow.com/questions/2722 ... y-homepage

Its working for in same OC vesrion which is you use

Take The File Backup first

In The Header.tpl serch for the below code after add the controller code
<div class="col-sm-5"><?php echo $search; ?></div>

And replace the below one with HOME PAGE condition
<?php if (isset($ishome)) {?>
<div class="col-sm-5"><?php echo $search; ?></div>
<?php } ?>

All The Best

Thanks

Sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm

Post by olynnow11 » Mon May 01, 2017 9:20 pm

thanks a mill!!!!

the solution from the link worked:


down vote
accepted


I have found Perfect Solution. This is perfect work .

catalog/controller/common/header.php

add

if (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'){
$data['ishome']=1;
}

then in your header.tpl

<?php if (isset($ishome)) {?>
Our Box Content
<?php } ?>


best
O

Newbie

Posts

Joined
Fri Dec 30, 2016 4:22 am

Post by sachin6609 » Mon May 01, 2017 9:24 pm

Hii

Can you Share The site url please??

After Do This If any Div in header Shifted to left side when you go to another any page then just replace this code in header.tpl

<?php if (isset($ishome)) {?>
<div class="col-sm-5"><?php echo $search; ?></div>
<?php }else { ?>
<div class="col-sm-5"></div>
<?php }?>

So when the search is hide on other pages no any design issue is occur

Thanks
Sachin

Active Member

Posts

Joined
Thu Jul 23, 2015 2:57 pm
Who is online

Users browsing this forum: No registered users and 18 guests