hi david,
i have been working on my site for a week now and am really liking price tapestry. i have done some modifications to PT i have done multiple images in xml forgot what node also i have done node 822 for logging querys and the follow on node for most popular search. i have also set up 2 extra fields in the product database table one for currency and one for keywords.
basically what i would like to know is if there is a way to output these fields in wordpress and also as for one feed there is multiple images for each product i have managed to get the images into the database and display them in price tapestry but im not sure how to integrate multiple images into the wordpress plugin.
i tried to output some extra fields like currency with %CURRENCY% but to no avail. also tried some script for the logging on wordpress and couldn't get it to log the querys from wordpress.
Hi David
Thank you for the support.
Cheers
Michael
hi again David i managed to get the custom fields sorted thanks for the link, but im still having dificulty setting up wordpress to deal with multiple images, after a bit of searching i found the origial node i followed 4610. i need a way to set up the php in wordpress so its got the correct delimiter and foreach but i cant figure it out i tried vaious %IF_EVERY% combinations but nothing seemed to work for the images. it would be ideal if there is a way to include the php in the backend gui so i could set up the single image for the search results and featured products and multiple images on the product page. is this possible?
Hello Michael,
I'll investigate the use of PHP code within templates (should be possible using 'eval') but in the mean time; a similar multiple images mod within the plugin would be as follows. First look for the following code at line 303 in pto_product.php:
$html_product = str_replace("%IMAGE_URL%",$product->image_url,$html_product);
...and REPLACE with:
$images_html = "";
$images = explode(",",$product->image_url);
foreach($images as $image_url)
{
$images_html .= "<img width='180' src='".$image_url."' />";
}
$html_product = str_replace("%IMAGES%",$images_html,$html_product);
Finally, in your Product / Main template (wp-admin > Settings > PriceTapestry.org), in place of the default line:
<img class='pto_product_image' src='%IMAGE_URL%' />
...use just:
%IMAGES%
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
hi david thanks for the help i managed to get the images to display with that, i just had to make one correction. i had to change:
$html_product = str_replace("%IMAGES%",$image_html,$html_product);
$html_product = str_replace("%IMAGES%",$images_html,$html_product);
$image_single = $imagess;
$imagess = explode(",",$product->image_url);
$product->image_url = $images[0];
$html_product = str_replace("%IMAGE_S%",$image_single,$html_product);
%IF_IMAGE%
<img class='pto_product_image' src='%IMAGE_S%' />
%ENDIF_IMAGE%
Ok so i managed to get it working so the whole thing is as follows:
if ($product->image_url)
{
$images_html = "";
$images = explode(",",$product->image_url);
foreach($images as $image_url)
{
$images_html .= "<img width='180' src='".$image_url."' />";
}
$html_product = str_replace("%IMAGES%",$images_html,$html_product);
$image_single = "";
$images = explode(" ,",$product->image_url);
$image_single = $images[0];
$html_product = str_replace("%IMAGE_S%",$image_single,$html_product);
$html_product = str_replace("%IF_IMAGE%","",$html_product);
$html_product = str_replace("%ENDIF_IMAGE%","",$html_product);
}
else
{
$html_produc = preg_replace('/%IF_IMAGE%(.*)%ENDIF_IMAGE%/','',$html_product);
}
Thanks for the update, Michael, and I've corrected the inital typo above...
Cheers,
David.
--
PriceTapestry.com
Hi Michael,
Thank you for your comments!
Custom fields can be output within the plugin using %DB_fieldname% - check out this page on PriceTapestry.org for more information. It is case sensitive, so if the custom field in your database is "currency" then the placeholder, which can be used anywhere within the Product / Main and Price / Each templates would be %DB_currency%
Cheers,
David.
--
PriceTapestry.com