Hi guys,
This is my question:
I have deleted many old watches products, and add many new watches product. ( i really should not do this)
Now have problems, some customers still can access old product page by google search.
Example: when custome access :
http://www.jewelrywall.com/rolex-oys...rj-p-8638.html
the page will show: "Sorry, the product was not found. "
Now, i do not want the page show these words, i want the page redirect to search page, search keywords is :
rolex oyster perpetual datejust mens watch
----------------------------------------------------
then i edit the page (includes\templates\template_default\templates\tpl_product_info_noproduct.php), and add new codes:
PHP Code:
//no product url: http://www.jewelrywall.com/rolex-oyster-perpetual-datejust-mens-watch-116233bksbrj-p-8638.html
function getUrl(){
$url="http://".$_SERVER["HTTP_HOST"];
if(isset($_SERVER["REQUEST_URI"])){
$url.=$_SERVER["REQUEST_URI"];
}
else{
$url.=$_SERVER["PHP_SELF"];
if(!empty($_SERVER["QUERY_STRING"])){
$url.="?".$_SERVER["QUERY_STRING"];
}
}
$eUrl=getUrl();
//exit("url=".$eUrl);
preg_match('/www\.jewelrywall\.com\/(.+)\-p\-([0-9]+)\.html/', $eUrl, $matches);
//print_r($matches);
$pname=str_replace('-','+',$matches[1]);
$searchUrl='http://www.jewelrywall.com/index.php?main_page=advanced_search_result&search_in_description=1&keyword='.$pname;
//print $pname;
zen_redirect($searchUrl);
But it do not work, how should i do?
Or have another better way to fix this "the product was not found" problem?
Thanks for helps!!!!!!!
Miles
Bookmarks