You are here:  » Price & Date


Price & Date

Submitted by philstone on Tue, 2006-04-04 09:57 in

Was thinking it would be an idea in the price column to add script underneath the price with the date that the price on PT was imported - Which file would this need added to and what script would i need to get the DD/MM/YYYY format

just like at Pricerunner

regards

Submitted by support on Tue, 2006-04-04 10:15

Hi Phil,

Here's what i'd do. Firstly, create new function in includes/tapestry.php called tapestry_priceDate as follows:

<?php
  
function tapestry_priceDate($merchant)
  {
    global 
$config_databaseTablePrefix;
    
$sql "SELECT imported FROM `".$config_databaseTablePrefix."feeds` WHERE merchant='".$merchant."'";
    
database_querySelect($sql,$rows);
    return 
date("d/m/y",$rows[0]["imported"]);
  }
?>

Then, you can use that function call in html/prices.php by changing the line that displays the price to something like the following:

<td align='center'><strong><?php print $config_currencyHTML.$product["price"]; ?></strong><br /><small><?php print tapestry_priceDate($product["merchant"]); ?></small></td>

If you want to use a different date format; you simply need to change the first parameter to the date() function in tapestry_priceDate(), as per the date format specification:

http://uk.php.net/manual/en/function.date.php

Hope this helps!

Submitted by philstone on Tue, 2006-04-04 11:11

looks sweet Dave, thanks!!!