You are here:  » Removing Price on Selected Feeds


Removing Price on Selected Feeds

Submitted by bat on Thu, 2023-01-26 13:35 in

Hi David,
I hope you're well.
I've got a specific feed where I don't want to use the product price but instead have a generic text like "Check Website".

What would be the best way to do this?

Thank you

Submitted by support on Thu, 2023-01-26 13:51

Hi,

One way to do this would be to first use a Search and Replace RegExp filter on the price field for the feed using Search:

/.*/

...and Replace:

0.00

Then in includes/tapestry.php look for the following code at line 308:

    $price = str_replace(".",$config_currencySeparator,$price);

...and REPLACE with:

    if ((string)$price==="0.00") return "Check Website";
    $price = str_replace(".",$config_currencySeparator,$price);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Thu, 2023-01-26 14:05

Brilliant, thank you David!

If I wanted that 'Check Website' to hyperlink to the merchant's product page, what would that be please?

Submitted by support on Fri, 2023-01-27 10:14

Hi,

Try this alternative replacement to the above;

    global $product;
    if ((string)$price==="0.00")
    {
      if (isset($product["buy_url"])) return "<a href='".tapestry_buyURL($product)."'>Check Website</a>";
      return "Check Website";
    }
    $price = str_replace(".",$config_currencySeparator,$price);

The global $product will pick up for featured products, search results and the price comparison table however is not set where the best price is displayed alongside the product image; let me know if you also require the modification there if using...

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Fri, 2023-01-27 16:34

Hi David,
Thank you, I tried that code but it made the price field and those fields following it in the price table disappear, and where the featured products on the front were from that merchant, the first appearance of its product made the subsequent html disappear.

Submitted by support on Sat, 2023-01-28 09:46

Sorry about that, the code should have used tapestry_buyURL() not tapestry_href(). I've corrected the alternative replacement above...

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Sun, 2023-01-29 15:52

Smashing! Works like a treat, thank you!