Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new product module not displaying


yubnub

Recommended Posts

hi,

 

I have a problem that is driving me mad - I hope perhaps some one can help or point me in the right direction.

 

On my site when you select a parent category the new_product module does not display. Instead it displays a message saying that the category contains no products.

 

I have tried replacing my includes/boxes/categories.php file with a new file - still get the same problem

I have check the code in index php against code i know work - still the same problem

I have tried a new new_product.php file - still no change

 

I am unsure where else to look,

 

If anyone can offer any assistance I would be grateful,

 

regards,

 

anthony

Link to comment
Share on other sites

Hi,

 

Many thanks for the reply.

 

 

I have another osc store that performs differently.

 

On that store

 

I have a catergory called masks and snorkels (parent) - that has 2 sub cats

 

masks & Snorkels (parent)

- Masks (child)

- Snorkels (child)

 

when I click upon masks and snorkels, the category box then displays the 2 sub catergorys below the parent cat (this works fine on the 2nd site also) however it also then displays a random selection of products from both the masks and snorkels categories is displayed in products_new. When you then click on your chosen sub cat you get a product listing of the results,

 

This is what I am trying to acheive.

 

Do you have a product in that category? If you don't then you get that message.

 

on the other site i only get the "there are no products to display" if my deepest category has not products in it. Even if a category only contains subcategorys it looks into those for the "new_products" on this site it is displaying the no products message even when the categorys below do contain products.

 

 

Thanks again

Link to comment
Share on other sites

A link could be helpful.

 

Many thanks for your time in reading and responding to my query,

 

I have found a solution below which has solved the issue

 

Quote :

 

First, since I never want categories or subcategories headings in the main panel, I makes sure that if there are any products in the current category or in a subcategory a product listing will appear, like this:

 

IN INDEX.PHP

 

 

At around line 20 find

 

if ($cateqories_products['total'] > 0) {

$category_depth = 'products'; // display products

} else {

 

 

replace with

 

// Begin show all subcategories mod.

if (tep_count_products_in_category($cPath) > 0) {

// End show all subcategories mod.

$category_depth = 'products'; // display products

} else {

 

 

 

Then the actual search in the database has to be modified to include all subcategories, like this:

 

 

At around line 186 find

 

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

}

}

 

 

Replace with

 

 

 

// We show them all

 

// Begin show all subcategories mod.

 

$cPathA = explode("_", $cPath);

$size = sizeof($cPathA)-1;

$subcategories_array = array();

tep_get_subcategories($subcategories_array, $cPathA[$size]);

$size_sc = sizeof($subcategories_array); //Subcat count

$cat_Search = "(";

for($i = 0; $i < $size_sc; $i++){

$cat_Search .= "p2c.categories_id = '" . $subcategories_array[$i] . "' or ";

}

$cat_Search .= "p2c.categories_id = '" . $cPathA[$size] . "'" . ")";

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and ". $cat_Search . "";

 

}

}

 

// End show all subcategories mod.

 

 

hope this helps some on e else in the future,

 

thanks again

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...