7 replies [Last post]
BenStallings's picture
Offline
Joined: 03/13/2008
Juice: 91
Was this information Helpful?

On my site, I have a long list of attributes for an option -- that is, a long drop-down menu -- and they need to appear in a custom, non-alphabetical order. The built-in range of -10 to 10 for the ordering field is not enough -- I have to go from -10 to 24! I can assign values larger than 10 in the database, but each time I create or edit a product, the values larger than 10 are reset to -10 and I have to do a database query to fix them again.

Is the range of the ordering field set by a variable somewhere, or is it hardcoded? I can't seem to find it. Please advise. Thanks!

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Re: increasing the range for ordering attributes

Yeah, and I would add that I don't understand the choice of drupal about providing a dropdown list to select weight, which add nothing except limitations.

I would add a textfield instead.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: increasing the range for ordering attributes

Good point, zmove. My only guess was that it was easier to prevent mistakes. Puzzled

In any event, the only way to really address this atm is with hook_form_alter(). I don't have a snippet on hand, but you can increase the #delta value of that ordering element in the form array to get a wider range.

BenStallings's picture
Offline
Joined: 03/13/2008
Juice: 91
auto-complete textfield?
zmove wrote:

I would add a textfield instead.

I'm not sure if you're suggesting that Drupal should have a textfield for weight, or that I should have a textfield instead of the long dropdown.

I would love to replace the long dropdown with a textfield for the attribute, if it could autocomplete with values from my option list. Is that possible with Ubercart?

Perhaps some details will help explain my situation, and maybe suggest a better solution... the attribute is the name of a congregation (church). There are more than 60 congregations in the district served by the Web site. If we use a plain text field, people will type in all kinds of things and we'll have to match them up manually with the congregations in our database. So currently the list looks something like this:

First Church, Iowa City, IA
Church of Minneapolis, Minneapolis, MN

the list has to be ordered by state and city so that people can find their churches, so if the values didn't have to be presentable, the easy solution would be something like

IA Iowa City First Church
MN Minneapolis Church of Minneapolis

That would cause the list to sort properly, but it would look terrible on nametags. So instead we're using the ordering field, with values from -10 to 24. Sad If we could get an autocomplete field, then we someone could just type

First

and every First whatever would pop up. It would be slick.

Thanks in advance for any advice you can give!

cYu
cYu's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 11/19/2007
Juice: 850
Re: auto-complete textfield?

While not very smooth, you might be able to fit all of your attributes into the -10 to 10 range if you take advantage of any two alphabetically sequential attributes being sorted correctly when sharing the same weight.

thesmeghead's picture
Offline
Joined: 08/01/2008
Juice: 15
Re: Re: auto-complete textfield?

Alphabetical ordering does not seem to be working. I downloaded a module to increase the weight range and it works prefectly. You can find it in here: http://drupal.org/node/117274#comment-944650

jumonjii's picture
Offline
Joined: 07/08/2008
Juice: 37
Re: Re: Re: auto-complete textfield?

Do you have a link to your site? Maybe a solution can be found if we could see exactly how you have things set up.

BenStallings's picture
Offline
Joined: 03/13/2008
Juice: 91
thanks for the module!

Thanks, Smeghead! I'll give that a try.

Jumonjii, the site in question is https://secure.bluehost.com/~psduuaor/ubercart/ . The "PSD Congregation" field is the one that needs a larger weight range.

--Ben