You are here:  » Direct link to merchant search results


Direct link to merchant search results

Submitted by dflsports on Sat, 2011-12-17 00:14 in

I used to use

<?php
 
print "<a href='".tapestry_buyURL($product)."' rel='nofollow'>Buy Now"
?>
at
<?php
 
print $product["merchant"]; 
?>

for my old search results page,

How can I translate this to the wordpress plugin?

Submitted by support on Sat, 2011-12-17 11:39

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

Submitted by dflsports on Tue, 2011-12-20 12:44

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?

Submitted by support on Tue, 2011-12-20 13:10

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

Submitted by randza on Mon, 2012-03-12 16:21

Hi David,

Is there a way to also target blank all links ?

Regards

Submitted by support on Mon, 2012-03-12 18:19

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

Submitted by randza on Tue, 2012-03-13 09:53

Hi David,

Thank you for your answer.

I tried to modify but it seems not working.

Kind Regards,

Submitted by support on Tue, 2012-03-13 10:17

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

Submitted by randza on Tue, 2012-03-13 14:54

I'm afraid it still doesn't work.

Submitted by support on Tue, 2012-03-13 15:07

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

Submitted by randza on Wed, 2012-03-14 20:44

David,
Thank you for your support. It works !

Kind Regards