You are here:  » Add content to PT Pages


Add content to PT Pages

Submitted by Perce2 on Sat, 2018-01-20 06:51 in

Hi David,

What is the best way to add content on the Merchant, Category and Brand pages ?

Maybe like to to add some page specific text or images to compliment the information on these pages, but as they are not individual WP pages not sure how to accomplish this.

Thanks for any advice.

Submitted by support on Sat, 2018-01-20 10:19

Hi,

If you create a new "content" directory in the associated Price Tapestry installation; and inside that directory create .html files with the content you wish to display named either merchant, category or brand followed by underscore, the exact merchant category or brand name as displayed on your site, with the .html extension for example;

content/merchant_Merchant Name.html
content/category_Category Name.html
content/category_Brand Name.html

Then edit the plugin file pto_search.php and look for the following code beginning at line 412:

    if (pto_common_isContainer())
    {
      $html .= pto_search_banner();
    }

...and REPLACE with:

    if (pto_common_isContainer())
    {
      global $pto_q;
      global $pto_config_externalPath;
      if ($pto_searchResultsTotal && ($pto_page == 1))
      {
        $parts = explode(":",$pto_q);
        if (in_array($parts[0],array("merchant","category","brand")))
        {
          $contentFilename = $pto_config_externalPath."content/".$parts[0]."_".$parts[1].".html";
          if (file_exists($contentFilename))
          {
            $html .= file_get_contents($contentFilename);
          }
        }
      }
      $html .= pto_search_banner();
    }

...that will display the HTML from the relevant content/ file (if exists) above the banner on page 1 of merchant / category / brand results...

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Sat, 2018-01-20 12:31

Hi David,

thank you for your quick response.

Sorry if I haven't explained properly, I am referring to the main Merchant, Category, and Brand pages (only 3 pages). Not the sub-entries contained within.
So, there would be no merchant_Merchant Name.html only the main page Merchant itself.

Hope that better explains.
Thanks.

Submitted by support on Mon, 2018-01-22 09:17

Hi,

No problem - keeping the same content/ directory within the Price Tapestry installation, create files merchant.html, category.html and brand.html containing the required content e.g.

/pt/content/category.html

Then edit the plugin file pto_atoz.php and look for the following code at line 86:

  $html = "";

...and REPLACE with:

  $html = "";
  $contentFilename = $pto_config_externalPath."content/".$pto_module.".html";
  if (file_exists($contentFilename))
  {
    $html .= file_get_contents($contentFilename);
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Wed, 2018-01-24 08:46

Hi David,

sorry for late reply...

Works perfectly!
Many thanks.