Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37
  1. #1
    Join Date
    Mar 2010
    Posts
    2
    Plugin Contributions
    0

    Default I've deleted products. How do I redirect customers to new ones? or to search instead?

    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

  2. #2
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,009
    Plugin Contributions
    61

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    Code:
    redirect 301 /rolex-oyster-perpetual-datejust-mens-watch-116233bksbrj-p-8638.html http://www.jewelrywall.com/

    In your htaccess.


    ~Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  3. #3
    Join Date
    Mar 2010
    Posts
    2
    Plugin Contributions
    0

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    Thanks ~Melanie!

    But there are many other deleted products(about 1000), how use 301 in htaccess to redirect ?

    i think the zencart system should kow the product is not existed, then redirect to other url, that is better, but i do not know how and where to modify?

  4. #4
    Join Date
    Feb 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    I'm here with a similar question. When a product gets deleted, the link to the deleted product generates the "no product" page. It's just a regular "product_info" page using the tpl_product_info_noproduct.php template.

    Also—and this is important: the server responds with a 404 error! That should never happen for a product that's been deleted. The "no product" page shouldn't generate an error. Not sure why this happens.

    So—how can we generate a more helpful response? The idea of returning search results is a very good one, but there's a lot of functionality missing (keyword lookup for one thing) that makes this not easily possible. How about just sending them to the category page? That should be possible, but by the time you're serving the template it's too late for a header redirect, which would be the most seamless and SEO-friendly way to do it.

    I'm looking into a rewrite in the .htaccess that would send the visitor to the category page for the product.

  5. #5
    Join Date
    Feb 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    OK, here's the solution I'm using. Right up front I want to say this is not necessarily the best way to address this issue—partly because it alters a file that might be overwritten in an upgrade, and I would normally not do this because it leads to trouble down the road. (I tried using an override for this, but it didn't work)

    So, if someone looks for a deleted product (because there's a link somewhere on the web that pointed to it) the user comes in with a URL like this: /index.php?main_page=product_info&cPath=4&products_id=61

    I altered the file /includes/modules/pages/product_info/main_template_vars.php

    On line 31 there's a check for a non-existent product. Normally it send the user to the "noproduct" page. For my change, I inserted a PHP header function like this:

    Code:
    $requeststring = (isset($_GET['cPath']))?'&cPath='. (int)$_GET['cPath']:'';
            header('location:index.php?main_page=index'.$requeststring);
    This sends them to the category the product was in. If the category is also non-existent, it goes to the "no products in this category" page, which is fine by me. If there's no category in the URL at all, it goes to the site index page.

    Either way, no error is generated.

    So this is what I did and so use this change at your own risk, test the hell out of it and use your own programming skills and common sense to do it better if you want.

  6. #6
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,009
    Plugin Contributions
    61

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    Also—and this is important: the server responds with a 404 error! That should never happen for a product that's been deleted. The "no product" page shouldn't generate an error. Not sure why this happens.
    Because the page/product is gone and that or a permanent redirect is the proper response.

    So—how can we generate a more helpful response? The idea of returning search results is a very good one, but there's a lot of functionality missing (keyword lookup for one thing) that makes this not easily possible. How about just sending them to the category page? That should be possible, but by the time you're serving the template it's too late for a header redirect, which would be the most seamless and SEO-friendly way to do it.

    I'm looking into a rewrite in the .htaccess that would send the visitor to the category page for the product.
    The page they are sent to is not an issue, sure you can add functionality here to assist the shoppers and I agree fully, but the correct response in this case is still a 404.

    OK, here's the solution I'm using. Right up front I want to say this is not necessarily the best way to address this issue—partly because it alters a file that might be overwritten in an upgrade, and I would normally not do this because it leads to trouble down the road. (I tried using an override for this, but it didn't work)
    Upgrade overwrites are the least of your worry, by removing the error you have created a new canonical address, probably with a 302 which is a serious duplication issue... especially wide scale like you are talking about.

    Again, the resulting page is a non issue... send them where you wish. The server's response MUST be a 404 or a 301 or you are causing a great deal more than you are solving with duplication and redirect issues for non canonical urls.

    ~Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  7. #7
    Join Date
    Feb 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    @mprough

    Thanks for your informative response! I admit I'm somewhat ignorant of these issues with setting the proper error for a page that is not found. I guess I was thinking a "product not found" is not at all the same as a "page not found"

    If I understand you correctly, I just need to add a 404 error response to my redirect.

    thanks again

  8. #8
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,009
    Plugin Contributions
    61

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    7thVeil, I have edited your code and have some other relevant information and technique regarding this issue here http://pro-webs.net/blog/2010/03/21/...tock-products/

    I have always forced a permanent redirect by hand (ultimate control), but I certainly understand the need for a more large scale dynamic solution. So I edited your code to achieve this.

    Cheers,

    Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  9. #9
    Join Date
    Feb 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    Nicely done— thanks!

  10. #10
    Join Date
    Oct 2007
    Posts
    326
    Plugin Contributions
    0

    Default Re: I've deleted products. How do I redirect customers to new ones? or to search inst

    Quote Originally Posted by mprough View Post
    7thVeil, I have edited your code and have some other relevant information and technique regarding this issue here http://pro-webs.net/blog/2010/03/21/...tock-products/

    I have always forced a permanent redirect by hand (ultimate control), but I certainly understand the need for a more large scale dynamic solution. So I edited your code to achieve this.

    Cheers,

    Melanie

    Hi Melanie, the redirection example you gave:

    redirect 301 /index.php?main_page=product_info&cPath=5&products_id=38 http://www.domain.com/

    is not working on my site. I put it in the .htaccess file in the root but when I go to the product page it simply does not redirect. Do you have any idea why? I am not using any URL rewrite modules.

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. How do I redirect old links to new products?
    By diamond1 in forum General Questions
    Replies: 5
    Last Post: 12 Oct 2013, 11:28 AM
  2. Replies: 1
    Last Post: 25 Feb 2013, 02:27 AM
  3. Replies: 7
    Last Post: 2 Sep 2011, 10:30 AM
  4. Redirect deleted, moved and discontinued products to the home page.
    By Podgeminster in forum General Questions
    Replies: 1
    Last Post: 15 Mar 2011, 02:11 AM
  5. I deleted ALL my banners, now I can't add new ones
    By adod in forum Basic Configuration
    Replies: 5
    Last Post: 13 Nov 2008, 01:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR