Hi David,
I've already asked some of these questions in the Pricetapestry.com forum and you've helped me a lot so far.
Integrating PT in WP now causes some questions and I appreciate your support once again.
1. I would like to add a custom field "shipping" in the WP product template.
In the products.php I did something like this, which worked fine:
<?php
print $mainProduct["shipping"];
if ($mainProduct["shipping"] == ""){
echo "Not specified"
};
endif;
?>
How to add this field in the WP template?
2. I want to display the date of the last update on the product page. In the forum I found something like this:
<?php
$sql = "SELECT imported FROM `".$config_databaseTablePrefix."feeds`
WHERE merchant='".database_safe($mainProduct["merchant"])."'";
database_querySelect($sql,$rows);
$updated = date("d.m.Y",$rows[0]["imported"]);
print $updated;
?>
How to do this in the WP template?
3. I would like to reformat the prices to the german notation.
You already told me how to to this:
<?php
print number_format($product["price"],2,",",".")." ".$config_currencyHTML;
?>
How and where to apply this in the WP files?
Thank you very much and best regards
Bernhard
Hi Bernhard,
Re: 1/
To pull in the value of the shipping field you can use the placeholder %DB_shipping% within your Product / Main template (wp-admin > Settings > PriceTapestry.org). The same placeholder may also be used within the Prices / Each template.
Re: 2/
To add support for a %UPDATED% placeholder in the Product / Main template; edit pto_product.php and look for the following code at line 293:
$html_product = $pto_html_product;
...and REPLACE with:
$products_result = $wpdb->last_result;
$sql = "SELECT imported FROM `".$pto_config_databaseTablePrefix."feeds` WHERE filename = '".$wpdb->escape($product->filename)."'";
$wpdb->query($sql);
$updated = $wpdb->last_result[0]->imported;
$wpdb->last_result = $products_result;
$html_product = $pto_html_product;
$html_product = str_replace("%UPDATED%",date("d.m.Y",$updated),$html_product);
Re: 3/
For the main product info and price comparison table, perform a search and replace in pto_product.php
Search:
$product->price
Replace:
number_format($product->price,2,",",".")
And in pto_search.php and pto_featured.php
Search:
$row->price
Replace:
number_format($row->price,2,",",".")
Hope this helps!
Cheers,
David.
--
PriceTapestry.com