Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Categories by letters


cistabue

Recommended Posts

Posted

This is my problem...i got 15 categories....each category has a lot of title inside 500 or more...we you chose one the limit is set to 40 for page....I've seen that many site have the possibility to chose not only by page (1...2...3) but also by alphabetic letters (a...b...c..) check this link http://www4.cd-wow.com/browse_catalogue.php? Is there any suggestion?

Posted

For each category you can add sub-categories. If you add subcategories under the letters of the alphabet and then drop the products into them then you've got your alphabetical listing. Vger

Posted

True but is a a nightmare i have 10.000 titles...and 15 categories...No I need some of a contribution...that...for exemple...create all the alphabet letters...and when you click on A...or B...or whatever....do a serch only for the first letter of the products of that category. This could be useful! Help me, please

Posted

I have something like that in my allprods page that might be usefull.

 

http://www.wizardsandwars.com/allprods.php

 

Nothing really very fancy, but lif you want it, I'll post it up here.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

Pretty simple hack, really.

 

In my allprods page, I added this to the top someplace.....

 

  $firstletter=$HTTP_GET_VARS['fl'];
   if (!$HTTP_GET_VARS['page']){
  	 $where="where pd.products_name like '$firstletter%'";
   }else {
  	 $where="";
   }

 

 

Then I changed the $product_query_raw string to this....

 

  $products_new_query_raw = "select p.products_releasedate, p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id $where order by pd.products_name";

 

 

Then I added the menu somewhere near the top, like this.....

 

         $firstletter_nav=
         '<a href="' . tep_href_link("allprods.php",  'fl=A', 'NONSSL') . '"> A |</A>' . 
         '<a href="' . tep_href_link("allprods.php",  'fl=B', 'NONSSL') . '"> B |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=C', 'NONSSL') . '"> C |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=D', 'NONSSL') . '"> D |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=E', 'NONSSL') . '"> E |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=F', 'NONSSL') . '"> F |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=G', 'NONSSL') . '"> G |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=H', 'NONSSL') . '"> H |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=I', 'NONSSL') . '"> I |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=J', 'NONSSL') . '"> J |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=K', 'NONSSL') . '"> K |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=L', 'NONSSL') . '"> L |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=M', 'NONSSL') . '"> M |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=N', 'NONSSL') . '"> N |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=O', 'NONSSL') . '"> O |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=P', 'NONSSL') . '"> P |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=Q', 'NONSSL') . '"> Q |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=R', 'NONSSL') . '"> R |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=S', 'NONSSL') . '"> S |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=T', 'NONSSL') . '"> T |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=U', 'NONSSL') . '"> U |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=V', 'NONSSL') . '"> V |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=W', 'NONSSL') . '"> W |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=X', 'NONSSL') . '"> X |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=Y', 'NONSSL') . '"> Y |</A>' .
         '<a href="' . tep_href_link("allprods.php",  'fl=Z', 'NONSSL') . '"> Z</A>';
         
         echo $firstletter_nav;

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

hey Wizards ... is that Prince of Persia a good game?

 

I like the Baldur's Gate, Dungeon Siege, Icewind Dale, and of course NWN, but I also like EverQuest and MMORPG's ... would you recommend Persia?

 

B)

Posted

I'd probably be banned for life from here for answering that question, but if your intested having your question answered by other gamers that are playing that game now, check out our forums.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

First of all I don't undestand where is this line $product_query_raw nohting in allprod_php file. Second how can I limited the product to show...I click on View All Product...and all the 10000 titles come out!

Posted

Well, perhaps I have a different version of allprods, but even yours should have a product_query_raw file. Perhaps it is named slightly different. Just search for "_raw"

 

Second, this would limit how many products are displayed when you click on the allprods page.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

No new news to report.

 

Hope everything is going well for you.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

All you have to do to limit the number of products displayed is to add a filter on the where clause of the select statement. Should be very straightforward.

 

Best of luck.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

THIS IS THE FILE...whre i shold do the change?

 

Thanx in advance!

 

 

<?php

/*

$Id: allprods.php,v 1.5 2002/09/29 1

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

 

*/

 

require('includes/application_top.php');

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALLPRODS);

 

// Set number of columns in listing

define ('NR_COLUMNS', 1);

//

$breadcrumb->add(HEADING_TITLE, tep_href_link(FILENAME_ALLPRODS, '', 'NONSSL'));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<?php

// BOF: WebMakers.com Changed: Header Tag Controller v1.0

// Replaced by header_tags.php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

// EOF: WebMakers.com Changed: Header Tag Controller v1.0

?>

 

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td align="right"></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="productListing-heading">

<td align="left" class="productListing-heading">Product Name</td>

<td align="center" class="productListing-heading">Model</td>

<td align="right" class="productListing-heading">Price  </td>

</tr>

<?php

 

 

 

 

 

$languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");

while ($languages = tep_db_fetch_array($languages_query)) {

$languages_array[] = array('id' => $languages['languages_id'],

'name' => $languages['name'],

'code' => $languages['code'],

'image' => $languages['image'],

'directory' => $languages['directory']);

}

for ($i=0; $i<sizeof($languages_array); $i++)

{

$this_language_id = $languages_array[$i]['id'];

$this_language_name = $languages_array[$i]['name'];

$this_language_code = $languages_array[$i]['code'];

$this_language_image = $languages_array[$i]['image'];

$this_language_directory = $languages_array[$i]['directory'];

echo " <tr>\n";

 

 

 

 

 

 

 

 

$products_query = tep_db_query("SELECT s.specials_new_products_price, p.products_id, p.products_model, p.products_price, pd.products_name FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd LEFT JOIN " . TABLE_SPECIALS . " s ON p.products_id=s.products_id WHERE p.products_id = pd.products_id AND p.products_status = 1 AND pd.language_id = $this_language_id ORDER BY pd.products_name");

 

$products_array = array();

while($products = tep_db_fetch_array($products_query))

{

$products_array[] = array('id'=> $products['products_id'],

'name' => $products['products_name'],

'model' => $products['products_model'],

'price' => $products['products_price'],

'tax' => $products['products_tax_class_id'],

'special' => $products['specials_new_products_price']);

}

 

$num_prods = sizeof($products_array); // This optimizes that slow FOR loop...

 

for ($i = 0; $i < $num_prods; $i++) // Traverse Rows

{

// Rotate Row Colors

if ($i % 2) // Odd Row

{

$row_col = 'class="productListing-odd"';

}

else // Guess...

{

$row_col = 'class="productListing-even"';

}

 

 

$this_id = $products_array[$i]['id'];

$this_name = $products_array[$i]['name'];

$this_model = $products_array[$i]['model'];

$this_price = $products_array[$i]['price'];

$this_special = $products_array[$i]['special'];

$this_tax = $products_array[$i]['tax'];

$this_url = tep_href_link(FILENAME_PRODUCT_INFO, 'name=' . str_replace(" ", "_", $this_name). '&products_id=' . $this_id . (($this_language_code == DEFAULT_LANGUAGE) ? '' : ('&language=' . $this_language_code)), 'NONSSL', false);

 

echo "<tr $row_col>";

echo "<td class='productListing-data' align='left'><a href='$this_url'>$this_name</a></td>";

echo "<td class='productListing-data' align='center'><a href='$this_url'>$this_model</a></td>";

if (tep_not_null($this_special))

{

echo "<td class='productListing-data' align='right'><a href='$this_url'><span class='productSpecialPrice'>".$currencies->display_price($this_special, tep_get_tax_rate($this_tax))."</span></a></td>";

}

else

{

echo "<td class='productListing-data' align='right'><a href='$this_url'>".$currencies->display_price($this_price, tep_get_tax_rate($this_tax))."</a></td>";

}

echo "</tr>\n";

}

}

 

 

 

?>

</td>

</tr>

</table></td>

</tr>

<tr>

<td align="right" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

</tr>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

Wizardsandwars, you are always a lot of help on this forum. Thank you for that.

 

I have a problem with splitting results per page on the allprods page.

 

Could you help me with adding the filter on the where clause of the select statement. I just can't figure it out. I tried comparing the product_listing module, but still no go.

 

Thank you in advance.

 

BTW: In my allprods page there is no $product_query_raw, but the same thing is $product_query. I guess we all have different versions. Anyway, the hack to products by letters worked perfectly, now I just need to split the results per page.

Posted
Hi Wizard...any news about my problem?

Hello cistabue,

 

I'm sorry, however I am not currently working on any problems for you.

 

Best of luck.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Posted

Im trying to get this to work with All products enhanced.

 

I have added the code Wiards and wars said to the top of the page, and although I dont have the Raw statement I do have the following.

 $listing_sql = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' order by pd.products_name";

 

Its almost identical.

 

The page shows and the a-z menu shows but when I click on a letter I get page not found, this might be because I has SEF urls turned on, but even when I try it with the query string manually typed in it still doesnt work, it just loads the first page again!

Posted

Fixed part of my problem!!

 

In these lines

'<a href="' . tep_href_link("allprods.php",  'fl=A', 'NONSSL') . '"> A |</A>' .

 

If you are using the enhanced mod remember to change

 

allprods.php

 

to

 

all_products.php

 

Missed that one. However when i click a link it still shows all the listing starting from A, I will have to try and find where it does this,anyone else got any ideas let me know :)

Posted

try changing this

$firstletter=$HTTP_GET_VARS['fl'];
  if (!$HTTP_GET_VARS['page']){
   $where="where pd.products_name like '$firstletter%'";
  }else {
   $where="";
  }

 

to this

 

$firstletter=$HTTP_GET_VARS['fl'];
  if (!$HTTP_GET_VARS['page']){
   $where="where pd.products_name like '$firstletter%'";
  }else {
   $where="where pd.products_name like '$firstletter%";
  }

Posted

Thanks for the tip :)

But that didnt seem to work either :( I even tried it with the missing ' after firstletter%

 

Here is my page code, i think its so obvious im overlooking it

 

require('includes/application_top.php'); 
 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALLPRODS); 

 $breadcrumb->add(HEADING_TITLE, tep_href_link(FILENAME_ALLPRODS, '', 'NONSSL')); 

$firstletter=$HTTP_GET_VARS['fl'];
 if (!$HTTP_GET_VARS['page']){
  $where="where pd.products_name like '$firstletter%'";
 }else {
  $where="where pd.products_name like '$firstletter%'";
 } 


?> 
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html <?php echo HTML_PARAMS; ?>> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 
<title><?php echo TITLE ?></title> 
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> 
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head> 
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> 
<!-- header //--> 
<?php require(DIR_WS_INCLUDES . 'header.php'); ?> 

<!-- header_eof //--> 

<!-- body //--> 
<table border="0" width="100%" cellspacing="3" cellpadding="3"> 
 <tr> 
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> 
<!-- left_navigation //--> 
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> 
<!-- left_navigation_eof //--> 
   </table></td> 
<!-- body_text //--> 
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>

       </table></td>
     </tr>
     <tr>
       <td align="center"><?php $firstletter_nav=
        '<a href="' . tep_href_link("all_products.php",  'fl=A', 'NONSSL') . '"> A |</A>' . 
        '<a href="' . tep_href_link("all_products.php",  'fl=B', 'NONSSL') . '"> B |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=C', 'NONSSL') . '"> C |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=D', 'NONSSL') . '"> D |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=E', 'NONSSL') . '"> E |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=F', 'NONSSL') . '"> F |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=G', 'NONSSL') . '"> G |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=H', 'NONSSL') . '"> H |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=I', 'NONSSL') . '"> I |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=J', 'NONSSL') . '"> J |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=K', 'NONSSL') . '"> K |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=L', 'NONSSL') . '"> L |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=M', 'NONSSL') . '"> M |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=N', 'NONSSL') . '"> N |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=O', 'NONSSL') . '"> O |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=P', 'NONSSL') . '"> P |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=Q', 'NONSSL') . '"> Q |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=R', 'NONSSL') . '"> R |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=S', 'NONSSL') . '"> S |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=T', 'NONSSL') . '"> T |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=U', 'NONSSL') . '"> U |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=V', 'NONSSL') . '"> V |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=W', 'NONSSL') . '"> W |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=X', 'NONSSL') . '"> X |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=Y', 'NONSSL') . '"> Y |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=Z', 'NONSSL') . '"> Z</A>';
        
        echo $firstletter_nav; ?></td>
     </tr>
    <tr>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
    </tr>
     <tr>
       <td>
<?php
 // create column list
 $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                      'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                      'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 
                      'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                      'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                      'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                      'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                      'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
 asort($define_list);

 $column_list = array();
 reset($define_list);
 while (list($column, $value) = each($define_list)) {
   if ($value) $column_list[] = $column;
 }

 $select_column_list = '';

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   if ( ($column_list[$col] == 'PRODUCT_LIST_BUY_NOW') || ($column_list[$col] == 'PRODUCT_LIST_NAME') || ($column_list[$col] == 'PRODUCT_LIST_PRICE') ) {
     continue;
   }
 }
 
 $listing_sql = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' order by pd.products_name";
 include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
?>
       </td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

try this query instead of yours.

 

$listing_sql = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id $where order by pd.products_name";

Posted

Spot on :)

 

For anyone running the All products page enhanced mod then change your all_products.php page for this

 

<?php 
/* 
 $Id: allprods.php,v 2.0 2004/01/13 20:28:47 UJP Co. Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2004 osCommerce

 Released under the GNU General Public License
 
*/ 

 require('includes/application_top.php'); 
 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ALLPRODS); 

 $breadcrumb->add(HEADING_TITLE, tep_href_link(FILENAME_ALLPRODS, '', 'NONSSL')); 

$firstletter=$HTTP_GET_VARS['fl'];
 if (!$HTTP_GET_VARS['page']){
  $where="where pd.products_name like '$firstletter%'";
 }else {
  $where="where pd.products_name like '$firstletter%'";
 } 


?> 
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html <?php echo HTML_PARAMS; ?>> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 
<title><?php echo TITLE ?></title> 
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> 
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head> 
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> 
<!-- header //--> 
<?php require(DIR_WS_INCLUDES . 'header.php'); ?> 

<!-- header_eof //--> 

<!-- body //--> 
<table border="0" width="100%" cellspacing="3" cellpadding="3"> 
 <tr> 
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> 
<!-- left_navigation //--> 
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> 
<!-- left_navigation_eof //--> 
   </table></td> 
<!-- body_text //--> 
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>

       </table></td>
     </tr>
     <tr>
       <td align="center"><?php $firstletter_nav=
        '<a href="' . tep_href_link("all_products.php",  'fl=A', 'NONSSL') . '"> A |</A>' . 
        '<a href="' . tep_href_link("all_products.php",  'fl=B', 'NONSSL') . '"> B |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=C', 'NONSSL') . '"> C |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=D', 'NONSSL') . '"> D |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=E', 'NONSSL') . '"> E |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=F', 'NONSSL') . '"> F |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=G', 'NONSSL') . '"> G |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=H', 'NONSSL') . '"> H |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=I', 'NONSSL') . '"> I |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=J', 'NONSSL') . '"> J |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=K', 'NONSSL') . '"> K |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=L', 'NONSSL') . '"> L |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=M', 'NONSSL') . '"> M |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=N', 'NONSSL') . '"> N |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=O', 'NONSSL') . '"> O |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=P', 'NONSSL') . '"> P |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=Q', 'NONSSL') . '"> Q |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=R', 'NONSSL') . '"> R |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=S', 'NONSSL') . '"> S |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=T', 'NONSSL') . '"> T |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=U', 'NONSSL') . '"> U |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=V', 'NONSSL') . '"> V |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=W', 'NONSSL') . '"> W |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=X', 'NONSSL') . '"> X |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=Y', 'NONSSL') . '"> Y |</A>' .
        '<a href="' . tep_href_link("all_products.php",  'fl=Z', 'NONSSL') . '"> Z</A>';
        
        echo $firstletter_nav; ?></td>
     </tr>
    <tr>
    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
    </tr>
     <tr>
       <td>
<?php
 // create column list
 $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                      'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                      'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 
                      'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                      'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                      'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                      'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                      'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
 asort($define_list);

 $column_list = array();
 reset($define_list);
 while (list($column, $value) = each($define_list)) {
   if ($value) $column_list[] = $column;
 }

 $select_column_list = '';

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   if ( ($column_list[$col] == 'PRODUCT_LIST_BUY_NOW') || ($column_list[$col] == 'PRODUCT_LIST_NAME') || ($column_list[$col] == 'PRODUCT_LIST_PRICE') ) {
     continue;
   }
 }
 
$listing_sql = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id $where order by pd.products_name";
 include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
?>
       </td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Thanks to Wizard and wars for the original code and natural health for the tweaking ;)

Archived

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

×
×
  • Create New...