Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34
  1. #11
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Redirect discontinued items

    Quote Originally Posted by Kevin205 View Post
    Thank you twitchtoo for the reply,

    I tried your solution, replacing tpl_product_info_noproduct.php with the following files:
    includes/templates/MyTemplate/templates/tpl_index_default.php
    Stopped displaying page info, including navigation breadcrumbs. Showing a blank center page. With the following error:


    includes/templates/MyTemplate/templates/tpl_index_product_list.php
    Displays the following warning after the nav breadcrumbs:
    WARNING: An Error occurred, please refresh the page and try again.
    Stopped displaying the rest of the page. Showing a blank center page. With the following error:


    includes/templates/MyTemplate/templates/tpl_index_categories.php
    Replacing the above file works , displaying the navigation breadcrumbs and sub-category name only, plus all other page information, all the the way down to the footer.

    But when I change the URI to
    http: // Domain.com /index.php?main_page=product_info&cPath=2_5&products_id=320132, id= 320132 a random number, no product in the database. It changes the URI to
    http: // Domain.com /index.php?main_page=product_info&products_id=320132, genrating the following error



    Thank you.
    When you say you replaced the files, did you mean that you copied one file over another, or in

    includes/modules/pages/product_info/main_template_vars.php

    did you simply replace


    $tpl_page_body = '/tpl_product_info_noproduct.php';

    With


    $tpl_page_body = '/tpl_index_default.php';

    ? I haven't tried that myself, but if you copied the files like it seems you did, then that would seem to explain the error messages.

    Btw, agree, my attempt to offer a solution was one of a completely missing page, not a discontinued/disabled product.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #12
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Redirect discontinued items

    Quote Originally Posted by mc12345678 View Post
    When you say you replaced the files, did you mean that you copied one file over another, or in

    includes/modules/pages/product_info/main_template_vars.php

    did you simply replace


    $tpl_page_body = '/tpl_product_info_noproduct.php';

    With


    $tpl_page_body = '/tpl_index_default.php';

    ? I haven't tried that myself, but if you copied the files like it seems you did, then that would seem to explain the error messages.

    Btw, agree, my attempt to offer a solution was one of a completely missing page, not a discontinued/disabled product.
    Sorry for that. In the working case; from what I understood from twitchtoo's post,
    I replaced
    PHP Code:
    if ( $res->fields['total'] < ) {

    $tpl_page_body '/tpl_product_info_noproduct.php';

    } else {

    $tpl_page_body '/tpl_product_info_display.php'
    with
    PHP Code:
    if ( $res->fields['total'] < ) {

    $tpl_page_body '/tpl_index_categories.php';

    } else {

    $tpl_page_body '/tpl_product_info_display.php'
    Last edited by Kevin205; 26 Dec 2013 at 11:43 PM.
    Using Zen Cart 1.5.1

  3. #13
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Redirect discontinued items

    Kevin205, yes you were right to change one line of code, not shuffle files around. So now that it's working you'd like the URI mapping looked at?

    I need to know which URI module you have installed?

    There is a php statement that's either missing the cPath expression in it or the cPath search is not being passed to the URI module to be published correctly.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  4. #14
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Redirect discontinued items

    Quote Originally Posted by twitchtoo View Post
    Kevin205, yes you were right to change one line of code, not shuffle files around. So now that it's working you'd like the URI mapping looked at?

    I need to know which URI module you have installed?

    There is a php statement that's either missing the cPath expression in it or the cPath search is not being passed to the URI module to be published correctly.
    Quote Originally Posted by Kevin205 View Post
    But when I change the URI to
    http: // Domain.com /index.php?main_page=product_info&cPath=2_5&products_id=320132, id= 320132 a random number, no product with that id, in the database. It changes the URI to
    http: // Domain.com /index.php?main_page=product_info&products_id=320132, genrating the following error
    I am NOT using any URI package.

    As you see in the path, it is directly from Zen Cart. The cPath gets truncated when a wrong product "id" gets queried!

    Thank you.
    Using Zen Cart 1.5.1

  5. #15
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Redirect discontinued items

    Quote Originally Posted by Kevin205 View Post
    I am NOT using any URI package.

    As you see in the path, it is directly from Zen Cart. The cPath gets truncated when a wrong product "id" gets queried!

    Thank you.
    As an FYI, the fact that don't have a URI rewriter is as much information as indicating which one you have. Typical rewriters still "function" with knowing the standard ZC URI format.

    That said, I'm not surprised to see the effect of losing the cPath because afterall, the cPath indicates which category the product is in. In this case, the product does not exist, therefore is not in any cPath, and in essence would go to the noproduct page, which now is being redirected back to the categories page, where the product doesn't exist to be looked up.

    Mentally and without looking at the details, it appears that the system is setup to be in a loop, though I would expect some sort of "break" or perhaps that's what twitchtoo is/was considering. Because of what I perceive is a loop, what affects are there other than a logged message of trying your non-existent product? Does the same thing occur if the product is merely disabled? (Ie, review product catalog for a product that is in the list, but is turned off from display to customers, and try that product number. Same error?)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #16
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Redirect discontinued items

    Here's what's happening...
    Client:
    Finds product T, likes product T, bookmarks product T

    Admin:
    No longer offers product T.

    Client:
    Wants to buy product T cause now they have the money!

    If Admin 'disables' the product and has changed the noproduct.php to the index_categories.php...
    It will revert back to the index or category landing page the product used to be in.

    If Admin 'deletes' the product from the database...
    Everything fails.

    So, I put the noproduct.php back in and found that the message 'Sorry, the product was not found' will display properly. However the 'back' or 'continue' button does not display.
    <div class="centerColumn" id="productInfoNoProduct">

    <div id="productInfoNoProductMainContent" class="content"><?php echo TEXT_PRODUCT_NOT_FOUND; ?></div>

    <div class="buttonRow back"><?php zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>

    Meaning it's not coded correctly or it's not getting any data to 'go back' or 'continue' to which makes sense.

    So, the alternate solution here would be to leave the message on the noproducts.php and add the code needed to go somewhere.

    It would be clean, fast and prevent any future problems if any of the files involved were to be changed. It would also be consistent, regardless of a 'disabled' or 'deleted' product the redirect would return to a controlled location.

    in includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_noproduct.php
    replace line 18:
    <div class="buttonRow back"><?php zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>

    with this:
    <?php // Twitch No Product Continue to Index ?>
    <div class="buttonRow back"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo zen_image_button(BUTTON_IMAGE_CONTINUE);?></a></div>
    <!-- <div class="buttonRow back"><?php //zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>-->

    it will look like this:
    Name:  noproducts_continue.JPG
Views: 153
Size:  18.0 KB
    and clicking the continue button will take you home. The customer can read the message, understand why they can't see what they want and decide to move on or perhaps select a new category in the category sidebox.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  7. #17
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Redirect discontinued items

    Quote Originally Posted by twitchtoo View Post
    Here's what's happening...
    Client:
    Finds product T, likes product T, bookmarks product T

    Admin:
    No longer offers product T.

    Client:
    Wants to buy product T cause now they have the money!

    If Admin 'disables' the product and has changed the noproduct.php to the index_categories.php...
    It will revert back to the index or category landing page the product used to be in.

    If Admin 'deletes' the product from the database...
    Everything fails.

    So, I put the noproduct.php back in and found that the message 'Sorry, the product was not found' will display properly. However the 'back' or 'continue' button does not display.
    <div class="centerColumn" id="productInfoNoProduct">

    <div id="productInfoNoProductMainContent" class="content"><?php echo TEXT_PRODUCT_NOT_FOUND; ?></div>

    <div class="buttonRow back"><?php zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>

    Meaning it's not coded correctly or it's not getting any data to 'go back' or 'continue' to which makes sense.

    So, the alternate solution here would be to leave the message on the noproducts.php and add the code needed to go somewhere.

    It would be clean, fast and prevent any future problems if any of the files involved were to be changed. It would also be consistent, regardless of a 'disabled' or 'deleted' product the redirect would return to a controlled location.

    in includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_noproduct.php
    replace line 18:
    <div class="buttonRow back"><?php zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>

    with this:
    <?php // Twitch No Product Continue to Index ?>
    <div class="buttonRow back"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo zen_image_button(BUTTON_IMAGE_CONTINUE);?></a></div>
    <!-- <div class="buttonRow back"><?php //zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>-->

    it will look like this:
    Name:  noproducts_continue.JPG
Views: 153
Size:  18.0 KB
    and clicking the continue button will take you home. The customer can read the message, understand why they can't see what they want and decide to move on or perhaps select a new category in the category sidebox.
    I would say that the above solution is probably more on target with what would be expected. There are a few other zen Cart functions that could be used to obtain the same result, especially the Url creation for the button. I think there is a zen_submit_button or zen_button_submit option that can be fed the destination and image and will do most of what that line does.

    Otherwise, part of the redirect solution should "clear" the product/category information so that the guest goes to some other page like was trying before. Now, that said, twitchtoo does bring it back to home by keeping the "guest" informed about what is going on rather than just flinging them around to different areas of your site. Perhaps even more information could be provided on the noproduct page, in text or in hyperlinks. I thought there might be a redirect to sitemap option also that could be taken advantage of.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #18
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Redirect discontinued items

    Quote Originally Posted by mc12345678 View Post
    As an FYI, the fact that don't have a URI rewriter is as much information as indicating which one you have. Typical rewriters still "function" with knowing the standard ZC URI format.
    Good to know. Thanks.
    Using Zen Cart 1.5.1

  9. #19
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Redirect discontinued items

    Quote Originally Posted by twitchtoo View Post
    So, the alternate solution here would be to leave the message on the noproducts.php and add the code needed to go somewhere.

    It would be clean, fast and prevent any future problems if any of the files involved were to be changed. It would also be consistent, regardless of a 'disabled' or 'deleted' product the redirect would return to a controlled location.

    in includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_noproduct.php
    replace line 18:
    <div class="buttonRow back"><?php zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>

    with this:
    <?php // Twitch No Product Continue to Index ?>
    <div class="buttonRow back"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo zen_image_button(BUTTON_IMAGE_CONTINUE);?></a></div>
    <!-- <div class="buttonRow back"><?php //zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE, BUTTON_CONTINUE_ALT) . '</a>'; ?></div>-->

    it will look like this:
    Name:  noproducts_continue.JPG
Views: 153
Size:  18.0 KB
    and clicking the continue button will take you home. The customer can read the message, understand why they can't see what they want and decide to move on or perhaps select a new category in the category sidebox.
    It sounds great to me.

    I will give it try and keep you posted. Thank you.

    ps. Nice car.
    Using Zen Cart 1.5.1

  10. #20
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Redirect discontinued items

    twitchtoo and mc12345678, problem solved.

    Thank you.
    Using Zen Cart 1.5.1

 

 
Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. v153 Flag discontinued products
    By fahadali in forum Customization from the Admin
    Replies: 16
    Last Post: 18 Mar 2016, 08:19 PM
  2. 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
  3. Replies: 0
    Last Post: 8 Oct 2008, 03:58 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