Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Module Product Listing, how?


Juto

Recommended Posts

Hello, in the module product listing the option to show the categories name, possibly with a tep_href_link to that category, is missing in all 2.x versions.

 

But, how can it be done?

 

First an sql (change the sort order as needed::

 

insert into configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function,
set_function) values ('', 'Display Category Name', 'PRODUCT_LIST_CATEGORY', '0', 'Do you want to display the Category Name?', '8', '12', '2010-09-13 21:32:55', '2009-10-28 15:28:41', NULL, NULL);

 

Then in includes/modules/product_listing.php

 

       // Row: Product's category
         case 'PRODUCT_LIST_CATEGORY':
           $lc_text .= '  <tr>' . "\r\n"
                     . '    <td class="main" align="center">'. $listing['categories_name'] . '</td>' . "\r\n"
                     . '  </tr>' . "\r\n";
           break;

 

Then some changes in catalog/index.php:

 

// Added What should xxx be?
       case 'PRODUCT_LIST_CATEGORY':
         $select_column_list .= 'xxx.categories_name, ';
         break;

 

Further, these queries need to be changed, but how?

 

// show the products of a specified manufacturer
   if (isset($_GET['manufacturers_id'])) {
     if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
// We are asked to show only a specific category
       $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 . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' 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)$_GET['filter_id'] . "'";
     } else {
// 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 . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";

     }
   } else {
// show the products in a given category
     if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
// We are asked to show only a specific category
       $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 . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['filter_id'] . "' 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 . "'";
     } else {
// 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 . "'";
     }
   }

 

Or, am I totaly wrong on this?

 

Anyhow, the functionality would be a nice alternative to the product list filter.

 

I do appreciate any advice on this.

 

Sara

Link to comment
Share on other sites

Having a product listing, it mean you are already inside a category: Items of category "dvd movies" get listed < -> all listed items belong to category "dvd movies"

 

That mean that all category info is already available, for example the category name, that display on top of the page anyway (2.3.1). What you want is, instead of having it o top of the page, to have it on each product row.

 

So you don't need to query again to get this info, you can take it and use it in file includes/modules/product_listing.php. You can do an admin setting or not, that's up to you but not necessary.

Link to comment
Share on other sites

Hello George, thank you for answering :)

 

What I want is to display the category name for every type of listing, like for example when a customer selects a manufacturer.

 

See this link: Manufacturer

 

It is correct that if a customer choose a category this displays the category name:

        // Row: Product's category
         case 'PRODUCT_LIST_CATEGORY':
           $lc_text .= '  <tr>' . "\r\n"
                     . '    <td class="main" align="center">'. $category['categories_name'] . '</td>' . "\r\n"
                     . '  </tr>' . "\r\n";
           break;

 

But the category name is already shown in column left.

 

So how do I achieve what I want?

 

Sara

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...