showing search results on web page?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

showing search results on web page?

Post by Chris Hadden » Sat Oct 22, 2011 4:35 pm

I am working on some landing pages for certain key words. How do I get a web page that acts like a category page but shows specific search results? Here is an example: I am advertising for " horse jewelry" on Google ads. When someone clicks on that I want them to land on a web page that has some sales info and then below the out put from http://www.cameojewelrysupply.com/Search.aspx?k=horse How do I do that?

Thanks
Chris

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Sun Oct 23, 2011 3:53 pm

Here's one way to do that.
  • 1. Make a copy of the Search.aspx in the root store folder and name it something like LandingPage.aspx
  • 2. Make a copy of the content scriptlet "Search" and name it something like Landing Page
  • 3. Browse to the LandingPage.aspx page (logged in as an admin)
  • 4. Change the content from Search to Landing Page
  • 5. Edit the Landing Page content scriptlet to include your sales information
  • 6. Change your link from Search.aspx?k=horse to LandingPage?k=horse
You might want to change some of your other scriptlets in the left/right hand columns and perhaps make a special version of the product display widget that links to LandingPage.aspx instead of Search.aspx.

Hopefully this will get you started.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Mon Oct 24, 2011 10:31 am

David thanks a lot for the help. I did as you said... and it works. I was wondering if the problem could also be solved by altering the conlib? right now if I use [[ConLib:SearchPage]] it outputs all items in the inventory. How difficult is it to create search conlibs that output specific keywords?

Thanks Again

Chris

plugables
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Sat Aug 15, 2009 4:04 am
Contact:

Re: showing search results on web page?

Post by plugables » Mon Oct 24, 2011 10:50 am

Hi Chris,

You probably need this http://www.plugables.com/Product-Tags-Module-P11.aspx

Supports tag based search both in merchant admin as well as retail store.
Tags can be searched and sorted based on their tag name and creation date.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Mon Oct 24, 2011 11:19 am

Chris,

You could create a new version of the SearchPage ConLib control and pass in your search keyword.

To see how to hard code a version of the SearchPage, change the

Code: Select all

_Keywords = searchSidebar.Keyword;
inside the ProcessSidebarEvent and the RefreshCriteria functions to

Code: Select all

_Keywords = "horse";
Then when you browse to the page with this new searchpage control, it will automatically search for products matching horse. You'll have a little more work to do to add a parameter to the SearchPage.ascx and SearchPage.ascx.cs files, but once you do that you can just call your new ConLib control like this:

Code: Select all

[[Conlib:Custom\KeywordSearch Term="horse"
If you don't want the CategorySearchSidebar to display, you can hide it by changing the left hand column to:

Code: Select all

[[ConLib:CategorySearchSidebar Visible="false"]]
This control has to be on the page but not visible. The left hand column will still display so you'll probably want to put something else in there too.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Mon Oct 24, 2011 12:51 pm

David, I tried this but I must be missing a step.

I made a copy of the searchpage.ascx and searchpage.ascx.cs renamed them to searchpagehorse.ascx and searchpagehorse.ascx.cs and placed them in the custom folder.

I then replaced "horse" in the two areas you told me. This is in the searchpagehorse.ascx.cs

I went and created a scriptlet [[ConLib:Custom/SearchPagehorse]]

Adding that to my web page I get this error .....Page content for horse cameo [[ConLib:Custom/SearchPagehorse]] The file '/ConLib/Custom/SearchPage.ascx.cs' does not exist.

obviously I have to change something else it is not even looking for the correct file. it is looking for searchPage as opposed to searchpage horse ?? What do you think?

Thanks again
Chris

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Mon Oct 24, 2011 1:00 pm

Chris,

Sorry, I did my work directly in the SearchPage.ascx.cs file so I did forget a step. You need to change the first line of your new SearchPageHorse.ascx file to say:

Code: Select all

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SearchPageHorse.ascx.cs" Inherits="ConLib_SearchPage" %>
Otherwise it is trying to reference the old SearchPage.ascx.cs for the code behind.

Hopefully that will get it working.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Tue Oct 25, 2011 12:18 pm

I think I have this working however,How do I get an individual page ( the horse page) to use different content and side bar settings then the rest of the web site? I have created a web page under a category I named informational pages....when I change the standard sidebar 1 ( which is what I use through the whole site to "search sidebar" it effects a lot of other pages, same thing happens when I try to change content from "web page" to my custom "search horse" now my other web pages all switched to "search horse"

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Tue Oct 25, 2011 1:29 pm

It sounds like you're using the same .aspx page to accomplish multiple tasks. Can you provide me this information:

When logged in as an ADMIN, browse to the page in the store you are trying to use as the "search horse" page. Then scroll to the bottom where you can see the Mode dropdown where you can switch between view and edit. To the far right of that dropdown is the name of the webpage you are using - something like ~/SearchPage.aspx. What does that say?

The solution will depend on your answer to that question.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Tue Oct 25, 2011 1:36 pm

I have to create a unique .aspx page in the root folder for each landing page? Is that it? . Changing layout on any dynamically created webpage.aspx seems to effect any other webpage.aspx .... unless I am missing something.

Thanks
Chris

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Tue Oct 25, 2011 1:39 pm

Yes you are correct, I was just using "add a web page" under a category to create these landing pages. They are all named webpage.aspx

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Tue Oct 25, 2011 1:44 pm

You can create a copy of the webpage.aspx and name it something else and then switch display page to that version in the admin for your new landing pages.
I would recommend you edit the new .aspx page and change the <Name>Basic Webpage</Name> to something else like Landing Page.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Tue Oct 25, 2011 2:30 pm

Yeah that's it, got it now.....Thanks so much for all your help Dave. I really do appreciate that. It would be impossible for me to figure things like this out without help and guidance from people like you on this board . Thanks again... really.

Chris

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Thu Nov 03, 2011 10:51 am

Dave, do you think it is possible to create create a custom conlib advancedsearch for a specific keyword.... the same way you told me to do with the regular search? That has worked well but now I have some landing pages where the keyword has to be pulled from the description. What do you think?

Thanks
Chris

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Thu Nov 03, 2011 5:27 pm

Chris - what version of AbleCommerce are you using? Starting with 7.0.3 the search can use the SQL Full Text Search and the standard search will search the description field.

But, I was also able to modify the AdvancedSearchPage ConLib control to let you pass a keyword. Notice that the AdvancedSearchPage uses an ObjectDataSource on the .ascx page to set up the search parameters. That means we have to take a different approach is we're going to use the advanced search method.

First, modify the AdvancedSearchPage.ascx so that the Description checkbox is checked by default. If you want, you can uncheck the Name and SKU.

Code: Select all

<asp:CheckBox ID="SearchDescription" runat="server" Text="Description" Checked="true" />
Then, modify the AdvancedSearchPage.ascx.cs code inside the Page_Load from:

Code: Select all

if (!Page.IsPostBack)
{
    InitializeCategoryTree();
}
to

Code: Select all

if (!Page.IsPostBack)
{
	InitializeCategoryTree();
	if (!String.IsNullOrEmpty(Request.QueryString["k"]))  // checks to see if a parameter was passed
	{
		Keywords.Text = Request.QueryString["k"]; // set the keywords field with the parameter
		BindProductsGrid();  // do the search
	}
}
Then you can call the advanced search page like this:

Code: Select all

http://www.mysite.com/advancedsearch.aspx?k=horse
From there you should be able to create custom versions of the advanced search page like you have the search page.

Hope that helps,
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Thu Nov 03, 2011 8:17 pm

I am using 7.0.2 I will play around with this and see if I can get it to work. Thanks Chris

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Fri Nov 04, 2011 1:11 pm

Dave, Yeah that works good. If I wanted to create a custom versions of this advanced search should I just replace ["k"] with ["horse] ?

Thanks
Chris

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Fri Nov 04, 2011 1:36 pm

You need to keep the "k" but replace the values you send on the query string. For example:

Code: Select all

http://www.mysite.com/advancedsearch.aspx?k=horse
to search for horse versus

Code: Select all

http://www.mysite.com/advancedsearch.aspx?k=submarine
to search for submarine.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Fri Nov 04, 2011 2:07 pm

Yes I understand that. I am getting the correct search output. That is working. http://www.cameojewelrysupply.com/advan ... px?k=horse

it is just that each unique address( ?=keyword) brings you to the same page. You can't really have unique content on that landing page.... like you showed me with the regular search.

http://www.cameojewelrysupply.com/Horse ... Glass.aspx

Is there a way for the advancedsearch to spit out a specific keyword result and used as a conlib ? or will it only do by adding the ?=keyword

Thanks again
Chris

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: showing search results on web page?

Post by david-ebt » Fri Nov 04, 2011 4:56 pm

I think I understand your question.

Are you looking for a page that just shows the results and maybe some custom text at the top? You don't need the advanced search controls at the top?

Try this. In your new custom control, delete all the form stuff (I think it's all in a table). Then modify the <asp:ObjectDataSource at the bottom of the ascx page to this:

Code: Select all

<asp:ObjectDataSource ID="ProductDs" runat="server" DataObjectTypeName="CommerceBuilder.Products.Product"
    OldValuesParameterFormatString="original_{0}" SelectMethod="AdvancedSearch" SelectCountMethod="AdvancedSearchCount" SortParameterName="sortExpression"  TypeName="CommerceBuilder.Products.ProductDataSource">
    <SelectParameters>
        <asp:Parameter Name="keyword" Type="String" DefaultValue="horse" />
        <asp:Parameter Name="categoryId" Type="Int32" DefaultValue="0" />
        <asp:Parameter Name="manufacturerId" Type="Int32" DefaultValue="0" />
        <asp:Parameter Name="searchName" Type="boolean" DefaultValue="false"/>
        <asp:Parameter Name="searchDescription" Type="boolean" DefaultValue="true" />
        <asp:Parameter Name="searchSKU" Type="boolean" DefaultValue="false" />
        <asp:Parameter Name="lowPrice" Type="decimal" DefaultValue="0" />
        <asp:Parameter Name="highPrice" Type="decimal" DefaultValue="0" />
    </SelectParameters>
</asp:ObjectDataSource>
This hard codes all of the search values. You'll see "horse" is the keyword and this says we don't care about the rest of the search values.

In the .cs file, you'll need to delete some code that will now produce errors. Just keep running your page until you get no errors.

Then add this line to end of your Page_Load function:

Code: Select all

BindProductsGrid();
and reload the page. It should now display the advanced search results for "horse". You can add your custom text in the control or in each landing page. You can make multiple copies of this control for each keyword or you can change the keyword back to a controlparameter and have a hidden field that you use for the search term.

Make sense?
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Chris Hadden
Commander (CMDR)
Commander (CMDR)
Posts: 182
Joined: Tue Jan 27, 2009 2:29 pm

Re: showing search results on web page?

Post by Chris Hadden » Sat Nov 05, 2011 2:03 pm

Dave,
Awesome, yeah that works perfect. Just what I wanted. You just selling your reporting tool or do you also do custom side work? Feel free to send me a personal message if your soliciting business. Thanks Again

Post Reply