If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / Remove featured product from new product list

Remove featured product from new product list

Locked

Started by bamsik on 21 Feb 2009, 9:23 PM · Views: 1,554

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
21 Feb 2009, 9:23 PM
#1
bamsik avatar

bamsik

New Zenner

Join Date:
Feb 2009
Posts:
3
Plugin Contributions:
0

Post #1 by bamsik

Hi,

When I setup featured prod. they show in featured list and new prod. list,
How can I remove featured product from new product list?

Maybe someone could modificate sql query in:
/includes/modules/new_products.php

to check if in database at featured table, status is 1. If status = 1 dont show product in new product list.

Thank you.

22 Feb 2009, 3:48 AM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

New Products are based on the setting for the Configuration ... Maximum Values ...

New Product Listing - Limited to ...
Limit the New Product Listing to
0= All Products
1= Current Month
7= 7 Days
14= 14 Days
30= 30 Days
60= 60 Days
90= 90 Days
120= 120 Days

That is then determined by the products_date_added in the products table ...

If you do not want something that was added and would normally fall within your setting for the New Products, you could change the date in the products_date_added in the products table to be older so it won't show there ...

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!

22 Feb 2009, 2:00 PM
#3
bamsik avatar

bamsik

New Zenner

Join Date:
Feb 2009
Posts:
3
Plugin Contributions:
0

Post #3 by bamsik

But every time, when I add product to featured list, I must edit database.
Maybe someone know other way?.

22 Feb 2009, 2:10 PM
#4
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Post #4 by tony_sar

bamsik:

But every time, when I add product to featured list, I must edit database.
Maybe someone know other way?.

I think Ajeh with over 45000 post knows thing or two :blush:

22 Feb 2009, 2:56 PM
#5
ajeh avatar

ajeh

Oba-san

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

Post #5 by ajeh

You could try this and see if it works with your version of MySQL ...

$display_limit = zen_get_new_date_range();

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') ) {
  $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and   p.products_status = 1 " . $display_limit . "
                           and p.products_id not in (select products_id from " . TABLE_FEATURED . ")";
} 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) {
    $sql = "select products_id from " . TABLE_FEATURED . " where status = 1";
    $result = $db->Execute($sql);
    while (!$result->EOF) {
      if (isset($productsInCategory[$result->fields['products_id']])) {
        unset($productsInCategory[$result->fields['products_id']]);
      }
      $result->MoveNext();
    }

    // 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

    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                  p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and p.products_id in (" . $list_of_products . ")";
  }
}

if ($new_products_query != '') $new_products = $db->ExecuteRandomMulti($new_products_query, MAX_DISPLAY_NEW_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!

22 Feb 2009, 3:41 PM
#6
ajeh avatar

ajeh

Oba-san

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

Post #6 by ajeh

oops! Little goober there for when all products are Featured ... :eek:

Move the code:

    $sql = "select products_id from " . TABLE_FEATURED . " where status = 1";
    $result = $db->Execute($sql);
    while (!$result->EOF) {
      if (isset($productsInCategory[$result->fields['products_id']])) {
        unset($productsInCategory[$result->fields['products_id']]);
      }
      $result->MoveNext();
    }

above the line:

  if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {

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!

22 Feb 2009, 4:09 PM
#7
bamsik avatar

bamsik

New Zenner

Join Date:
Feb 2009
Posts:
3
Plugin Contributions:
0

Post #7 by bamsik

Perfect :clap: Thank you very much :smile:

22 Feb 2009, 8:19 PM
#8
ajeh avatar

ajeh

Oba-san

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

Post #8 by ajeh

Be sure to really test this with all aspects of your cart to ensure nothing was missed ...

Thank DrByte for his help on this one ... I just tidied it up a bit more ... :cool:

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!