Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Integrating 3rd party search engine

Integrating 3rd party search engine

Locked

Started by paul3648 on 3 May 2007, 12:44 PM · Views: 2,137

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

Post #1 by paul3648

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

Post #2 by 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

Zen-Venom Get Bitten

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

paul3648

Zen Follower

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

Post #3 by paul3648

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

Post #4 by kobra

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

Zen-Venom Get Bitten

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

paul3648

Zen Follower

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

Post #5 by paul3648

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,512
Plugin Contributions:
176

Post #6 by drbyte

try using the header_php.php file in your page.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

paul3648

Zen Follower

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

Post #7 by paul3648

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,512
Plugin Contributions:
176

Post #8 by drbyte

What's in the files?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

paul3648

Zen Follower

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

Post #9 by paul3648

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

Post #10 by paul3648

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,512
Plugin Contributions:
176

Post #11 by drbyte

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.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

paul3648

Zen Follower

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

Post #12 by paul3648

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!