You are here:  » Changes to price field

Support Forum



Changes to price field

Submitted by jonny5 on Sat, 2008-08-16 20:53 in

Hi David,

on my product page where the item and price is displayed , i would like the price field to display exactly what is in the datafeed for the price , for instance i have a feed and the price in the feed says
"£9.99 for 1 week only" but at the moment will only show £9.99 , can this be changed to display all

also i had posted a message on your personal forum a few days ago and was wondering if you could have a quick look for me , please

many thanks

Submitted by support on Sun, 2008-08-17 11:10

Hi Jonny,

Perhaps the easiest thing to do with the price field would be to convert it into a VARCHAR(255). You could either do this using phpMyAdmin; or alternatively run the following script in the main folder of your Price Tapestry installation:

<?php
  set_time_limit
(0);
  
ignore_user_abort();
  require(
"includes/common.php");
  
$sql =
  
"ALTER TABLE `".$config_databaseTablePrefix."products` CHANGE `price` `price` VARCHAR( 255 ) NOT NULL DEFAULT '0.00'";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Having done this, it will then be necessary to remove the decimalisation from the import routine. To do this, look for the following code on line 168 of includes/admin.php:

$record[$admin_importFeed["field_price"]] = tapestry_decimalise($record[$admin_importFeed["field_price"]]);

...and simply comment out or delete this line. That should do the trick, but bear in mind that this will almost certainly have consequences in terms of sorting by price etc. The database will also have to perform conversion when calculating minPrice, maxPrice etc. which may have performance issues; so if this turns out to cause more problems than it solves for you, let me know and we'll "undo" this change and look at another way to achieve what you want to do; for example by adding the original price field as a new field in the database...

Cheers,
David.

Submitted by jonny5 on Sun, 2008-08-17 14:22

cheers David , worked with no probs , perforance was never going to be an issue as there are only a few products in the database , its a very small specific site.

cheers