Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New products not displaying in some categories


Pottypotsworth

Recommended Posts

Posted

Hey all,

 

I have been developing a site for a while, please take a quick look and get your self acustomed so that i may explain better ;)

 

http://www.modelseeker.co.uk

 

This is the first site i have developed using OSCommerce, and alltho it has taken a great deal of time, i am very near completion, and i am happy with the results.

 

I have searched this forum no end, and found many useful post which have helped me solve my problems, but alas, for this problem i have found no solution.

 

Basically, if you goto the site (http://www.modelseeker.co.uk) you will see that the 3 latest products are displayed right there as they should be on the first page.

 

Right, go click the following...

Aircraft > Diecast > Corgi > Avation Archive. You will see that it has taken 3 clicks until any new products have appeared below the category images.

 

Now click ...

Cars > Diecast. We see that new products appear instantly for this one.

 

It seems to be only the aircraft "tree" that has a problem displaying the new products, i think this may be because there are directories in Aircraft that have no products in them, only a further sub category. Does that make sense? :)

 

I've hacked the new_products module a bit to customise, but i cant see how to do the above.

 

Any help would be appreciated.

Posted

That's the way it works I'm afraid. You have a hierarchy, and in parts of that hierarchy there is nothing to display - and so nothing is displayed.

 

Vger

Posted
Is there no way at all of getting it to go deeper into the hierachy?

 

Thanx for quick response by the way.

Hi,

 

What I did on my site

My Webpage

was add all my cutlery to the cutlery category. Then I copied the knives to the knives sub-category and copied the utensils to the utensils sub-category etc etc..

 

I don't know if this is what you want to do, but it does show products in every page.

Posted

I have the exact same problem with my site & I've been searching for an answer on this forum without success.

 

It seems that the problem occurs when you go to category levels of 3 or more. I just recently switched over to a 3-level category structure from 2-levels. Although, going back to 2 levels would solve the problem, this makes finding products & browsing my site much more difficult. (which is the reason I switched to more levels).

 

I will continue to search for an answer to the problem & post any information that I find.

Posted

If anyone needs to modify their new_products.php file (instead of replacing it), the part of the code that handles the subcategores is...

 

} else {   // in a category

$cats[] = $new_products_category_id; // current catID as starting value
// put cat-IDs of all cats nested in current branch into $cats array, go through all subbranches
for($i=0;$i<count($cats);$i++) {
 $categorie_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$cats[$i] . "'"); 
 while ($categorie = tep_db_fetch_array($categorie_query)) {
	 $cats[] = $categorie['categories_id'];
 }
 $cats=array_unique($cats); // sort out doubles
}

$num = (int) MAX_DISPLAY_NEW_PRODUCTS;
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id in (".implode(', ', $cats).") and p.products_status = '1' order by p.products_date_added desc limit " . $num);
}

 

You can see that this code is working (although not fully bug tested) by browsing our website:

http://www.spotted-horse.com

 

I am not a programmer, but I have been able to apply this sub-categories contrib on top of a Random new products contrib which has been modified to only select products with images (if available). If anyone is interested in doing something similar, I can post my modified code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...