I used to use
<?php
print "<a href='".tapestry_buyURL($product)."' rel='nofollow'>Buy Now";
?>
<?php
print $product["merchant"];
?>
for my old search results page,
How can I translate this to the wordpress plugin?
Thanks for answering my last question.
What if I want to have links to both the product page and a direct link to the merchant? Seems like the code replacement would not allow this?
Hi,
You could implement an additional placeholder for the product page URL - try adding the following on the line after the modification above:
$each = str_replace("%PRODUCT_HREF%",pto_common_productHREF($row),$each);
...and in the Search Results / Each HTML template you can use %PRODUCT_HREF% to get a link to the product page in addition to using %PRODUCT_URL%.
A tidier approach might actually be to undo the initial modification, and instead simply add:
$each = str_replace("%BUY_URL%",pto_common_buyURL($row),$each);
e.g. using %PRODUCT_HREF% as the product page URL as before, with the new %BUY_URL% placeholder for a link the actual buy URL...
Cheers,
David.
--
PriceTapestry.com
Hi David,
Is there a way to also target blank all links ?
Regards
Hi randza,
Within the plugin this can be managed through your templates. If you go to wp-admin > Plugins > Settings and then scroll down to HTML > Prices / Each within that template you'll find this line:
<td><a href='%BUY_URL%'><nobr>Visit Store</nobr></a></td>
...which you can replace with:
<td><a href='%BUY_URL%' target='_BLANK'><nobr>Visit Store</nobr></a></td>
Cheers,
David.
--
PriceTapestry.com
Hi David,
Thank you for your answer.
I tried to modify but it seems not working.
Kind Regards,
Sorry Randza,
I copied the above from pto_default.php which contains escape characters that don't appear in the actual template - the replacement should be:
<td><a href='%BUY_URL%' target='_BLANK'><nobr>Visit Store</nobr></a></td>
(corrected above also)
Cheers,
David.
--
PriceTapestry.com
Hi Randza,
The above would apply to the Visit Store links in the price comparison table only; there would actually be another change required in the code if the links you want to open in new window are the Best Price £1.23 from Merchant.
In this case, if you edit pto_product.php and look for the following code at line 337:
$price_links[] = "<a href='".pto_common_buyURL($price_product)."'>".$price_product->merchant."</a>";
...and REPLACE with:
$price_links[] = "<a target='_BLANK' href='".pto_common_buyURL($price_product)."'>".$price_product->merchant."</a>";
Cheers,
David.
--
PriceTapestry.com
David,
Thank you for your support. It works !
Kind Regards
Hi,
Sure - in pto_search.php, look for the following code at line 494:
$each = str_replace("%PRODUCT_URL%",pto_common_productHREF($row),$each);
...and REPLACE with:
$each = str_replace("%PRODUCT_URL%",pto_common_buyURL($row),$each);
Cheers,
David.
--
PriceTapestry.com