Thread: 302

Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,019
    Plugin Contributions
    61

    Default 302

    Zen Cart 2.0.0-rc2
    PHP Version: 8.1.27
    Bootstrap 3.6.4

    Main Page - Opens with Category = 0
    Categories with 0 Products Status = 0

    One category & 1 product in the store. Main page opens to index.php?main_page=product_info&products_id=1 as it should, but the redirect is a 302. Anyone know where I can find the code driving this and make it a 301?

    ~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.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,703
    Plugin Contributions
    123

    Default Re: 302

    Try changing includes/./modules/pages/index/header_php.php line 142 to include 301 as the final parameter to zen_redirect.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

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

    Default Re: 302

    Quote Originally Posted by swguy View Post
    Try changing includes/./modules/pages/index/header_php.php line 142 to include 301 as the final parameter to zen_redirect.
    Thanks swguy... If anyone needs this

    Code:
    // if only one product in this category, go directly to the product page, instead of displaying a link to just one item:
    // if filter_id exists the 1 product redirect is ignored
    if (SKIP_SINGLE_PRODUCT_CATEGORIES == 'True' && !isset($_GET['filter_id']) && !isset($_GET['alpha_filter_id'])) {
        if ($listing->RecordCount() == 1) {
            header('HTTP/1.1 301 Moved Permanently');
            zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']));
        }
    }
    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.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: 302

    Quote Originally Posted by mprough View Post
    Thanks swguy... If anyone needs this

    Code:
    // if only one product in this category, go directly to the product page, instead of displaying a link to just one item:
    // if filter_id exists the 1 product redirect is ignored
    if (SKIP_SINGLE_PRODUCT_CATEGORIES == 'True' && !isset($_GET['filter_id']) && !isset($_GET['alpha_filter_id'])) {
        if ($listing->RecordCount() == 1) {
            header('HTTP/1.1 301 Moved Permanently');
            zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']));
        }
    }
    What was the problem encountered when doing as recommended with:
    Code:
    // if only one product in this category, go directly to the product page, instead of displaying a link to just one item:
    // if filter_id exists the 1 product redirect is ignored
    if (SKIP_SINGLE_PRODUCT_CATEGORIES == 'True' && !isset($_GET['filter_id']) && !isset($_GET['alpha_filter_id'])) {
        if ($listing->RecordCount() == 1) {
                    zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']), 301);
        }
    }
    If none, perhaps could enlighten on why the alternate choice.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,498
    Plugin Contributions
    88

    Default Re: 302

    Quote Originally Posted by mc12345678 View Post
    What was the problem encountered when doing as recommended with:
    Code:
    // if only one product in this category, go directly to the product page, instead of displaying a link to just one item:
    // if filter_id exists the 1 product redirect is ignored
    if (SKIP_SINGLE_PRODUCT_CATEGORIES == 'True' && !isset($_GET['filter_id']) && !isset($_GET['alpha_filter_id'])) {
        if ($listing->RecordCount() == 1) {
                    zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']), 301);
        }
    }
    If none, perhaps could enlighten on why the alternate choice.
    I agree totally; simply adding the 301 as the final parameter to zen_redirect will do that 301-header for you.

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

    Default Re: 302

    Quote Originally Posted by lat9 View Post
    I agree totally; simply adding the 301 as the final parameter to zen_redirect will do that 301-header for you.
    Just added it quick & tested
    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.

 

 

Similar Threads

  1. v154 Redirect 302 picked up
    By Annie_zaz in forum General Questions
    Replies: 4
    Last Post: 28 Jan 2016, 06:59 AM
  2. v139h redirect 302
    By lruskauff in forum General Questions
    Replies: 0
    Last Post: 2 Jan 2014, 06:04 AM
  3. 302 redirects
    By dwessell in forum General Questions
    Replies: 1
    Last Post: 1 Jul 2011, 08:15 PM

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