Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Alphanetical list that ignores 'A' and 'The' etc


drdecker

Recommended Posts

Posted

Hi

 

I have a lot of products in my store that would start with common words like 'A' and 'The'. What I'd like is for any alphabetical listing I have to ignore these words.

 

Currently I work around this by listing something like 'Fog, The' instead of 'The Fog' so that is shows under 'F'.

 

Maybe I'm being fussy, but the correct name of the the film in question is 'The Fog' and I'd like it displayed/ listed as such, but not under 'T'!

 

Is there a bit of code that can be added that excludes a series of words from alphabatised lists?

 

Many thanks

Posted

There some contributions that allow you to sort your products as you like instead of alphabetically.

 

Here is one, but you may find some others listed in the Add-Ons section.

 

http://addons.oscommerce.com/info/911

 

Thanks for the reply.

 

I did see this contribution earlier, but wasn't sure that it (or others I found) quite fitted the bill.

 

Whilst not being PHP/ SQL fluent, I felt sure there'd be some way of excluding/ ignoring words.

 

I'll carry on looking in the meantime.

Posted

I felt sure there'd be some way of excluding/ ignoring words.

 

I'll carry on looking in the meantime.

Hmm. I don't see any capability in standard MySQL to modify a string field (drop A, An, The, etc. words) before sorting. The referenced add-on might need to be modified, but in any case I don't think you can use the standard ORDER BY clause in SQL. What you would do is to build an array of all the results, in accidental (unsorted) order, and then write a few lines of PHP code to sort in the desired manner. This would involve making a copy of the product title, while dropping leading articles, doing a sort() on that, and using the results to indicate the order in which to display products with full titles. If the add-on already does much of the heavy lifting of handling these tasks, it might be a minor extension to drop leading articles before doing the actual sort.

Archived

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

×
×
  • Create New...