Google links to deleted products

From AVACTIS : Ecommerce Shopping Cart Software Wiki
Jump to: navigation, search

Question: We have a link referenced in google... but this item no longer exists in our Database...

If a link to your product is saved in the Google database, but the product was deleted, the page with blank central part will be displayed. In order to redirect visitors from such pages to your "index.php" page open the "avactis-system/modules/catalog/catalog_api.php"file and find the following part of code:

function setCurrentProductID($pid)
   {
       global $application;
       if ($this->isCorrectProductId($pid))
       {
           //                 storefront -          ,                  Offline:
           if (modApiFunc('Users', 'getZone') == "CustomerZone")
           {
               $prod = &new CProductInfo($pid);
               if($prod->haveOnlineCategory())
               {
                   $this->currentProductID = $pid;
               }
               else
               {
                   $query = new Request($application->getAppIni('SITE_URL'));
                   $application->redirect($query);
               }
           }
           else
           {
               $this->currentProductID = $pid;
           }
       }
       else
       {

          }
   }

Replace it with this one:

function setCurrentProductID($pid)
   {
       global $application;
       if ($this->isCorrectProductId($pid))
       {
           //                 storefront -          ,                  Offline:
           if (modApiFunc('Users', 'getZone') == "CustomerZone")
           {
               $prod = &new CProductInfo($pid);
               if($prod->haveOnlineCategory())
               {
                   $this->currentProductID = $pid;
               }
               else
               {
                   $query = new Request($application->getAppIni('SITE_URL'));
                   $application->redirect($query);
               }
           }
           else
           {
               $this->currentProductID = $pid;
           }
       }
       else
       {

      header('Location: http://domain.com/AVACTIS-DIRECTORY/index.php'); exit();
       }
   }

where domain.com is your domain name and AVACTIS-DIRECTORY is the directory on your server where Avactis is installed.