Results 1 to 9 of 9
  1. #1
    Join Date
    May 2014
    Location
    Florida
    Posts
    13
    Plugin Contributions
    0

    Default Question about hiding products where quantity is 0 from site search and a thank you!

    Hi, this forum has been an absolute wealth of information since installing my first Zen Cart. I've been able to get every single bit of information I've needed here and am completely thrilled with the final result of my store.

    I've found the last piece of information I need to truly finish it off but its from 2011 and doesn't seem to work on v1.5.1.

    Simply put, I want sold items to be hidden from search results on the website but yet have the items remain on the site so they still appear in search results on Google or backlinks from other sites.

    The original post with the same concept can be seen here- http://www.zen-cart.com/showthread.p...abling-product

    There also was a solution, posted here- http://www.zen-cart.com/showthread.p...252#post979252

    The solution posted was

    and add the code around line 27 that is in red above the code in black:
    Code:
      $alpha_sort .= " and p.products_quantity > 0 ";
      if (!isset($select_column_list)) $select_column_list = "";
    The line number has changed to 52 and when I insert the code as stated, it does not do the trick. Can someone please provide an update on where or how to implement this to make it functional?

    Here is a screenshot of my code and you can see where I have copied that line of code to line 51 which appears to be the same thing as in my quoted post - http://i.imgur.com/52iuU1P.jpg

    Since I only have 1 of most items, its important to me that links stay active in the Google search results but not on the website for searches. To see an example, you can go to the cart: http://thehockeyjersey.co/store/ and then search for 'whalers' - I'd like the green jersey which has sold to no longer show up in the search results and future sold items going forward.

    Thank you for this great resource!!!

  2. #2
    Join Date
    Aug 2009
    Posts
    368
    Plugin Contributions
    0

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    I did this on my website and I had to change some files and some admin configurations :

    1. Admin/Configuration/Stock/Products status in Catalog when out of stock should be set to 1
    2.includes/index_filters/default_filter.php substitute everywhere p.products_status = 1 with p.products_status = 1 and p.products_quantity > 0
    3./includes/modules/pages/advanced_search_result : $where_str = " WHERE (p.products_status = 1 and p.products_quantity > 0 add condition p.products_quantity > 0
    4./includes/modules/product_prev_next.php : add p.products_quantity >= 1 to the query
    5./includes/pages/products_new/header.php : add p.products_quantity >= 1 to the query

    Regarding old products in my case I had to manual update status :

    update products set products_status = 1
    where products_status = 0
    and products_quantity = 0


    REMEMBER! test all those changes on test environment first and backup your shop !

  3. #3
    Join Date
    May 2014
    Location
    Florida
    Posts
    13
    Plugin Contributions
    0

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    Absolutely amazing work. I cant thank you enough. Took all of 2 minutes to get this in place.

    Here is a link to a sold item - http://thehockeyjersey.co/store/inde...products_id=28

    ...that you wont be finding in my sites search results any time soon!

    And let it be known that I dont know the first thing about php.

    Great work and I will be updating that old post with a link here for 1.5 users.

  4. #4
    Join Date
    Aug 2009
    Posts
    368
    Plugin Contributions
    0

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    I'm glad you did it and happy to help you :-)

  5. #5
    Join Date
    Sep 2014
    Location
    ohio
    Posts
    216
    Plugin Contributions
    0

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    Quote Originally Posted by solo_400 View Post
    I did this on my website and I had to change some files and some admin configurations :

    1. Admin/Configuration/Stock/Products status in Catalog when out of stock should be set to 1
    2.includes/index_filters/default_filter.php substitute everywhere p.products_status = 1 with p.products_status = 1 and p.products_quantity > 0
    3./includes/modules/pages/advanced_search_result : $where_str = " WHERE (p.products_status = 1 and p.products_quantity > 0 add condition p.products_quantity > 0
    4./includes/modules/product_prev_next.php : add p.products_quantity >= 1 to the query
    5./includes/pages/products_new/header.php : add p.products_quantity >= 1 to the query

    Regarding old products in my case I had to manual update status :

    update products set products_status = 1
    where products_status = 0
    and products_quantity = 0

    This is what I want to do, but I am not clear as to what to put where in the files,

  6. #6
    Join Date
    Dec 2008
    Location
    Rimini, Italy, Italy
    Posts
    67
    Plugin Contributions
    0

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    Giving life to an old thread....
    it seems that's enough for 1.5.1 but not for 1.5.5e
    Anybody here tried to hide out of stock products from search?
    Many thanks, kind regards
    Francesco

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

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    Edit
    includes/modules/pages/advanced_search_result/header_php.php

    There will be a block that starts with this:

    $where_str = " WHERE (p.products_status = 1

    just change it to

    $where_str = " WHERE (p.products_status = 1
    AND p.products_quantity > 0

    And Bob's your uncle. :)
    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.

  8. #8
    Join Date
    Dec 2008
    Location
    Rimini, Italy, Italy
    Posts
    67
    Plugin Contributions
    0

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    Quote Originally Posted by swguy View Post
    Edit
    includes/modules/pages/advanced_search_result/header_php.php
    Not that simple....I found the solution by moving a die($where_str) all around the file:
    If you installed Stock_By_Attributes_Combined plugin (as I did) you have to modify includes/classes/observers/auto.advanced_search_categories_custom_id.php also by adding the red part in following code

    Code:
       $where_str .= "(p.products_status = 1
                      AND p.products_id = pd.products_id
                      AND pd.language_id = :languagesID
                      AND p.products_id = p2c.products_id
                      AND p.products_quantity > 0
                      AND p2c.categories_id = c.categories_id
                      ";

    And Bob's your uncle. :)
    Great,didn't know this sentence.... :)

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,690
    Plugin Contributions
    9

    Default Re: Question about hiding products where quantity is 0 from site search and a thank y

    this is an issue that i have struggled with in the past. but hiding these items from site search does not really hide the items. google will still find them. your category listings will still show them, if you have a product feed for search engines, they will still be there, and heavens to betsy if those items make it to your best sellers list prior to having a 0 quantity.

    from what i remember, v157 now has a facility for setting future date available, and inactivating items until the date comes. which could probably be easily modified to accommodate items that 0 quantity going into and out of stock. i remember looking at that modification, which i think makes use of cron jobs (scheduled jobs) to do its work, and thinking it is a good solution to a royal pain of a problem.

    in the past (on live sites), these are some of the files (not all are base ZC files, but most are) i have had to modify to ensure that no items with 0 quantity or a future arrival date show up on a site:

    Code:
    googlefroogle.php
    includes/index_filters/default_filter.php
    includes/classes/db/mysql/define_queries.php
    includes/modules/YOUR_TEMPLATE/new_products.php
    includes/modules/YOUR_TEMPLATE/featured_products.php
    includes/modules/YOUR_TEMPLATE/specials_index.php
    includes/modules/pages/sitemapxml/sitemapxml_products.php
    includes/modules/pages/advanced_search_result/header_php.php
    includes/modules/pages/products_all/header_php.php
    includes/modules/pages/product_info/header_php.php
    includes/modules/pages/product_info/main_template_vars.php
    includes/modules/pages/products_new/header_php.php
    includes/modules/sideboxes/YOUR_TEMPLATE/whats_new.php
    includes/modules/sideboxes/YOUR_TEMPLATE/best_sellers.php
    includes/modules/product_prev_next.php
    includes/functions/functions_lookups.php
    includes/functions/functions_prices.php
    includes/extra_datafiles/added_sql.php
    having a product class would make this so much easier..... i think.....

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. HI, i need a help about categories's display ,thank you
    By kaelin.joy in forum General Questions
    Replies: 4
    Last Post: 8 Oct 2013, 01:56 PM
  2. Replies: 2
    Last Post: 2 Oct 2009, 04:24 PM
  3. Question about search sidebox and search header
    By jenzi in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 14 Sep 2008, 06:47 AM
  4. Hiding products from search
    By monkeytown in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 4 Dec 2007, 03:48 PM
  5. Where is HTML for order confirmation/thank you page?
    By chacha-vintage in forum General Questions
    Replies: 0
    Last Post: 22 Aug 2007, 10:26 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