You are here:  »  Difference between first and last shop


Difference between first and last shop

Submitted by Tobix on Fri, 2021-01-15 18:36 in

I am making my comparator and I am very happy with the result. (You can see it here {link saved})

I wanted to add new features like below the price in the search page the difference between the first and the last store written in small print which says "Savings x euro".
I don't know if I give the idea but this wording at the marketing level seems excellent to attract people.

Submitted by support on Mon, 2021-01-18 09:51

Hi Tobix,

Sure - from wp-admin > Settings > PriceTapestry.org edit the Search Results / Each template and look for the IF_COMPARED section, as follows in the distribution;

%IF_COMPARED%
  <em>from</em> %PRICE%
  <br />
  <a href='%PRODUCT_URL%'>Compare Prices</a>
%ELSE_COMPARED%

And REPLACE with:

%IF_COMPARED%
  <em>from</em> %PRICE%
  <br />
  <a href='%PRODUCT_URL%'>Compare Prices</a>
  %SAVING%
%ELSE_COMPARED%

Next, edit pto_search.php and look for the following code at line 39:

  $pto_searchSelect = "SQL_CALC_FOUND_ROWS id,COUNT(id) AS numMerchants,MIN(price) as minPrice";

...and REPLACE with:

  $pto_searchSelect = "SQL_CALC_FOUND_ROWS id,COUNT(id) AS numMerchants,MIN(price) as minPrice,MAX(price) as maxPrice";

And then the following code at line 581:

      $each = str_replace("%NUM_MERCHANTS%",$row->numMerchants,$each);

...and REPLACE with:

      $each = str_replace("%NUM_MERCHANTS%",$row->numMerchants,$each);
      $html_saving = "";
      $saving = ($row->maxPrice - $row->minPrice);
      if ($saving)
      {
        $html_saving = "<br />Save ".$pto_config_currencyHTML.$saving;
      }
      $each = str_replace("%SAVING%",$html_saving,$each);

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Mon, 2021-01-18 19:26

Work! ;)