You are here:  » put an include on product page

Support Forum



put an include on product page

Submitted by wilkins on Fri, 2006-12-01 11:30 in

hi

Is there any way to put an page include on the product page that would bring a page based on the mercant name.

An example would be

In the price box, the merchants name is displayed. What i want to do is create a page for the merchants to give extra info such as there address and tel no, then included this page on the product page just below the price info when that merchants product is shown.

Brent

Submitted by support on Fri, 2006-12-01 12:17

Hi Brent,

I would use a technique similar to the merchant logos mod described in this thread:
http://www.pricetapestry.com/node/314

Basically, create a sub-directory called "merchants", and place in that directly HTML files (they don't need to contain any PHP) with the filename exactly matching the merchant names that you have registered each feed with. You can then use code like this within html/prices.php

<?php
  
if (file_exists("merchants/".$product["merchant"]))
  {
    require(
"merchants/".$product["merchant"]);
  }
?>

That code would work within the price box loop; where $product contains each product record.

If you only wanted to bring code based on the featured / lowest price merchant you would need to use the code in html/product.php with the variable $mainProduct["merchant"].

Hope this helps;
Cheers,
David.

Submitted by Oisin on Thu, 2007-01-04 06:37

<?php
      
if (file_exists("merchantinfo/".$product["merchant"]))
      {
print 
"<a href='"merchantinfo/".$product["merchant"])'>Merchant Info</a>";
      }
      else
      {
        print 
"&nbsp;";
      }
      
?>

david, can you please look at my code.. i want to use a pop-up JS or ajax popup to open simple html page located on the merchantinfo folder. I keep getting errors, it must be an error in php tags. If this can be done using ajax using a modified lightbox ajax code here
http://www.pricetapestry.com/node/719 that would be even better.

thank you.

Submitted by support on Thu, 2007-01-04 09:40

Hi Oisin,

The first thing I notice is that you are not explicitly referencing the top level directory of your Price Tapestry installation; so this mod may not work on the product page if you are using search engine friendly URLs. I would add a reference to $config_baseHREF as follows:

<?php
      
if (file_exists("merchantinfo/".$product["merchant"]))
      {
print 
"<a href='".$config_baseHREF."merchantinfo/".$product["merchant"]."'>Merchant Info</a>";
      }
      else
      {
        print 
"&nbsp;";
      }
?>

There were also some PHP syntax errors in your print statement which I have correct in the above text. If you want it to load in a new window don't forget that you can add target='_BLANK' to the link...

Cheers,
David.