Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Manufacturers sort order


arash.najafi

Recommended Posts

hi

manufacturers are sorted from A - Z . how can i have them contrary from Z - A ?

i know i have to edit includes/boxes/manufacturers.php and there is a line "order by manufacturers_name"

 

excuse my poor English ... thankyou in advance..

 

order by manufacturers_name asc For Ascending

 

order by manufacturers_name desc For Descending

Link to comment
Share on other sites

order by manufacturers_name asc For Ascending

 

order by manufacturers_name desc For Descending

i did what you said but no joy came up and everything was more of the same before :huh:

 

 

here is my manufacturer.php content

 

 



<?php
/*
$Id: manufacturers.php,v 1.19 2003/06/09 22:17:13 hpdl Exp $

Virtu, Open Source E-Commerce
http://www.e-virtu.com/
http://www.oscommerce.com/

Copyright (c) 2007-2009 Virtu E-Commerce

Released under the GNU General Public License
*/

defined('PROJECT_VERSION') or die('Access denied!');

$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name desc" );
if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
?>
<!-- manufacturers //-->
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_MANUFACTURERS);

new infoBoxHeading($info_box_contents, false, false);

if ($number_of_rows <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
// Display a list
$manufacturers_list = '';
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id'])) $manufacturers_name = '<b>' . $manufacturers_name .'</b>';
$manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br>';
}

$manufacturers_list = substr($manufacturers_list, 0, -4);

$info_box_contents = array();
$info_box_contents[] = array('text' => $manufacturers_list);
} else {
// Display a drop-down
$manufacturers_array = array();
if (MAX_MANUFACTURERS_LIST < 2) {
$manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
}

while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
'text' => $manufacturers_name);
}

$info_box_contents = array();
$info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());
}

new infoBox($info_box_contents);
?>
</td>
</tr>
<!-- manufacturers_eof //-->
<?php
}
?>

Link to comment
Share on other sites

That's odd, it should work. Did you clear your browser cache so that you're getting a fresh page and not looking at an older cached page? If that doesn't do it, perhaps you changed the wrong code (that's not the query you're looking to sort) in the wrong file?

Link to comment
Share on other sites

  • 5 months later...

hi all,

 

i hav tried changin the coding to sort products via PRODUCT MODEL which im using as my stock codes.

it does sort according to PRODUCT MODEL but when i add to sort in DESC it doesnt change to descending order.

second problem: when i click on a category, the first page of that category gives the following error (see below) but when i click on next its fine; when i click prev (first page) only then does it pick up the products that should b on the first page of that category.

please help !! ;) thank u !! ;)

 

 

Displaying 1 to 6 (of 211 products) Result Pages: 1 2 3 4 5 ... [Next >>]

1054 - Unknown column 'pd.products_model' in 'order clause'

 

select p.products_model, 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 products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, 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 = '1' and p2c.categories_id = '8' order by pd.products_model ASC limit 0, 6

 

[TEP STOP]

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...