Forums / General Questions / Search results direct to product detail page

Search results direct to product detail page

Started by mmwilcox on 17 Feb 2012, 6:34 PM · Views: 792

Results 1 to 7 of 7
17 Feb 2012, 6:34 PM
#1
mmwilcox avatar

mmwilcox

New Zenner

Join Date:
Nov 2007
Location:
Huntington, Indiana
Posts:
67
Plugin Contributions:
0

Search results direct to product detail page

Is there any way to have a search result to directly to the detail product information page?

If I enter a specific part number (or ask a customer to do so), it first goes to the search results page, shows just the one item, and the user has to click again for the detail page.

It would be slick if the search results would go direct to the detail page when just one result is found in the search.

Possible?

Thanks,

18 Feb 2012, 5:44 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Search results direct to product detail page

You could edit the file:
/includes/modules/pages/advanced_search_results/header_php.php

and add the code in RED so when ever there is only 1 Product found it goes to the product_info page ...

$breadcrumb->add(NAVBAR_TITLE_2);

// bof: if only 1 search result skip listing and go to product_info
$chk_count = $db->Execute($listing_sql);
if ($chk_count->RecordCount() == 1) {
    zen_redirect(zen_href_link(zen_get_info_page($chk_count->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($chk_count->fields['master_categories_id']) . '&products_id=' . $chk_count->fields['products_id']));
}
// eof: if only 1 search result skip listing and go to product_info

$result = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_LISTING, 'p.products_id', 'page');

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Feb 2012, 8:16 PM
#3
mmwilcox avatar

mmwilcox

New Zenner

Join Date:
Nov 2007
Location:
Huntington, Indiana
Posts:
67
Plugin Contributions:
0

Re: Search results direct to product detail page

Great piece of code... Way above my coding ability, so thank you!

As for the other post, that was a different topic so I created a different thread. That was looking for a way to enter a list of items directly into the shopping cart without having to visit each product page first. Like a user entry box on the shopping cart page.

18 Feb 2012, 10:06 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Search results direct to product detail page

Thanks for the update that this worked ... :smile: sorry for the mix up on your other post ... :blink:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

19 Feb 2012, 9:45 PM
#5
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town & London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Search results direct to product detail page

Some years ago we developed a ZC site for a supplier of teaching aids. Each year, he would send detailed printed product catalogs to schools, listing the Products, and (naturally) the Product Code.

We found and installed THIS module.

One drawback is that it does not handle products with attributes, nor products with quantity discounts.

Also... it hasn't been updated for some time.

You may consider installing it on a TEST site, and see if it works for you.

20 Feb 2012, 2:56 PM
#6
mmwilcox avatar

mmwilcox

New Zenner

Join Date:
Nov 2007
Location:
Huntington, Indiana
Posts:
67
Plugin Contributions:
0

Re: Search results direct to product detail page

Thank you for the link. That sounds like what I was looking for. We don't use attributes but do use qty discounts, so we will look at that and run some tests.

Thanks again!

20 Feb 2012, 8:09 PM
#7
mmwilcox avatar

mmwilcox

New Zenner

Join Date:
Nov 2007
Location:
Huntington, Indiana
Posts:
67
Plugin Contributions:
0

Re: Search results direct to product detail page

fairestcape:

Thanks again for the referral to the Quick Order module. It seemed to work fine with our quantity discounts.

I did make one code change to allow users (and us) to enter the product_id instead of the product_model which, in our case, is much simpler.