You are here:  » Adding additional fields to the price comparison table

Support Forum



Adding additional fields to the price comparison table

Submitted by evismaniac on Tue, 2008-08-05 14:45 in

Hi there.

Pretty sure this is going to be simple, and I have had a look around but cant figure it out still.

I have my price comparison table which lists retailer, product name, price, and link to store. All good!

But I need to add 2 more columns to this table that display data from the feed file. one is 'delivery cost' and the feed heading is 'delivery_cost' and the other is 'total price' which is 'total_price' in the feed.

I have modified my feed files to include both the delivery cost in £ and also the total price in £. (I edit the feed manually as there aren't that many products in there).

I have tried using the additional fields when registering the feed ('brand' and 'category', but using my own names 'Delivery and Total', but cant see how to display these in the prices.php.

My prices.php is all layed out correctly with the additional two columns, I'm just not 100% sure what needs to be in there to 'actually' display this info? i.e

<?php
 
print $config_currencyHTML.$product["price"]; 
?>
will display the price, but what tells it to display both delivery and total?

many thanks for any help!

Submitted by support on Tue, 2008-08-05 14:49

Hi,

If the fields are called "delivery" and "total", you will be able to access these in the $product array using:

$product["delivery"]

and

$product["total"]

(the fields in the $product array are exactly what is in the products table in the database)

Let me know if you need more help in terms of where to use this inside prices.php

Cheers,
David.

Submitted by evismaniac on Tue, 2008-08-05 16:58

Hi David,

Thanks for the reply.

i think that I did actually try this with no luck unless it was because i was using

print $config_currencyHTML.$product["delivery"];

maybe?

I have however modified the 'brand' and category' to work with these prices now, so almost there, but the only issue I have now is that even though I have modified the 'brand' and 'category' using phpmyadmin to completely replicate the 'price' ( i.e DECIMAL(10,2) ) and have ensured that they are the same format in my feed file....... for some strange reason they are being displayed with the wrong decimals. for example postage cost of £3.90 is showing as £390.00 and total price of £202.88 is showing as £20288.00.

Do you know what I may have missed? or what could be causing this?

Im almost there now :) Thanks again for your help!!

Submitted by support on Tue, 2008-08-05 17:15

Hi,

Are you using Price Tapestry's decimalise() function in the import record handler to make sure the fields are converted to decimal correctly before INSERTing?

You will see how the normal price field is treated in this way on line 168 of the original includes/admin.php:

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

...however i'm not sure what format would cause MySQL to import the field as the supplied value multiplied by 100...

If this doesn't help if you could email me a copy of your modified includes/admin.php i'll check it over for you...

Cheers,
David.

Submitted by evismaniac on Tue, 2008-08-05 21:18

Thanks David.