osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Sort by price?

This is a discussion on Sort by price? within the osCMax v2 Customization/Mods forums, part of the osCMax v2.0 Forums category; I want to sort my category listing by price. I have deduced that it's not in product_listing_col.php, because I put ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Customization/Mods

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack Thread Tools
  #1  
Old 02-16-2006, 11:17 AM
Member
 
Join Date: Jul 2005
Posts: 91
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0
kenlyle
Default Sort by price?

I want to sort my category listing by price. I have deduced that it's not in product_listing_col.php, because I put sort by price ASC in the $pg_query, and ran the query string through PHPMyAdmin, and it returned empty set, but my page shows products, so I know that the query must be passed from somewhere else but I don't know where.

I see in index.php that there are references to $HTTP_GET_VARS and whether sort by price has been 'requested' and I think I remember this in the Admin of another OSC version, and I don't know how to pass the variables to index.php to make the categories list sort by price.

Any tips appreciated.

Ken
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 02-16-2006, 11:35 AM
Member
 
Join Date: Jul 2005
Posts: 91
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0
kenlyle
Default RE: Sort by price?

I found that appending &sort=3a to my URL, like index.php?cPath=1_17&sort=3a
does what I want. Now, how to get that appended onto the URL produced by clicking on the category in the categories box or from the categories list?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 02-21-2006, 01:08 PM
New Member
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
bgreenlee
Default

I am having the same issue. Any luck?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 02-21-2006, 01:57 PM
New Member
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
bgreenlee
Default

Found this and it works great!

http://www.oscdox.com/index.php?name...pic&t=2435
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 02-02-2007, 02:22 PM
New Member
 
Join Date: Apr 2005
Posts: 29
Thanks: 1
Thanked 6 Times in 6 Posts
Rep Power: 0
dead7 is on a distinguished road
Default Re: Sort by price?

Sorry to bump this but I thought it would be a good addition to the thread.

To sort by lowest first you would use ?sort=3a, to sort by highest to lowest it's ?sort=3d.

IF you want to do this in your product listings, apply the following examples. I'm running RC3 using product listing columns (product_listing_col.php).

You may style these links however you see fit.

PHP Code:
<?
$myfile 
explode("?"basename($_SERVER['REQUEST_URI']));
$myfile $myfile[0];
?>
<a href="http://www.foo.bar/catalog/<?=(!empty($myfile)) ? $myfile ''?>?sort=3a">lowest price</a>
<br />
<a href="http://www.foo.bar/catalog/<?=(!empty($myfile)) ? $myfile ''?>?sort=3d">highest price</a>
If you're a php guru feel free to make it better and let others know about it. I had a very good need for this function and came up with this, use it as you wish.

Hope it helps someone..

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to dead7 For This Useful Post:
michael_s (02-02-2007)
  #6  
Old 04-17-2008, 05:37 PM
osCMax Testing Team
 
Join Date: Sep 2005
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0
sirsonic is an unknown quantity at this point
Default Re: Sort by price?

I used this code on index_products.tpl right after the normal category sort at about line 60

Code:
 // Additional Products Sort
	     echo '<td align="center" class="main">' . tep_draw_form('sort', FILENAME_DEFAULT, 'get') . '<b>Sort by:</b>&nbsp;&nbsp;';

	     if (isset($HTTP_GET_VARS['manufacturers_id'])) {
	         echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
	     } else {
	         echo tep_draw_hidden_field('cPath', $cPath);
	     }

	     $sort_list = array('' => 'Select',
							'4a' => 'Price Low to High',
	                        '4d' => 'Price High to Low',
							'3a' => 'Products Name A to Z',
	                        '3d' => 'Products Name Z to A');
	     foreach($sort_list as $id=>$text) {
	      $sort_range[] = array('id' => $id, 'text' => $text);
	     }

	     echo tep_draw_pull_down_menu('sort', $sort_range, (isset($HTTP_GET_VARS['sort']) ? $HTTP_GET_VARS['sort'] : ''), 'onchange="this.form.submit()"');
	     echo tep_draw_hidden_field('filter_id', (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''));
	     echo '</form></td>' . "\n";
 // End Additional Products Sort
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Separate Price per customer additional price box auntie22 osCMax v1.7 Discussion 0 06-05-2006 08:12 AM
attribute sort timbrrr osCMax v2 Customization/Mods 3 01-17-2006 12:24 PM
Sort by price question moreduff osCMax v1.7 Discussion 1 08-02-2005 07:32 AM
Sort products by price Anonymous osCMax v1.7 Discussion 3 06-02-2005 04:55 AM
Add Delivery Price based on Total Price mikeyboy osCMax v1.7 Discussion 1 01-30-2004 09:24 AM


All times are GMT -8. The time now is 02:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax