You are here:  » Add #id selector to Amazon output


Add #id selector to Amazon output

Submitted by Perce2 on Tue, 2017-06-20 13:03 in

Would it be possible to give the Amazon's search results an id selector , so that they can be removed off page using css where they are not needed ?

When using [pto search="keyword"] on pages, I need to remove associated Amazon results that show.

Thanks.

Submitted by support on Tue, 2017-06-20 13:09

Hi,

API modules can be disabled when the search results HTML is generated from a non plugin generated page (e.g. from a shortcode) - to do this, edit the plugin file pto/pto_search.php and look for the following code at line 433:

  if ($pto_config_apiSearch)

...and REPLACE with:

  if ($pto_config_apiSearch && pto_common_isContainer())

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Wed, 2017-06-21 14:57

That sorted it, thanks David.

Would it also be possible to paginate the results from a shortcode ?
Right now, it lists the first X number of items, dependent on how many you have set to show per page, then stops with no choice to view further.

Thanks.

Submitted by support on Wed, 2017-06-21 15:44

Hi,

Sure - the navigation HTML can be output following the search results shown by a shortcode - the links will go to the normal plugin generated search results page. To do this, edit pto.php and look for the following code at line 826:

          $html .= pto_search();

...and REPLACE with:

          $html .= pto_search();
          $html .= pto_search_navigation();

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Wed, 2017-06-28 16:44

Hi David,

just noticed, Amazon search results are omitted from the results using this mod, but only on page 1. When selecting any other page they re-appear.

Is there a way to stop that ?

Thanks in advance.

Submitted by support on Thu, 2017-06-29 08:29

Hi,

Not easily i'm afraid as you leave the page containing the shortcode and from then on it is standard search but one option would be to suppress Amazon results for anything you are currently using as the query parameter in shortcodes throughout the site which would be straight forward. To give this a go, as an alternative to the first replacement described above to line 433 of pto/pto_search.php

  if ($pto_config_apiSearch && pto_common_isContainer())

use instead:

  global $pto_q;
  $noApi = array("Query 1","Query 2");
  if ($pto_config_apiSearch && (!in_array($pto_q,$noApi)))

Edit the $noApi replacing Query 1 etc. with the search terms being used in shortcodes (add to the array if necessary with comma separated values in "quotes") and that will suppress API results for any queries using those terms...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Thu, 2017-06-29 11:25

Hi,

tried to apply that code but it gives a syntax error!

Thanks.

Submitted by support on Thu, 2017-06-29 11:32

Ooops - semi-colon missed off the second line in the replacement - corrected above...

Cheers,
David.
--
PriceTapestry.com