Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sorting by product price on product listing page


Guest

Recommended Posts

Posted

On the front page of our shop, we have a product listing of the 7 products we have for sale, which at the moment is sorting by ascending price, i.e. the lowest price is at the top and the highest price at the bottom.

We want it to list the other way around but I can't see anywhere in the configuration settings how to change the order of product listing.

 

Would appreciate any help!

Posted

change the folowing code in index.php:

($sort_order == 'd' ? 'desc' : '')

to

($sort_order == 'd' ? 'asc' : 'desc')

Posted

Have looked in index.php and that code isn't there. Do I need to add it, and if so, where would I do it?

Posted
Have looked in index.php and that code isn't there. Do I need to add it, and if so, where would I do it?

Are you sure that codes not there? the file is catalog\index.php

 

In my index.php file there is 6 of them first being on line 259 although mine is modded a fair bit.

 

Post a link and I will look at the code see if I can find it for you

Posted
Are you sure that codes not there? the file is catalog\index.php

 

In my index.php file there is 6 of them first being on line 259 although mine is modded a fair bit.

 

Post a link and I will look at the code see if I can find it for you

 

The website is www.zipnsteam.co.uk, and if you click on the buy online link, it will take you to the index page with the issue.

 

Have looked at the offline version of the site and I don't have a catalog folder. The closest I have to it is "shop", but the index.php file in that doesn't appear to contain any sort order definition. (Other folders I have are 1_phrases, admin, banners, css, flash, images, includes, phpmyadmin, resources, tmp and video)

Posted

This is the text of the shop/index.php file

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<?php

 

 

 

//header("Location: http://www.zipnsteam.co.uk/comingsoon.php");

// exit();

 

 

 

require('includes/application_top.php');

$category_depth = 'products';

require('includes/languages/english/index.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

require('../../offline/db.inc');

 

$querey="SELECT content FROM page_content WHERE label = 'shop_front'";

$result=mysql_query($querey,$db);

$result_array=mysql_fetch_array($result);

$content=$result_array[0];

 

$querey="SELECT content FROM page_content WHERE label = 'shop_title'";

$result=mysql_query($querey,$db);

$result_array=mysql_fetch_array($result);

$title=$result_array[0];

 

?>

<head>

<title>Zip N' Steam™</title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

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

<script language="JavaScript" type="text/JavaScript" src="../includes/general.js"></script>

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="preloadImages('../images/product_info_2.gif','../images/product_demo_2.gif','../images/history_2.gif','../images/cooking_guide_2.gif','../images/recipes_2.gif','../images/buy_online_2.gif','../images/contact_us_2.gif')">

<?PHP //echo $request_type; ?>

<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

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

<tr>

<td width="213" height="12"><img src="../images/space.gif" width="213" height="12" /></td>

</tr>

<tr>

<td width="213" height="83"><a href="../index.php"><img src="../images/logo.gif" width="213" height="83" border="0" /></a></td>

</tr>

<tr>

<td width="213" height="283"> <?php $lit=6 ?>

<?php require("../includes/nav.inc"); ?> </td>

</tr>

<tr>

<?php require("../includes/banners.inc"); ?> </tr>

</table></td>

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

<tr>

<td width="452"><img src="../images/space.gif" width="452" height="12" /></td>

</tr>

<tr>

<td><img src="../images/blank_top.gif" width="452" height="10" /></td>

</tr>

<tr>

<td background="../images/content_bg.gif" bgcolor="#FFFFFF"><?php require('includes/shopnav.inc'); ?></td>

</tr>

<tr>

<td width="452" height="494" background="../images/content_bg.gif" bgcolor="#FFFFFF" valign="top">

<!-- body_text //--><div class="mainContent">

<h2><?php echo $title; ?></h2>

<p><?php echo $content; ?></p>

<?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.manu_sort, p.products_tax_class_id, p.products_status, 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 order by p.products_price, p.manu_sort, pd.products_name";

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

?></div>

<!-- body_text_eof //--> </td>

</tr>

<tr>

<td><img src="../images/center_bottom.gif" width="452" height="10" /></td>

</tr>

<tr>

<td align="center" valign="middle"><?php include("../includes/footer.inc"); ?></td>

</tr>

</table></td>

<td width="95" valign="top"><img src="../images/r_steam.jpg" width="95" height="268" /></td>

</tr>

</table>

</body>

</html>

Archived

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

×
×
  • Create New...