Forums / Templates, Stylesheets, Page Layout / Hide upcoming products from all and category listings

Hide upcoming products from all and category listings

Started by jmsnyder23 on 6 Mar 2012, 11:36 AM · Views: 957

Results 1 to 9 of 9
6 Mar 2012, 11:36 AM
#1
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Hide upcoming products from all and category listings

Hi,

Is there a way to hide upcoming products from the all listing and category listing? I'd like them to show on the manufacturer listing, but not on the individual categories before they're available.

What can I do to remove them from the category/all listings short of removing them in the admin from those categories?

Thank you in advance.

J.M. Snyder

8 Mar 2012, 2:19 AM
#2
winwin avatar

winwin

Banned

Join Date:
Feb 2012
Location:
China
Posts:
37
Plugin Contributions:
0

Re: Hide upcoming products from all and category listings

location:configuration-index listing- Show Upcoming Products on Main Page - Category with SubCategories
set it's value to 0

winwin
be a company of zen-cart.com

8 Mar 2012, 2:26 AM
#3
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Re: Hide upcoming products from all and category listings

Yes, it's set to 0. Upcoming products still appear in the category and all products lists.

Thanks anyway!

8 Mar 2012, 3:36 AM
#4
winwin avatar

winwin

Banned

Join Date:
Feb 2012
Location:
China
Posts:
37
Plugin Contributions:
0

Re: Hide upcoming products from all and category listings

there are another three set concerning showing upcoming product,
how about setting them all to 0?
Show Upcoming Products - below Product Listing
Show Upcoming Products on Main Page
Show Upcoming Products on Main Page - Errors and Missing Products Page

winwin
be a company of zen-cart.com

8 Mar 2012, 3:53 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide upcoming products from all and category listings

And example to block upcoming products in the Featured Center box would be the code in RED:
/includes/modules/featured_products.php

$display_limit = '';

$chk_date = date('Ymd', time());

if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
  $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id
                           from (" . TABLE_PRODUCTS . " p
                           left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
                           where p.products_id = f.products_id
                           and p.products_id = pd.products_id
                           and p.products_status = 1 and f.status = 1
                       AND (p.products_date_available <= $chk_date or p.products_date_available IS NULL)
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
} else {
  // get all products and cPaths in this subcat tree
  $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);

  if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
    // build products-list string to insert into SQL query
    foreach($productsInCategory as $key => $value) {
      $list_of_products .= $key . ', ';
    }
    $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma
    $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id
                                from (" . TABLE_PRODUCTS . " p
                                left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                                left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id)
                                where p.products_id = f.products_id
                                and p.products_id = pd.products_id
                                and p.products_status = 1 and f.status = 1
                           AND (p.products_date_available <= $chk_date or p.products_date_available IS NULL)
                                and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                and p.products_id in (" . $list_of_products . ")";
  }
}

You would need to add this code where ever you want to block the Upcoming products ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Mar 2012, 11:06 AM
#6
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Re: Hide upcoming products from all and category listings

Thanks Ajeh. That's more what I'm after, but I can't find the file to add the code into to block the products from the categories pages :(

8 Mar 2012, 1:37 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide upcoming products from all and category listings

For the Product Listing via the Categories ... edit the file:
/includes/index_filters/default_filter.php

if (isset($_GET['alpha_filter_id']) && (int)$_GET['alpha_filter_id'] > 0) {
    $alpha_sort = " and pd.products_name LIKE '" . chr((int)$_GET['alpha_filter_id']) . "%' ";
  } else {
    $alpha_sort = '';
  }

// bof: add upcoming filter to WHERE
  $chk_date = date('Ymd', time());
  $alpha_sort .= ' AND (p.products_date_available <= ' . $chk_date . ' or p.products_date_available IS NULL) ';
// eof: add upcoming filter to WHERE

  if (!isset($select_column_list)) $select_column_list = "";

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Mar 2012, 1:40 PM
#8
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Re: Hide upcoming products from all and category listings

OMG OMG OMG you rock! I'm buying you a cup of coffee today!!!

Thank you so much :)

8 Mar 2012, 1:44 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide upcoming products from all and category listings

You are most welcome ... thanks for the update that this is working for you ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!