Hi all
Anyone who knows some of the Zen language can you please help me convert this simple mod from OsCommerce: addons.oscommerce.com/info/5351.
Here is the OsCommerce Mod:
"=======================================================================
Show all products in category mod V1.01 11/11/2007
=======================================================================
This is a very simple modification to osCommerce 2.2 MS2. Once this modification is installed the products will be listed similar to the product listing page for the selected category, including all products in the subcategories. You will not see the individual subcategory selections for each category.
The product listing results displayed can be refined by shoppers by clicking down through the category tree already present in your category box.
All credit goes to itsover who posted this in the forums, I've just tweaked it a little and presented it as a contrib.
I've included a generic screen shot so you can see the results before installing.
Dont forget to backup first, its only one file.
All line numbers are estimates based on your previous modifications to the file.
*8/26/2007= Update to 8/10 release with bug fix to show product listing options.
*11/11/2007= Update to fix bug so the same item in multiple subcategories is only displayed once.
Update to fix breadcrumb bug.
=====================================================================
In catalog/index.php:
1) Around line 20, replace
if ($cateqories_products['total'] > 0) {
$category_depth = 'products'; // display products
} else {
with
if (tep_count_products_in_category($cPath) > 0) {
$category_depth = 'products'; // display products
} else {
****************************************
2) Around line 86, replace
CODE
// 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 left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c 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 . "'";
}
}
with......
CODE
// We show them all
$cPathA = explode("_", $cPath);
$size = sizeof($cPathA)-1;
$subcategories_array = array();
zen_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 distinct" . $select_column_list . " p.products_image, pd.products_name, 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 left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c 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 . "";
}
}
**************************************
3) In includes/modules/product_listing.php, replace:
case 'PRODUCT_LIST_NAME':
$lc_align = '';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
} else {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
}
with.....
case 'PRODUCT_LIST_NAME':
$lc_align = '';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
} else {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' - ' . tep_get_category_name($listing['products_id']) . '</a> ';
}
**************************************
and also includes/modules/product_listing.php, replace:
case 'PRODUCT_LIST_IMAGE':
$lc_align = 'center';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
} else {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
}
with......
case 'PRODUCT_LIST_IMAGE':
$lc_align = 'center';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
} else {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
}
**************************************
And thats it. "
I believe I have found the files that need slight modification:
Step 1 (OsCommerce's "catalog/index.php") refers to Zen Cart's "includes/modules/pages/index/header_php.php"
Step 2 (OsCommerce's "catalog/index.php") refers to Zen Cart's "includes/index_filters/default_filter.php"
Steps 3 & 4 (OsCommerce's "includes/modules/product_listing.php") refers ti Zen Cart's "includes/modules/product_listing.php".
I have found this article also regarding converting OsCommerce Mods into Zen Cart Mods: http://www.zenportali.com/index.php?...d=35&Itemid=25
Any help would be much appreciated! I have tried various modifications to my code but have not had success yet.
Thanks a million!!!
Nick.





