You are here:  » Custom meta for discontinued merchants


Custom meta for discontinued merchants

Submitted by 2fer on Sun, 2017-02-19 05:51 in

Hi David,
I haven't tried anything different for awhile - "if it ain't broke, don't fix it" you know. Something I've wanted to be able to do just might be possible with your outstanding help.

It seems that now and then a merchant closes their business or at least their affiliate program and I am left with 4000 indexed pages I ned to Un-register and delete. I was hoping to find a more graceful way to remove entire feeds over a little more time if possible.

I've looked around and did find a method for adding custom meta tags here:
http://www.pricetapestry.com/node/5929
so I have to ask if there is a way to add a meta robots tag of "noindex,noarchive" when this happens, to make the disappearance of thousands of products less abrupt?

I can easily add an additional field and add a filter to insert the "noindex,noarchive" text, but is there a way to add it so that all merchants won't need a different tag? I mean for all to use the standard header except for a specific merchant name or datafeed name?

I'm still on the modded but pretty 13a, awaiting the next improvement before changing things much. I see there have been many improvements already! If it is part of the future version I can wait.

Thank you,
2fer

Submitted by support on Mon, 2017-02-20 09:50

Hello 2fer,

If the merchant has closed down and therefore the feed de-registered there wouldn't be a custom field value available for display however it would be no problem to add noindex,noarchive to old product pages - simply edit products.php and look for the following code at line 78:

      $banner["h2"] .= "(".translate("product no longer available").")";

...and REPLACE with:

      $banner["h2"] .= "(".translate("product no longer available").")";
      $header["meta"]["robots"] = "noindex,noarchive";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by 2fer on Mon, 2017-02-20 20:56

Thanks, David, I appreciate the suggestion, but if I use that suggestion and edit the products.php, won't it show the same for all the merchants in that shop?

The feed does not de-register automatically so I could easily edit/filter fields to add a link for a discontinued page for the link and edit the price to N/A, but I was looking for a way to let the pages remain as "dummies" until they were noindexed. Then I could de-register the feed when indexed pages are no longer indexed.

The merchant is still shown as active in some cases on the network. A "new" datafeed gets imported, but I was checking some. On one I clicked through and their server says the account was suspended. There is no indication other than that that they have closed. The images are from a different URL. Sometimes there are thousands of indexed pages gone overnight and I wanted to avoid the abrupt changes if possible.

Thanks,
2fer

Submitted by support on Tue, 2017-02-21 09:28

Hi,

That would work - in other words, modify the feed or use filters to set the Buy URL to be a local page "Discontinues" page for example:

/discontinued.php

(create discontinued.php from a copy of example.php in the distribution)

And then in products.php, look for the following code at line 72:

      $header["meta"]["keywords"] = $product["products"][0]["name"];

...and REPLACE with:

      $header["meta"]["keywords"] = $product["products"][0]["name"];
      if ($product["products"][0]["buy_url"] == "/discontinued.php")
      {
        $header["meta"]["robots"] = "noindex,noarchive";
      }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by 2fer on Tue, 2017-02-21 16:30

Thank you so much David! You always come through and I appreciate it.

I have only one question about this. Where I am editing to add:
if ($product["products"][0]["buy_url"] == "/discontinued.php")

The ["products"] won't be [0] they would still show but with a price of "N/A" and I can replace the ["buy_url"] in the feed with the "/discontinued.php" link with a regex replace filter.

It looks like this is more complicated than I thought or else (more likely) it is my very poor understanding of php. I just wouldn't want a search that returned no results to go to the discontinued page, it properly should return a 404 error.

Thank you,
2fer

Submitted by support on Tue, 2017-02-21 18:03

Hi,

In this syntax;

$product["products"][0]

...[0] refers to the first entry in the $product["products"] array - PHP arrays (non-associative) are zero based, so it's not actually referring to an instance where there are no results. Note (for comparison / info) - the code used at the top of html/product.php at line 2:

  $product_main = $product["products"][0];

...the $product_main variable is subsequently used to generate the main page body - image, description etc.

However regarding price, bear in mind that this is DECIMAL(10,2) on the database so it's not actually possible to import a value of "N/A" - instead, what I would suggest further is removing the "Best Price..." display if price is "0.00" - for 13/03A first look for the following code beginning at line 48 of html/product.php:

    <p>
      <strong><?php print $product_bestPriceText?>:</strong>
      <?php print $config_currencyHTML.$product_main["price"]; ?> <?php print translate("from"); ?>
      <?php print $product_bestPriceMerchants?>
    </p>

...and REPLACE with:

    <?php if($product_main["price"]!="0.00"): ?>
    <p>
      <strong><?php print $product_bestPriceText?>:</strong>
      <?php print $config_currencyHTML.$product_main["price"]; ?> <?php print translate("from"); ?>
      <?php print $product_bestPriceMerchants?>
    </p>
    <?php endif; ?>

And then in html/prices.php look for the following code at line 59:

<td class='pt_pr_price'><?php print $config_currencyHTML.$product["price"]; ?></td>

...and REPLACE with:

<?php if($product_main["price"]!="0.00"): ?>
<td class='pt_pr_price'><?php print $config_currencyHTML.$product["price"]; ?></td>
<?php else: ?>
<td class='pt_pr_price'>N/A</td>
<?php endif; ?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by 2fer on Wed, 2017-02-22 04:16

Thank you David,

I think I can follow that. I've modified the product.php file (to get things to html5/responsive) but I see what it is doing now and can adapt this to do the job I believe.

I will get that up and see how it goes. I am so grateful for your patience and help!

Thank you!
2fer