Zen Cart Logo
Forums / General Questions / Integrating 3rd party search engine

Integrating 3rd party search engine

Locked

Views: 2,130

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
3 May 2007, 12:44 PM
#1
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Integrating 3rd party search engine

The ZC search function is not great for my site because it only searches products. My site is light on products and heavy on articles.

So...I would like to know if it's feasible to integrate a 3rd party search engine that uses a spider to search and index the entire site. The search results page is a php file with a single php include command.

I've seen a few workarounds for integrating php code in ZC pages, so it seems to be technically possible, but are there are security or other reasons why I should not attempt to do this?

3 May 2007, 1:31 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Integrating 3rd party search engine

As the pages perse' do not exist until they are assembled for the DB data I doubt that a search engine can locate what you are trying to do

3 May 2007, 3:32 PM
#3
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Integrating 3rd party search engine

kobra:

As the pages perse' do not exist until they are assembled for the DB data I doubt that a search engine can locate what you are trying to do

The pages are indexed with a spider - it sees and indexes pages exactly as a search engine like Google.

3 May 2007, 8:22 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Integrating 3rd party search engine

If your 3rd party engine does this, then try using it.

9 May 2007, 5:01 AM
#5
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Integrating 3rd party search engine

This is coming along great, but I have last problem:

The search engine requires two files to be included in header of the search result page.

For testing purposes I've put these files in the includes/application_top.php file:

include('os2/config.php');
include('os2/head.php');

This works, except I get an error on the home page.

How do I include these files on only the search results page?

The search results page was created according to the about us page contribution and is called search_return.

9 May 2007, 10:53 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Integrating 3rd party search engine

try using the header_php.php file in your page.

9 May 2007, 3:01 PM
#7
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Integrating 3rd party search engine

DrByte:

try using the header_php.php file in your page.

When I do that I get a huge number of errors whenever I call the search_return page.

The first error is this:

Notice: Undefined variable: this_is_main_page in /home/teagen/public_html/newtest/includes/templates/template_default/common/tpl_main_page.php on line 51I guess what I'm trying to do is beyond my limited (non-existent) programming skills. :cry:

Too bad, because it was almost there when I used the includes/application_top.php file.

9 May 2007, 3:23 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Integrating 3rd party search engine

What's in the files?

10 May 2007, 4:32 AM
#9
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Integrating 3rd party search engine

What's in the files?

As far as I can tell, mostly database calls. I'm using a separate database from the ZC dB.

I'm attaching the two files.

11 May 2007, 7:33 AM
#10
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Integrating 3rd party search engine

DrByte:

try using the header_php.php file in your page.

What does this file actually do? Does it insert data before the opening html tag?

This is from the docs of the search engine I'm trying to use:

First you should see that there are two included files right at
the top of the page: "os2/config.php" and "os2/head.php". These files
set up the environment and handle the search process, so they must be
included in the results page before any HTML output. This means
before the <html> tag, and before any other whitespace. Otherwise you
will get many "Headers could not be sent" errors.So can I use the header_php.php file for this?

11 May 2007, 8:08 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Integrating 3rd party search engine

Yes.

In this document which explains the program flow of Zen Cart, you'll see that the header_php.php file processes code "before" the "header" is generated. It does all the background processing before anything is sent to the browser (except perhaps a "headers already sent" or other error-related messages), including the <HTML> and <HEAD> tags.

Program-Flow document:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_54&products_id=378

However, with that said, from what you've posted earlier, when you're inserting your "include" statements for those files, you're somehow getting an error message (the variable not found message) which suggests that somehow the normal flow of the Zen Cart page-loading activity has been intercepted and pieces of it skipped. I'm not sure exactly why.

Where exactly in the header_php.php file did you put the includes? Without studying it in great detail thus far, I would start by suggesting putting them at the end, before the closing ?> tag.

11 May 2007, 3:48 PM
#12
paul3648 avatar

paul3648

Zen Follower

Join Date:
Mar 2007
Location:
Taiwan
Posts:
239
Plugin Contributions:
0

Re: Integrating 3rd party search engine

The error messages that were being generated were ZC errors made visible by this line of code in the search engine:

error_reporting(E_ALL);

I commented out that line and all works well.

I'm happy - thanks for your help!