Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CHEAP Products FIRST on Display, please?


Guest

Recommended Posts

Please help us...THANKS!

~~~~~~~~~~~~~~~~~

How do we adjust <New Products for the Month of 'January'>

to show

CHEAP PRODUCTS FIRST???...from the top???

What sorts the thing...insertion date? ...It's not alphabetical, that I can see, and certainly not by price.

~

Alternatively, is there a mod we can use for a box above the New Products that shows the Cheapest Products by in our shop, please?

 

For us the first solution is the very best, but the 2nd is workable...!

 

Many, many, Thanks... :rolleyes:

Link to comment
Share on other sites

includes/modules/new_products.php

  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

change to

  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by products_price asc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by products_price asc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Thank you, Steve....

Wow; you_are_FAST....

Expertise SHOWS! :thumbsup:

...There will be many Happy Campers our here in 'userland,' thanks to you!

Have a Great Day and Many, Many Thanks!

Charles

Link to comment
Share on other sites

Spectacular, Perfect, Bravo...It works like a Charm!

All software should be THIS Easy to install!

THANK YOU STEVE

...Yes, it sorts the price (I assume) in the underlying base currency, and displays top to down, Left-to-Right...

And, even in Right-to-Left languages, it displays 100% properly (i.e., Hebrew)

And it is currency/language independent...and seems to work perfectly despite various language + currency combinations.

(Smart software writers!!!!)

~~~+++

Please, please, please...is there a similar little fix for the Product Category listings pages, please???

We want to show our CHEAP prices FIRST, Everywhere....

:rolleyes:

Many. Many Thanks Steve, once again...and everyone who helped write the excellent code!

Charles

Link to comment
Share on other sites

this can be done as fised for the listing page however as default the listing page can be sorted by clicking the title price etc.

 

As I say this can be made to be fixed or alternatively you could make the sort function more visible by using an up arrow and down arrow image as seen here A DEMO

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

HI!

Lots of good things to digest; thanks, but I've been swimming through the high waves. Still a relative newbie here...

You kindly wrote:

1. "this can be done as fised for the listing page however as default the listing page can be sorted by clicking the title price etc."

Where/how can I do this sorting, please? I've been tooling around in Admin looking for something to click/switch but nothing I do seems to effect the price sorting order of Category listings. (Certainly maybe I missed it?)

 

2. "this can be made to be fixed "

Great...That would be a good start...simple. cheap and ascending from cheap to more expensive..but how to do it, please???

 

3. I really like the arrows embedded in the bar. Yes, the demo site is lovely (is it yours???) & full of great ideas The UP&Down Arrows are very nice. I'd set it the same way...for cheapest price first, looking down, and let them reset the arrow if they want higher priced products. Is it a contrib I can get somewhere, please?

Many thanks for your great patience...

 

Thanks again for the help, and thanks for reading through my dumb, sincere questions!

Link to comment
Share on other sites

Sorry busy moderating a forum...

 

The product listing section derives the list from the listing sql in index.php

 

	if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
	if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
	  $listing_sql .= " order by pd.products_name";
	  break;
	}
  }
} else {
  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);
  $listing_sql .= ' order by ';
  switch ($column_list[$sort_col-1]) {
	case 'PRODUCT_LIST_MODEL':
	  $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_NAME':
	  $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
	  break;
	case 'PRODUCT_LIST_MANUFACTURER':
	  $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_QUANTITY':
	  $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_IMAGE':
	  $listing_sql .= "pd.products_name";
	  break;
	case 'PRODUCT_LIST_WEIGHT':
	  $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_PRICE':
	  $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;
  }
}
?>

make your changes to the orders and whether or not the default setting is desc or asc

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Thank you very kindly for putting up with my newbie questions in addition to your otherwise full day, Steve.

You kindly wrote two instructions:

1) "make your changes to the orders and"

2) " whether or not the default setting is desc or asc"

 

After changing ultimately all the "desc" to "asc" and seeing no changes, I realized my tired eyes hadn't seen #1. How/where please do I do the make "changes to the orders"? *Thanks ...

Your cut out and mine looked the same before I changed the "desc" to "asc"

Here is what I have in my /catalog/index.php file, presently.

Many thanks, once again!

Charles

 

	if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
	if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
	  $listing_sql .= " order by pd.products_name";
	  break;
	}
  }
} else {
  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);
  $listing_sql .= ' order by ';
  switch ($column_list[$sort_col-1]) {
	case 'PRODUCT_LIST_MODEL':
	  $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'asc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_NAME':
	  $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'asc' : '');
	  break;
	case 'PRODUCT_LIST_MANUFACTURER':
	  $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'asc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_QUANTITY':
	  $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'asc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_IMAGE':
	  $listing_sql .= "pd.products_name";
	  break;
	case 'PRODUCT_LIST_WEIGHT':
	  $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'asc' : '') . ", pd.products_name";
	  break;
	case 'PRODUCT_LIST_PRICE':
	  $listing_sql .= "final_price " . ($sort_order == 'd' ? 'asc' : '') . ", pd.products_name";
	  break;
  }
}

Link to comment
Share on other sites

you have not completed setting the order all that has been changed is desc to asc which will just change the order of the product name to be z-a instead of a-z you need to change your sort order to products_price as you are still sorting by products_name.

 

If you want it to be by product_price on initial load change this

 if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
$HTTP_GET_VARS['sort'] = $i+1 . 'a';
$listing_sql .= " order by pd.products_name";
break;

 

to this

 if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
$HTTP_GET_VARS['sort'] = $i+1 . 'a';
$listing_sql .= " order by products_price";
break;

 

if you want it to be products price on intial load and also to allow change by clicking titles then change to this

 if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
$HTTP_GET_VARS['sort'] = $i+1 . 'a';
$listing_sql .= " order by products_price";
break;
}
}
} else {
$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
$sort_order = substr($HTTP_GET_VARS['sort'], 1);
$listing_sql .= ' order by ';
switch ($column_list[$sort_col-1]) {
case 'PRODUCT_LIST_MODEL':
$listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", products_price";
break;
case 'PRODUCT_LIST_NAME':
$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '') . ", products_price";
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", products_price";
break;
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", products_price";
break;
case 'PRODUCT_LIST_IMAGE':
$listing_sql .= "pd.products_name";
break;
case 'PRODUCT_LIST_WEIGHT':
$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", products_price";
break;
case 'PRODUCT_LIST_PRICE':
$listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", products_price";
break;
}
}
?>

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

You are a patient man to tolerate such newbies as am I...

Thank you Steve!

~

Yes, I do not really know how to do this yet, but I am trying.

Your suggestion of initial load then user change by clicking titles is superb!

USER FRIENDLY!...Best of Breed...Nice Touch...

I have my homework assignment!

Thanks again for the supremely patient help, Steve! ... :thumbsup:

Link to comment
Share on other sites

It Works Wonderfully Well, Steve!

Thank YOU!

~> :D <~

I installed your suggested <Click Sort Version> for User Driven Selecting of Sorting, and it's GREAT!

It defaults to the "Lowest Price = First," and then customers can click a column heading in whatever language they are using for different sorting across the product columns within the category being viewed, if they get the urge!

= Really USER FRIENDLY and unobtrusive.

This is exactly the kind of quiet < 1st Class Solution > Needed & Wanted.

Many thanks for your patient help and Great Suggestion, too, Steve!

Best regards, Charles

Link to comment
Share on other sites

  • 2 months later...
It Works Wonderfully Well, Steve!

Thank YOU!

~> :D <~

I installed your suggested <Click Sort Version> for User Driven Selecting of Sorting, and it's GREAT!

It defaults to the "Lowest Price = First," and then customers can click a column heading in whatever language they are using for different sorting across the product columns within the category being viewed, if they get the urge!

= Really USER FRIENDLY and unobtrusive.

This is exactly the kind of quiet < 1st Class Solution > Needed & Wanted.

Many thanks for your patient help and Great Suggestion, too, Steve!

Best regards, Charles

 

Yes very nice solution - except for one problem. If you have more products than can fit on one page when you click next or previous buttons your sort goes back to product name.

 

Here is the solution that seems to work just fine:

 

In index.php change the line:

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

 

to

 

$HTTP_GET_VARS['sort'] = $i . 'a';

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...