Post by dpDesignz » Sun Jun 13, 2010 9:55 am

I have recently updated a template of mine from an old version of OC, and I can't press enter after entering something in the search box, I have to manually press "go". Can anyone tell me what I need to add into my coding to do this?

Header.tpl

Code: Select all

<?php $path_theme = "catalog/view/theme/NDBNZ";?>

<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>" xml:lang="<?php echo $lang; ?>">
<head>
<title><?php echo $title; ?></title>
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>" />
<?php } ?>
<base href="<?php echo $base; ?>" />
<?php if ($icon) { ?>
<link href="image/<?php echo $icon; ?>" rel="icon" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/stylesheet/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/stylesheet/style.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/stylesheet/ie6.css" />
<script type="text/javascript" src="catalog/view/javascript/unitpngfix/unitpngfix.js"></script>
<![endif]-->
<script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/thickbox/thickbox-compressed.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/thickbox/thickbox.css" />
<script type="text/javascript" src="catalog/view/javascript/jquery/tab.js"></script>
</head>
<body>
<div id="container">
  <div id="header">
    <div class="div1">
      <div class="div2"><a href="<?php echo $home; ?>"><img src="<?php echo $logo; ?>" title="<?php echo $store; ?>" alt="<?php echo $store; ?>" /></a></div>
      <div id="search">
	  <div class="div3"><?php echo $entry_search; ?>
        <?php if ($keyword) { ?>
        <input type="text" value="<?php echo $keyword; ?>" id="filter_keyword" />
        <?php } else { ?>
        <input type="text" value="<?php echo $text_keyword; ?>" id="filter_keyword" onclick="this.value = '';" onkeydown="this.style.color = '#000000'" style="color: #999;" />
        <?php } ?>
        <a onclick="moduleSearch();" class="button"><span><?php echo $button_go; ?></span></a><br />
        <div align="center" ><a href="<?php echo str_replace('&', '&', $advanced); ?>"><?php echo $text_advanced; ?></a></div>
      </div>
    </div>
    <div class="div4">
      <div class="menu">
        <ul>
           <li><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a></li>
           <li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li>
           <li>
             <?php if (!$logged) { ?>
             <a href="<?php echo $login; ?>"><?php echo $text_login; ?></a>
             <?php } else { ?>
             <a href="<?php echo $logout; ?>"><?php echo $text_logout; ?></a>
             <?php } ?>
           </li>
        </ul>
      </div>
    </div>
	</div>
	<?php if (isset($common_error)) { ?>
	  <div class="warning"><?php echo $common_error; ?></div>
	  <?php } ?>
	  <?php if (isset($common_error)) { ?>
	  <div class="warning"><?php echo $common_error; ?></div>
	  <?php } ?>
    <div id="breadcrumb">
      <div class="div5">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a><img src="catalog/view/theme/<?php echo $template; ?>/image/tab.png" alt="" class="split" />
        <?php } ?>
      </div>
      <div class="div6">
        <img src="catalog/view/theme/<?php echo $template; ?>/image/icon_checkout.png" alt="" class="icon" /><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a>
        <img src="catalog/view/theme/<?php echo $template; ?>/image/icon_basket.png" alt="" class="icon" /><a href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a>
      </div>
    </div> 
  </div>
<script type="text/javascript"><!--
$('#module_search input').keydown(function(e) {
    if (e.keyCode == 13) {
        moduleSearch();
    }
});

function moduleSearch() {
    url = 'index.php?route=product/search';

    var filter_keyword = $('#filter_keyword').attr('value')

    if (filter_keyword) {
        url += '&keyword=' + encodeURIComponent(filter_keyword);
    }

    var filter_category_id = $('#filter_category_id').attr('value');

    if (filter_category_id) {
        url += '&category_id=' + filter_category_id;
    }
	url += '&description=1';
    url += '&model=1';
	location = url;
}
//--></script>
<script type="text/javascript"><!--
$('.switcher').bind('click', function() {
    $(this).find('.option').slideToggle('fast');
});
//--></script>
<?php if ($this->customer->isLogged()) { ?>
<b>Welcome. You are logged in as <?php echo $this->customer->getFirstName(); ?>.</b>
<?php } ?>
Thanks
dpDesignz

http://dpDesignz.webs.com Web & Publication Designer


User avatar
New member

Posts

Joined
Thu Jun 03, 2010 1:45 pm
Location - Waikato, New Zealand

Post by readyman » Sun Jun 13, 2010 11:13 am

You or someone has changed the #module_search box to #search.

You need to update your javascript to...

Code: Select all

<script type="text/javascript"><!--
$('#search input').keydown(function(e) {
    if (e.keyCode == 13) {
        moduleSearch();
    }
});
...I think that might be the issue.

http://www.alreadymade.com
Follow me on twitter.com/alreadymade


User avatar
Global Moderator

Posts

Joined
Wed May 20, 2009 5:16 am
Location - Sydney

Post by dpDesignz » Sun Jun 13, 2010 12:25 pm

Thanks
Will try that

http://dpDesignz.webs.com Web & Publication Designer


User avatar
New member

Posts

Joined
Thu Jun 03, 2010 1:45 pm
Location - Waikato, New Zealand

Post by dpDesignz » Sun Jun 13, 2010 12:36 pm

Is there any way to add icons to your buttons?

Thanks
dpDesignz

http://dpDesignz.webs.com Web & Publication Designer


User avatar
New member

Posts

Joined
Thu Jun 03, 2010 1:45 pm
Location - Waikato, New Zealand

Post by readyman » Tue Jun 15, 2010 8:26 pm

You can add an icon by changing the styles of your buttons to use a different background image.

http://www.alreadymade.com
Follow me on twitter.com/alreadymade


User avatar
Global Moderator

Posts

Joined
Wed May 20, 2009 5:16 am
Location - Sydney

Post by dpDesignz » Wed Jun 16, 2010 2:36 pm

Thanks. Worked fine

http://dpDesignz.webs.com Web & Publication Designer


User avatar
New member

Posts

Joined
Thu Jun 03, 2010 1:45 pm
Location - Waikato, New Zealand
Who is online

Users browsing this forum: No registered users and 131 guests