How to set up the search comparison widget

There are two widgets in Price Comparison Pro – the standard ‘price comparison’ table that you can add through shortcodes on any page, or on each WooCommerce product detail page. With WooCommerce, that means you need to have each product added along with alternative URLs for each product to populate the price comparison table.

We created the search comparison widget to make things quicker and easier to get started. All you need to do is provide search URLs for your target affiliate sites and the widget will take care of the rest.

There is very little configuration required with the search comparison widget. For example, there is no need to configure CSS or xPath selectors because it’s quite easy to spot the search results on a search page and figure out where the prices and the images are.

What is a search URL

The search URLs required by the search comparison widget are any URL that is in your browser after you have performed a search on their site. Here are some examples for ‘BMW’:

  • https://www.kijijiautos.ca/cars/bmw/
  • https://www.autotrader.ca/cars/bmw/3%20series/on/maple/?rcp=15&rcs=0&srt=3&prx=100&prv=Ontario&loc=L6A0J7&kwd=bmw&hprc=True&wcp=True&sts=New-Used&inMarket=advancedSearch
  • https://ca.cargurus.com/Cars/inventorylisting/viewDetailsFilterViewInventoryListing.action?sourceContext=carGurusHomePageModel&newSearchFromOverviewPage=true&inventorySearchWidgetType=AUTO&entitySelectingHelper.selectedEntity=&entitySelectingHelper.selectedEntity2=&zip=N5Y+3J1&distance=50000&searchChanged=true&lostFilters=Text+Search&modelChanged=true&filtersModified=true
  • https://www.carpages.ca/used-cars/search/?search_radius=100&province_code=on&city=toronto&ll=43.670791055676407,-79.392554685961685&keyword=bmw

Note: When generating your search URLs, it’s important you use keyword search. That’s the only type of search that the search comparison widget will work with.

For example, see the image below – don’t select the dropdowns for BMW and then expect search comparison to work, unless you are creating a search comparison widget specifically for BMWs and then you want keyword search within all the BMWs.

Search Comparison Page Options

The first step is to figure out what kind of search comparison you are going to create. Are you creating something that will search ALL of your target websites or are you creating something that only searches ‘dog toys’. This is important, because if – for example – you include a department store in your search results, then you should narrow your search results down to the dog toys category before performing your keyword search to generate your search URL.

With some sites, you will need to perform your keyword search first and then narrow the category to get the correct search URL.

Here’s an example from FoundThru of a site-wide search URL vs a dog-toys restricted search URL (I’m searching for ‘chicken’):

Site-wide: https://foundthru.com/search/chicken/?sssid=8&post_type=product

Dog-toy category specific: https://foundthru.com/product-category/dogs/dog-toys/?s=chicken

Notice how the placement of the search keyword has altered slightly. Which search type you choose depends on your use-case – if you have a site specific to dog toys, it makes sense to use the 2nd version above, if your site allows users to search EVERYTHING from your target sites then the first version is what you need.

Once you have your search URL for your target sites, visit wp-admin -> Price Comparison Pro -> Search Comparison and set up your websites.

Configuring your websites for Search Comparison

The bare minimum you need are:

  • Website name
  • Search URL

We’ll cover the others later.

For the search URL, take the URLs you generated earlier and replace the text you searched for with the {productname}. So, using our two examples, they would become:

  • https://foundthru.com/search/{productname}/?sssid=8&post_type=product
  • https://foundthru.com/product-category/dogs/dog-toys/?s={productname}

The search comparison widget automatically figures out if it needs to HTML encode the product name depending on whether it is in a parameter or in the URL.

The Website Name you choose is for your reference only – if you are creating multiple search widgets against a single site inside different categories, then you’ll have to create multiple entries for that site to configure each Search URL. Here’s how it looks when I add the site-wide and the dog-toy-specific search URLs for FoundThru.

Adding Search Comparison to a single page

This is your most likely starting point. The search comparison widget has a couple of display options – either full screen, similar to normal searches, or a ‘related products’ widget which can be automatically added to every product-detail page on your site. If it’s added to woocommerce pages, the product name for that product detail page is what will be used for the search.

The full page search shortcode takes this form:

[pcpro_searchcomparison websites=”name1,name2,name3…” display=”searchform” buttontext=”GO” placeholder=”Search…”]

You don’t have to pre-populate the productname – just leave that blank if you wish. So, our dog-toys search would be like this, just searching against 1 site:

[pcpro_searchcomparison websites=”foundthrudogtoys” display=”searchform” buttontext=”GO” placeholder=”Search…”]

So, then when I visit the page where I added this shortcode and search for ‘beef’ I get this page:

Note: The broken placeholder is where the icon for FoundThru would appear if I’d configured it. I’ll clean this up a little later.

 

Did this article answer your question?

Leave a Reply

Your email address will not be published. Required fields are marked *


Pin It on Pinterest

Share This