Can Google Custom Search work in Able?(edit: YES)
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Can Google Custom Search work in Able?(edit: YES)
We want to use google custom search on the site but I cant get it to work.
The plan is to have the custom search input box where the Able search is now, and have the results appear on a page made for googles output.
The results are pulled with a snippet of google JS, which uses a get variable to define the search. The problem I have found is that when you make the input form target a .aspx file(which itself brings in its content and layout from scriptlets) the get variable doesnt make it to the results code snippet.
I was trying to follow instructions from here http://dotnetslackers.com/articles/aspn ... earch.aspx but this is not the same complexity as Able.
Is there a way to set up this search the way we want to?
The plan is to have the custom search input box where the Able search is now, and have the results appear on a page made for googles output.
The results are pulled with a snippet of google JS, which uses a get variable to define the search. The problem I have found is that when you make the input form target a .aspx file(which itself brings in its content and layout from scriptlets) the get variable doesnt make it to the results code snippet.
I was trying to follow instructions from here http://dotnetslackers.com/articles/aspn ... earch.aspx but this is not the same complexity as Able.
Is there a way to set up this search the way we want to?
Last edited by William_firefold on Tue Aug 18, 2009 8:07 am, edited 1 time in total.
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Can Google Custom Search work in Able?
This seems like it should be possible, but I dont know what to do in Able.
Last edited by William_firefold on Tue Aug 18, 2009 5:23 am, edited 1 time in total.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Can Google Custom Search work in Able?
I'm not sure what problems you are running in to, but try putting it into a custom conlib and then putting that conlib on the page. Merchants have had to do that with email signup programs, contact forms since all the .net pages already have a form on them.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Can Google Custom Search work in Able?
Our problem is that nothing happens when you search. The google page says that you can use an iframe on the target page to receive the search results. The search box does some unknown stuff using javascript and get variables, and ends up redirecting to the target page like so:
This works for the simple html file here, but will not work when the iframe is placed in a scriptlet or conlib. here is the code for the result page:
Im not sure where to begin, but google says this is supposed to be simple. Does anyone know where im going wrong?
Code: Select all
http://www.firefold.com/googletest2.html?cx=014731849385091516742%3Ae-rar04i5je&cof=FORID%3A10%3BNB%3A1&ie=UTF-8&q=hdmi&sa=Search#906
Code: Select all
<html>
<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 600;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script></html>
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Can Google Custom Search work in Able?
This might help- I haven't read it, though.
http://www.eggheadcafe.com/community/as ... n-asp.aspx
http://www.eggheadcafe.com/community/as ... n-asp.aspx
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Can Google Custom Search work in Able?
Very helpful.
Google Custom search(no offense) is so much better than the stock Able search. No images, but at least it can find what you are looking for.
Will post my complete code for anyone who wants to implement.
Page File
Scriptlet:
GCSResult.ascx:
Then just modify your search bar, SimpleSearch.ascx.cs:
Get the iframe code from google, and fill in your GET variables in the URL from the code that google gives you.
Google Custom search(no offense) is so much better than the stock Able search. No images, but at least it can find what you are looking for.
Will post my complete code for anyone who wants to implement.
Page File
Code: Select all
<%@ Page Language="C#" MasterPageFile="~/Layouts/Scriptlet.master" Inherits="CommerceBuilder.Web.UI.AbleCommercePage" %>
<%@ Register Assembly="CommerceBuilder.Web" Namespace="CommerceBuilder.Web.UI.WebControls.WebParts" TagPrefix="cb" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="PageContent">
<cb:ScriptletPart ID="Privacy" runat="server" Layout="Two Column" Header="Search Header" Sidebar="Short Sidebar" Content="gresult page" Footer="Footer With Google Analytics" AllowClose="False" AllowMinimize="false" />
</asp:Content>
Code: Select all
[[ConLib:custom/GCSResult ]]
Code: Select all
<div style="width:792px;padding:0 0 0 5px;background:#fff;overflow:hidden;">
<div id="cse-search-results" style=""></div></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
Code: Select all
using System;
using CommerceBuilder.Utility;
public partial class ConLib_SimpleSearch : System.Web.UI.UserControl
{
protected void SearchButton_Click(object sender, EventArgs e)
{
// string safeSearchPhrase = StringHelper.StripHtml(SearchPhrase.Text).Trim();
// if (!string.IsNullOrEmpty(safeSearchPhrase))
// Response.Redirect("~/Search.aspx?k=" + Server.UrlEncode(safeSearchPhrase));
// Response.Redirect("~/Search.aspx");
string s1=SearchPhrase.Text;
string s2=s1.Replace(' ','+').ToString();
string s3="http://www.FireFold.com/CustomSearch.aspx?cx=014731849xxxx91516742:e-rarxxi5je&cof=FORID:10;NB:1&ie=UTF-8&q="+s2+"";
Response.Redirect(s3);
}
}
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: Can Google Custom Search work in Able?
I won't take it personally that Google handles search better than we do.William_firefold wrote:Google Custom search(no offense) is so much better than the stock Able search.

Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.