You are here:  » External Layout

Support Forum



External Layout

Submitted by Stew on Wed, 2011-02-16 11:19 in

Hi there, wondering if you can help with a ew site & some layout issues I'm having with external.php

I'll list them out,

1) I'm trying to display the merchant name, I'd also like to display a logo for the merchant (there isn't one in the feed so I think I'd have to edit external.php and add some php to say 'if merchantname == 'example' then display thisimage.gif' - or something similar!)

2)At present the external.php is displaying a product image, my feeds do not contain any images thus I'm trying to remove.

3)Just the general layout, I'd like to display the product title, then merchant image, then the buy now link all on a horizontal line, cant see how to do in the external.php?

Apologies for the 3 questions here in one thread, I've looked through external.php and cant quite see how to adjust, any help is gratefully received.

The calling code I'm using is:

<?php
$external_BaseHREF 
"http://mysite.uk/products";
$external_path "/home/public_html/mysite.uk/products/";
if (!
$_GET["sort"]) $_GET["sort"] = "relevance";
require(
$external_path."external.php");
?>

Many Thanks,

Stew

Submitted by support on Wed, 2011-02-16 13:22

Hi Strew,

The actual HTML isn't in external.php, what it does is call the html/ files from within the Price Tapestry installation, so that's where you'll find what you need to change.

If you only want to make changes externally but don't want to change how your Price Tapestry installation looks, then what you can do is create new versions of the files specifically for external.php.

For example, for a different product layout, create a new file html/productexternal.php (start with a copy of html/product.php, and then edit your external.php and look for:

require($external_path."html/product.php");

...and REPLACE that with:

require($external_path."html/productexternal.php");

Then you can start working on html/productexternal.php to get the product page layout you want.

Regarding images, they should only attempt to be displayed if a product image file has been registered. For a very basic product layout of title - merchant image - buy now link, have a go with something like this:

<?php
  $mainProduct 
$product["products"][0];
  print 
"<p>";
  print 
$mainProduct["name"];
  print 
"&nbsp;";
  if (
file_exists($external_path."logos/".$mainProduct["merchant"]))
  {
    print 
"<img src='".$external_baseHREF."logos/".$mainProduct["merchant"]."' />";
  }
  else
  {
    print 
$mainProduct["merchant"];
  }
  print 
"&nbsp;";
  print 
"<a href='".tapestry_buyURL($mainProduct)."'>Buy Now</a>";
  print 
"</p>";
?>

For the merchant logos, if you don't have one already create a logos/ folder within your Price Tapestry installation folder, and then upload merchant logo images with a filename exactly matching the merchant name as it appears on your site - including spaces - and without any file extension (e.g. .jpg)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Stew on Tue, 2011-02-22 04:23

Hi David, many thanks for this, apologies for delay in reply, have implemented today and is working for me :-)

I get it now re the /html/ folder.

Many Thanks

Submitted by Stew on Tue, 2011-02-22 13:28

Hi David, sorry me again, I'm now trying to create the same layout as per your example but in the searchresults.php, but so far it hasn't worked for me.

Do I need to include the statement:

$mainProduct = $product["products"][0];

I've included it but hasn't made a difference unless I've missed something?

Submitted by support on Tue, 2011-02-22 14:10

Hi Stew,

In html/searchresults.php there is no single product so the concept of a $mainProduct (which is the cheapest / first item on the products page) does apply.

Instead, there is a loop beginning at line 6:

    <?php foreach($searchresults["products"] as $product): ?>

...and within that loop, where you're trying to create the same layout as something using $mainProduct, just use $product instead...

Cheers,
David.
--
PriceTapestry.com

Submitted by Stew on Tue, 2011-02-22 15:00

Brilliant - worked great