You are here:  » leave old products in database

Support Forum



leave old products in database

Submitted by remco on Thu, 2012-05-03 10:32 in

Hello david

Searched the forum but could not find any answer
the question is simple.

when importing feeds weekly i want that old products that are not anymore in the feeds will stay in the database
so when a user comes from google they see the product page and with message "no prices found"

is this possible ?

Regards
Remco

Submitted by support on Thu, 2012-05-03 10:40

Hello Remco,

Sure - first of all you'd need to implement the "keeping track of new products" mod from this thread.

However, to keep old products in the database, leave out these lines from the modification to includes/admin.php

    $sql = "DELETE FROM `".$config_databaseTablePrefix."products` WHERE deleteme=`1`";
    database_queryModify($sql,$insertId);

With that in place, old products will have deleteme=1 in the database, so you can use that flag on the product page to show "no prices found". To do this, in products.php look for the following code beginning at line 116:

  if (isset($product)) require("html/product.php");
  if (isset($prices)) require("html/prices.php");

...and REPLACE with:

  $oldProduct = TRUE;
  foreach($product["products"] as $p)
  {
    if (!$p["deleteme"])
    {
      $oldProduct = FALSE;
      break;
    }
  }
  if ($oldProduct)
  {
    if (isset($product)) require("html/oldproduct.php");
  }
  else
  {
    if (isset($product)) require("html/product.php");
    if (isset($prices)) require("html/prices.php");
  }

Finally, make a copy of html/product.php as html/oldproduct.php; and then edit the file down to exclude the cheapest price display code (let me know if you're not sure what to remove) and replace with your "Sorry, no prices currently available" message...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by remco on Mon, 2012-05-07 18:17

Hi david

I did all the things but your solution is not working i,m affraid ?

after i changed it all i imported a updated feed a from a merchant and the results whent from 500 to 336 ?

i have to say that i not followed the "keeping track of new products" mod thread.
is this necessary ?

Regards

Remco

Submitted by support on Tue, 2012-05-08 09:51

Hi Remco,

Sorry, yes - the modifications in the keeping track of new products thread are required - in particular the new deleteme field in the database which is what you can use to identify that a product is "old"...

If you're not sure of any of the changes email me any file you're not sure about and I'll apply / check the changes for you...

Cheers,
David.
--
PriceTapestry.com