Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Trouble with featured products and others (Dr Byte - Linda or others??)

Trouble with featured products and others (Dr Byte - Linda or others??)

Locked
This thread is locked. New replies are disabled.
1 Feb 2007, 3:29 PM
#1
jla avatar

jla

Zen Follower

Join Date:
Jul 2005
Posts:
128
Plugin Contributions:
0

Post #1 by jla

A couple years ago worked with Linda on an issue we were having

We wanted the following to happen:

On the featured products (and some others) we wanted only those products that had at least quantity 1 in stock to be displayed in the featured products results and featured products box and not those items that had quantity 0.

We have all of our products remain in the catalog even when they are sold out but only have them DISPLAYED if they have quantity 1 or higher. If doing a search, you can still view the products that are sold out and if you have the direct URL you can view them but they are not viewable in the general browsing catalog or specials, new products and featured products pages.

The solution we were provided (back on version 1.2.25) was to go into (we will only talk about the featured products now - but it is the same for the others as well) /includes/modules/featured products.php and make the queries look like this

$title = TABLE_HEADING_FEATURED_PRODUCTS;

  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
    $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name
                           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_quantity >= '1' and p.products_id = pd.products_id and p.products_status = '1' and f.status = '1' and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
  } else {
    $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name
                           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, " .
                              TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
                              TABLE_CATEGORIES . " c
                           where p.products_id = p2c.products_id
				   and p.products_quantity >= '1' 
                           and p2c.categories_id = c.categories_id
                           and c.parent_id = '" . (int)$new_products_category_id . "'
                           and p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = '1' and f.status = '1' and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

You will notice that we added the p.products_quantity >= '1' in a couple of places which basically is saying to only display products that are equal to or greater than quantity one.

We did this same sort of thing in the file /includes/sideboxes/featured.php

$show_featured= true;

  if ($show_featured == true) {
    $random_featured_products_query = "select p.products_id, p.products_image, pd.products_name
                           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_quantity >= '1' and p.products_id = pd.products_id and p.products_status = '1' and f.status = '1' and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           order by pd.products_name desc
                           limit " . MAX_RANDOM_SELECT_FEATURED_PRODUCTS;

This was the query for the featured sidebox which basically did the same thing.

Well now there is an issue - working with the new version 1.3.7 and making these same query changes in the same files - it appears that this no longer works and we are not quite sure on why.

Can Dr Byte or Linda - or perhaps someone else advise why? We know there have been quite a few changes in the code but not sure why this is apparently affected or what we are missing.

JLA ENTERPRISES DIRECT
http://www.jlaenterprises.net

JLA FORUMS
http://www.jlaforums.com

1 Feb 2007, 3:37 PM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

Check that you updated the files correctly ...

If using an overrides file that file needs to be changed ...

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!

1 Feb 2007, 3:47 PM
#3
jla avatar

jla

Zen Follower

Join Date:
Jul 2005
Posts:
128
Plugin Contributions:
0

Post #3 by jla

Ajeh:

Check that you updated the files correctly ...

If using an overrides file that file needs to be changed ...

Linda - we have done the upgrade in simplier manner

  1. Copied our existing database
  2. Fresh install of 1.3.37 into a test installation directory
  3. Deleted all newly created tables from new installation
  4. Restored our existing database tables to new database
  5. Ran database update to database structure from old existing version to 1.3.37

Everything is working fine in our test installation as we are only using the FRESHLY installed files - but when going into the new files and making these query changes, the featured products sidebox and featured products listing is still showing all the OUT OF STOCK (less that quantity 1) products in that list.

Thanks

JLA ENTERPRISES DIRECT
http://www.jlaenterprises.net

JLA FORUMS
http://www.jlaforums.com

1 Feb 2007, 4:01 PM
#4
ajeh avatar

ajeh

Oba-san

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

Post #4 by ajeh

I am not sure where you are missing the boat on this ...

I add to any of the WHERE statements:
and p.products_quantity >= 1

And I do not see any Products with quantities of less than 1

Check your two configure.php files ...

Both your Catalog and Admin are looking at the same database and paths etc. correct?

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!

1 Feb 2007, 4:18 PM
#5
jla avatar

jla

Zen Follower

Join Date:
Jul 2005
Posts:
128
Plugin Contributions:
0

Post #5 by jla

Ajeh:

I am not sure where you are missing the boat on this ...

I add to any of the WHERE statements:
and p.products_quantity >= 1

And I do not see any Products with quantities of less than 1

Check your two configure.php files ...

Both your Catalog and Admin are looking at the same database and paths etc. correct?

Ah, thanks for your help... It appeared forgot to edit the queries in the header file in the featured products folder in pages.

That solved it.

Thanks Linda

JLA ENTERPRISES DIRECT
http://www.jlaenterprises.net

JLA FORUMS
http://www.jlaforums.com

1 Feb 2007, 6:18 PM
#6
ajeh avatar

ajeh

Oba-san

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

Post #6 by ajeh

Glad to of been of help ... hope this solves all of your dilemas ... :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!