Post by bthirsk » Sun Nov 02, 2008 7:23 pm

I would like to make a suggestion for inclusion in 7.9
When using on site search, whenever you return to home page or category pages, search term remains in text box.
If a customer wants to create another search, the have to double click the term or backspace it out.
I think it should be cleared and revert to Keywords whenever you leave the search page.
I have inserted the following code in template/module/search.tpl to correct.


 
  " method="post">
Brent

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by jty » Mon Nov 03, 2008 9:58 am

Thank-you. It works for me  :)

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by fido-x » Mon Nov 03, 2008 2:57 pm

Works OK as long as URL aliasing is turned off. An alternative would be to edit the controller itself (catalog/extension/module/search.php) by changing the following line from:-

Code: Select all

$view->set('search', $session->get('search.search'));
to

Code: Select all

$view->set('search', '');
This places the word "Keywords" back in the search box, but allows for a single click to clear it, and it doesn't break when URL aliasing is turned on.

Regards, Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by bthirsk » Mon Nov 03, 2008 6:39 pm

That kind of does the same thing, only it also removes the key words from the text box in search,
which means if your customer wanted to add a word to the search, they would have to re key it all
again.
As I don't have URL aliasing on at this time, I can't comment.
Does that mean if URL aliasing is turned on, there is no way to determine what page you are on.??

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by jty » Mon Nov 03, 2008 7:41 pm

bthirsk wrote: which means if your customer wanted to add a word to the search, they would have to re key it all
again.
The keywords remain in the search on the search page so customers could utilise that instead of the search box up top
Does that mean if URL aliasing is turned on, there is no way to determine what page you are on.??
I ran a "quick" test and with URL alias turned on and using the SEO contrib, it didn't work but I can't remember what didn't work means as I also need to apply Bruce's fix to get search working with the SEO contrib so I got all confused  :D

Fido-x's solution works with the SEO contrib
Nothing works without Bruce's fix when using the SEO contrib though Qphoria doesn't need Bruce's fix. I figured Q must be using the American version which doesn't work on Aussie PCs  ;D (kidding)

Thanks to you both

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by hm2k » Tue Nov 04, 2008 6:08 am

Can I ask why you might want this to work like this? I need to work out whether to adopt it into the core or not.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by bthirsk » Tue Nov 04, 2008 7:03 am

When you do a search and go to the search page, the search should remain in the text box in
case you wish to add a word to enhance the search.
When you leave the search page, you are probably done searching for whatever widget you were looking for.
In all other pages, the search box should be cleared, not only for aesthetic purposes, but to make additional searches easier for your customers.
Right now, they have to click the text box and backspace out all the text from the last search.
Because I was doing a lot of testing with a wild card search I built, I got POed at having to backspace every time I wanted to change the terms, and I own the site.
Imagine a customer.
They just leave.
Brent

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by jty » Tue Nov 04, 2008 12:11 pm

bthirsk wrote: When you do a search and go to the search page, the search should remain in the text box in
case you wish to add a word to enhance the search.
This is not so important to me as the keywords remain in the search field "on the page"
So, having it cleared in the search box at the top bar is fine by me as the user can add words to the search "on the page" which is where I would look as a user. I'm not so likely to go back to the top bar search box but that's just me.
When you leave the search page, you are probably done searching for whatever widget you were looking for.
In all other pages, the search box should be cleared, not only for aesthetic purposes, but to make additional searches easier for your customers.
Right now, they have to click the text box and backspace out all the text from the last search.
Because I was doing a lot of testing with a wild card search I built, I got POed at having to backspace every time I wanted to change the terms, and I own the site.
Imagine a customer.
This one is important. Customers will get POed if they have to keep clearing the search box everytime they want to search something else.

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by bthirsk » Tue Nov 04, 2008 2:11 pm

That's not quite how it works.
When you are on the SEARCH page, both search boxes are active and are not cleared after a search,
so you can add or change either box.
The only box that is cleared is the module box at the top of the page, and only when you leave the search page.

I have it set up this way on my site now.

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by fido-x » Tue Nov 04, 2008 5:49 pm

This code should do the trick (in catalog/extension/module/search.php)

Code: Select all

if ($request->get('controller') == 'search') {
   $view->set('search', $session->get('search.search'));
} else {
   $view->set('search', '');
}
EDIT: You'll also have to add the following to the top of the file:-

Code: Select all

$request  =& $this->locator->get('request');
Last edited by fido-x on Tue Nov 04, 2008 5:53 pm, edited 1 time in total.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by bruce » Tue Nov 04, 2008 6:23 pm

Nice one fido-x

Your code follows the "true path" and works both with and without url alias turned on.

Nice idea too bthirsk, I have adopted it for my sites too.  8)

cheers

Bruce
Last edited by bruce on Tue Nov 04, 2008 6:30 pm, edited 1 time in total.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by fido-x » Tue Nov 04, 2008 6:59 pm

bruce wrote: Nice one fido-x
Your code follows the "true path" and works both with and without url alias turned on.
Thanks Bruce. Damn, now I have to open the double doors to get my head through (both of them) ;D ::)
Nice idea too bthirsk, I have adopted it for my sites too.  8)
I agree, it is a good idea. I'll be using it myself in my own current and future projects.

Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by bthirsk » Tue Nov 04, 2008 11:23 pm

That's definitely a better way to define page you are on.
It does not cure the problem in 7.8 though.
There is a bug I have not found yet where $search in the content .tpl
and the module .tpl seem to be different.
When testing my search problem with the added amp, I would always get one more in
the module .tpl than the content .tpl.
I think there must be a call somewhere that again modifies the 'search' variable,
but I haven't found that yet.
I really need to update to 7.9.
Thanks for all the help, guys.
Brent

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by hm2k » Tue Nov 04, 2008 11:27 pm

There's a better way to do this...

Code: Select all

$session->delete('search.search')
Probably something like this:

Code: Select all

if ($request->get('controller') != 'search') { $session->delete('search.search'); }
Having said all this, I'm still not convinced of the actual issue.
bthirsk wrote: I got POed at having to backspace every time I wanted to change the terms
What does your backspace do exactly? On my browser, it makes me go back a page, unless i'm in the field, in which case, I can double click my mouse in the field, then hit backspace to delete the entire field. I'd be more "POed" if I wanted to refine my search and it simply wasn't there.

A problem well defined is a problem half solved.

I'm not convinced we need to even involve the controller in this, i'm very much of the opinion that this is a "view" user experience issue that can probably be resolved using javascript.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by Qphoria » Tue Nov 04, 2008 11:34 pm

well he means in the search box, you have to hit backspace to delete the last thing you searched for.

Either way, I don't see this as a great solution as you still have to hit backspace to delete the entry on the search page.

Perhaps a better solution would be to use some simple javascript to select all text onclick. Similar to how the browser address bars are.
Click on the url and the whole thing selects, ready for you to type over it.
Last edited by Qphoria on Tue Nov 04, 2008 11:44 pm, edited 1 time in total.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by hm2k » Tue Nov 04, 2008 11:43 pm

I thought he might have meant "go back" on the browser which would probably result in an empty field. I hardly think that highlighting a field, and hitting backspace is strenuous on a user, they understand and expect it to work like this.

As you said Qphoria, I think some kind of javascript highlight could be the way forward, much in the same way as in browsers where when you click on the address bar the whole field highlights.

This method takes out the step of treble-(not double)-clicking the mouse in the field, but you will have to hit the delete or backspace key to clear the field.

The other option is to have a "reset" button/link, that will clear the field, and set focus on the field so you can get started on it.

I'm not convinced there's an issue at all, but if there is, I don't believe the solution is in the code, but instead in the user experience of the user interface.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by Qphoria » Tue Nov 04, 2008 11:44 pm

Some stats:

Target.com clears the search but clearly shows "Your search for 'blah' has resulted in"
Amazon.com works the way opencart does now. Leaves it in the box and requires you to backspace
Prestashop works the way opencart does now.
Newegg.com works the way opencart does now..
Tigerdirect.com works like target above
ecost.com works like opencart
buy.com works like opencart
ebay.com works like opencart.
Zen-Cart works the way you'd like it.

I guess at the very least we could say that it might be a configurable thing.. but seems the majority of the big ones don't have any PO'd customers.
Last edited by Qphoria on Tue Nov 04, 2008 11:47 pm, edited 1 time in total.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by hm2k » Tue Nov 04, 2008 11:59 pm

Considering Amazon.com and ebay.com are pretty much the experts on UX for e-commerce, i'd be wanting to run with that, not that they are perfect, but pretty close.

Having said this, you only have to look at what Google and Yahoo do to understand how it should work. Thus, I really don't see an issue.

Furthermore, considering this is an open source project, I'd say this is a configurable thing should you want it enough. ;)

My advice would be to work this into your template (view) by using javascript.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by bthirsk » Wed Nov 05, 2008 12:16 am

It's not that big a problem. I all ready have it on my site.
I just thought it makes things cleaner not having previous search terms
in the search box when your not on the search page anymore and
thought other people might like that.
Thanks
Brent

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by hm2k » Wed Nov 05, 2008 12:42 am

It is worth noting that the search field in the above mentioned sites are POST/GET based, not SESSION based.

This means, on other sites, when you return to the home page, the search field is empty, as expected.

However, OpenCart retains the search session data until you overwrite it with another, or the session expires.

The reason the data is retained is mainly for the search pages, so that the entry can be amended, and for the pagination to work.

Thus, we probably only really need to use the session values on the search page itself.

And on the search page, there are two fields, one in the main template, and one as part of the actual search page itself. I propose we don't need to fill both, only the one as part of the search page, the other can remain default.

As a result, this solves all the issues.
Last edited by hm2k on Wed Nov 05, 2008 1:38 am, edited 1 time in total.

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK
Who is online

Users browsing this forum: No registered users and 3 guests