Support Forums

extra fields : range missing

This is a discussion on extra fields : range missing within the v3.1 Suggestions and Feedback forums, part of the Legacy Help & Support category; Hi ! I've created some extra fields, about the number of kilometers done with used cars. The problem is that ...


Go Back   68 Classifieds Forums > Archives > Legacy Help & Support > v3.1 Suggestions and Feedback

 
 
Thread Tools Display Modes
Old 07-12-2006, 10:46 AM   #1
Senior Member
 
frommarcq's Avatar
 
Join Date: Mar 2006
Location: Lille (France)
Posts: 111
Rep Power: 17
frommarcq is on a distinguished road
Question extra fields : range missing

Hi !
I've created some extra fields, about the number of kilometers done with used cars.
The problem is that the list of choices is displayed by alphabetical order, I'm unable to change the range.

Example :
I wanted to have this order :

-from 0 to 10.000 kilometers
- from 10.000 to 50.000 kilometers
- from 50.000 to 100.000 kilometers
- from 100.000 to 200.000 kilometers
- + than 200.000 kilometers

(logical, no ?)

What is displayed :

- + than 200.000 kilometers ('+' character is displayed BEFORE 'a')
-from 0 to 10.000 kilometers
- from 10.000 to 50.000 kilometers
- from 100.000 to 200.000 kilometers
- from 50.000 to 100.000 kilometers

Is it possible in the next version, to add a 'weight' option (as in 'categories' order), to have the ability to choose the range of the options fields.

68Classifieds users, what's your opinion ?

Regard
__________________
68classifieds (V4.0.9Developer)

occasion nord - immobilier Lille - maison lens - meteo Lille - restaurants Lievin
frommarcq is offline  
Old 07-12-2006, 12:39 PM   #2
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 1,961
Rep Power: 57
juven14 is a jewel in the rough
Default

Yes, this sounds like a good request. I guess we should get a new wish list going for future versions.
__________________
John Snyder
PHP Developer
juven14 is offline  
Old 07-12-2006, 02:43 PM   #3
Senior Member
 
SkGold's Avatar
 
Join Date: Mar 2006
Location: Best city in the World � Calgary, Canada
Posts: 450
Rep Power: 25
SkGold has a spectacular aura about
Default

I agree. I have the same problem and I have always to think how to name the choice that will set the order what I want.
Quote:
Originally Posted by frommarcq
Example :
I wanted to have this order :

-from 0 to 10.000 kilometers
- from 10.000 to 50.000 kilometers
- from 50.000 to 100.000 kilometers
- from 100.000 to 200.000 kilometers
- + than 200.000 kilometers

(logical, no ?)

What is displayed :

- + than 200.000 kilometers ('+' character is displayed BEFORE 'a')
-from 0 to 10.000 kilometers
- from 10.000 to 50.000 kilometers
- from 100.000 to 200.000 kilometers
- from 50.000 to 100.000 kilometers
In your case �more� instead of �+� should do the trick.
__________________
Thanks,
Sergey

Bargain Finder in Calgary, Alberta, Canada.
Calgary Business Directory V3.1.10 Dev - Calgary Classifieds V3.1.10 Dev - Calgary Real Estate V3.1.10 Dev - Calgary Used Cars V3.1.10 Dev - Calgary Rent V3.1.10 Dev - Calgary Dating V3.1.5 Dev

A website without well-done Internet Marketing and Search Engine Optimization is as good as non-existent.
SkGold is offline  
Old 07-18-2006, 02:13 PM   #4
Coder
 
Join Date: Mar 2006
Posts: 4,680
Rep Power: 114
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

I was just putzing around with a new site idea and ran into an instance where I am using child/parent dropdown lists as well as some other dropdowns that contain numberic values.

In one dropdown I have numbers from 1 to 40 and by default the SQL query that retrieves and displays the results for the contents of the dropdown is ascending based on the value and when working with values from 1 to 40 it will display them like this...

1
10
11
12
13
14
15
16
17
18
19
2
20
.........

Needless to say thats a bit ugly.

However there is a pretty easy change that can be made if you would like to alter their order, however it does require a little planning when creating your fields.

If you have the developer edition you can opne the file /includes/functions_checkout.php.

At approx line 105 (in ver 3.0.14) you chould see the folloing section of code.

Code:
if($row['fType']=="D")
	{
	//it is a select list//
	$optdata.="<tr><td align='left' class=\"formleft\">".$star ." ". $row['fName'].":</td><td align='left' class=\"formright\"><select name=\"opt".$row['fID']."\">";
	$ssql="SELECT optID,fieldID,optValue,optSub FROM ".PREFIX."fields_options WHERE fieldID='".$row['fID']."' ORDER BY optValue";
	$resultsets=$db->query($ssql);
	while($opt=$resultsets->fetch())
	{
	if($arow['sValue']==$opt['optValue']) $selected=" SELECTED";
	$optdata.="<option value=\"".$opt['optValue']."\"".$selected.">".$opt['optValue']."</option>\n";
								$selected="";
       }
    $optdata.="</select></td></tr>";
}
IF you plan your field and enter the dropdown values in the order you would like them to appear what you can do is change the query.

Change this....

ORDER BY optValue

to.....

ORDER BY optID

By default each item that is added to the table is given an id that is auto incremented so if you change it to order the results by the fields ID value instead of its contents it will display them in the order they were added.

Keep in mind that if you chose to do this you can not easily add options between your current options. Any values you add to the dropdown will appear after the values that are already in place to carefull planning must be taken into account.

An alternative that would take a little more work would be to add a "weight" field to the database so you could manually alter the "weight" of each field and ORDER BY the weight field.
__________________
Larry

What I post here should be used only as a guide to point you in the right direction. If the code I post doesnt make any sense or work as posted then you should spend more time reading the various manuals and tutorials so it does make sense and you can tweak it to work. A sure fire way to get yourself in trouble is to implement changes you dont have an intimate understanding of. Im happy to help, but I am not here to teach you to code or create your site for you.
Lhotch is offline  
Old 07-18-2006, 06:16 PM   #5
Senior Member
 
frommarcq's Avatar
 
Join Date: Mar 2006
Location: Lille (France)
Posts: 111
Rep Power: 17
frommarcq is on a distinguished road
Thumbs up

Hi Larry !

I tried your script and... wow ! it works fine !!!

I found this week-end an other solution (please give me your opinion) :

still in 'includes/functions_checkout.php', under '//it is a select list//', change :
PHP Code:
$ssql="SELECT optID,fieldID,optValue,optSub FROM ".PREFIX."fields_options WHERE fieldID='".$row['fID']."' ORDER BY optValue"
to :
PHP Code:
$ssql="SELECT optID,fieldID,optValue,optSub,optOrder FROM ".PREFIX."fields_options WHERE fieldID='".$row['fID']."' ORDER BY optOrder"
The only problem found is that there's no command in admin panel. You have to use your old 'phpmyadmin', and to use optOrder for asc order.

Perhaps our Santa Claus (Eric), could add a bit of code in admin zone to make the order active in select fields, mmmh ?

The weather is too hot for me...

Pascal
__________________
68classifieds (V4.0.9Developer)

occasion nord - immobilier Lille - maison lens - meteo Lille - restaurants Lievin
frommarcq is offline  
Old 09-19-2006, 03:36 AM   #6
Senior Member
 
frommarcq's Avatar
 
Join Date: Mar 2006
Location: Lille (France)
Posts: 111
Rep Power: 17
frommarcq is on a distinguished road
Default

In order to have the same result with the checkbox order, I've changed under '//checkbox' in functions_checkout.php :
PHP Code:
$ssql="SELECT optID,fieldID,optValue,optOrder FROM ".PREFIX."fields_options WHERE fieldID='".$row['fID']."' ORDER BY optValue"
to
PHP Code:
$ssql="SELECT optID,fieldID,optValue,optOrder FROM ".PREFIX."fields_options WHERE fieldID='".$row['fID']."' ORDER BY optOrder"
(The only problem is that I must change the order of existing checkbox list in the phpMyAdmin page... I didn't test it with new checkbox fields)
__________________
68classifieds (V4.0.9Developer)

occasion nord - immobilier Lille - maison lens - meteo Lille - restaurants Lievin
frommarcq is offline  
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Location of extra fields Acpjax v3.1 Questions & Support 4 10-25-2006 04:03 PM
Extra fields on Category.php Maffo v3.1 Questions & Support 6 07-17-2006 07:06 PM
Extra fields calaf6 v3.1 Questions & Support 2 05-17-2006 11:39 AM


All times are GMT -4. The time now is 11:01 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0